Generate Secret References for Sensitive Parameters under the spec.initProvider API tree #406
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
While working on adding the
User.mq
resource incrossplane-contrib/provider-upjet-aws
, we hit the limitation that currently we do not generate secret references for the sensitive parameters under thespec.initProvider
API. Currently, one can specify an ActiveMQ broker user withcrossplane-contrib/provider-upjet-aws
as follows:However, we cannot fully specify the broker user using the
spec.initProvider
API tree because there's nospec.initProvider.user[*].passwordSecretRef
and a partial specification like the following:will not function as the required user password is missing in the user specification, which renders the
spec.initProvider.user
API useless.This PR adds support for the generation of secret references for sensitive parameters under the
spec.initProvider
API tree. As a result, it now becomes possible to fully specify a broker user as follows:The PR proposes both the code generation changes & the runtime secret resolution changes:
Code generation changes:
spec.initProvider
API tree. As an example,Broker.mq
now hasspec.initProvider.user[*].passwordSecretRef
as a sensitive parameter.spec.forProvider
API tree because they have now counterparts under thespec.initProvider
subtree, i.e., they can now be specified from underspec.initProvider
.zz_*_terraformed.go
files, connection details mappings without thespec.forProvider
prefixes in CRD paths. For example, what upjet used to generate as follows:now becomes:
This is because, the mapping is now not 1:1. The sensitive value for the
notes
Terraform configuration argument can now be resolved from either aspec.forProvider
reference or asoec.initProvider
reference.Runtime changes:
Upjet runtime now has to be able to resolve secret references from under the
spec.initProvider
tree and the mapping between the Terraform configuration arguments & secret references is no longer one-to-one. If both aspec.initProvider
and aspec.forProvider
secret reference target the same Terraform configuration argument, then thespec.forProvider
's reference prevails over.I have:
make reviewable
to ensure this PR is ready for review.backport release-x.y
labels to auto-backport this PR if necessary.How has this code been tested
Manually tested via the
User.users
crossplane-contrib/provider-upjet-azuread
resource.