diff --git a/DEVELOPER.md b/DEVELOPER.md index 168c4dd85..54c8c48e8 100644 --- a/DEVELOPER.md +++ b/DEVELOPER.md @@ -567,7 +567,7 @@ By default, the memory profiler is disabled. To enable it, add a parameter when 1. Use `kubectl edit` to open the running deployment for editing: ```shell - kubectl edit deployment verticadb-operator-controller-manager + kubectl edit deployment verticadb-operator-manager ``` 2. Locate the `args` array that passes values to the deployment manager, and add `--enable-profiler`: @@ -588,7 +588,7 @@ By default, the memory profiler is disabled. To enable it, add a parameter when 4. Port forward 6060 to access the profiler's user interface (UI). The name of the pod differs for each deployment, so make sure that you find the one specific to your cluster: ```shell - kubectl port-forward pod/verticadb-operator-controller-manager-5dd5b54df4-2krcr 6060:6060 + kubectl port-forward pod/verticadb-operator-manager-5dd5b54df4-2krcr 6060:6060 ``` 5. Use a web browser or the standalone tool to connect to the profiler's UI at `http://localhost:6060/debug/pprof`. diff --git a/changes/unreleased/Fixed-20240212-212436.yaml b/changes/unreleased/Fixed-20240212-212436.yaml new file mode 100644 index 000000000..f11a72f1a --- /dev/null +++ b/changes/unreleased/Fixed-20240212-212436.yaml @@ -0,0 +1,5 @@ +kind: Fixed +body: Avoid deploying the operator with default label +time: 2024-02-12T21:24:36.201941181-04:00 +custom: + Issue: "701" diff --git a/config/clusterpermissions/cluster_role_binding.yaml b/config/clusterpermissions/cluster_role_binding.yaml index ad482291f..8d837581e 100644 --- a/config/clusterpermissions/cluster_role_binding.yaml +++ b/config/clusterpermissions/cluster_role_binding.yaml @@ -4,9 +4,9 @@ metadata: name: openshift-cluster-rolebinding subjects: - kind: ServiceAccount - name: controller-manager + name: verticadb-operator namespace: system roleRef: kind: ClusterRole name: openshift-cluster-role - apiGroup: rbac.authorization.k8s.io \ No newline at end of file + apiGroup: rbac.authorization.k8s.io diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 3779d3246..a0ffb86d2 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -27,7 +27,7 @@ resources: patchesStrategicMerge: # Protect the /metrics endpoint by putting it behind auth. -# If you want your controller-manager to expose the /metrics +# If you want your operator to expose the /metrics # endpoint w/o any authn/z, please comment the following line. - manager_auth_proxy_patch.yaml diff --git a/config/default/manager_auth_proxy_patch.yaml b/config/default/manager_auth_proxy_patch.yaml index 2e422f145..7833322e0 100644 --- a/config/default/manager_auth_proxy_patch.yaml +++ b/config/default/manager_auth_proxy_patch.yaml @@ -3,7 +3,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: controller-manager + name: manager namespace: system spec: template: @@ -47,7 +47,7 @@ spec: - "--level=info" - "--dev=false" - "--prefix-name=verticadb-operator" - - "--webhook-cert-secret=verticadb-operator-controller-manager-service-cert" + - "--webhook-cert-secret=verticadb-operator-service-cert" - "--verticadb-concurrency=5" - "--verticaautoscaler-concurrency=1" - "--eventtrigger-concurrency=1" diff --git a/config/default/manager_config_patch.yaml b/config/default/manager_config_patch.yaml index 6c400155c..98456c9a4 100644 --- a/config/default/manager_config_patch.yaml +++ b/config/default/manager_config_patch.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: controller-manager + name: manager namespace: system spec: template: diff --git a/config/default/manager_webhook_patch.yaml b/config/default/manager_webhook_patch.yaml index 5ca3c861a..9d587a719 100644 --- a/config/default/manager_webhook_patch.yaml +++ b/config/default/manager_webhook_patch.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: controller-manager + name: manager namespace: system spec: template: diff --git a/config/manager/manager.yaml b/config/manager/manager.yaml index 2279f05df..1aa74f647 100644 --- a/config/manager/manager.yaml +++ b/config/manager/manager.yaml @@ -1,21 +1,21 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: controller-manager + name: manager namespace: system labels: - control-plane: controller-manager + control-plane: verticadb-operator spec: selector: matchLabels: - control-plane: controller-manager + control-plane: verticadb-operator replicas: 1 template: metadata: annotations: kubectl.kubernetes.io/default-container: manager labels: - control-plane: controller-manager + control-plane: verticadb-operator app.kubernetes.io/name: verticadb-operator spec: securityContext: @@ -64,7 +64,7 @@ spec: configMapKeyRef: name: manager-config key: VERSION - serviceAccountName: controller-manager + serviceAccountName: verticadb-operator-manager terminationGracePeriodSeconds: 10 volumes: - name: tmp diff --git a/config/manifests/kustomization.yaml b/config/manifests/kustomization.yaml index e67bbf0a7..478be8f52 100644 --- a/config/manifests/kustomization.yaml +++ b/config/manifests/kustomization.yaml @@ -14,7 +14,7 @@ patchesJson6902: group: apps version: v1 kind: Deployment - name: controller-manager + name: manager namespace: system patch: |- # Remove the manager container's "cert" volumeMount, since OLM will create and mount a set of certs. diff --git a/config/prometheus/monitor.yaml b/config/prometheus/monitor.yaml index 994266904..b2cb6d3d7 100644 --- a/config/prometheus/monitor.yaml +++ b/config/prometheus/monitor.yaml @@ -4,7 +4,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: labels: - control-plane: controller-manager + control-plane: verticadb-operator name: metrics-monitor namespace: system spec: @@ -17,4 +17,4 @@ spec: insecureSkipVerify: true selector: matchLabels: - control-plane: controller-manager + control-plane: verticadb-operator diff --git a/config/rbac/auth_proxy_client_clusterrolebinding.yaml b/config/rbac/auth_proxy_client_clusterrolebinding.yaml index 3de2a4485..ae2fa8f66 100644 --- a/config/rbac/auth_proxy_client_clusterrolebinding.yaml +++ b/config/rbac/auth_proxy_client_clusterrolebinding.yaml @@ -8,7 +8,7 @@ roleRef: name: metrics-reader subjects: - kind: ServiceAccount - name: controller-manager + name: manager namespace: system - apiGroup: rbac.authorization.k8s.io kind: Group diff --git a/config/rbac/auth_proxy_role_binding.yaml b/config/rbac/auth_proxy_role_binding.yaml index 4f0668dd6..5f70c2d54 100644 --- a/config/rbac/auth_proxy_role_binding.yaml +++ b/config/rbac/auth_proxy_role_binding.yaml @@ -8,5 +8,5 @@ roleRef: name: proxy-role subjects: - kind: ServiceAccount - name: controller-manager + name: manager namespace: system diff --git a/config/rbac/auth_proxy_service.yaml b/config/rbac/auth_proxy_service.yaml index 8d1ff9f74..7ab405a22 100644 --- a/config/rbac/auth_proxy_service.yaml +++ b/config/rbac/auth_proxy_service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: labels: - control-plane: controller-manager + control-plane: verticadb-operator vertica.com/svc-type: operator-metrics name: metrics-service namespace: system @@ -13,4 +13,4 @@ spec: protocol: TCP targetPort: metrics selector: - control-plane: controller-manager + control-plane: verticadb-operator diff --git a/config/rbac/leader_election_role_binding.yaml b/config/rbac/leader_election_role_binding.yaml index 1d1321ed4..d5e004467 100644 --- a/config/rbac/leader_election_role_binding.yaml +++ b/config/rbac/leader_election_role_binding.yaml @@ -8,5 +8,5 @@ roleRef: name: leader-election-role subjects: - kind: ServiceAccount - name: controller-manager + name: manager namespace: system diff --git a/config/rbac/role_binding.yaml b/config/rbac/role_binding.yaml index 8a2a58741..744682887 100644 --- a/config/rbac/role_binding.yaml +++ b/config/rbac/role_binding.yaml @@ -8,5 +8,5 @@ roleRef: apiGroup: rbac.authorization.k8s.io subjects: - kind: ServiceAccount - name: controller-manager + name: manager namespace: system diff --git a/config/rbac/service_account.yaml b/config/rbac/service_account.yaml index 7cd6025bf..77f747b53 100644 --- a/config/rbac/service_account.yaml +++ b/config/rbac/service_account.yaml @@ -1,5 +1,5 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: controller-manager + name: manager namespace: system diff --git a/config/webhook/service.yaml b/config/webhook/service.yaml index d379c58a2..f0575cc2c 100644 --- a/config/webhook/service.yaml +++ b/config/webhook/service.yaml @@ -5,7 +5,7 @@ metadata: name: webhook-service namespace: system labels: - control-plane: controller-manager + control-plane: verticadb-operator vertica.com/svc-type: webhook spec: ports: @@ -13,4 +13,4 @@ spec: protocol: TCP targetPort: 9443 selector: - control-plane: controller-manager + control-plane: verticadb-operator diff --git a/helm-charts/verticadb-operator/templates/_helpers.tpl b/helm-charts/verticadb-operator/templates/_helpers.tpl index 04bc32709..e21ce0ba6 100644 --- a/helm-charts/verticadb-operator/templates/_helpers.tpl +++ b/helm-charts/verticadb-operator/templates/_helpers.tpl @@ -12,7 +12,7 @@ Choose the serviceAccount name {{- if .Values.serviceAccountNameOverride }} {{- .Values.serviceAccountNameOverride }} {{- else }} -{{- include "vdb-op.name" . }}-controller-manager +{{- include "vdb-op.name" . }}-manager {{- end }} {{- end }} @@ -38,6 +38,6 @@ it is generated internally) {{- else if eq .Values.webhook.certSource "internal" }} {{- "" }} {{- else }} -{{- include "vdb-op.name" . }}-controller-manager-service-cert +{{- include "vdb-op.name" . }}-service-cert {{- end }} {{- end }} diff --git a/helm-charts/verticadb-operator/tests/image-name-and-tag_test.yaml b/helm-charts/verticadb-operator/tests/image-name-and-tag_test.yaml index 4f4fe5da4..864d7c171 100644 --- a/helm-charts/verticadb-operator/tests/image-name-and-tag_test.yaml +++ b/helm-charts/verticadb-operator/tests/image-name-and-tag_test.yaml @@ -1,6 +1,6 @@ suite: image tests templates: - - verticadb-operator-controller-manager-deployment.yaml + - verticadb-operator-manager-deployment.yaml tests: - it: allows the operator image and tag to be specified set: diff --git a/helm-charts/verticadb-operator/tests/kind-concurrency_test.yaml b/helm-charts/verticadb-operator/tests/kind-concurrency_test.yaml index 978f7a86f..16b224f28 100644 --- a/helm-charts/verticadb-operator/tests/kind-concurrency_test.yaml +++ b/helm-charts/verticadb-operator/tests/kind-concurrency_test.yaml @@ -1,6 +1,6 @@ suite: test that verifies we can control the concurrency of reconcile iterations templates: - - verticadb-operator-controller-manager-deployment.yaml + - verticadb-operator-manager-deployment.yaml tests: - it: we can specify a concurrency for various CRs set: diff --git a/helm-charts/verticadb-operator/tests/metric-cert_test.yaml b/helm-charts/verticadb-operator/tests/metric-cert_test.yaml index 68afae244..7ece2d630 100644 --- a/helm-charts/verticadb-operator/tests/metric-cert_test.yaml +++ b/helm-charts/verticadb-operator/tests/metric-cert_test.yaml @@ -1,6 +1,6 @@ suite: Metrics certificate tests templates: - - verticadb-operator-controller-manager-deployment.yaml + - verticadb-operator-manager-deployment.yaml tests: - it: should include the cert if prometheus.tlsSecret is set set: diff --git a/helm-charts/verticadb-operator/tests/metrics-deployment_test.yaml b/helm-charts/verticadb-operator/tests/metrics-deployment_test.yaml index afdd3f0ff..c2d946fad 100644 --- a/helm-charts/verticadb-operator/tests/metrics-deployment_test.yaml +++ b/helm-charts/verticadb-operator/tests/metrics-deployment_test.yaml @@ -1,6 +1,6 @@ suite: Metrics deployment tests templates: - - verticadb-operator-controller-manager-deployment.yaml + - verticadb-operator-manager-deployment.yaml tests: - it: should not include proxy sidecar if expose is disabled set: diff --git a/helm-charts/verticadb-operator/tests/pod-schedule_test.yaml b/helm-charts/verticadb-operator/tests/pod-schedule_test.yaml index 8d8924b3e..a23dbdf60 100644 --- a/helm-charts/verticadb-operator/tests/pod-schedule_test.yaml +++ b/helm-charts/verticadb-operator/tests/pod-schedule_test.yaml @@ -1,6 +1,6 @@ suite: test that control where the operator is scheduled templates: - - verticadb-operator-controller-manager-deployment.yaml + - verticadb-operator-manager-deployment.yaml tests: - it: we can specify a node selector set: diff --git a/helm-charts/verticadb-operator/tests/resources_test.yaml b/helm-charts/verticadb-operator/tests/resources_test.yaml index 81ad3df69..3db7aaa06 100644 --- a/helm-charts/verticadb-operator/tests/resources_test.yaml +++ b/helm-charts/verticadb-operator/tests/resources_test.yaml @@ -1,6 +1,6 @@ suite: test that resources can be specified for the operator templates: - - verticadb-operator-controller-manager-deployment.yaml + - verticadb-operator-manager-deployment.yaml tests: - it: we can override the resources for the pod set: diff --git a/helm-charts/verticadb-operator/tests/serviceaccount_test.yaml b/helm-charts/verticadb-operator/tests/serviceaccount_test.yaml index b45a72aa5..974781dbd 100644 --- a/helm-charts/verticadb-operator/tests/serviceaccount_test.yaml +++ b/helm-charts/verticadb-operator/tests/serviceaccount_test.yaml @@ -1,6 +1,6 @@ suite: ServiceAccount tests templates: - - verticadb-operator-controller-manager-sa.yaml + - verticadb-operator-manager-sa.yaml tests: - it: should allow you to override the serviceaccount name set: diff --git a/pkg/kstepgen/kill_operator.go b/pkg/kstepgen/kill_operator.go index 2eced59af..55f74097e 100644 --- a/pkg/kstepgen/kill_operator.go +++ b/pkg/kstepgen/kill_operator.go @@ -48,7 +48,7 @@ var killOperatorPodTemplate = ` apiVersion: kuttl.dev/v1beta1 kind: TestStep commands: - - command: kubectl -n {{ .Namespace }} delete pod -l control-plane=controller-manager + - command: kubectl -n {{ .Namespace }} delete pod -l control-plane=verticadb-operator - command: {{ .ScriptsDir }}/wait-for-webhook.sh -n {{ .Namespace }} ` diff --git a/pkg/security/webhook.go b/pkg/security/webhook.go index bf0383bda..3b40f40a2 100644 --- a/pkg/security/webhook.go +++ b/pkg/security/webhook.go @@ -267,7 +267,7 @@ func getWebhookServiceName(prefixName string) string { // We have slightly different names depending on the deployment type since // OLM likes to generate it themselves and tie the CA cert to it. if val, ok := os.LookupEnv(vmeta.OperatorDeploymentMethodEnvVar); ok && val == vmeta.OLMDeploymentType { - return fmt.Sprintf("%s-controller-manager-service", prefixName) + return fmt.Sprintf("%s-manager-service", prefixName) } return fmt.Sprintf("%s-webhook-service", prefixName) } diff --git a/scripts/authorize-metrics.sh b/scripts/authorize-metrics.sh index 003ffa3b6..8df4f62ec 100755 --- a/scripts/authorize-metrics.sh +++ b/scripts/authorize-metrics.sh @@ -23,7 +23,7 @@ set -o pipefail SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" REPO_DIR=$(dirname $SCRIPT_DIR) -OP_SA=verticadb-operator-controller-manager +OP_SA=verticadb-operator UNDO= function usage() { diff --git a/scripts/template-helm-chart.sh b/scripts/template-helm-chart.sh index 0288a42db..7e2873ecc 100755 --- a/scripts/template-helm-chart.sh +++ b/scripts/template-helm-chart.sh @@ -40,24 +40,24 @@ fi # 1. Template the namespace perl -i -0777 -pe 's/verticadb-operator-system/{{ .Release.Namespace }}/g' $TEMPLATE_DIR/* # 2. Template image names -perl -i -0777 -pe "s|image: controller|image: '{{ with .Values.image }}{{ join \"/\" (list .repo .name) }}{{ end }}'|" $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe "s|image: gcr.io/kubebuilder/kube-rbac-proxy:v.*|image: '{{ with .Values.rbac_proxy_image }}{{ join \"/\" (list .repo .name) }}{{ end }}'|" $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +perl -i -0777 -pe "s|image: controller|image: '{{ with .Values.image }}{{ join \"/\" (list .repo .name) }}{{ end }}'|" $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe "s|image: gcr.io/kubebuilder/kube-rbac-proxy:v.*|image: '{{ with .Values.rbac_proxy_image }}{{ join \"/\" (list .repo .name) }}{{ end }}'|" $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml # 3. Template imagePullPolicy -perl -i -0777 -pe 's/imagePullPolicy: IfNotPresent/imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }}/' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +perl -i -0777 -pe 's/imagePullPolicy: IfNotPresent/imagePullPolicy: {{ default "IfNotPresent" .Values.image.pullPolicy }}/' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml # 4. Append imagePullSecrets -cat >>$TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml << END +cat >>$TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml << END {{ if .Values.imagePullSecrets }} imagePullSecrets: {{ .Values.imagePullSecrets | toYaml | indent 8 }} {{ end }} END # 5. Template the tls secret name -for fn in verticadb-operator-controller-manager-deployment.yaml \ +for fn in verticadb-operator-manager-deployment.yaml \ verticadb-operator-serving-cert-certificate.yaml do perl -i -0777 -pe 's/secretName: webhook-server-cert/secretName: {{ include "vdb-op.certSecret" . }}/' $TEMPLATE_DIR/$fn done -for fn in $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +for fn in $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml do # Include the secret only if not using webhook.certSource=internal perl -i -0777 -pe 's/(.*- name: webhook-cert\n.*secret:\n.*defaultMode:.*\n.*secretName:.*)/\{\{- if or (ne .Values.webhook.certSource "internal") (not (empty .Values.webhook.tlsSecret)) \}\}\n$1\n\{\{- end \}\}/g' $fn @@ -76,20 +76,20 @@ done # Include WEBHOOK_CERT_SOURCE in the config map perl -i -0777 -pe 's/(\ndata:)/$1\n WEBHOOK_CERT_SOURCE: {{ include "vdb-op.certSource" . }}/g' $TEMPLATE_DIR/verticadb-operator-manager-config-cm.yaml # 7. Template the resource limits and requests -perl -i -0777 -pe 's/resources: template-placeholder/resources:\n {{- toYaml .Values.resources | nindent 10 }}/' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +perl -i -0777 -pe 's/resources: template-placeholder/resources:\n {{- toYaml .Values.resources | nindent 10 }}/' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml # 8. Template the logging -perl -i -0777 -pe "s/--filepath=.*/--filepath={{ .Values.logging.filePath }}/" $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe "s/--maxfilesize=.*/--maxfilesize={{ .Values.logging.maxFileSize }}/" $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe "s/--maxfileage=.*/--maxfileage={{ .Values.logging.maxFileAge }}/" $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe "s/--maxfilerotation=.*/--maxfilerotation={{ .Values.logging.maxFileRotation }}/" $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe "s/--level=.*/--level={{ .Values.logging.level }}/" $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe "s/--dev=.*/--dev={{ .Values.logging.dev }}/" $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +perl -i -0777 -pe "s/--filepath=.*/--filepath={{ .Values.logging.filePath }}/" $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe "s/--maxfilesize=.*/--maxfilesize={{ .Values.logging.maxFileSize }}/" $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe "s/--maxfileage=.*/--maxfileage={{ .Values.logging.maxFileAge }}/" $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe "s/--maxfilerotation=.*/--maxfilerotation={{ .Values.logging.maxFileRotation }}/" $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe "s/--level=.*/--level={{ .Values.logging.level }}/" $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe "s/--dev=.*/--dev={{ .Values.logging.dev }}/" $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml # 9. Template the serviceaccount, roles and rolebindings -perl -i -0777 -pe 's/serviceAccountName: verticadb-operator-controller-manager/serviceAccountName: {{ include "vdb-op.serviceAccount" . }}/' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe 's/name: .*/name: {{ include "vdb-op.serviceAccount" . }}/' $TEMPLATE_DIR/verticadb-operator-controller-manager-sa.yaml -cat << EOF >> $TEMPLATE_DIR/verticadb-operator-controller-manager-sa.yaml +perl -i -0777 -pe 's/serviceAccountName: verticadb-operator-manager/serviceAccountName: {{ include "vdb-op.serviceAccount" . }}/' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe 's/name: .*/name: {{ include "vdb-op.serviceAccount" . }}/' $TEMPLATE_DIR/verticadb-operator-manager-sa.yaml +cat << EOF >> $TEMPLATE_DIR/verticadb-operator-manager-sa.yaml {{- if .Values.serviceAccountAnnotations }} annotations: {{- toYaml .Values.serviceAccountAnnotations | nindent 4 }} @@ -118,7 +118,7 @@ echo "{{- end }}" >> $TEMPLATE_DIR/verticadb-operator-webhook-service-svc.yaml # Add in the --use-cert-manager option if we use cert-manager to generate the # TLS for the webhook. This is needed to tell the operator to add the # appropriate annotation for CA bundle injections. -perl -i -0777 -pe 's/(--webhook-cert-secret.*)/$1\n{{- if eq .Values.webhook.certSource "cert-manager" }}\n - --use-cert-manager\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +perl -i -0777 -pe 's/(--webhook-cert-secret.*)/$1\n{{- if eq .Values.webhook.certSource "cert-manager" }}\n - --use-cert-manager\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml # 11. Template the prometheus metrics service perl -i -pe 's/^/{{- if hasPrefix "Enable" .Values.prometheus.expose -}}\n/ if 1 .. 1' $TEMPLATE_DIR/verticadb-operator-metrics-service-svc.yaml @@ -141,14 +141,14 @@ perl -i -0777 -pe 's/(.*endpoints:)/$1\n{{- if eq "EnableWithAuthProxy" .Values. perl -i -0777 -pe 's/(.*insecureSkipVerify:.*)/$1\n{{- else }}\n - path: \/metrics\n port: metrics\n scheme: http\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-metrics-monitor-servicemonitor.yaml # 14. Template the metrics bind address -perl -i -0777 -pe 's/- --metrics-bind-address=.*/- --metrics-bind-address={{ if eq "EnableWithAuthProxy" .Values.prometheus.expose }}127.0.0.1{{ end }}:{{ if eq "EnableWithAuthProxy" .Values.prometheus.expose }}8080{{ else }}8443{{ end }}/' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe 's/(.*metrics-bind-address.*)/{{- if hasPrefix "Enable" .Values.prometheus.expose }}\n$1\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml -perl -i -0777 -pe 's/(.*ports:\n.*containerPort: 9443\n.*webhook-server.*\n.*)/$1\n{{- if hasPrefix "EnableWithoutAuth" .Values.prometheus.expose }}\n - name: metrics\n containerPort: 8443\n protocol: TCP\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +perl -i -0777 -pe 's/- --metrics-bind-address=.*/- --metrics-bind-address={{ if eq "EnableWithAuthProxy" .Values.prometheus.expose }}127.0.0.1{{ end }}:{{ if eq "EnableWithAuthProxy" .Values.prometheus.expose }}8080{{ else }}8443{{ end }}/' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe 's/(.*metrics-bind-address.*)/{{- if hasPrefix "Enable" .Values.prometheus.expose }}\n$1\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml +perl -i -0777 -pe 's/(.*ports:\n.*containerPort: 9443\n.*webhook-server.*\n.*)/$1\n{{- if hasPrefix "EnableWithoutAuth" .Values.prometheus.expose }}\n - name: metrics\n containerPort: 8443\n protocol: TCP\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml # 15. Template the rbac container -perl -i -0777 -pe 's/(.*- args:.*\n.*secure)/{{- if eq .Values.prometheus.expose "EnableWithAuthProxy" }}\n$1/g' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +perl -i -0777 -pe 's/(.*- args:.*\n.*secure)/{{- if eq .Values.prometheus.expose "EnableWithAuthProxy" }}\n$1/g' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml # We need to put the matching end at the end of the container spec. -perl -i -0777 -pe 's/(memory: 64Mi)/$1\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +perl -i -0777 -pe 's/(memory: 64Mi)/$1\n{{- end }}/g' $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml # 16. Template places that refer to objects by name. Do this in all files. # In the config/ directory we hardcoded everything to start with @@ -156,7 +156,7 @@ perl -i -0777 -pe 's/(memory: 64Mi)/$1\n{{- end }}/g' $TEMPLATE_DIR/verticadb-op perl -i -0777 -pe 's/verticadb-operator/{{ include "vdb-op.name" . }}/g' $TEMPLATE_DIR/*yaml # 17. Mount TLS certs in the rbac proxy -for f in $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +for f in $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml do perl -i -0777 -pe 's/(.*--v=[0-9]+)/$1\n{{- if not (empty .Values.prometheus.tlsSecret) }}\n - --tls-cert-file=\/cert\/tls.crt\n - --tls-private-key-file=\/cert\/tls.key\n - --client-ca-file=\/cert\/ca.crt\n{{- end }}/g' $f perl -i -0777 -pe 's/(volumes:)/$1\n{{- if not (empty .Values.prometheus.tlsSecret) }}\n - name: auth-cert\n secret:\n secretName: {{ .Values.prometheus.tlsSecret }}\n{{- end }}/g' $f @@ -164,7 +164,7 @@ do done # 18. Add pod scheduling options -cat << EOF >> $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +cat << EOF >> $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml {{- if .Values.nodeSelector }} nodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }} @@ -183,7 +183,7 @@ cat << EOF >> $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yam EOF # 19. Template the per-CR concurrency parameters -for f in $TEMPLATE_DIR/verticadb-operator-controller-manager-deployment.yaml +for f in $TEMPLATE_DIR/verticadb-operator-manager-deployment.yaml do perl -i -0777 -pe 's/(--verticadb-concurrency=)[0-9]+/$1\{\{ .Values.reconcileConcurrency.verticadb \}\}/g' $f perl -i -0777 -pe 's/(--verticaautoscaler-concurrency=)[0-9]+/$1\{\{ .Values.reconcileConcurrency.verticaautoscaler \}\}/g' $f diff --git a/scripts/undeploy.sh b/scripts/undeploy.sh index 704588ed8..041c569b0 100755 --- a/scripts/undeploy.sh +++ b/scripts/undeploy.sh @@ -82,7 +82,7 @@ elif kubectl get subscription --all-namespaces=true | grep -cqe "verticadb-opera then $SCRIPT_DIR/undeploy-olm.sh remove_cluster_objects -elif kubectl get deployment -n verticadb-operator -l control-plane=controller-manager | grep -cqe "verticadb-operator-controller-manager" 2> /dev/null +elif kubectl get deployment -n verticadb-operator -l control-plane=verticadb-operator | grep -cqe "verticadb-operator" 2> /dev/null then kubectl delete -f $REPO_DIR/config/release-manifests/operator.yaml || true remove_cluster_objects diff --git a/scripts/wait-for-verticadb-steady-state.sh b/scripts/wait-for-verticadb-steady-state.sh index 665cca9e9..279758a17 100755 --- a/scripts/wait-for-verticadb-steady-state.sh +++ b/scripts/wait-for-verticadb-steady-state.sh @@ -18,19 +18,21 @@ # namespace of the vdb you want to check. TIMEOUT=30 # Default, can be overridden +CONTROL_PLANE_LABEL=verticadb-operator function usage() { - echo "usage: $(basename $0) [-n ] [-t ] []" + echo "usage: $(basename $0) [-n ] [-t ] [-l