From 2d4f7af3e27b767ebd3cf5cfbd53f527f6c8333d Mon Sep 17 00:00:00 2001 From: realanna Date: Wed, 4 Oct 2023 15:20:14 +0200 Subject: [PATCH 1/5] fix: change annotation from klt to keptn Signed-off-by: realanna --- .../lifecycle/keptnappcreationrequest/controller.go | 12 +++++++++--- test/integration/app-creation-request/00-assert.yaml | 2 +- test/integration/app-creation-request/01-assert.yaml | 2 +- .../00-assert.yaml | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller.go b/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller.go index 5668fe24e1..97174cea33 100644 --- a/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller.go +++ b/lifecycle-operator/controllers/lifecycle/keptnappcreationrequest/controller.go @@ -37,7 +37,8 @@ import ( ) const ( - managedByKLT = "klt" + managedByKLT = "klt" //TODO deprecate and remove in the next version + managedByKeptn = "keptn" ) // KeptnAppCreationRequestReconciler reconciles a KeptnAppCreationRequest object @@ -100,7 +101,7 @@ func (r *KeptnAppCreationRequestReconciler) Reconcile(ctx context.Context, req c } // if the found app has not been created by this controller, we are done at this point - we don't want to mess with what the user has created - if appFound && keptnApp.Labels[common.K8sRecommendedManagedByAnnotations] != managedByKLT { + if appFound && !appIsManagedByKeptn(keptnApp) { r.Log.Info("User defined KeptnApp found for KeptnAppCreationRequest", "KeptnAppCreationRequest", creationRequest) if err := r.Delete(ctx, creationRequest); err != nil { r.Log.Error(err, "Could not delete KeptnAppCreationRequest", "KeptnAppCreationRequest", creationRequest) @@ -242,7 +243,7 @@ func (r *KeptnAppCreationRequestReconciler) createKeptnApp(ctx context.Context, Name: creationRequest.Spec.AppName, Namespace: creationRequest.Namespace, Labels: map[string]string{ - common.K8sRecommendedManagedByAnnotations: managedByKLT, + common.K8sRecommendedManagedByAnnotations: managedByKeptn, }, // pass through the annotations since those contain the trace context Annotations: creationRequest.Annotations, @@ -287,3 +288,8 @@ func computeVersionFromWorkloads(workloads []lifecycle.KeptnWorkload) string { return common.TruncateString(hashValue, 10) } + +func appIsManagedByKeptn(keptnApp *lifecycle.KeptnApp) bool { + annotation := common.K8sRecommendedManagedByAnnotations + return keptnApp.Labels[annotation] == managedByKLT || keptnApp.Labels[annotation] == managedByKeptn +} diff --git a/test/integration/app-creation-request/00-assert.yaml b/test/integration/app-creation-request/00-assert.yaml index c7de12ac1b..dc4ed63f29 100644 --- a/test/integration/app-creation-request/00-assert.yaml +++ b/test/integration/app-creation-request/00-assert.yaml @@ -5,7 +5,7 @@ kind: KeptnApp metadata: name: my-app labels: - app.kubernetes.io/managed-by: "klt" + app.kubernetes.io/managed-by: "keptn" spec: workloads: - name: my-workload diff --git a/test/integration/app-creation-request/01-assert.yaml b/test/integration/app-creation-request/01-assert.yaml index f35fe34fa5..19526b60c4 100644 --- a/test/integration/app-creation-request/01-assert.yaml +++ b/test/integration/app-creation-request/01-assert.yaml @@ -5,7 +5,7 @@ kind: KeptnApp metadata: name: my-app labels: - app.kubernetes.io/managed-by: "klt" + app.kubernetes.io/managed-by: "keptn" spec: workloads: - name: my-workload diff --git a/test/integration/podtato-head-application-auto-app-discovery/00-assert.yaml b/test/integration/podtato-head-application-auto-app-discovery/00-assert.yaml index f77168786e..2936796718 100644 --- a/test/integration/podtato-head-application-auto-app-discovery/00-assert.yaml +++ b/test/integration/podtato-head-application-auto-app-discovery/00-assert.yaml @@ -3,7 +3,7 @@ kind: KeptnApp metadata: name: podtato-head labels: - app.kubernetes.io/managed-by: "klt" + app.kubernetes.io/managed-by: "keptn" spec: revision: 1 version: '95a0b0ddca' From 2050977b89a4c549db32521ec19b0383867e2410 Mon Sep 17 00:00:00 2001 From: realanna Date: Wed, 4 Oct 2023 15:26:43 +0200 Subject: [PATCH 2/5] fix: docs Signed-off-by: realanna --- docs/content/en/docs/implementing/integrate/_index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/en/docs/implementing/integrate/_index.md b/docs/content/en/docs/implementing/integrate/_index.md index 021b08b392..abd5d2c9d0 100644 --- a/docs/content/en/docs/implementing/integrate/_index.md +++ b/docs/content/en/docs/implementing/integrate/_index.md @@ -335,7 +335,7 @@ metadata: name: podtato-head namespace: podtato-kubectl annotations: - app.kubernetes.io/managed-by: "klt" + app.kubernetes.io/managed-by: "keptn" spec: version: "" workloads: From 5cb941b9ef27f3e608ca34e28811ab4837ca45b2 Mon Sep 17 00:00:00 2001 From: realanna Date: Wed, 4 Oct 2023 15:46:02 +0200 Subject: [PATCH 3/5] fix: change klt-certs Signed-off-by: realanna --- .../scripts/.helm-tests/default/result.yaml | 40 +++++++++---------- .../en/docs/architecture/cert-manager.md | 6 +-- docs/content/en/docs/operate/cert-manager.md | 6 +-- .../templates/certificate-operator-rbac.yaml | 2 +- klt-cert-manager/config/rbac/role.yaml | 2 +- klt-cert-manager/pkg/common/config.go | 2 +- .../chart/templates/keptnapp-crd.yaml | 2 +- .../keptnappcreationrequest-crd.yaml | 2 +- .../chart/templates/keptnappversion-crd.yaml | 2 +- .../chart/templates/keptnconfig-crd.yaml | 2 +- .../chart/templates/keptnevaluation-crd.yaml | 2 +- .../keptnevaluationdefinition-crd.yaml | 2 +- .../keptnevaluationprovider-crd.yaml | 2 +- .../chart/templates/keptntask-crd.yaml | 2 +- .../templates/keptntaskdefinition-crd.yaml | 2 +- .../chart/templates/keptnworkload-crd.yaml | 2 +- .../templates/keptnworkloadinstance-crd.yaml | 2 +- ...ecycle-mutating-webhook-configuration.yaml | 2 +- ...ycle-validating-webhook-configuration.yaml | 2 +- lifecycle-operator/webhooks/config.go | 2 +- .../chart/templates/analysis-crd.yaml | 2 +- .../templates/analysisdefinition-crd.yaml | 2 +- .../templates/analysisvaluetemplate-crd.yaml | 2 +- .../chart/templates/keptnmetric-crd.yaml | 2 +- .../templates/keptnmetricsprovider-crd.yaml | 2 +- ...rics-validating-webhook-configuration.yaml | 2 +- .../cert-recreates/00-assert.yaml | 2 +- .../cert-recreates/00-teststep.yaml | 2 +- .../cert-recreates/01-assert.yaml | 2 +- .../cert-recreates/01-delete.yaml | 2 +- .../cert-recreates/02-assert.yaml | 2 +- .../cert-recreates/02-install.yaml | 2 +- .../cert-recreates/02-teststep.yaml | 2 +- 33 files changed, 56 insertions(+), 56 deletions(-) diff --git a/.github/scripts/.helm-tests/default/result.yaml b/.github/scripts/.helm-tests/default/result.yaml index 3f89f9c3aa..5471265584 100644 --- a/.github/scripts/.helm-tests/default/result.yaml +++ b/.github/scripts/.helm-tests/default/result.yaml @@ -137,7 +137,7 @@ metadata: name: keptnapps.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -402,7 +402,7 @@ metadata: name: keptnappcreationrequests.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -465,7 +465,7 @@ metadata: name: keptnappversions.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -1284,7 +1284,7 @@ metadata: name: keptnconfigs.options.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -1354,7 +1354,7 @@ metadata: name: keptnevaluations.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -1739,7 +1739,7 @@ metadata: name: keptnevaluationdefinitions.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -1932,7 +1932,7 @@ metadata: name: keptnevaluationproviders.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -2114,7 +2114,7 @@ metadata: name: keptntasks.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -2526,7 +2526,7 @@ metadata: name: keptntaskdefinitions.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -4246,7 +4246,7 @@ metadata: name: keptnworkloads.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -4538,7 +4538,7 @@ metadata: name: keptnworkloadinstances.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh @@ -5328,7 +5328,7 @@ metadata: name: analyses.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh @@ -5514,7 +5514,7 @@ metadata: name: analysisdefinitions.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh @@ -5871,7 +5871,7 @@ metadata: name: analysisvaluetemplates.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh @@ -5954,7 +5954,7 @@ metadata: name: keptnmetrics.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh @@ -6309,7 +6309,7 @@ metadata: name: keptnmetricsproviders.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh @@ -7364,7 +7364,7 @@ rules: - apiGroups: - "" resourceNames: - - klt-certs + - keptn-certs resources: - secrets verbs: @@ -8229,7 +8229,7 @@ kind: MutatingWebhookConfiguration metadata: name: lifecycle-mutating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: keptn.sh/inject-cert: "true" app.kubernetes.io/part-of: "keptn-lifecycle-toolkit" @@ -8286,7 +8286,7 @@ kind: ValidatingWebhookConfiguration metadata: name: lifecycle-validating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: keptn.sh/inject-cert: "true" helm.sh/chart: lifecycle-operator-0.1.0 @@ -8322,7 +8322,7 @@ kind: ValidatingWebhookConfiguration metadata: name: metrics-validating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: 'helmtests/klt-certs' + cert-manager.io/inject-ca-from: 'helmtests/keptn-certs' labels: keptn.sh/inject-cert: "true" helm.sh/chart: metrics-operator-0.1.0 diff --git a/docs/content/en/docs/architecture/cert-manager.md b/docs/content/en/docs/architecture/cert-manager.md index 8f1045984a..d216053005 100644 --- a/docs/content/en/docs/architecture/cert-manager.md +++ b/docs/content/en/docs/architecture/cert-manager.md @@ -59,12 +59,12 @@ This returns something like: ```shell NAME TYPE DATA AGE -klt-certs Opaque 5 4d23h +keptn-certs Opaque 5 4d23h ``` -Specify the `NAME` of the Keptn certificate (`klt-certs` in this case) +Specify the `NAME` of the Keptn certificate (`keptn-certs` in this case) to delete the Keptn certificate: ```shell -kubectl delete secret klt-certs -n keptn-lifecycle-toolkit-system +kubectl delete secret keptn-certs -n keptn-lifecycle-toolkit-system ``` diff --git a/docs/content/en/docs/operate/cert-manager.md b/docs/content/en/docs/operate/cert-manager.md index 9f1470ce95..2b3e8f4a5a 100644 --- a/docs/content/en/docs/operate/cert-manager.md +++ b/docs/content/en/docs/operate/cert-manager.md @@ -37,7 +37,7 @@ These are the CRs for `cert-manager.io` to be applied to your cluster: apiVersion: cert-manager.io/v1 kind: Certificate metadata: - name: klt-certs + name: keptn-certs namespace: spec: dnsNames: @@ -48,7 +48,7 @@ spec: issuerRef: kind: Issuer name: klt-selfsigned-issuer - secretName: klt-certs + secretName: keptn-certs --- apiVersion: cert-manager.io/v1 kind: Issuer @@ -63,7 +63,7 @@ Note the following about these fields: * The `apiVersion` field refers to the API for the cert-manager. * The value of the `.spec.secretName` field as well as the `.metadata.name` of the `Certificate` CR - must be `klt-certs`. + must be `keptn-certs`. * Substitute the namespace placeholders with your namespace, where Keptn is installed. See the [CA Injector](https://cert-manager.io/docs/concepts/ca-injector/) diff --git a/klt-cert-manager/chart/templates/certificate-operator-rbac.yaml b/klt-cert-manager/chart/templates/certificate-operator-rbac.yaml index d23ca3445b..fbf38d4f87 100644 --- a/klt-cert-manager/chart/templates/certificate-operator-rbac.yaml +++ b/klt-cert-manager/chart/templates/certificate-operator-rbac.yaml @@ -17,7 +17,7 @@ rules: - apiGroups: - "" resourceNames: - - klt-certs + - keptn-certs resources: - secrets verbs: diff --git a/klt-cert-manager/config/rbac/role.yaml b/klt-cert-manager/config/rbac/role.yaml index a4a3257bf5..c682555764 100644 --- a/klt-cert-manager/config/rbac/role.yaml +++ b/klt-cert-manager/config/rbac/role.yaml @@ -60,7 +60,7 @@ rules: - apiGroups: - "" resourceNames: - - klt-certs + - keptn-certs resources: - secrets verbs: diff --git a/klt-cert-manager/pkg/common/config.go b/klt-cert-manager/pkg/common/config.go index aec7b570c3..b72ffa6e40 100644 --- a/klt-cert-manager/pkg/common/config.go +++ b/klt-cert-manager/pkg/common/config.go @@ -8,7 +8,7 @@ import ( const ( SuccessDuration = 3 * time.Hour - SecretName = "klt-certs" + SecretName = "keptn-certs" CertificatesSecretEmptyErr = "certificates secret is empty" ) diff --git a/lifecycle-operator/chart/templates/keptnapp-crd.yaml b/lifecycle-operator/chart/templates/keptnapp-crd.yaml index 09642631e5..7ba3190bfb 100644 --- a/lifecycle-operator/chart/templates/keptnapp-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnapp-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnapps.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptnappcreationrequest-crd.yaml b/lifecycle-operator/chart/templates/keptnappcreationrequest-crd.yaml index be02e3fc96..bce27b0fe2 100644 --- a/lifecycle-operator/chart/templates/keptnappcreationrequest-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnappcreationrequest-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnappcreationrequests.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptnappversion-crd.yaml b/lifecycle-operator/chart/templates/keptnappversion-crd.yaml index a7448e77b3..78fac10577 100644 --- a/lifecycle-operator/chart/templates/keptnappversion-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnappversion-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnappversions.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptnconfig-crd.yaml b/lifecycle-operator/chart/templates/keptnconfig-crd.yaml index ea03349bae..02506928c2 100644 --- a/lifecycle-operator/chart/templates/keptnconfig-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnconfig-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnconfigs.options.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptnevaluation-crd.yaml b/lifecycle-operator/chart/templates/keptnevaluation-crd.yaml index d9073fe4cb..016ba12834 100644 --- a/lifecycle-operator/chart/templates/keptnevaluation-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnevaluation-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnevaluations.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptnevaluationdefinition-crd.yaml b/lifecycle-operator/chart/templates/keptnevaluationdefinition-crd.yaml index 8459bdbd5f..2a0dc865f7 100644 --- a/lifecycle-operator/chart/templates/keptnevaluationdefinition-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnevaluationdefinition-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnevaluationdefinitions.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptnevaluationprovider-crd.yaml b/lifecycle-operator/chart/templates/keptnevaluationprovider-crd.yaml index a37eda56d9..64b2cae197 100644 --- a/lifecycle-operator/chart/templates/keptnevaluationprovider-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnevaluationprovider-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnevaluationproviders.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptntask-crd.yaml b/lifecycle-operator/chart/templates/keptntask-crd.yaml index 7b49821b92..b73e76dbda 100644 --- a/lifecycle-operator/chart/templates/keptntask-crd.yaml +++ b/lifecycle-operator/chart/templates/keptntask-crd.yaml @@ -5,7 +5,7 @@ metadata: name: keptntasks.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptntaskdefinition-crd.yaml b/lifecycle-operator/chart/templates/keptntaskdefinition-crd.yaml index 447c74a124..fb560f695b 100644 --- a/lifecycle-operator/chart/templates/keptntaskdefinition-crd.yaml +++ b/lifecycle-operator/chart/templates/keptntaskdefinition-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptntaskdefinitions.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptnworkload-crd.yaml b/lifecycle-operator/chart/templates/keptnworkload-crd.yaml index 6238558710..7202de6f01 100644 --- a/lifecycle-operator/chart/templates/keptnworkload-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnworkload-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnworkloads.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/keptnworkloadinstance-crd.yaml b/lifecycle-operator/chart/templates/keptnworkloadinstance-crd.yaml index ba9b7b3a73..6e05581bc1 100644 --- a/lifecycle-operator/chart/templates/keptnworkloadinstance-crd.yaml +++ b/lifecycle-operator/chart/templates/keptnworkloadinstance-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnworkloadinstances.lifecycle.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: lifecycle.keptn.sh diff --git a/lifecycle-operator/chart/templates/lifecycle-mutating-webhook-configuration.yaml b/lifecycle-operator/chart/templates/lifecycle-mutating-webhook-configuration.yaml index f37ba64cee..6314634cb0 100644 --- a/lifecycle-operator/chart/templates/lifecycle-mutating-webhook-configuration.yaml +++ b/lifecycle-operator/chart/templates/lifecycle-mutating-webhook-configuration.yaml @@ -3,7 +3,7 @@ kind: MutatingWebhookConfiguration metadata: name: lifecycle-mutating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: keptn.sh/inject-cert: "true" app.kubernetes.io/part-of: "keptn-lifecycle-toolkit" diff --git a/lifecycle-operator/chart/templates/lifecycle-validating-webhook-configuration.yaml b/lifecycle-operator/chart/templates/lifecycle-validating-webhook-configuration.yaml index 2a3c22d1df..ce7add8d23 100644 --- a/lifecycle-operator/chart/templates/lifecycle-validating-webhook-configuration.yaml +++ b/lifecycle-operator/chart/templates/lifecycle-validating-webhook-configuration.yaml @@ -3,7 +3,7 @@ kind: ValidatingWebhookConfiguration metadata: name: lifecycle-validating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: keptn.sh/inject-cert: "true" {{- include "chart.labels" . | nindent 4 }} diff --git a/lifecycle-operator/webhooks/config.go b/lifecycle-operator/webhooks/config.go index 97fb8e4a0d..79622a8291 100644 --- a/lifecycle-operator/webhooks/config.go +++ b/lifecycle-operator/webhooks/config.go @@ -3,5 +3,5 @@ package webhooks const ( // SecretCertsName is the name of the secret where the webhook certificates are stored. - SecretCertsName = "klt-certs" + SecretCertsName = "keptn-certs" ) diff --git a/metrics-operator/chart/templates/analysis-crd.yaml b/metrics-operator/chart/templates/analysis-crd.yaml index e3fc687a37..bb6659dc41 100644 --- a/metrics-operator/chart/templates/analysis-crd.yaml +++ b/metrics-operator/chart/templates/analysis-crd.yaml @@ -4,7 +4,7 @@ metadata: name: analyses.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh diff --git a/metrics-operator/chart/templates/analysisdefinition-crd.yaml b/metrics-operator/chart/templates/analysisdefinition-crd.yaml index 3c9c7c2c4a..1d6f5c7322 100644 --- a/metrics-operator/chart/templates/analysisdefinition-crd.yaml +++ b/metrics-operator/chart/templates/analysisdefinition-crd.yaml @@ -4,7 +4,7 @@ metadata: name: analysisdefinitions.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh diff --git a/metrics-operator/chart/templates/analysisvaluetemplate-crd.yaml b/metrics-operator/chart/templates/analysisvaluetemplate-crd.yaml index 23ef4c8270..a2cb226266 100644 --- a/metrics-operator/chart/templates/analysisvaluetemplate-crd.yaml +++ b/metrics-operator/chart/templates/analysisvaluetemplate-crd.yaml @@ -4,7 +4,7 @@ metadata: name: analysisvaluetemplates.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh diff --git a/metrics-operator/chart/templates/keptnmetric-crd.yaml b/metrics-operator/chart/templates/keptnmetric-crd.yaml index f0a52bdea0..c2a6fbc1ea 100644 --- a/metrics-operator/chart/templates/keptnmetric-crd.yaml +++ b/metrics-operator/chart/templates/keptnmetric-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnmetrics.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh diff --git a/metrics-operator/chart/templates/keptnmetricsprovider-crd.yaml b/metrics-operator/chart/templates/keptnmetricsprovider-crd.yaml index f180be6233..b3679d121d 100644 --- a/metrics-operator/chart/templates/keptnmetricsprovider-crd.yaml +++ b/metrics-operator/chart/templates/keptnmetricsprovider-crd.yaml @@ -4,7 +4,7 @@ metadata: name: keptnmetricsproviders.metrics.keptn.sh annotations: controller-gen.kubebuilder.io/version: v0.13.0 - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: app.kubernetes.io/part-of: keptn-lifecycle-toolkit crdGroup: metrics.keptn.sh diff --git a/metrics-operator/chart/templates/metrics-validating-webhook-configuration.yaml b/metrics-operator/chart/templates/metrics-validating-webhook-configuration.yaml index d188313680..d9ddd300ad 100644 --- a/metrics-operator/chart/templates/metrics-validating-webhook-configuration.yaml +++ b/metrics-operator/chart/templates/metrics-validating-webhook-configuration.yaml @@ -3,7 +3,7 @@ kind: ValidatingWebhookConfiguration metadata: name: metrics-validating-webhook-configuration annotations: - cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/klt-certs' + cert-manager.io/inject-ca-from: '{{ .Release.Namespace }}/keptn-certs' labels: keptn.sh/inject-cert: "true" {{- include "chart.labels" . | nindent 4 }} diff --git a/test/testcertificate/cert-recreates/00-assert.yaml b/test/testcertificate/cert-recreates/00-assert.yaml index 636eb3405b..596297d252 100644 --- a/test/testcertificate/cert-recreates/00-assert.yaml +++ b/test/testcertificate/cert-recreates/00-assert.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: klt-certs + name: keptn-certs namespace: keptn-lifecycle-toolkit-system --- apiVersion: apps/v1 diff --git a/test/testcertificate/cert-recreates/00-teststep.yaml b/test/testcertificate/cert-recreates/00-teststep.yaml index dd15873612..fda7c36bc6 100644 --- a/test/testcertificate/cert-recreates/00-teststep.yaml +++ b/test/testcertificate/cert-recreates/00-teststep.yaml @@ -1,6 +1,6 @@ apiVersion: kuttl.dev/v1 kind: TestStep commands: # first scenario: the toolkit is restarted after removing the certificate - - script: kubectl delete secret klt-certs -n keptn-lifecycle-toolkit-system + - script: kubectl delete secret keptn-certs -n keptn-lifecycle-toolkit-system - script: kubectl rollout restart deployment -n keptn-lifecycle-toolkit-system -l control-plane=lifecycle-operator - script: kubectl rollout restart deployment -n keptn-lifecycle-toolkit-system -l control-plane=metrics-operator diff --git a/test/testcertificate/cert-recreates/01-assert.yaml b/test/testcertificate/cert-recreates/01-assert.yaml index 636eb3405b..596297d252 100644 --- a/test/testcertificate/cert-recreates/01-assert.yaml +++ b/test/testcertificate/cert-recreates/01-assert.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: klt-certs + name: keptn-certs namespace: keptn-lifecycle-toolkit-system --- apiVersion: apps/v1 diff --git a/test/testcertificate/cert-recreates/01-delete.yaml b/test/testcertificate/cert-recreates/01-delete.yaml index 1ca271c25a..f39dfd62b1 100644 --- a/test/testcertificate/cert-recreates/01-delete.yaml +++ b/test/testcertificate/cert-recreates/01-delete.yaml @@ -2,5 +2,5 @@ apiVersion: v1 kind: Secret metadata: - name: klt-certs + name: keptn-certs namespace: keptn-lifecycle-toolkit-system diff --git a/test/testcertificate/cert-recreates/02-assert.yaml b/test/testcertificate/cert-recreates/02-assert.yaml index e54956a7b4..ee79107c0b 100644 --- a/test/testcertificate/cert-recreates/02-assert.yaml +++ b/test/testcertificate/cert-recreates/02-assert.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: klt-certs + name: keptn-certs namespace: keptn-lifecycle-toolkit-system annotations: mycert: "true" # make sure this is the latest secret diff --git a/test/testcertificate/cert-recreates/02-install.yaml b/test/testcertificate/cert-recreates/02-install.yaml index 28abe03683..9be94821bf 100644 --- a/test/testcertificate/cert-recreates/02-install.yaml +++ b/test/testcertificate/cert-recreates/02-install.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: klt-certs + name: keptn-certs namespace: keptn-lifecycle-toolkit-system annotations: mycert: "true" diff --git a/test/testcertificate/cert-recreates/02-teststep.yaml b/test/testcertificate/cert-recreates/02-teststep.yaml index 1553671775..f9b9a46465 100644 --- a/test/testcertificate/cert-recreates/02-teststep.yaml +++ b/test/testcertificate/cert-recreates/02-teststep.yaml @@ -2,7 +2,7 @@ apiVersion: kuttl.dev/v1 kind: TestStep commands: - script: | # make sure secret is updated from the bad one to a proper one - str1=$(kubectl get secret klt-certs -n keptn-lifecycle-toolkit-system -o=go-template='{{index .data "tls.crt"}}') + str1=$(kubectl get secret keptn-certs -n keptn-lifecycle-toolkit-system -o=go-template='{{index .data "tls.crt"}}') str2="LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNkekNDQWg2Z0F3SUJBZ0lRZUpBWkJMcmxCY2VqNzh3cm4wV1ZIekFLQmdncWhrak9QUVFEQWpDQmlURUwKa0ZGY1FpY29hdE8yRFJnPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0t" if [ "$str1" == "$str2" ]; then echo "Strings are equal" $str1 From b414b64750837d5e00e34a36d2dd1d4d26754897 Mon Sep 17 00:00:00 2001 From: realanna Date: Wed, 4 Oct 2023 16:47:48 +0200 Subject: [PATCH 4/5] fix: controller resourceNames Signed-off-by: realanna --- .../keptnwebhookcertificate_controller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/klt-cert-manager/controllers/keptnwebhookcontroller/keptnwebhookcertificate_controller.go b/klt-cert-manager/controllers/keptnwebhookcontroller/keptnwebhookcertificate_controller.go index c1414121f4..ade0d231f8 100644 --- a/klt-cert-manager/controllers/keptnwebhookcontroller/keptnwebhookcertificate_controller.go +++ b/klt-cert-manager/controllers/keptnwebhookcontroller/keptnwebhookcertificate_controller.go @@ -79,7 +79,7 @@ type KeptnWebhookCertificateReconciler struct { // +kubebuilder:rbac:groups="apps",resources=deployments,verbs=get;list;watch; //role -// +kubebuilder:rbac:groups="",namespace=keptn-lifecycle-toolkit-system,resources=secrets,verbs=get;update;patch,resourceNames=klt-certs +// +kubebuilder:rbac:groups="",namespace=keptn-lifecycle-toolkit-system,resources=secrets,verbs=get;update;patch,resourceNames=keptn-certs // +kubebuilder:rbac:groups="",namespace=keptn-lifecycle-toolkit-system,resources=secrets,verbs=create;list;watch // Reconcile is part of the main kubernetes reconciliation loop which aims to From 27f1773d9ec271049b905805b09bf8149626f68b Mon Sep 17 00:00:00 2001 From: realanna Date: Wed, 4 Oct 2023 17:03:15 +0200 Subject: [PATCH 5/5] fix: update dependancies Signed-off-by: realanna --- lifecycle-operator/go.mod | 2 +- lifecycle-operator/go.sum | 4 ++-- metrics-operator/go.mod | 2 +- metrics-operator/go.sum | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lifecycle-operator/go.mod b/lifecycle-operator/go.mod index 092efe5209..14d5ee040a 100644 --- a/lifecycle-operator/go.mod +++ b/lifecycle-operator/go.mod @@ -9,7 +9,7 @@ require ( github.com/cloudevents/sdk-go/v2 v2.14.0 github.com/go-logr/logr v1.2.4 github.com/kelseyhightower/envconfig v1.4.0 - github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231005051601-a656512e6a8d + github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231004144748-2363c9ca439a github.com/magiconair/properties v1.8.7 github.com/onsi/ginkgo/v2 v2.12.1 github.com/onsi/gomega v1.28.0 diff --git a/lifecycle-operator/go.sum b/lifecycle-operator/go.sum index ed448481a8..bb46821693 100644 --- a/lifecycle-operator/go.sum +++ b/lifecycle-operator/go.sum @@ -189,8 +189,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= -github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231005051601-a656512e6a8d h1:a+mNQzFMHV24Z+RFfLHufqhfM9NzH3ddPpGSB/4Oe6I= -github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231005051601-a656512e6a8d/go.mod h1:GjJFB+g1DuBYrOXSgF4kzR9Phb+W5t3obFt4UHqz9OM= +github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231004144748-2363c9ca439a h1:En7I6X4VaBQSzYpZNAbIDcqS6p0jdQh5MyElU0c9PDs= +github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231004144748-2363c9ca439a/go.mod h1:GjJFB+g1DuBYrOXSgF4kzR9Phb+W5t3obFt4UHqz9OM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= diff --git a/metrics-operator/go.mod b/metrics-operator/go.mod index 24776682f0..df1d0912f0 100644 --- a/metrics-operator/go.mod +++ b/metrics-operator/go.mod @@ -8,7 +8,7 @@ require ( github.com/go-logr/logr v1.2.4 github.com/gorilla/mux v1.8.0 github.com/kelseyhightower/envconfig v1.4.0 - github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231005051601-a656512e6a8d + github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231004144748-2363c9ca439a github.com/open-feature/go-sdk v1.8.0 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.17.0 diff --git a/metrics-operator/go.sum b/metrics-operator/go.sum index 1306b54cb6..4cf8c067d3 100644 --- a/metrics-operator/go.sum +++ b/metrics-operator/go.sum @@ -240,8 +240,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= -github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231005051601-a656512e6a8d h1:a+mNQzFMHV24Z+RFfLHufqhfM9NzH3ddPpGSB/4Oe6I= -github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231005051601-a656512e6a8d/go.mod h1:GjJFB+g1DuBYrOXSgF4kzR9Phb+W5t3obFt4UHqz9OM= +github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231004144748-2363c9ca439a h1:En7I6X4VaBQSzYpZNAbIDcqS6p0jdQh5MyElU0c9PDs= +github.com/keptn/lifecycle-toolkit/klt-cert-manager v0.0.0-20231004144748-2363c9ca439a/go.mod h1:GjJFB+g1DuBYrOXSgF4kzR9Phb+W5t3obFt4UHqz9OM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=