diff --git a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositeresourcedefinitions.yaml b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositeresourcedefinitions.yaml index 602690a..99c5074 100644 --- a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositeresourcedefinitions.yaml +++ b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositeresourcedefinitions.yaml @@ -32,9 +32,12 @@ spec: schema: openAPIV3Schema: description: |- - A CompositeResourceDefinition defines a new kind of composite infrastructure - resource. The new resource is composed of other composite or managed - infrastructure resources. + A CompositeResourceDefinition defines the schema for a new custom Kubernetes + API. + + + Read the Crossplane documentation for + [more information about CustomResourceDefinitions](https://docs.crossplane.io/latest/concepts/composite-resource-definitions). properties: apiVersion: description: |- @@ -480,6 +483,13 @@ spec: A Message containing details about this condition's last transition from one status to another, if any. type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer reason: description: A Reason for this condition's last transition from one status to another. diff --git a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositionrevisions.yaml b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositionrevisions.yaml index 93f4dcb..3c4b7db 100644 --- a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositionrevisions.yaml +++ b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositionrevisions.yaml @@ -34,8 +34,12 @@ spec: schema: openAPIV3Schema: description: |- - A CompositionRevision represents a revision in time of a Composition. - Revisions are created by Crossplane; they should be treated as immutable. + A CompositionRevision represents a revision of a Composition. Crossplane + creates new revisions when there are changes to the Composition. + + + Crossplane creates and manages CompositionRevisions. Don't directly edit + CompositionRevisions. properties: apiVersion: description: |- @@ -283,7 +287,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options on - a field path + a field path. properties: appendSlice: description: Specifies that already existing elements @@ -697,7 +701,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options - on a field path + on a field path. properties: appendSlice: description: Specifies that already existing elements @@ -987,6 +991,46 @@ spec: items: description: A PipelineStep in a Composition Function pipeline. properties: + credentials: + description: Credentials are optional credentials that the Composition + Function needs. + items: + description: |- + FunctionCredentials are optional credentials that a Composition Function + needs to run. + properties: + name: + description: Name of this set of credentials. + type: string + secretRef: + description: |- + A SecretRef is a reference to a secret containing credentials that should + be supplied to the function. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + source: + description: Source of the function credentials. + enum: + - None + - Secret + type: string + required: + - name + - source + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map functionRef: description: |- FunctionRef is a reference to the Composition Function this step should @@ -1195,7 +1239,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options - on a field path + on a field path. properties: appendSlice: description: Specifies that already existing elements @@ -1477,7 +1521,7 @@ spec: items: description: |- ReadinessCheck is used to indicate how to tell whether a resource is ready - for consumption + for consumption. properties: fieldPath: description: FieldPath shows the path of the field whose @@ -1570,6 +1614,13 @@ spec: A Message containing details about this condition's last transition from one status to another, if any. type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer reason: description: A Reason for this condition's last transition from one status to another. @@ -1616,8 +1667,12 @@ spec: schema: openAPIV3Schema: description: |- - A CompositionRevision represents a revision in time of a Composition. - Revisions are created by Crossplane; they should be treated as immutable. + A CompositionRevision represents a revision of a Composition. Crossplane + creates new revisions when there are changes to the Composition. + + + Crossplane creates and manages CompositionRevisions. Don't directly edit + CompositionRevisions. properties: apiVersion: description: |- @@ -1865,7 +1920,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options on - a field path + a field path. properties: appendSlice: description: Specifies that already existing elements @@ -2279,7 +2334,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options - on a field path + on a field path. properties: appendSlice: description: Specifies that already existing elements @@ -2569,6 +2624,46 @@ spec: items: description: A PipelineStep in a Composition Function pipeline. properties: + credentials: + description: Credentials are optional credentials that the Composition + Function needs. + items: + description: |- + FunctionCredentials are optional credentials that a Composition Function + needs to run. + properties: + name: + description: Name of this set of credentials. + type: string + secretRef: + description: |- + A SecretRef is a reference to a secret containing credentials that should + be supplied to the function. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + source: + description: Source of the function credentials. + enum: + - None + - Secret + type: string + required: + - name + - source + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map functionRef: description: |- FunctionRef is a reference to the Composition Function this step should @@ -2777,7 +2872,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options - on a field path + on a field path. properties: appendSlice: description: Specifies that already existing elements @@ -3059,7 +3154,7 @@ spec: items: description: |- ReadinessCheck is used to indicate how to tell whether a resource is ready - for consumption + for consumption. properties: fieldPath: description: FieldPath shows the path of the field whose @@ -3152,6 +3247,13 @@ spec: A Message containing details about this condition's last transition from one status to another, if any. type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer reason: description: A Reason for this condition's last transition from one status to another. diff --git a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositions.yaml b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositions.yaml index cb1d489..61e6d4c 100644 --- a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositions.yaml +++ b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_compositions.yaml @@ -30,7 +30,13 @@ spec: name: v1 schema: openAPIV3Schema: - description: A Composition specifies how a composite resource should be composed. + description: |- + A Composition defines a collection of managed resources or functions that + Crossplane uses to create and manage new composite resources. + + + Read the Crossplane documentation for + [more information about Compositions](https://docs.crossplane.io/latest/concepts/compositions). properties: apiVersion: description: |- @@ -276,7 +282,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options on - a field path + a field path. properties: appendSlice: description: Specifies that already existing elements @@ -690,7 +696,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options - on a field path + on a field path. properties: appendSlice: description: Specifies that already existing elements @@ -980,6 +986,46 @@ spec: items: description: A PipelineStep in a Composition Function pipeline. properties: + credentials: + description: Credentials are optional credentials that the Composition + Function needs. + items: + description: |- + FunctionCredentials are optional credentials that a Composition Function + needs to run. + properties: + name: + description: Name of this set of credentials. + type: string + secretRef: + description: |- + A SecretRef is a reference to a secret containing credentials that should + be supplied to the function. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + source: + description: Source of the function credentials. + enum: + - None + - Secret + type: string + required: + - name + - source + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map functionRef: description: |- FunctionRef is a reference to the Composition Function this step should @@ -1007,6 +1053,9 @@ spec: - step type: object type: array + x-kubernetes-list-map-keys: + - step + x-kubernetes-list-type: map publishConnectionDetailsWithStoreConfigRef: default: name: default @@ -1188,7 +1237,7 @@ spec: type: string mergeOptions: description: MergeOptions Specifies merge options - on a field path + on a field path. properties: appendSlice: description: Specifies that already existing elements @@ -1470,7 +1519,7 @@ spec: items: description: |- ReadinessCheck is used to indicate how to tell whether a resource is ready - for consumption + for consumption. properties: fieldPath: description: FieldPath shows the path of the field whose diff --git a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_environmentconfigs.yaml b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_environmentconfigs.yaml index 9a703e2..1d80d90 100644 --- a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_environmentconfigs.yaml +++ b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_environmentconfigs.yaml @@ -24,8 +24,13 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: A EnvironmentConfig contains a set of arbitrary, unstructured - values. + description: |- + An EnvironmentConfig contains user-defined unstructured values for + use in a Composition. + + + Read the Crossplane documentation for + [more information about EnvironmentConfigs](https://docs.crossplane.io/latest/concepts/environment-configs). properties: apiVersion: description: |- diff --git a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_usages.yaml b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_usages.yaml index e05a9b4..cc8f7e5 100644 --- a/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_usages.yaml +++ b/crossplane-crd-model/src/main/resources/kubernetes/apiextensions.crossplane.io_usages.yaml @@ -28,8 +28,16 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: A Usage defines a deletion blocking relationship between two - resources. + description: |- + A Usage defines a deletion blocking relationship between two resources. + + + Usages prevent accidental deletion of a single resource or deletion of + resources with dependent resources. + + + Read the Crossplane documentation for + [more information about Compositions](https://docs.crossplane.io/latest/concepts/usages). properties: apiVersion: description: |- @@ -168,6 +176,13 @@ spec: A Message containing details about this condition's last transition from one status to another, if any. type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer reason: description: A Reason for this condition's last transition from one status to another. diff --git a/crossplane-crd-model/src/main/resources/kubernetes/fetch.sh b/crossplane-crd-model/src/main/resources/kubernetes/fetch.sh index 516825e..0c3588a 100755 --- a/crossplane-crd-model/src/main/resources/kubernetes/fetch.sh +++ b/crossplane-crd-model/src/main/resources/kubernetes/fetch.sh @@ -1,6 +1,6 @@ #!/bin/bash -release="release-1.15" +release="release-1.16" apiextensions=$(gh api --jq '.[].name' "/repos/crossplane/crossplane/contents/cluster/crds?ref=${release}" | grep apiextensions) diff --git a/crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneCompositeFunctionBase.java b/crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneCompositeFunctionBase.java index e18d3b9..926a4e2 100644 --- a/crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneCompositeFunctionBase.java +++ b/crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneCompositeFunctionBase.java @@ -33,9 +33,8 @@ public abstract class CrossplaneCompositeFunctionBase extends FunctionRunnerServ desiredBuilder.putAllResources(desired.getResourcesMap()); CrossplaneFunctionRequest crossplaneFunctionRequest = new CrossplaneFunctionRequest(request.getObserved(), - request.getExtraResourcesMap(), request.getDesired()); + request.getExtraResourcesMap(), request.getCredentialsMap(), request.getDesired()); - // request.getCredentialsMap(), logger.debug("Calling method with implemented logic"); CrossplaneFunctionResponse crossplaneFunctionResponse = runFunction(crossplaneFunctionRequest); diff --git a/crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneFunctionRequest.java b/crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneFunctionRequest.java index 7babdbb..db2dcf7 100644 --- a/crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneFunctionRequest.java +++ b/crossplane-function-base/src/main/java/io/crossplane/compositefunctions/base/CrossplaneFunctionRequest.java @@ -1,5 +1,6 @@ package io.crossplane.compositefunctions.base; +import io.crossplane.compositefunctions.protobuf.Credentials; import io.crossplane.compositefunctions.protobuf.Resources; import io.crossplane.compositefunctions.protobuf.State; @@ -9,12 +10,10 @@ import java.util.Map; * Holder for the request from crossplane * @param observedState The observedstate of the crossplane resources * @param extraResourcesMap A map of any extra resources requested + * @param credentialsMap A map of credentials sent as input * @param desiredState The sum of previously called functions state. To override, create a new resource with the same name in the response */ -public record CrossplaneFunctionRequest(State observedState, Map extraResourcesMap, State desiredState) { +public record CrossplaneFunctionRequest(State observedState, Map extraResourcesMap, + Map credentialsMap, State desiredState) { - // * - // * @param credentialsMap A map of credentials sent as input - // - // Map credentialsMap } diff --git a/crossplane-protobuf-model/src/main/proto/fetch.sh b/crossplane-protobuf-model/src/main/proto/fetch.sh index c8fc0fc..78b5292 100755 --- a/crossplane-protobuf-model/src/main/proto/fetch.sh +++ b/crossplane-protobuf-model/src/main/proto/fetch.sh @@ -1,6 +1,6 @@ #!/bin/bash -release="release-1.15" +release="release-1.16" file="run_function.proto" gh api -H "Accept: application/vnd.github.raw+json" "/repos/crossplane/crossplane/contents/apis/apiextensions/fn/proto/v1beta1/${file}?ref=${release}" > $file diff --git a/crossplane-protobuf-model/src/main/proto/run_function.proto b/crossplane-protobuf-model/src/main/proto/run_function.proto index 7dc0df5..7db077e 100644 --- a/crossplane-protobuf-model/src/main/proto/run_function.proto +++ b/crossplane-protobuf-model/src/main/proto/run_function.proto @@ -70,6 +70,24 @@ message RunFunctionRequest { // did not exist, Crossplane sets the map key to an empty Resources message to // indicate that it attempted to satisfy the request. map extra_resources = 6; + + // Optional credentials that this Function may use to communicate with an + // external system. + map credentials = 7; +} + +// Credentials that a Function may use to communicate with an external system. +message Credentials { + // Source of the credentials. + oneof source { + // Credential data loaded by Crossplane, for example from a Secret. + CredentialData credential_data = 1; + } +} + +// CredentialData loaded by Crossplane, for example from a Secret. +message CredentialData { + map data = 1; } // Resources represents the state of several Crossplane resources. @@ -123,11 +141,18 @@ message Requirements { // ResourceSelector selects a group of resources, either by name or by label. message ResourceSelector { + // API version of resources to select. string api_version = 1; + + // Kind of resources to select. string kind = 2; + // Resources to match. oneof match { + // Match the resource with this name. string match_name = 3; + + // Match all resources with these labels. MatchLabels match_labels = 4; } }