Skip to content

Commit

Permalink
Fix the service name override issue in rolebindings (#453)
Browse files Browse the repository at this point in the history
kuberay manifest was generated from helm and the service name reference won’t be automatically updated even with given namePrefix. I tried nameReference transformer but didn’t work well soI just patch the files to fix it.
  • Loading branch information
Jeffwan authored Dec 2, 2024
1 parent 808d71f commit 1d0c89f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 112 deletions.
133 changes: 21 additions & 112 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

# Adds namespace to all resources.
namespace: aibrix-system

Expand Down Expand Up @@ -30,116 +33,22 @@ resources:
#- ../prometheus

patches:
# [METRICS] The following patch will enable the metrics endpoint. Ensure that you also protect this endpoint.
# More info: https://book.kubebuilder.io/reference/metrics
# If you want to expose the metric endpoint of your controller-manager uncomment the following line.
#- path: manager_metrics_patch.yaml

# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
# crd/kustomization.yaml
#- path: manager_webhook_patch.yaml

# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
# 'CERTMANAGER' needs to be enabled to use ca injection
#- path: webhookcainjection_patch.yaml
- patch: |
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuberay-operator
subjects:
- kind: ServiceAccount
name: aibrix-kuberay-operator
namespace: aibrix-system
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
# Uncomment the following replacements to add the cert-manager CA injection annotations
#replacements:
# - source: # Add cert-manager annotation to ValidatingWebhookConfiguration, MutatingWebhookConfiguration and CRDs
# kind: Certificate
# group: cert-manager.io
# version: v1
# name: serving-cert # this name should match the one in certificate.yaml
# fieldPath: .metadata.namespace # namespace of the certificate CR
# targets:
# - select:
# kind: ValidatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 0
# create: true
# - select:
# kind: MutatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 0
# create: true
# - select:
# kind: CustomResourceDefinition
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 0
# create: true
# - source:
# kind: Certificate
# group: cert-manager.io
# version: v1
# name: serving-cert # this name should match the one in certificate.yaml
# fieldPath: .metadata.name
# targets:
# - select:
# kind: ValidatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 1
# create: true
# - select:
# kind: MutatingWebhookConfiguration
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 1
# create: true
# - select:
# kind: CustomResourceDefinition
# fieldPaths:
# - .metadata.annotations.[cert-manager.io/inject-ca-from]
# options:
# delimiter: '/'
# index: 1
# create: true
# - source: # Add cert-manager annotation to the webhook Service
# kind: Service
# version: v1
# name: webhook-service
# fieldPath: .metadata.name # namespace of the service
# targets:
# - select:
# kind: Certificate
# group: cert-manager.io
# version: v1
# fieldPaths:
# - .spec.dnsNames.0
# - .spec.dnsNames.1
# options:
# delimiter: '.'
# index: 0
# create: true
# - source:
# kind: Service
# version: v1
# name: webhook-service
# fieldPath: .metadata.namespace # namespace of the service
# targets:
# - select:
# kind: Certificate
# group: cert-manager.io
# version: v1
# fieldPaths:
# - .spec.dnsNames.0
# - .spec.dnsNames.1
# options:
# delimiter: '.'
# index: 1
# create: true
- patch: |
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kuberay-operator-leader-election
subjects:
- kind: ServiceAccount
name: aibrix-kuberay-operator-leader-election
namespace: aibrix-system
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resources:
- ../../rbac/orchestration
- ../../rbac/controller-manager
- ../../manager
- ../../dependency/kuberay-operator

# Adds namespace to all resources.
namespace: aibrix-system
Expand All @@ -29,3 +30,21 @@ patches:
version: v1
kind: Deployment
name: controller-manager
- patch: |
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kuberay-operator
subjects:
- kind: ServiceAccount
name: aibrix-orchestration-kuberay-operator
namespace: aibrix-system
- patch: |
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kuberay-operator-leader-election
subjects:
- kind: ServiceAccount
name: aibrix-orchestration-kuberay-operator-leader-election
namespace: aibrix-system

0 comments on commit 1d0c89f

Please sign in to comment.