From 848f504bdd30e7404625e65912bb8ef00b6f5b02 Mon Sep 17 00:00:00 2001 From: Mashama McFarlane Date: Sun, 16 Feb 2025 11:10:32 -0600 Subject: [PATCH] feat: integrate function credentials Signed-off-by: Mashama McFarlane --- Makefile | 2 +- README.md | 95 ++++++------------- env.go | 20 +--- env_test.go | 12 +-- example/README.md | 44 --------- example/aws/functions.yaml | 2 +- example/datadog-dashboard-ids/README.md | 27 ++++++ .../datadog-dashboard-ids/composition.yaml | 26 ++--- .../datadog-dashboard-ids/credentials.yaml | 8 ++ .../deployment-runtime-config.yaml | 21 ---- example/datadog-dashboard-ids/functions.yaml | 8 +- example/echo/functions.yaml | 2 +- example/ip-addr-validation/functions.yaml | 2 +- fn.go | 20 ++-- fn_test.go | 69 +++++++------- get_credential_data.go | 26 +++++ get_credential_data_test.go | 89 +++++++++++++++++ go.mod | 68 ++++++------- go.sum | 72 ++++++++++++++ input/v1alpha1/parameters.go | 18 ++-- input/v1alpha1/zz_generated.deepcopy.go | 34 ++++--- .../template.fn.crossplane.io_parameters.yaml | 28 +++--- 22 files changed, 406 insertions(+), 287 deletions(-) delete mode 100644 example/README.md create mode 100644 example/datadog-dashboard-ids/README.md create mode 100644 example/datadog-dashboard-ids/credentials.yaml delete mode 100644 example/datadog-dashboard-ids/deployment-runtime-config.yaml create mode 100644 get_credential_data.go create mode 100644 get_credential_data_test.go diff --git a/Makefile b/Makefile index a0db3e6..95894e7 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ test: ## Run Code Tests go test -v -cover . render: ## Render Examples, Requires make debug first - crossplane beta render \ + crossplane \ example/echo/xr.yaml \ example/echo/composition.yaml \ example/echo/functions.yaml diff --git a/README.md b/README.md index 37ada72..216a22c 100644 --- a/README.md +++ b/README.md @@ -15,50 +15,8 @@ is expected to be enhanced with the above pattern. The `function-shell` accepts commands to run in a shell and it returns the output to specified fields. It accepts the following parameters: -- `shellEnvVarsRef` - referencing environment variables in the -function-shell Kubernetes pod that were loaded through a -`deploymentRuntimeConfig`. The file MUST be in `JSON` format. -It can be a Kubernetes secret. `shellEnvVarsRef` requires a `name` -for the pod environment variable, and `keys` for the keys Inside -of the JSON formatted pod environment variable that have associated -values. - -Example secret: - -```json -{ - "ENV_FOO": "foo value", - "ENV_BAR": "bar value" -} -``` - -Example `deploymentRuntimeConfig`: - -```yaml ---- -apiVersion: pkg.crossplane.io/v1beta1 -kind: DeploymentRuntimeConfig -metadata: - name: function-shell -spec: - deploymentTemplate: - spec: - selector: {} - replicas: 1 - template: - spec: - containers: - - name: package-runtime - args: - - --debug - env: - - name: DATADOG_SECRET - valueFrom: - secretKeyRef: - key: credentials - name: datadog-secret -``` - +- `shellCredentialRefs` - referencing function credentials +and the required keys. - `shellEnvVars` - an array of environment variables with a `key` and `value` each. - `shellCommand` - a shell command line that can contain pipes @@ -81,12 +39,9 @@ This repository includes the following examples The composition calls the `function-shell` instructing it to obtain dashboard ids from a [Datadog](https://www.datadoghq.com/) account. -For this, the composition specifies the name of a Kubernetes -pod environment variable called `DATADOG_SECRET`. This environment -variable was populated with the `JSON` of a Kubernetes datadog-secret -through a deploymentRuntimeConfig. The `JSON` includes the -`DATADOG_API_KEY` and `DATADOG_APP_KEY` -keys and their values. The Datadog API endpoint is passed +For this, the composition specifies the name of a function credential called +`DATADOG_SECRET` referencing a Kubernetes secret containing `DATADOG_API_KEY` +and `DATADOG_APP_KEY` keys and their values. The Datadog API endpoint is passed in a clear text `DATADOG_API_URL` environment variable. The shell command uses a `curl` to the endpoint with a header that contains the access credentials. The command output is piped into @@ -101,15 +56,18 @@ The composition is for illustration purposes only. When using the you may want to patch function input from claim and other composition field values. -The `deploymentRuntimeConfig` reads a datadog secret -that looks like below. Replace `YOUR_API_KEY` and `YOUR_APP_KEY` with your respective keys. -```json -{ - "DATADOG_API_KEY": "YOUR_API_KEY", - "DATADOG_APP_KEY": "YOIR_APP_KEY" -} +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: datadog-secret + namespace: default +type: Opaque +data: + DATADOG_API_KEY: Zm9v # your api key + DATADOG_APP_KEY: YmFy # your app key ``` ```yaml @@ -125,6 +83,12 @@ spec: mode: Pipeline pipeline: - step: shell + credentials: + - name: DATADOG_SECRET + secretRef: + namespace: default + name: datadog-secret + source: Secret functionRef: # When installed through a package manager, use # name: crossplane-contrib-function-shell @@ -132,14 +96,13 @@ spec: input: apiVersion: shell.fn.crossplane.io/v1beta1 kind: Parameters - # Load shellEnvVarsRef from a Kubernetes secret - # through a deploymentRuntimeConfig into the - # function-shell pod. - shellEnvVarsRef: - name: DATADOG_SECRET - keys: - - DATADOG_API_KEY - - DATADOG_APP_KEY + # Load shellCredentialsRef from a Kubernetes secret + # into the function-shell pod. + shellCredentialRefs: + - name: DATADOG_SECRET + keys: + - DATADOG_API_KEY + - DATADOG_APP_KEY shellEnvVars: - key: DATADOG_API_URL value: "https://api.datadoghq.com/api/v1/dashboard" @@ -296,7 +259,7 @@ go run . --insecure --debug In Terminal 2 ```shell -crossplane beta render \ +crossplane \ example/out-of-cluster/xr.yaml \ example/out-of-cluster/composition.yaml \ example/out-of-cluster/functions.yaml diff --git a/env.go b/env.go index 1873988..f30714b 100644 --- a/env.go +++ b/env.go @@ -1,34 +1,18 @@ package main import ( - "encoding/json" "fmt" - "os" "regexp" - "github.com/crossplane-contrib/function-shell/input/v1alpha1" "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/fieldpath" - fnv1beta1 "github.com/crossplane/function-sdk-go/proto/v1beta1" + fnv1 "github.com/crossplane/function-sdk-go/proto/v1" "github.com/crossplane/function-sdk-go/request" "github.com/crossplane/function-sdk-go/resource" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" ) -func addShellEnvVarsFromRef(envVarsRef v1alpha1.ShellEnvVarsRef, shellEnvVars map[string]string) (map[string]string, error) { - var envVarsData map[string]string - - envVars := os.Getenv(envVarsRef.Name) - if err := json.Unmarshal([]byte(envVars), &envVarsData); err != nil { - return shellEnvVars, err - } - for _, key := range envVarsRef.Keys { - shellEnvVars[key] = envVarsData[key] - } - return shellEnvVars, nil -} - -func fromValueRef(req *fnv1beta1.RunFunctionRequest, path string) (string, error) { +func fromValueRef(req *fnv1.RunFunctionRequest, path string) (string, error) { // Check for context key presence and capture context key and path contextRegex := regexp.MustCompile(`^context\[(.+?)].(.+)$`) if match := contextRegex.FindStringSubmatch(path); match != nil { diff --git a/env_test.go b/env_test.go index acb7741..6b8c7e0 100644 --- a/env_test.go +++ b/env_test.go @@ -3,7 +3,7 @@ package main import ( "testing" - fnv1beta1 "github.com/crossplane/function-sdk-go/proto/v1beta1" + fnv1 "github.com/crossplane/function-sdk-go/proto/v1" "github.com/crossplane/function-sdk-go/resource" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" @@ -13,7 +13,7 @@ import ( func TestFromValueRef(t *testing.T) { type args struct { - req *fnv1beta1.RunFunctionRequest + req *fnv1.RunFunctionRequest path string } @@ -30,9 +30,9 @@ func TestFromValueRef(t *testing.T) { "FromCompositeValid": { reason: "If composite path is valid, it should be returned.", args: args{ - req: &fnv1beta1.RunFunctionRequest{ - Observed: &fnv1beta1.State{ - Composite: &fnv1beta1.Resource{ + req: &fnv1.RunFunctionRequest{ + Observed: &fnv1.State{ + Composite: &fnv1.Resource{ Resource: resource.MustStructJSON(`{ "apiVersion": "", "kind": "", @@ -53,7 +53,7 @@ func TestFromValueRef(t *testing.T) { "FromContextValid": { reason: "If composite path is valid, it should be returned.", args: args{ - req: &fnv1beta1.RunFunctionRequest{ + req: &fnv1.RunFunctionRequest{ Context: resource.MustStructJSON(`{ "apiextensions.crossplane.io/foo": { "bar": "baz" diff --git a/example/README.md b/example/README.md deleted file mode 100644 index a5853b7..0000000 --- a/example/README.md +++ /dev/null @@ -1,44 +0,0 @@ -# Example manifests - -You can run your function locally and test it using `crossplane beta render` -with these example manifests. - -```shell -# Run the function locally -$ go run . --insecure --debug -``` - -```shell -# Then, in another terminal, call it with these example manifests -$ crossplane beta render xr.yaml composition.yaml functions.yaml -r ---- -apiVersion: example.crossplane.io/v1 -kind: XR -metadata: - name: example-xr ---- -apiVersion: render.crossplane.io/v1beta1 -kind: Result -message: I was run with input "Hello world"! -severity: SEVERITY_NORMAL -step: run-the-template -``` - - -Make a Kubernetes secret for API and APP keys and credentials -in the form of a JSON file. -``` -{ - "API_KEY": "...masked.value.here...", - "APP_KEY": "...masked.value.here..." -} -``` -For example, it can be created as follows: -``` -kubectl -n upbound-system \ - create secret generic datadog-secret \ - --from-literal=credentials="${DATADOG_ENV_VARS_JSON}" \ - --dry-run=client \ - -o yaml|\ - kubectl apply -f - -``` diff --git a/example/aws/functions.yaml b/example/aws/functions.yaml index 86b46af..2659bbe 100644 --- a/example/aws/functions.yaml +++ b/example/aws/functions.yaml @@ -4,7 +4,7 @@ kind: Function metadata: name: function-shell annotations: - # This tells crossplane beta render to connect to the function locally. + # This tells crossplane render to connect to the function locally. render.crossplane.io/runtime: Development spec: # This is ignored when using the Development runtime. diff --git a/example/datadog-dashboard-ids/README.md b/example/datadog-dashboard-ids/README.md new file mode 100644 index 0000000..503d3a9 --- /dev/null +++ b/example/datadog-dashboard-ids/README.md @@ -0,0 +1,27 @@ +# Example manifests + +You can run your function locally and test it using `crossplane render` +with these example manifests. + +```shell +# Run the function locally +$ go run . --insecure --debug +``` + +```shell +# Then, in another terminal, call it with these example manifests +$ crossplane render xr.yaml composition.yaml functions.yaml \ + --function-credentials=credentials.yaml \ + --include-function-results +--- +apiVersion: example.crossplane.io/v1 +kind: XR +metadata: + name: example-xr +--- +apiVersion: render.crossplane.io/v1beta1 +kind: Result +message: I was run with input "Hello world"! +severity: SEVERITY_NORMAL +step: run-the-template +``` diff --git a/example/datadog-dashboard-ids/composition.yaml b/example/datadog-dashboard-ids/composition.yaml index 96af201..3ebf789 100644 --- a/example/datadog-dashboard-ids/composition.yaml +++ b/example/datadog-dashboard-ids/composition.yaml @@ -10,6 +10,12 @@ spec: mode: Pipeline pipeline: - step: shell + credentials: + - name: DATADOG_SECRET + secretRef: + namespace: default + name: datadog-secret + source: Secret functionRef: # When installed through a package manager, use # name: crossplane-contrib-function-shell @@ -17,21 +23,17 @@ spec: input: apiVersion: shell.fn.crossplane.io/v1beta1 kind: Parameters - # Load shellEnvVarsRef from a Kubernetes secret - # through a deploymentRuntimeConfig into the - # function-shell pod. - shellEnvVarsRef: - name: DATADOG_SECRET - keys: - - DATADOG_API_KEY - - DATADOG_APP_KEY + # Load shellCredentialsRef from a Kubernetes secret + # into the function-shell pod. + shellCredentialRefs: + - name: DATADOG_SECRET + keys: + - credentials shellEnvVars: - key: DATADOG_API_URL value: "https://api.datadoghq.com/api/v1/dashboard" shellCommand: | - curl -X GET "${DATADOG_API_URL}" \ - -H "Accept: application/json" \ - -H "DD-API-KEY: ${DATADOG_API_KEY}" \ - -H "DD-APPLICATION-KEY: ${DATADOG_APP_KEY}"|jq '.dashboards[] .id' + echo "url=${DATADOG_API_URL}" + echo "credentials=$(echo ${credentials})" stdoutField: status.atFunction.shell.stdout stderrField: status.atFunction.shell.stderr diff --git a/example/datadog-dashboard-ids/credentials.yaml b/example/datadog-dashboard-ids/credentials.yaml new file mode 100644 index 0000000..f12b9d1 --- /dev/null +++ b/example/datadog-dashboard-ids/credentials.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: datadog-secret + namespace: default +type: Opaque +data: + credentials: ewogICJEQVRBRE9HX0FQSV9LRVkiOiAiZm9vIiwKICAiREFUQURPR19BUFBfS0VZIjogImJhciIKfQo= diff --git a/example/datadog-dashboard-ids/deployment-runtime-config.yaml b/example/datadog-dashboard-ids/deployment-runtime-config.yaml deleted file mode 100644 index ac1effc..0000000 --- a/example/datadog-dashboard-ids/deployment-runtime-config.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: pkg.crossplane.io/v1beta1 -kind: DeploymentRuntimeConfig -metadata: - name: function-shell -spec: - deploymentTemplate: - spec: - selector: {} - replicas: 1 - template: - spec: - containers: - - name: package-runtime - args: - - --debug - env: - - name: DATADOG_SECRET - valueFrom: - secretKeyRef: - key: credentials - name: datadog-secret diff --git a/example/datadog-dashboard-ids/functions.yaml b/example/datadog-dashboard-ids/functions.yaml index 94f73bf..c4cf26f 100644 --- a/example/datadog-dashboard-ids/functions.yaml +++ b/example/datadog-dashboard-ids/functions.yaml @@ -4,13 +4,9 @@ kind: Function metadata: name: function-shell annotations: - # This tells crossplane beta render to connect to the functi on locally. + # This tells crossplane render to connect to the function locally. render.crossplane.io/runtime: Development spec: # This is ignored when using the Development runtime. - package: package: xpkg.upbound.io/crossplane-contrib/function-shell:v0.3.0 + package: xpkg.upbound.io/crossplane-contrib/function-shell:v0.3.0 packagePullPolicy: Always - runtimeConfigRef: - apiVersion: pkg.crossplane.io/v1beta1 - kind: DeploymentRuntimeConfig - name: function-shell diff --git a/example/echo/functions.yaml b/example/echo/functions.yaml index 88cbbd7..af46276 100644 --- a/example/echo/functions.yaml +++ b/example/echo/functions.yaml @@ -4,7 +4,7 @@ kind: Function metadata: name: function-shell annotations: - # This tells crossplane beta render to connect to the function locally. + # This tells crossplane render to connect to the function locally. render.crossplane.io/runtime: Development spec: # This is ignored when using the Development runtime. diff --git a/example/ip-addr-validation/functions.yaml b/example/ip-addr-validation/functions.yaml index 88cbbd7..af46276 100644 --- a/example/ip-addr-validation/functions.yaml +++ b/example/ip-addr-validation/functions.yaml @@ -4,7 +4,7 @@ kind: Function metadata: name: function-shell annotations: - # This tells crossplane beta render to connect to the function locally. + # This tells crossplane render to connect to the function locally. render.crossplane.io/runtime: Development spec: # This is ignored when using the Development runtime. diff --git a/fn.go b/fn.go index 9723bcc..c142fd8 100644 --- a/fn.go +++ b/fn.go @@ -8,7 +8,7 @@ import ( "github.com/crossplane-contrib/function-shell/input/v1alpha1" "github.com/crossplane/crossplane-runtime/pkg/errors" "github.com/crossplane/crossplane-runtime/pkg/logging" - fnv1beta1 "github.com/crossplane/function-sdk-go/proto/v1beta1" + fnv1 "github.com/crossplane/function-sdk-go/proto/v1" "github.com/crossplane/function-sdk-go/request" "github.com/crossplane/function-sdk-go/response" "github.com/keegancsmith/shell" @@ -16,13 +16,13 @@ import ( // Function returns whatever response you ask it to. type Function struct { - fnv1beta1.UnimplementedFunctionRunnerServiceServer + fnv1.UnimplementedFunctionRunnerServiceServer log logging.Logger } // RunFunction runs the Function. -func (f *Function) RunFunction(_ context.Context, req *fnv1beta1.RunFunctionRequest) (*fnv1beta1.RunFunctionResponse, error) { +func (f *Function) RunFunction(_ context.Context, req *fnv1.RunFunctionRequest) (*fnv1.RunFunctionResponse, error) { f.log.Info("Running function", "tag", req.GetMeta().GetTag()) rsp := response.To(req, response.DefaultTTL) @@ -98,11 +98,15 @@ func (f *Function) RunFunction(_ context.Context, req *fnv1beta1.RunFunctionRequ } } - if len(in.ShellEnvVarsRef.Keys) > 0 { - shellEnvVars, err = addShellEnvVarsFromRef(in.ShellEnvVarsRef, shellEnvVars) - if err != nil { - response.Fatal(rsp, errors.Wrapf(err, "cannot process contents of shellEnvVarsRef %s", in.ShellEnvVarsRef.Name)) - return rsp, nil + if len(in.ShellCredentialRefs) > 0 { + for _, credRef := range in.ShellCredentialRefs { + if len(credRef.Keys) > 0 { + shellEnvVars, err = addShellEnvVarsFromCredentialRefs(req, credRef, shellEnvVars) + if err != nil { + response.Fatal(rsp, errors.Wrapf(err, "cannot process contents of shellCredentialRefs %s", credRef.Name)) + return rsp, nil + } + } } } diff --git a/fn_test.go b/fn_test.go index 8ba0a99..099e35f 100644 --- a/fn_test.go +++ b/fn_test.go @@ -10,7 +10,7 @@ import ( "google.golang.org/protobuf/types/known/durationpb" "github.com/crossplane/crossplane-runtime/pkg/logging" - fnv1beta1 "github.com/crossplane/function-sdk-go/proto/v1beta1" + fnv1 "github.com/crossplane/function-sdk-go/proto/v1" "github.com/crossplane/function-sdk-go/resource" "github.com/crossplane/function-sdk-go/response" ) @@ -19,10 +19,10 @@ func TestRunFunction(t *testing.T) { type args struct { ctx context.Context - req *fnv1beta1.RunFunctionRequest + req *fnv1.RunFunctionRequest } type want struct { - rsp *fnv1beta1.RunFunctionResponse + rsp *fnv1.RunFunctionResponse err error } @@ -34,8 +34,8 @@ func TestRunFunction(t *testing.T) { "ResponseIsParametersRequired": { reason: "The Function should return a fatal result if no input was specified", args: args{ - req: &fnv1beta1.RunFunctionRequest{ - Meta: &fnv1beta1.RequestMeta{Tag: "hello"}, + req: &fnv1.RunFunctionRequest{ + Meta: &fnv1.RequestMeta{Tag: "hello"}, Input: resource.MustStructJSON(`{ "apiVersion": "template.fn.crossplane.io/v1alpha1", "kind": "Parameters" @@ -43,12 +43,13 @@ func TestRunFunction(t *testing.T) { }, }, want: want{ - rsp: &fnv1beta1.RunFunctionResponse{ - Meta: &fnv1beta1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, - Results: []*fnv1beta1.Result{ + rsp: &fnv1.RunFunctionResponse{ + Meta: &fnv1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, + Results: []*fnv1.Result{ { - Severity: fnv1beta1.Severity_SEVERITY_FATAL, + Severity: fnv1.Severity_SEVERITY_FATAL, Message: "invalid Function input: parameters: Required value: one of ShellCommand or ShellCommandField is required", + Target: fnv1.Target_TARGET_COMPOSITE.Enum(), }, }, }, @@ -57,8 +58,8 @@ func TestRunFunction(t *testing.T) { "ResponseIsEmptyShellCommand": { reason: "The Function should return a response when after a script is run", args: args{ - req: &fnv1beta1.RunFunctionRequest{ - Meta: &fnv1beta1.RequestMeta{Tag: "hello"}, + req: &fnv1.RunFunctionRequest{ + Meta: &fnv1.RequestMeta{Tag: "hello"}, Input: resource.MustStructJSON(`{ "apiVersion": "template.fn.crossplane.io/v1alpha1", "kind": "Parameters", @@ -67,12 +68,13 @@ func TestRunFunction(t *testing.T) { }, }, want: want{ - rsp: &fnv1beta1.RunFunctionResponse{ - Meta: &fnv1beta1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, - Results: []*fnv1beta1.Result{ + rsp: &fnv1.RunFunctionResponse{ + Meta: &fnv1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, + Results: []*fnv1.Result{ { - Severity: fnv1beta1.Severity_SEVERITY_FATAL, + Severity: fnv1.Severity_SEVERITY_FATAL, Message: "invalid Function input: parameters: Required value: one of ShellCommand or ShellCommandField is required", + Target: fnv1.Target_TARGET_COMPOSITE.Enum(), }, }, }, @@ -81,8 +83,8 @@ func TestRunFunction(t *testing.T) { "ResponseIsEcho": { reason: "The Function should write stdout to the specified field", args: args{ - req: &fnv1beta1.RunFunctionRequest{ - Meta: &fnv1beta1.RequestMeta{Tag: "hello"}, + req: &fnv1.RunFunctionRequest{ + Meta: &fnv1.RequestMeta{Tag: "hello"}, Input: resource.MustStructJSON(`{ "apiVersion": "template.fn.crossplane.io/v1alpha1", "kind": "Parameters", @@ -92,10 +94,10 @@ func TestRunFunction(t *testing.T) { }, }, want: want{ - rsp: &fnv1beta1.RunFunctionResponse{ - Meta: &fnv1beta1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, - Desired: &fnv1beta1.State{ - Composite: &fnv1beta1.Resource{ + rsp: &fnv1.RunFunctionResponse{ + Meta: &fnv1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, + Desired: &fnv1.State{ + Composite: &fnv1.Resource{ Resource: resource.MustStructJSON(`{ "apiVersion": "", "kind": "", @@ -122,8 +124,8 @@ func TestRunFunction(t *testing.T) { "ResponseIsErrorWhenShellCommandNotFound": { reason: "The Function should write to the specified stderr field when the shellCommand is not found", args: args{ - req: &fnv1beta1.RunFunctionRequest{ - Meta: &fnv1beta1.RequestMeta{Tag: "hello"}, + req: &fnv1.RunFunctionRequest{ + Meta: &fnv1.RequestMeta{Tag: "hello"}, Input: resource.MustStructJSON(`{ "apiVersion": "template.fn.crossplane.io/v1alpha1", "kind": "Parameters", @@ -134,12 +136,13 @@ func TestRunFunction(t *testing.T) { }, }, want: want{ - rsp: &fnv1beta1.RunFunctionResponse{ - Meta: &fnv1beta1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, - Results: []*fnv1beta1.Result{ + rsp: &fnv1.RunFunctionResponse{ + Meta: &fnv1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, + Results: []*fnv1.Result{ { - Severity: fnv1beta1.Severity_SEVERITY_FATAL, + Severity: fnv1.Severity_SEVERITY_FATAL, Message: "shellCmd unkown-shell-command for failed: exit status 127", + Target: fnv1.Target_TARGET_COMPOSITE.Enum(), }, }, }, @@ -148,8 +151,8 @@ func TestRunFunction(t *testing.T) { "ResponseIsEchoEnvVar": { reason: "The Function should accept and use environment variables", args: args{ - req: &fnv1beta1.RunFunctionRequest{ - Meta: &fnv1beta1.RequestMeta{Tag: "hello"}, + req: &fnv1.RunFunctionRequest{ + Meta: &fnv1.RequestMeta{Tag: "hello"}, Input: resource.MustStructJSON(`{ "apiVersion": "template.fn.crossplane.io/v1alpha1", "kind": "Parameters", @@ -160,10 +163,10 @@ func TestRunFunction(t *testing.T) { }, }, want: want{ - rsp: &fnv1beta1.RunFunctionResponse{ - Meta: &fnv1beta1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, - Desired: &fnv1beta1.State{ - Composite: &fnv1beta1.Resource{ + rsp: &fnv1.RunFunctionResponse{ + Meta: &fnv1.ResponseMeta{Tag: "hello", Ttl: durationpb.New(response.DefaultTTL)}, + Desired: &fnv1.State{ + Composite: &fnv1.Resource{ Resource: resource.MustStructJSON(`{ "apiVersion": "", "kind": "", diff --git a/get_credential_data.go b/get_credential_data.go new file mode 100644 index 0000000..a444dd1 --- /dev/null +++ b/get_credential_data.go @@ -0,0 +1,26 @@ +package main + +import ( + "github.com/crossplane-contrib/function-shell/input/v1alpha1" + fnv1 "github.com/crossplane/function-sdk-go/proto/v1" +) + +func getCredentialData(req *fnv1.RunFunctionRequest, credName string) map[string][]byte { + var data map[string][]byte + switch req.GetCredentials()[credName].GetSource().(type) { + case *fnv1.Credentials_CredentialData: + data = req.GetCredentials()[credName].GetCredentialData().GetData() + default: + return nil + } + + return data +} + +func addShellEnvVarsFromCredentialRefs(req *fnv1.RunFunctionRequest, credentialRefs v1alpha1.ShellCredentialRef, shellEnvVars map[string]string) (map[string]string, error) { + var credentialData = getCredentialData(req, credentialRefs.Name) + for _, key := range credentialRefs.Keys { + shellEnvVars[key] = string(credentialData[key]) + } + return shellEnvVars, nil +} diff --git a/get_credential_data_test.go b/get_credential_data_test.go new file mode 100644 index 0000000..3d09692 --- /dev/null +++ b/get_credential_data_test.go @@ -0,0 +1,89 @@ +package main + +import ( + "testing" + + "github.com/crossplane-contrib/function-shell/input/v1alpha1" + "github.com/google/go-cmp/cmp" + + fnv1 "github.com/crossplane/function-sdk-go/proto/v1" + "github.com/crossplane/function-sdk-go/resource" +) + +func TestGetCredentialData(t *testing.T) { + type args struct { + req *fnv1.RunFunctionRequest + } + + type want struct { + data map[string]string + } + + cases := map[string]struct { + reason string + args args + want want + }{ + "RetrieveFunctionCredential": { + reason: "Should successfully retrieve the function credential", + args: args{ + req: &fnv1.RunFunctionRequest{ + Input: resource.MustStructJSON(`{ + "apiVersion": "template.fn.crossplane.io/v1alpha1", + "kind": "Parameters", + "shellCredentialRefs": [{"name": "foo-creds", "keys": ["password"]}], + "shellEnvVars": [{"key": "TEST_ENV_VAR", "value": "foo"}], + "shellCommand": "echo ${TEST_ENV_VAR}", + "stdoutField": "spec.atFunction.shell.stdout" + }`), + Credentials: map[string]*fnv1.Credentials{ + "foo-creds": { + Source: &fnv1.Credentials_CredentialData{ + CredentialData: &fnv1.CredentialData{ + Data: map[string][]byte{ + "password": []byte("secret"), + }, + }, + }, + }, + }, + }, + }, + want: want{ + data: map[string]string{ + "password": "secret", + }, + }, + }, + "FunctionCredentialNotFound": { + reason: "Should return nil if the function credential is not found", + args: args{ + req: &fnv1.RunFunctionRequest{ + Input: resource.MustStructJSON(`{ + "apiVersion": "template.fn.crossplane.io/v1alpha1", + "kind": "Parameters", + "shellCredentialRefs": [{"name": "foo-creds", "keys": ["password"]}], + "shellEnvVars": [{"key": "TEST_ENV_VAR", "value": "foo"}], + "shellCommand": "echo ${TEST_ENV_VAR}", + "stdoutField": "spec.atFunction.shell.stdout" + }`), + Credentials: map[string]*fnv1.Credentials{}, + }, + }, + want: want{ + data: map[string]string{ + "password": "", + }, + }, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + got, _ := addShellEnvVarsFromCredentialRefs(tc.args.req, v1alpha1.ShellCredentialRef{Name: "foo-creds", Keys: []string{"password"}}, map[string]string{}) + if diff := cmp.Diff(tc.want.data, got); diff != "" { + t.Errorf("%s\naddShellEnvVarsFromCredentialRefs(...): -want data, +got data:\n%s", tc.reason, diff) + } + }) + } +} diff --git a/go.mod b/go.mod index 38be118..2016a25 100644 --- a/go.mod +++ b/go.mod @@ -1,38 +1,39 @@ module github.com/crossplane-contrib/function-shell -go 1.21 +go 1.23.0 -toolchain go1.21.3 +toolchain go1.23.3 require ( github.com/alecthomas/kong v1.6.0 - github.com/crossplane/crossplane-runtime v1.15.1 - github.com/crossplane/function-sdk-go v0.2.0 + github.com/crossplane/crossplane-runtime v1.18.0 + github.com/crossplane/function-sdk-go v0.4.0 github.com/google/go-cmp v0.6.0 github.com/keegancsmith/shell v0.0.0-20160208231706-ccb53e0c7c5c google.golang.org/protobuf v1.36.0 - k8s.io/apimachinery v0.29.2 - sigs.k8s.io/controller-tools v0.14.0 + k8s.io/apimachinery v0.32.1 + sigs.k8s.io/controller-tools v0.16.0 ) require ( - dario.cat/mergo v1.0.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + dario.cat/mergo v1.0.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect - github.com/evanphx/json-patch/v5 v5.8.0 // indirect - github.com/fatih/color v1.16.0 // indirect - github.com/go-json-experiment/json v0.0.0-20231013223334-54c864be5b8d // indirect - github.com/go-logr/logr v1.4.1 // indirect + github.com/evanphx/json-patch/v5 v5.9.0 // indirect + github.com/fatih/color v1.17.0 // indirect + github.com/fxamacker/cbor/v2 v2.7.0 // indirect + github.com/go-json-experiment/json v0.0.0-20240815175050-ebd3a8989ca1 // indirect + github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-openapi/swag v0.23.0 // indirect github.com/gobuffalo/flect v1.0.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/protobuf v1.5.4 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.4.0 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -44,33 +45,34 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cobra v1.8.0 // indirect + github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/x448/float16 v0.8.4 // indirect go.uber.org/multierr v1.11.0 // indirect - go.uber.org/zap v1.26.0 // indirect - golang.org/x/mod v0.17.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/mod v0.21.0 // indirect golang.org/x/net v0.33.0 // indirect - golang.org/x/oauth2 v0.15.0 // indirect + golang.org/x/oauth2 v0.22.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.28.0 // indirect golang.org/x/term v0.27.0 // indirect golang.org/x/text v0.21.0 // indirect - golang.org/x/time v0.5.0 // indirect - golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect + golang.org/x/time v0.7.0 // indirect + golang.org/x/tools v0.26.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect - google.golang.org/grpc v1.61.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect + google.golang.org/grpc v1.67.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/api v0.29.1 // indirect - k8s.io/apiextensions-apiserver v0.29.1 // indirect - k8s.io/client-go v0.29.1 // indirect - k8s.io/klog/v2 v2.110.1 // indirect - k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect - k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect - sigs.k8s.io/controller-runtime v0.17.0 // indirect - sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect + k8s.io/api v0.31.0 // indirect + k8s.io/apiextensions-apiserver v0.31.0 // indirect + k8s.io/client-go v0.31.0 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect + k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect + sigs.k8s.io/controller-runtime v0.19.0 // indirect + sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) diff --git a/go.sum b/go.sum index a2418c2..53d6b02 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= +dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo= github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/alecthomas/assert/v2 v2.1.0 h1:tbredtNcQnoSd3QBhQWI7QZ3XHOVkw1Moklp2ojoH/0= @@ -21,41 +23,63 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/crossplane/crossplane-runtime v1.15.1 h1:g1h75tNYOQT152IUNxs8ZgSsRFQKrZN9z69KefMujXs= github.com/crossplane/crossplane-runtime v1.15.1/go.mod h1:kRcJjJQmBFrR2n/KhwL8wYS7xNfq3D8eK4JliEScOHI= +github.com/crossplane/crossplane-runtime v1.18.0 h1:aAQIMNOgPbbXaqj9CUSv+gPl3QnVbn33YlzSe145//0= +github.com/crossplane/crossplane-runtime v1.18.0/go.mod h1:p7nVVsLn0CWjsLvLCtr7T40ErbTgNWKRxmYnwFdfXb4= github.com/crossplane/function-sdk-go v0.2.0 h1:4r+dXeGgwOC2XehJlHsHlkdkUsGW8PzkiyPPd2cshQs= github.com/crossplane/function-sdk-go v0.2.0/go.mod h1:AvaWMHeKvzzE0vODLBrU5njOzW6sm61Ou4js9OdBUXM= +github.com/crossplane/function-sdk-go v0.4.0 h1:1jd+UIaZlVNQCUO4hLAgUqWBRnUKw2ObF9ZuMw5CpKk= +github.com/crossplane/function-sdk-go v0.4.0/go.mod h1:jLnzUG8pt8tn/U6/uvtNStAhDjhIq4wCR31yECT54NM= github.com/crossplane/upjet v1.1.0-rc.0.0.20231227120826-4cb45f9104ac h1:T1MTxsPAE/Cs0/EAGjeC29H9O/rO81yol2/5qGsf888= github.com/crossplane/upjet v1.1.0-rc.0.0.20231227120826-4cb45f9104ac/go.mod h1:t9etxIdYaxgyvFPBToikm5zBHi8RIpX8N4mTH77lQFM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro= github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= +github.com/evanphx/json-patch/v5 v5.9.0 h1:kcBlZQbplgElYIlo/n1hJbls2z/1awpXxpRi0/FOJfg= +github.com/evanphx/json-patch/v5 v5.9.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= github.com/fatih/camelcase v1.0.0 h1:hxNvNX/xYBp0ovncs8WyWZrOrpBNub/JfaMvbURyft8= github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= +github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-json-experiment/json v0.0.0-20231013223334-54c864be5b8d h1:zqfo2jECgX5eYQseB/X+uV4Y5ocGOG/vG/LTztUCyPA= github.com/go-json-experiment/json v0.0.0-20231013223334-54c864be5b8d/go.mod h1:6daplAwHHGbUGib4990V3Il26O0OC4aRyvewaaAihaA= +github.com/go-json-experiment/json v0.0.0-20240815175050-ebd3a8989ca1 h1:xcuWappghOVI8iNWoF2OKahVejd1LSVi/v4JED44Amo= +github.com/go-json-experiment/json v0.0.0-20240815175050-ebd3a8989ca1/go.mod h1:BWmvoE1Xia34f3l/ibJweyhrT+aROb/FQ6d+37F0e2s= github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= github.com/gobuffalo/flect v1.0.2 h1:eqjPGSo2WmjgY2XlpGwo2NXgL3RucAKo4k4qQMNA5sA= @@ -68,6 +92,8 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -81,6 +107,8 @@ github.com/google/pprof v0.0.0-20240117000934-35fc243c5815 h1:WzfWbQz/Ze8v6l++GG github.com/google/pprof v0.0.0-20240117000934-35fc243c5815/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik= github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= @@ -182,6 +210,8 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -203,6 +233,8 @@ github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9 github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13 h1:fVcFKWvrslecOb/tg+Cc05dkeYx540o0FuFt3nUVDoE= @@ -215,6 +247,8 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo= go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -226,6 +260,8 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -236,6 +272,8 @@ golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= golang.org/x/oauth2 v0.15.0 h1:s8pnnxNVzjWyrvYdFUQq5llS1PX2zhPXmccZv99h7uQ= golang.org/x/oauth2 v0.15.0/go.mod h1:q48ptWNTY5XWf+JNten23lcvHpLJ0ZSxF5ttTHKVCAM= +golang.org/x/oauth2 v0.22.0 h1:BzDx2FehcG7jJwgWLELCdmLuxk2i+x9UDpSiss2u0ZA= +golang.org/x/oauth2 v0.22.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -265,6 +303,8 @@ golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= +golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -272,6 +312,9 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= +golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= +golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -282,8 +325,12 @@ google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAs google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac h1:nUQEQmH/csSvFECKYRv6HWEyypysidKl2I6Qpsglq/0= google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac/go.mod h1:daQN87bsDqDoe316QbbvX60nMoJQa4r6Ds0ZuoAe5yA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.61.0 h1:TOvOcuXn30kRao+gfcvsebNEa5iZIiLkisYEkf7R7o0= google.golang.org/grpc v1.61.0/go.mod h1:VUbo7IFqmF1QtCAstipjG0GIoq49KvMe9+h1jFLBNJs= +google.golang.org/grpc v1.67.0 h1:IdH9y6PF5MPSdAntIcpjQ+tXO41pcQsfZV2RxtQgVcw= +google.golang.org/grpc v1.67.0/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= @@ -305,27 +352,52 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.29.1 h1:DAjwWX/9YT7NQD4INu49ROJuZAAAP/Ijki48GUPzxqw= k8s.io/api v0.29.1/go.mod h1:7Kl10vBRUXhnQQI8YR/R327zXC8eJ7887/+Ybta+RoQ= +k8s.io/api v0.31.0 h1:b9LiSjR2ym/SzTOlfMHm1tr7/21aD7fSkqgD/CVJBCo= +k8s.io/api v0.31.0/go.mod h1:0YiFF+JfFxMM6+1hQei8FY8M7s1Mth+z/q7eF1aJkTE= k8s.io/apiextensions-apiserver v0.29.1 h1:S9xOtyk9M3Sk1tIpQMu9wXHm5O2MX6Y1kIpPMimZBZw= k8s.io/apiextensions-apiserver v0.29.1/go.mod h1:zZECpujY5yTW58co8V2EQR4BD6A9pktVgHhvc0uLfeU= +k8s.io/apiextensions-apiserver v0.31.0 h1:fZgCVhGwsclj3qCw1buVXCV6khjRzKC5eCFt24kyLSk= +k8s.io/apiextensions-apiserver v0.31.0/go.mod h1:b9aMDEYaEe5sdK+1T0KU78ApR/5ZVp4i56VacZYEHxk= k8s.io/apimachinery v0.29.2 h1:EWGpfJ856oj11C52NRCHuU7rFDwxev48z+6DSlGNsV8= k8s.io/apimachinery v0.29.2/go.mod h1:6HVkd1FwxIagpYrHSwJlQqZI3G9LfYWRPAkUvLnXTKU= +k8s.io/apimachinery v0.31.0/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/apimachinery v0.32.1 h1:683ENpaCBjma4CYqsmZyhEzrGz6cjn1MY/X2jB2hkZs= +k8s.io/apimachinery v0.32.1/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= k8s.io/client-go v0.29.1 h1:19B/+2NGEwnFLzt0uB5kNJnfTsbV8w6TgQRz9l7ti7A= k8s.io/client-go v0.29.1/go.mod h1:TDG/psL9hdet0TI9mGyHJSgRkW3H9JZk2dNEUS7bRks= +k8s.io/client-go v0.31.0 h1:QqEJzNjbN2Yv1H79SsS+SWnXkBgVu4Pj3CJQgbx0gI8= +k8s.io/client-go v0.31.0/go.mod h1:Y9wvC76g4fLjmU0BA+rV+h2cncoadjvjjkkIGoTLcGU= k8s.io/component-base v0.29.1 h1:MUimqJPCRnnHsskTTjKD+IC1EHBbRCVyi37IoFBrkYw= k8s.io/component-base v0.29.1/go.mod h1:fP9GFjxYrLERq1GcWWZAE3bqbNcDKDytn2srWuHTtKc= k8s.io/klog/v2 v2.110.1 h1:U/Af64HJf7FcwMcXyKm2RPM22WZzyR7OSpYj5tg3cL0= k8s.io/klog/v2 v2.110.1/go.mod h1:YGtd1984u+GgbuZ7e08/yBuAfKLSO0+uR1Fhi6ExXjo= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 h1:aVUu9fTY98ivBPKR9Y5w/AuzbMm96cd3YHRTU83I780= k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00/go.mod h1:AsvuZPBlUDVuCdzJ87iajxtXuR9oktsTctW/R9wwouA= +k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= +k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ= k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= +k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= sigs.k8s.io/controller-runtime v0.17.0 h1:fjJQf8Ukya+VjogLO6/bNX9HE6Y2xpsO5+fyS26ur/s= sigs.k8s.io/controller-runtime v0.17.0/go.mod h1:+MngTvIQQQhfXtwfdGw/UOQ/aIaqsYywfCINOtwMO/s= +sigs.k8s.io/controller-runtime v0.19.0 h1:nWVM7aq+Il2ABxwiCizrVDSlmDcshi9llbaFbC0ji/Q= +sigs.k8s.io/controller-runtime v0.19.0/go.mod h1:iRmWllt8IlaLjvTTDLhRBXIEtkCK6hwVBJJsYS9Ajf4= sigs.k8s.io/controller-tools v0.14.0 h1:rnNoCC5wSXlrNoBKKzL70LNJKIQKEzT6lloG6/LF73A= sigs.k8s.io/controller-tools v0.14.0/go.mod h1:TV7uOtNNnnR72SpzhStvPkoS/U5ir0nMudrkrC4M9Sc= +sigs.k8s.io/controller-tools v0.16.0 h1:EJPB+a5Bve861SPBPPWRbP6bbKyNxqK12oYT5zEns9s= +sigs.k8s.io/controller-tools v0.16.0/go.mod h1:0I0xqjR65YTfoO12iR+mZR6s6UAVcUARgXRlsu0ljB0= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= +sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= +sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/input/v1alpha1/parameters.go b/input/v1alpha1/parameters.go index 17484fc..7244793 100644 --- a/input/v1alpha1/parameters.go +++ b/input/v1alpha1/parameters.go @@ -19,9 +19,9 @@ type Parameters struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - // shellEnvVarsRef + // shellCredentialRefs // +optional - ShellEnvVarsRef ShellEnvVarsRef `json:"shellEnvVarsRef,omitempty"` + ShellCredentialRefs []ShellCredentialRef `json:"shellCredentialRefs,omitempty"` // shellEnvVars // +optional @@ -44,15 +44,15 @@ type Parameters struct { StderrField string `json:"stderrField,omitempty"` } -type ShellEnvVar struct { - Key string `json:"key,omitempty"` - Value string `json:"value,omitempty"` - ValueRef string `json:"valueRef,omitempty"` -} - -type ShellEnvVarsRef struct { +type ShellCredentialRef struct { // The Key whose value is the secret Keys []string `json:"keys,omitempty"` // Name of the enviroment variable Name string `json:"name,omitempty"` } + +type ShellEnvVar struct { + Key string `json:"key,omitempty"` + Value string `json:"value,omitempty"` + ValueRef string `json:"valueRef,omitempty"` +} diff --git a/input/v1alpha1/zz_generated.deepcopy.go b/input/v1alpha1/zz_generated.deepcopy.go index 4dee1ad..415780b 100644 --- a/input/v1alpha1/zz_generated.deepcopy.go +++ b/input/v1alpha1/zz_generated.deepcopy.go @@ -13,7 +13,13 @@ func (in *Parameters) DeepCopyInto(out *Parameters) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - in.ShellEnvVarsRef.DeepCopyInto(&out.ShellEnvVarsRef) + if in.ShellCredentialRefs != nil { + in, out := &in.ShellCredentialRefs, &out.ShellCredentialRefs + *out = make([]ShellCredentialRef, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.ShellEnvVars != nil { in, out := &in.ShellEnvVars, &out.ShellEnvVars *out = make([]ShellEnvVar, len(*in)) @@ -40,36 +46,36 @@ func (in *Parameters) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ShellEnvVar) DeepCopyInto(out *ShellEnvVar) { +func (in *ShellCredentialRef) DeepCopyInto(out *ShellCredentialRef) { *out = *in + if in.Keys != nil { + in, out := &in.Keys, &out.Keys + *out = make([]string, len(*in)) + copy(*out, *in) + } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShellEnvVar. -func (in *ShellEnvVar) DeepCopy() *ShellEnvVar { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShellCredentialRef. +func (in *ShellCredentialRef) DeepCopy() *ShellCredentialRef { if in == nil { return nil } - out := new(ShellEnvVar) + out := new(ShellCredentialRef) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ShellEnvVarsRef) DeepCopyInto(out *ShellEnvVarsRef) { +func (in *ShellEnvVar) DeepCopyInto(out *ShellEnvVar) { *out = *in - if in.Keys != nil { - in, out := &in.Keys, &out.Keys - *out = make([]string, len(*in)) - copy(*out, *in) - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShellEnvVarsRef. -func (in *ShellEnvVarsRef) DeepCopy() *ShellEnvVarsRef { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ShellEnvVar. +func (in *ShellEnvVar) DeepCopy() *ShellEnvVar { if in == nil { return nil } - out := new(ShellEnvVarsRef) + out := new(ShellEnvVar) in.DeepCopyInto(out) return out } diff --git a/package/input/template.fn.crossplane.io_parameters.yaml b/package/input/template.fn.crossplane.io_parameters.yaml index cea0c50..cc6cce0 100644 --- a/package/input/template.fn.crossplane.io_parameters.yaml +++ b/package/input/template.fn.crossplane.io_parameters.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.14.0 + controller-gen.kubebuilder.io/version: v0.16.0 name: parameters.template.fn.crossplane.io spec: group: template.fn.crossplane.io @@ -44,6 +44,20 @@ spec: shellCommandField: description: shellCmdField type: string + shellCredentialRefs: + description: shellCredentialRefs + items: + properties: + keys: + description: The Key whose value is the secret + items: + type: string + type: array + name: + description: Name of the enviroment variable + type: string + type: object + type: array shellEnvVars: description: shellEnvVars items: @@ -56,18 +70,6 @@ spec: type: string type: object type: array - shellEnvVarsRef: - description: shellEnvVarsRef - properties: - keys: - description: The Key whose value is the secret - items: - type: string - type: array - name: - description: Name of the enviroment variable - type: string - type: object stderrField: description: stderrField type: string