Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Support []string and []*string as sensitive fields #197

Merged
merged 1 commit into from
Jan 31, 2022

Conversation

sergenyalcin
Copy link
Member

@sergenyalcin sergenyalcin commented Jan 9, 2022

Description of your changes

Fixes #100

This PR provides support for []string and []*string as sensitive fields. In resource manifests, more than one secrets and more than one fields of secrets can be referred as input for sensitive values. Also, sensitive field outputs will be written to the connection secret.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

I have tested this PR by using the example in the issue description.

  • Firstly, I added a custom configuration for aws_elasticache_user that marks the passwords field as sensitive.
  • Then I created the following manifest:
apiVersion: elasticache.aws.jet.crossplane.io/v1alpha1
kind: User
metadata:
  name: sample-user
spec:
  forProvider:
    userName: "testUserName"
    accessString: "on ~app::* -@all +@read +@hash +@bitmap +@geo -setbit -bitfield -hset -hsetnx -hmset -hincrby -hincrbyfloat -hdel -bitop -geoadd -georadius -georadiusbymember"
    engine: "REDIS"
    region: us-west-1
    passwordsSecretRef:
      - name: test-slice-1
        namespace: crossplane-system
        key: pwd
      - name: test-slice-2
        namespace: crossplane-system
        key: pwd
  writeConnectionSecretToRef:
    name: test-conn
    namespace: default
  • The external resource was successfully created and the connection secret had the correct values.

@sergenyalcin sergenyalcin force-pushed the sensitive-array-support branch 3 times, most recently from 8f557a5 to 18238c8 Compare January 9, 2022 20:38
@sergenyalcin sergenyalcin marked this pull request as ready for review January 9, 2022 20:56
@sergenyalcin sergenyalcin force-pushed the sensitive-array-support branch from 18238c8 to cc08cce Compare January 10, 2022 13:10
pkg/resource/sensitive.go Outdated Show resolved Hide resolved
Copy link
Member

@turkenh turkenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @sergenyalcin for dealing with this.

PR is looking pretty good, left couple of comments mostly asking for some code cleanup.

pkg/resource/sensitive.go Outdated Show resolved Hide resolved
pkg/resource/sensitive.go Outdated Show resolved Hide resolved
pkg/types/builder.go Show resolved Hide resolved
pkg/resource/sensitive.go Outdated Show resolved Hide resolved
pkg/resource/sensitive.go Outdated Show resolved Hide resolved
pkg/resource/sensitive_test.go Show resolved Hide resolved
@sergenyalcin sergenyalcin marked this pull request as draft January 25, 2022 15:52
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
@sergenyalcin sergenyalcin force-pushed the sensitive-array-support branch from 4362983 to d5b586c Compare January 31, 2022 13:02
@sergenyalcin sergenyalcin marked this pull request as ready for review January 31, 2022 13:13
Copy link
Member

@turkenh turkenh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, thanks @sergenyalcin 👍

@turkenh turkenh merged commit a3e660b into crossplane:main Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support []string and []*string as sensitive fields
3 participants