Fix connection secret owner check for K8s Secret Store #380
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of your changes
This fixes an issue when the External Secret Store feature is enabled, but K8s secrets are used (as the default secret store).
Fixes crossplane/crossplane#3520
I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested
Install XP with the external secret store feature enabled.
Apply the following XRD and Composition
`XRD` yaml:
`Composition` yaml:
``` apiVersion: apiextensions.crossplane.io/v1 kind: Composition metadata: name: xcruiseserviceaccounts.getcruise.com labels: provider: gcp spec: writeConnectionSecretsToNamespace: crossplane-system compositeTypeRef: apiVersion: getcruise.com/v1alpha1 kind: XCruiseServiceAccount resources: - name: serviceaccount base: # https://doc.crds.dev/github.com/upbound/provider-gcp/cloudplatform.gcp.upbound.io/ServiceAccount/v1beta1 apiVersion: cloudplatform.gcp.upbound.io/v1beta1 kind: ServiceAccount spec: forProvider: {} patches: - type: CombineFromComposite toFieldPath: spec.forProvider.description policy: fromFieldPath: Required combine: variables: - fromFieldPath: spec.claimRef.namespace - fromFieldPath: spec.claimRef.name strategy: string string: fmt: "%s/%s" - type: ToCompositeFieldPath fromFieldPath: status.atProvider.email toFieldPath: status.serviceAccountEmail policy: fromFieldPath: Required - name: serviceaccountkey connectionDetails: - fromConnectionSecretKey: private_key base: # https://doc.crds.dev/github.com/upbound/provider-gcp/cloudplatform.gcp.upbound.io/ServiceAccountKey/v1beta1 apiVersion: cloudplatform.gcp.upbound.io/v1beta1 kind: ServiceAccountKey spec: forProvider: publicKeyType: TYPE_X509_PEM_FILE serviceAccountIdSelector: matchControllerRef: true writeConnectionSecretToRef: name: sa-key namespace: crossplane-system ```Apply the following claim
Verify that the composite becomes READY & SYNCED and connection secret created properly.