From cc42b673000aca59f2711ad2469671b5a4ad7c66 Mon Sep 17 00:00:00 2001 From: Katyanna Moura Date: Fri, 9 Feb 2024 17:04:55 +0100 Subject: [PATCH] Add PlatformCredentialsSet API client (#580) Preparing for the implementation of the **PlatformCredentialsSet per Stack** feature, this Pull Request adds `PlatformCredentialsSet` to the zalando.org/v1 api. Signed-off-by: Katyanna Moura Signed-off-by: Mikkel Oscar Lyderik Larsen Co-authored-by: Mikkel Oscar Lyderik Larsen --- docs/stack_crd.yaml | 131 ++++++++---- docs/stackset_crd.yaml | 201 ++++++++---------- docs/zalando.org_platformcredentialssets.yaml | 102 +++++++++ pkg/apis/zalando.org/v1/register.go | 2 + pkg/apis/zalando.org/v1/types_pcs.go | 60 ++++++ .../zalando.org/v1/zz_generated.deepcopy.go | 168 +++++++++++++++ .../v1/fake/fake_platformcredentialsset.go | 142 +++++++++++++ .../v1/fake/fake_zalando.org_client.go | 4 + .../zalando.org/v1/generated_expansion.go | 2 + .../zalando.org/v1/platformcredentialsset.go | 195 +++++++++++++++++ .../zalando.org/v1/zalando.org_client.go | 5 + .../informers/externalversions/generic.go | 2 + .../zalando.org/v1/interface.go | 7 + .../zalando.org/v1/platformcredentialsset.go | 90 ++++++++ .../zalando.org/v1/expansion_generated.go | 8 + .../zalando.org/v1/platformcredentialsset.go | 99 +++++++++ 16 files changed, 1072 insertions(+), 146 deletions(-) create mode 100644 docs/zalando.org_platformcredentialssets.yaml create mode 100644 pkg/apis/zalando.org/v1/types_pcs.go create mode 100644 pkg/client/clientset/versioned/typed/zalando.org/v1/fake/fake_platformcredentialsset.go create mode 100644 pkg/client/clientset/versioned/typed/zalando.org/v1/platformcredentialsset.go create mode 100644 pkg/client/informers/externalversions/zalando.org/v1/platformcredentialsset.go create mode 100644 pkg/client/listers/zalando.org/v1/platformcredentialsset.go diff --git a/docs/stack_crd.yaml b/docs/stack_crd.yaml index df616131..06ecd005 100644 --- a/docs/stack_crd.yaml +++ b/docs/stack_crd.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.0 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: stacks.zalando.org spec: @@ -363,6 +363,7 @@ spec: TODO: Add other useful fields. apiVersion, kind, uid?' type: string type: object + x-kubernetes-map-type: atomic secretRef: description: Secret to be owned by Stack properties: @@ -371,6 +372,7 @@ spec: TODO: Add other useful fields. apiVersion, kind, uid?' type: string type: object + x-kubernetes-map-type: atomic type: object type: array externalIngress: @@ -568,6 +570,7 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic weight: description: Weight associated with matching the corresponding nodeSelectorTerm, in the @@ -674,10 +677,12 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic type: array required: - nodeSelectorTerms type: object + x-kubernetes-map-type: atomic type: object podAffinity: description: Describes pod affinity scheduling rules (e.g. @@ -762,6 +767,7 @@ spec: ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: description: A label query over the set of namespaces that the term applies to. @@ -823,6 +829,7 @@ spec: ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: description: namespaces specifies a static list of namespace names that the term @@ -932,6 +939,7 @@ spec: only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: description: A label query over the set of namespaces that the term applies to. The term is applied @@ -989,6 +997,7 @@ spec: only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: description: namespaces specifies a static list of namespace names that the term applies to. @@ -1098,6 +1107,7 @@ spec: ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: description: A label query over the set of namespaces that the term applies to. @@ -1159,6 +1169,7 @@ spec: ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: description: namespaces specifies a static list of namespace names that the term @@ -1268,6 +1279,7 @@ spec: only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: description: A label query over the set of namespaces that the term applies to. The term is applied @@ -1325,6 +1337,7 @@ spec: only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: description: namespaces specifies a static list of namespace names that the term applies to. @@ -1441,6 +1454,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, @@ -1460,6 +1474,7 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, @@ -1486,6 +1501,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -1508,6 +1524,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name @@ -1540,6 +1557,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. @@ -1558,6 +1576,7 @@ spec: be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: @@ -2815,6 +2834,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, @@ -2834,6 +2854,7 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, @@ -2860,6 +2881,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -2882,6 +2904,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name @@ -2914,6 +2937,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. @@ -2932,6 +2956,7 @@ spec: be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: @@ -4079,6 +4104,7 @@ spec: TODO: Add other useful fields. apiVersion, kind, uid?' type: string type: object + x-kubernetes-map-type: atomic type: array initContainers: description: 'List of initialization containers belonging @@ -4176,6 +4202,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, @@ -4195,6 +4222,7 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: description: 'Selects a resource of the container: only resources limits and requests (limits.cpu, @@ -4221,6 +4249,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -4243,6 +4272,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name @@ -4275,6 +4305,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. @@ -4293,6 +4324,7 @@ spec: be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: @@ -5846,6 +5878,7 @@ spec: requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic maxSkew: description: 'MaxSkew describes the degree to which pods may be unevenly distributed. When `whenUnsatisfiable=DoNotSchedule`, @@ -6077,6 +6110,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic user: description: 'user is optional: User is the rados user name, default is admin More info: https://examples.k8s.io/volumes/cephfs/README.md#how-to-use-it' @@ -6112,6 +6146,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic volumeID: description: 'volumeID used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' @@ -6191,6 +6226,7 @@ spec: or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic csi: description: csi (Container Storage Interface) represents ephemeral storage that is handled by certain external @@ -6224,6 +6260,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic readOnly: description: readOnly specifies a read-only configuration for the volume. Defaults to false (read/write). @@ -6282,6 +6319,7 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: description: 'Optional: mode bits used to set permissions on this file, must be an @@ -6327,6 +6365,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object @@ -6458,6 +6497,7 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: description: 'dataSourceRef specifies the object from which to populate the volume @@ -6508,6 +6548,7 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic resources: description: 'resources represents the minimum resources the volume should have. If RecoverVolumeExpansionFailure @@ -6571,14 +6612,6 @@ spec: In, NotIn, Exists and DoesNotExist. type: string values: - description: values is an array - of string values. If the operator - is In or NotIn, the values array - must be non-empty. If the operator - is Exists or DoesNotExist, the - values array must be empty. - This array is replaced during - a strategic merge patch. items: type: string type: array @@ -6600,6 +6633,7 @@ spec: ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: description: 'storageClassName is the name of the StorageClass required by the claim. @@ -6698,6 +6732,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic required: - driver type: object @@ -6888,6 +6923,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic targetPortal: description: targetPortal is iSCSI Target Portal. The Portal is either an IP or ip_addr:port if @@ -7070,6 +7106,7 @@ spec: the ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic downwardAPI: description: downwardAPI information about the downwardAPI data to project @@ -7089,18 +7126,13 @@ spec: supported.' properties: apiVersion: - description: Version of the - schema the FieldPath is written - in terms of, defaults to "v1". type: string fieldPath: - description: Path of the field - to select in the specified - API version. type: string required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: description: 'Optional: mode bits used to set permissions on this @@ -7136,26 +7168,19 @@ spec: supported.' properties: containerName: - description: 'Container name: - required for volumes, optional - for env vars' type: string divisor: anyOf: - type: integer - type: string - description: Specifies the output - format of the exposed resources, - defaults to "1" pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true resource: - description: 'Required: resource - to select' type: string required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object @@ -7227,6 +7252,7 @@ spec: the Secret or its key must be defined type: boolean type: object + x-kubernetes-map-type: atomic serviceAccountToken: description: serviceAccountToken is information about the serviceAccountToken data to project @@ -7353,6 +7379,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic user: description: 'user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' @@ -7397,6 +7424,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic sslEnabled: description: sslEnabled Flag enable/disable SSL communication with Gateway, default false @@ -7522,6 +7550,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic volumeName: description: volumeName is the human-readable name of the StorageOS volume. Volume names are only @@ -7588,10 +7617,22 @@ spec: items: properties: address: - description: Address is required for Type network + description: Address is required for type `network` type: string algorithm: - description: Algorithm is required for Type lb + description: Algorithm is required for type `lb`. `roundRobin` + - backend is chosen by the round robin algorithm, starting + with a random selected backend to spread across all backends + from the beginning. `random` - backend is chosen at random. + `consistentHash` - backend is chosen by [consistent hashing](https://en.wikipedia.org/wiki/Consistent_hashing) + algorithm based on the request key. The request key is + derived from `X-Forwarded-For` header or request remote + IP address as the fallback. Use [`consistentHashKey`](filters.md#consistenthashkey) + filter to set the request key. Use [`consistentHashBalanceFactor`](filters.md#consistenthashbalancefactor) + to prevent popular keys from overloading a single backend + endpoint. `powerOfRandomNChoices` - backend is chosen + by selecting N random endpoints and picking the one with + least outstanding requests from them (see http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf). enum: - roundRobin - random @@ -7599,7 +7640,7 @@ spec: - powerOfRandomNChoices type: string endpoints: - description: Endpoints is required for Type lb + description: Endpoints is required for type `lb` items: type: string minItems: 1 @@ -7609,13 +7650,30 @@ spec: as RouteGroupBackendReference type: string serviceName: - description: ServiceName is required for Type service + description: ServiceName is required for type `service` type: string servicePort: - description: ServicePort is required for Type service + description: ServicePort is required for type `service` type: integer type: - description: Type is one of "service|shunt|loopback|dynamic|lb|network" + description: Type of the backend. `service`- resolve Kubernetes + service to the available Endpoints belonging to the Service, + and generate load balanced routes using them. `shunt` + - reply directly from the proxy itself. This can be used + to shortcut, for example have a default that replies with + 404 or use skipper as a backend serving static content + in demos. `loopback` - lookup again the routing table + to a better matching route after processing the current + route. Like this you can add some headers or change the + request path for some specific matching requests. `dynamic` + - use the backend provided by filters. This allows skipper + as library users to do proxy calls to a certain target + from their own implementation dynamically looked up by + their filters. `lb` - balance the load across multiple + network endpoints using specified algorithm. If algorithm + is not specified it will use the default algorithm set + by Skipper at start. `network` - use arbitrary HTTP or + HTTPS URL. enum: - service - shunt @@ -7639,11 +7697,6 @@ spec: lbAlgorithm: description: The load balancing algorithm used for the generated per stack backends. - enum: - - roundRobin - - random - - consistentHash - - powerOfRandomNChoices type: string metadata: description: EmbeddedObjectMetaWithAnnotations defines the metadata @@ -7672,12 +7725,14 @@ spec: items: properties: backendName: - description: BackendName references the skipperBackend - by name + description: BackendName references backend by name type: string weight: - description: Weight defines the traffic weight, if - there are 2 or more default backends + description: Weight defines a portion of traffic for + the referenced backend. It equals to weight divided + by the sum of all backend weights. When all references + have zero (or unspecified) weight then traffic is + split equally between them. minimum: 0 type: integer required: diff --git a/docs/stackset_crd.yaml b/docs/stackset_crd.yaml index 12d63037..61b8adb0 100644 --- a/docs/stackset_crd.yaml +++ b/docs/stackset_crd.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.9.0 + controller-gen.kubebuilder.io/version: v0.9.2 creationTimestamp: null name: stacksets.zalando.org spec: @@ -117,10 +117,22 @@ spec: items: properties: address: - description: Address is required for Type network + description: Address is required for type `network` type: string algorithm: - description: Algorithm is required for Type lb + description: Algorithm is required for type `lb`. `roundRobin` + - backend is chosen by the round robin algorithm, starting + with a random selected backend to spread across all backends + from the beginning. `random` - backend is chosen at random. + `consistentHash` - backend is chosen by [consistent hashing](https://en.wikipedia.org/wiki/Consistent_hashing) + algorithm based on the request key. The request key is + derived from `X-Forwarded-For` header or request remote + IP address as the fallback. Use [`consistentHashKey`](filters.md#consistenthashkey) + filter to set the request key. Use [`consistentHashBalanceFactor`](filters.md#consistenthashbalancefactor) + to prevent popular keys from overloading a single backend + endpoint. `powerOfRandomNChoices` - backend is chosen + by selecting N random endpoints and picking the one with + least outstanding requests from them (see http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf). enum: - roundRobin - random @@ -128,7 +140,7 @@ spec: - powerOfRandomNChoices type: string endpoints: - description: Endpoints is required for Type lb + description: Endpoints is required for type `lb` items: type: string minItems: 1 @@ -138,13 +150,30 @@ spec: as RouteGroupBackendReference type: string serviceName: - description: ServiceName is required for Type service + description: ServiceName is required for type `service` type: string servicePort: - description: ServicePort is required for Type service + description: ServicePort is required for type `service` type: integer type: - description: Type is one of "service|shunt|loopback|dynamic|lb|network" + description: Type of the backend. `service`- resolve Kubernetes + service to the available Endpoints belonging to the Service, + and generate load balanced routes using them. `shunt` + - reply directly from the proxy itself. This can be used + to shortcut, for example have a default that replies with + 404 or use skipper as a backend serving static content + in demos. `loopback` - lookup again the routing table + to a better matching route after processing the current + route. Like this you can add some headers or change the + request path for some specific matching requests. `dynamic` + - use the backend provided by filters. This allows skipper + as library users to do proxy calls to a certain target + from their own implementation dynamically looked up by + their filters. `lb` - balance the load across multiple + network endpoints using specified algorithm. If algorithm + is not specified it will use the default algorithm set + by Skipper at start. `network` - use arbitrary HTTP or + HTTPS URL. enum: - service - shunt @@ -168,11 +197,6 @@ spec: lbAlgorithm: description: The load balancing algorithm used for the generated per stack backends. - enum: - - roundRobin - - random - - consistentHash - - powerOfRandomNChoices type: string metadata: description: EmbeddedObjectMetaWithAnnotations defines the metadata @@ -201,12 +225,14 @@ spec: items: properties: backendName: - description: BackendName references the skipperBackend - by name + description: BackendName references backend by name type: string weight: - description: Weight defines the traffic weight, if - there are 2 or more default backends + description: Weight defines a portion of traffic for + the referenced backend. It equals to weight divided + by the sum of all backend weights. When all references + have zero (or unspecified) weight then traffic is + split equally between them. minimum: 0 type: integer required: @@ -611,6 +637,7 @@ spec: uid?' type: string type: object + x-kubernetes-map-type: atomic secretRef: description: Secret to be owned by Stack properties: @@ -620,6 +647,7 @@ spec: uid?' type: string type: object + x-kubernetes-map-type: atomic type: object type: array minReadySeconds: @@ -788,6 +816,7 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic weight: description: Weight associated with matching the corresponding nodeSelectorTerm, @@ -907,10 +936,12 @@ spec: type: object type: array type: object + x-kubernetes-map-type: atomic type: array required: - nodeSelectorTerms type: object + x-kubernetes-map-type: atomic type: object podAffinity: description: Describes pod affinity scheduling @@ -966,25 +997,8 @@ spec: applies to. type: string operator: - description: operator - represents a key's relationship - to a set of values. - Valid operators are - In, NotIn, Exists and - DoesNotExist. type: string values: - description: values is - an array of string values. - If the operator is In - or NotIn, the values - array must be non-empty. - If the operator is Exists - or DoesNotExist, the - values array must be - empty. This array is - replaced during a strategic - merge patch. items: type: string type: array @@ -1008,6 +1022,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: description: A label query over the set of namespaces that the @@ -1046,17 +1061,6 @@ spec: DoesNotExist. type: string values: - description: values is - an array of string values. - If the operator is In - or NotIn, the values - array must be non-empty. - If the operator is Exists - or DoesNotExist, the - values array must be - empty. This array is - replaced during a strategic - merge patch. items: type: string type: array @@ -1080,6 +1084,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: description: namespaces specifies a static list of namespace names @@ -1204,6 +1209,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: description: A label query over the set of namespaces that the term applies @@ -1271,6 +1277,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: description: namespaces specifies a static list of namespace names that @@ -1354,25 +1361,8 @@ spec: applies to. type: string operator: - description: operator - represents a key's relationship - to a set of values. - Valid operators are - In, NotIn, Exists and - DoesNotExist. type: string values: - description: values is - an array of string values. - If the operator is In - or NotIn, the values - array must be non-empty. - If the operator is Exists - or DoesNotExist, the - values array must be - empty. This array is - replaced during a strategic - merge patch. items: type: string type: array @@ -1396,6 +1386,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: description: A label query over the set of namespaces that the @@ -1434,17 +1425,6 @@ spec: DoesNotExist. type: string values: - description: values is - an array of string values. - If the operator is In - or NotIn, the values - array must be non-empty. - If the operator is Exists - or DoesNotExist, the - values array must be - empty. This array is - replaced during a strategic - merge patch. items: type: string type: array @@ -1468,6 +1448,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: description: namespaces specifies a static list of namespace names @@ -1592,6 +1573,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaceSelector: description: A label query over the set of namespaces that the term applies @@ -1659,6 +1641,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic namespaces: description: namespaces specifies a static list of namespace names that @@ -1788,6 +1771,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, @@ -1808,6 +1792,7 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: description: 'Selects a resource of the container: only resources limits @@ -1837,6 +1822,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -1859,6 +1845,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name @@ -1892,6 +1879,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. @@ -1911,6 +1899,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: @@ -3302,6 +3291,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, @@ -3322,6 +3312,7 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: description: 'Selects a resource of the container: only resources limits @@ -3351,6 +3342,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -3373,6 +3365,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name @@ -3406,6 +3399,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. @@ -3425,6 +3419,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: @@ -4698,6 +4693,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic type: array initContainers: description: 'List of initialization containers belonging @@ -4805,6 +4801,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic fieldRef: description: 'Selects a field of the pod: supports metadata.name, metadata.namespace, @@ -4825,6 +4822,7 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic resourceFieldRef: description: 'Selects a resource of the container: only resources limits @@ -4854,6 +4852,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic secretKeyRef: description: Selects a key of a secret in the pod's namespace @@ -4876,6 +4875,7 @@ spec: required: - key type: object + x-kubernetes-map-type: atomic type: object required: - name @@ -4909,6 +4909,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic prefix: description: An optional identifier to prepend to each key in the ConfigMap. @@ -4928,6 +4929,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic type: object type: array image: @@ -6645,6 +6647,7 @@ spec: only "value". The requirements are ANDed. type: object type: object + x-kubernetes-map-type: atomic maxSkew: description: 'MaxSkew describes the degree to which pods may be unevenly distributed. When @@ -6902,6 +6905,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic user: description: 'user is optional: User is the rados user name, default is admin @@ -6941,6 +6945,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic volumeID: description: 'volumeID used to identify the volume in cinder. More info: https://examples.k8s.io/mysql-cinder-pd/README.md' @@ -7028,6 +7033,7 @@ spec: ConfigMap or its keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic csi: description: csi (Container Storage Interface) represents ephemeral storage that is handled @@ -7064,6 +7070,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic readOnly: description: readOnly specifies a read-only configuration for the volume. Defaults @@ -7128,6 +7135,7 @@ spec: required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: description: 'Optional: mode bits used to set permissions on this @@ -7181,6 +7189,7 @@ spec: required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object @@ -7328,6 +7337,7 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic dataSourceRef: description: 'dataSourceRef specifies the object from which to populate @@ -7385,6 +7395,7 @@ spec: - kind - name type: object + x-kubernetes-map-type: atomic resources: description: 'resources represents the minimum resources the volume @@ -7449,25 +7460,8 @@ spec: applies to. type: string operator: - description: operator - represents a key's relationship - to a set of values. - Valid operators are - In, NotIn, Exists and - DoesNotExist. type: string values: - description: values is - an array of string values. - If the operator is In - or NotIn, the values - array must be non-empty. - If the operator is Exists - or DoesNotExist, the - values array must be - empty. This array is - replaced during a strategic - merge patch. items: type: string type: array @@ -7491,6 +7485,7 @@ spec: are ANDed. type: object type: object + x-kubernetes-map-type: atomic storageClassName: description: 'storageClassName is the name of the StorageClass required @@ -7595,6 +7590,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic required: - driver type: object @@ -7803,6 +7799,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic targetPortal: description: targetPortal is iSCSI Target Portal. The Portal is either an IP or @@ -8009,6 +8006,7 @@ spec: keys must be defined type: boolean type: object + x-kubernetes-map-type: atomic downwardAPI: description: downwardAPI information about the downwardAPI data to project @@ -8030,21 +8028,13 @@ spec: are supported.' properties: apiVersion: - description: Version - of the schema the - FieldPath is written - in terms of, defaults - to "v1". type: string fieldPath: - description: Path of - the field to select - in the specified API - version. type: string required: - fieldPath type: object + x-kubernetes-map-type: atomic mode: description: 'Optional: mode bits used to set @@ -8088,28 +8078,19 @@ spec: currently supported.' properties: containerName: - description: 'Container - name: required for - volumes, optional - for env vars' type: string divisor: anyOf: - type: integer - type: string - description: Specifies - the output format - of the exposed resources, - defaults to "1" pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true resource: - description: 'Required: - resource to select' type: string required: - resource type: object + x-kubernetes-map-type: atomic required: - path type: object @@ -8192,6 +8173,7 @@ spec: must be defined type: boolean type: object + x-kubernetes-map-type: atomic serviceAccountToken: description: serviceAccountToken is information about the serviceAccountToken @@ -8327,6 +8309,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic user: description: 'user is the rados user name. Default is admin. More info: https://examples.k8s.io/volumes/rbd/README.md#how-to-use-it' @@ -8373,6 +8356,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic sslEnabled: description: sslEnabled Flag enable/disable SSL communication with Gateway, default @@ -8512,6 +8496,7 @@ spec: kind, uid?' type: string type: object + x-kubernetes-map-type: atomic volumeName: description: volumeName is the human-readable name of the StorageOS volume. Volume diff --git a/docs/zalando.org_platformcredentialssets.yaml b/docs/zalando.org_platformcredentialssets.yaml new file mode 100644 index 00000000..7e173d5d --- /dev/null +++ b/docs/zalando.org_platformcredentialssets.yaml @@ -0,0 +1,102 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.9.2 + creationTimestamp: null + name: platformcredentialssets.zalando.org +spec: + group: zalando.org + names: + kind: PlatformCredentialsSet + listKind: PlatformCredentialsSetList + plural: platformcredentialssets + singular: platformcredentialsset + scope: Namespaced + versions: + - name: v1 + schema: + openAPIV3Schema: + description: PlatformCredentialsSet describes a platform credentials set + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: PlatformCredentialsSpec is the spec part of the StackSet. + properties: + application: + type: string + clients: + additionalProperties: + properties: + grant: + type: string + realm: + type: string + redirectUri: + type: string + required: + - grant + - realm + - redirectUri + type: object + type: object + token_version: + type: string + tokens: + additionalProperties: + properties: + privileges: + items: + type: string + type: array + required: + - privileges + type: object + type: object + required: + - application + - clients + - token_version + - tokens + type: object + status: + description: PlatformCredentialsStatus is the status part of the Stack. + properties: + clients: {} + errors: + items: + type: string + type: array + observedGeneration: + format: int64 + type: integer + problems: + items: + type: string + type: array + tokens: {} + required: + - clients + - errors + - observedGeneration + - problems + - tokens + type: object + required: + - spec + - status + type: object + served: true + storage: true diff --git a/pkg/apis/zalando.org/v1/register.go b/pkg/apis/zalando.org/v1/register.go index 8549a433..84c9ab2a 100644 --- a/pkg/apis/zalando.org/v1/register.go +++ b/pkg/apis/zalando.org/v1/register.go @@ -33,6 +33,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &StackSetList{}, &Stack{}, &StackList{}, + &PlatformCredentialsSet{}, + &PlatformCredentialsSetList{}, ) metav1.AddToGroupVersion(scheme, SchemeGroupVersion) return nil diff --git a/pkg/apis/zalando.org/v1/types_pcs.go b/pkg/apis/zalando.org/v1/types_pcs.go new file mode 100644 index 00000000..6b544cc8 --- /dev/null +++ b/pkg/apis/zalando.org/v1/types_pcs.go @@ -0,0 +1,60 @@ +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PlatformCredentialsSet describes a platform credentials set +// +k8s:deepcopy-gen=true +type PlatformCredentialsSet struct { + metav1.TypeMeta `json:""` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec PlatformCredentialsSpec `json:"spec"` + Status PlatformCredentialsStatus `json:"status"` +} + +// PlatformCredentialsSpec is the spec part of the StackSet. +// +k8s:deepcopy-gen=true +type PlatformCredentialsSpec struct { + Application string `json:"application"` + Clients map[string]Client `json:"clients"` + Tokens map[string]Token `json:"tokens"` + TokenVersion string `json:"token_version"` +} + +// +k8s:deepcopy-gen=true +type Client struct { + Realm string `json:"realm"` + Grant string `json:"grant"` + RedirectURI string `json:"redirectUri"` +} + +// +k8s:deepcopy-gen=true +type Token struct { + Privileges []string `json:"privileges"` +} + +// PlatformCredentialsStatus is the status part of the Stack. +// +k8s:deepcopy-gen=true +type PlatformCredentialsStatus struct { + ObservedGeneration int64 `json:"observedGeneration"` + Errors []string `json:"errors"` + Problems []string `json:"problems"` + Tokens map[string]struct{} `json:"tokens"` + Clients map[string]struct{} `json:"clients"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// PlatformCredentialsSetList is a list of StackSets. +// +k8s:deepcopy-gen=true +type PlatformCredentialsSetList struct { + metav1.TypeMeta `json:""` + metav1.ListMeta `json:"metadata,omitempty"` + + Items []PlatformCredentialsSet `json:"items"` +} diff --git a/pkg/apis/zalando.org/v1/zz_generated.deepcopy.go b/pkg/apis/zalando.org/v1/zz_generated.deepcopy.go index 6cda7130..1b50fd13 100644 --- a/pkg/apis/zalando.org/v1/zz_generated.deepcopy.go +++ b/pkg/apis/zalando.org/v1/zz_generated.deepcopy.go @@ -118,6 +118,22 @@ func (in *AutoscalerMetrics) DeepCopy() *AutoscalerMetrics { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Client) DeepCopyInto(out *Client) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Client. +func (in *Client) DeepCopy() *Client { + if in == nil { + return nil + } + out := new(Client) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConfigurationResourcesSpec) DeepCopyInto(out *ConfigurationResourcesSpec) { *out = *in @@ -302,6 +318,137 @@ func (in *MetricsZMON) DeepCopy() *MetricsZMON { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformCredentialsSet) DeepCopyInto(out *PlatformCredentialsSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformCredentialsSet. +func (in *PlatformCredentialsSet) DeepCopy() *PlatformCredentialsSet { + if in == nil { + return nil + } + out := new(PlatformCredentialsSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PlatformCredentialsSet) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformCredentialsSetList) DeepCopyInto(out *PlatformCredentialsSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]PlatformCredentialsSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformCredentialsSetList. +func (in *PlatformCredentialsSetList) DeepCopy() *PlatformCredentialsSetList { + if in == nil { + return nil + } + out := new(PlatformCredentialsSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *PlatformCredentialsSetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformCredentialsSpec) DeepCopyInto(out *PlatformCredentialsSpec) { + *out = *in + if in.Clients != nil { + in, out := &in.Clients, &out.Clients + *out = make(map[string]Client, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Tokens != nil { + in, out := &in.Tokens, &out.Tokens + *out = make(map[string]Token, len(*in)) + for key, val := range *in { + (*out)[key] = *val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformCredentialsSpec. +func (in *PlatformCredentialsSpec) DeepCopy() *PlatformCredentialsSpec { + if in == nil { + return nil + } + out := new(PlatformCredentialsSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PlatformCredentialsStatus) DeepCopyInto(out *PlatformCredentialsStatus) { + *out = *in + if in.Errors != nil { + in, out := &in.Errors, &out.Errors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Problems != nil { + in, out := &in.Problems, &out.Problems + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Tokens != nil { + in, out := &in.Tokens, &out.Tokens + *out = make(map[string]struct{}, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Clients != nil { + in, out := &in.Clients, &out.Clients + *out = make(map[string]struct{}, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PlatformCredentialsStatus. +func (in *PlatformCredentialsStatus) DeepCopy() *PlatformCredentialsStatus { + if in == nil { + return nil + } + out := new(PlatformCredentialsStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PodTemplateSpec) DeepCopyInto(out *PodTemplateSpec) { *out = *in @@ -788,3 +935,24 @@ func (in *StackTemplate) DeepCopy() *StackTemplate { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Token) DeepCopyInto(out *Token) { + *out = *in + if in.Privileges != nil { + in, out := &in.Privileges, &out.Privileges + *out = make([]string, len(*in)) + copy(*out, *in) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Token. +func (in *Token) DeepCopy() *Token { + if in == nil { + return nil + } + out := new(Token) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/clientset/versioned/typed/zalando.org/v1/fake/fake_platformcredentialsset.go b/pkg/client/clientset/versioned/typed/zalando.org/v1/fake/fake_platformcredentialsset.go new file mode 100644 index 00000000..b80c18e3 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/zalando.org/v1/fake/fake_platformcredentialsset.go @@ -0,0 +1,142 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + zalandoorgv1 "github.com/zalando-incubator/stackset-controller/pkg/apis/zalando.org/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakePlatformCredentialsSets implements PlatformCredentialsSetInterface +type FakePlatformCredentialsSets struct { + Fake *FakeZalandoV1 + ns string +} + +var platformcredentialssetsResource = schema.GroupVersionResource{Group: "zalando.org", Version: "v1", Resource: "platformcredentialssets"} + +var platformcredentialssetsKind = schema.GroupVersionKind{Group: "zalando.org", Version: "v1", Kind: "PlatformCredentialsSet"} + +// Get takes name of the platformCredentialsSet, and returns the corresponding platformCredentialsSet object, and an error if there is any. +func (c *FakePlatformCredentialsSets) Get(ctx context.Context, name string, options v1.GetOptions) (result *zalandoorgv1.PlatformCredentialsSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(platformcredentialssetsResource, c.ns, name), &zalandoorgv1.PlatformCredentialsSet{}) + + if obj == nil { + return nil, err + } + return obj.(*zalandoorgv1.PlatformCredentialsSet), err +} + +// List takes label and field selectors, and returns the list of PlatformCredentialsSets that match those selectors. +func (c *FakePlatformCredentialsSets) List(ctx context.Context, opts v1.ListOptions) (result *zalandoorgv1.PlatformCredentialsSetList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(platformcredentialssetsResource, platformcredentialssetsKind, c.ns, opts), &zalandoorgv1.PlatformCredentialsSetList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &zalandoorgv1.PlatformCredentialsSetList{ListMeta: obj.(*zalandoorgv1.PlatformCredentialsSetList).ListMeta} + for _, item := range obj.(*zalandoorgv1.PlatformCredentialsSetList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested platformCredentialsSets. +func (c *FakePlatformCredentialsSets) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(platformcredentialssetsResource, c.ns, opts)) + +} + +// Create takes the representation of a platformCredentialsSet and creates it. Returns the server's representation of the platformCredentialsSet, and an error, if there is any. +func (c *FakePlatformCredentialsSets) Create(ctx context.Context, platformCredentialsSet *zalandoorgv1.PlatformCredentialsSet, opts v1.CreateOptions) (result *zalandoorgv1.PlatformCredentialsSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(platformcredentialssetsResource, c.ns, platformCredentialsSet), &zalandoorgv1.PlatformCredentialsSet{}) + + if obj == nil { + return nil, err + } + return obj.(*zalandoorgv1.PlatformCredentialsSet), err +} + +// Update takes the representation of a platformCredentialsSet and updates it. Returns the server's representation of the platformCredentialsSet, and an error, if there is any. +func (c *FakePlatformCredentialsSets) Update(ctx context.Context, platformCredentialsSet *zalandoorgv1.PlatformCredentialsSet, opts v1.UpdateOptions) (result *zalandoorgv1.PlatformCredentialsSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(platformcredentialssetsResource, c.ns, platformCredentialsSet), &zalandoorgv1.PlatformCredentialsSet{}) + + if obj == nil { + return nil, err + } + return obj.(*zalandoorgv1.PlatformCredentialsSet), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakePlatformCredentialsSets) UpdateStatus(ctx context.Context, platformCredentialsSet *zalandoorgv1.PlatformCredentialsSet, opts v1.UpdateOptions) (*zalandoorgv1.PlatformCredentialsSet, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(platformcredentialssetsResource, "status", c.ns, platformCredentialsSet), &zalandoorgv1.PlatformCredentialsSet{}) + + if obj == nil { + return nil, err + } + return obj.(*zalandoorgv1.PlatformCredentialsSet), err +} + +// Delete takes name of the platformCredentialsSet and deletes it. Returns an error if one occurs. +func (c *FakePlatformCredentialsSets) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(platformcredentialssetsResource, c.ns, name, opts), &zalandoorgv1.PlatformCredentialsSet{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakePlatformCredentialsSets) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(platformcredentialssetsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &zalandoorgv1.PlatformCredentialsSetList{}) + return err +} + +// Patch applies the patch and returns the patched platformCredentialsSet. +func (c *FakePlatformCredentialsSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *zalandoorgv1.PlatformCredentialsSet, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(platformcredentialssetsResource, c.ns, name, pt, data, subresources...), &zalandoorgv1.PlatformCredentialsSet{}) + + if obj == nil { + return nil, err + } + return obj.(*zalandoorgv1.PlatformCredentialsSet), err +} diff --git a/pkg/client/clientset/versioned/typed/zalando.org/v1/fake/fake_zalando.org_client.go b/pkg/client/clientset/versioned/typed/zalando.org/v1/fake/fake_zalando.org_client.go index 11250258..b063b5eb 100644 --- a/pkg/client/clientset/versioned/typed/zalando.org/v1/fake/fake_zalando.org_client.go +++ b/pkg/client/clientset/versioned/typed/zalando.org/v1/fake/fake_zalando.org_client.go @@ -28,6 +28,10 @@ type FakeZalandoV1 struct { *testing.Fake } +func (c *FakeZalandoV1) PlatformCredentialsSets(namespace string) v1.PlatformCredentialsSetInterface { + return &FakePlatformCredentialsSets{c, namespace} +} + func (c *FakeZalandoV1) Stacks(namespace string) v1.StackInterface { return &FakeStacks{c, namespace} } diff --git a/pkg/client/clientset/versioned/typed/zalando.org/v1/generated_expansion.go b/pkg/client/clientset/versioned/typed/zalando.org/v1/generated_expansion.go index 857c39d1..ab5ff6bc 100644 --- a/pkg/client/clientset/versioned/typed/zalando.org/v1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/zalando.org/v1/generated_expansion.go @@ -18,6 +18,8 @@ limitations under the License. package v1 +type PlatformCredentialsSetExpansion interface{} + type StackExpansion interface{} type StackSetExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/zalando.org/v1/platformcredentialsset.go b/pkg/client/clientset/versioned/typed/zalando.org/v1/platformcredentialsset.go new file mode 100644 index 00000000..acc77a47 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/zalando.org/v1/platformcredentialsset.go @@ -0,0 +1,195 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + "time" + + v1 "github.com/zalando-incubator/stackset-controller/pkg/apis/zalando.org/v1" + scheme "github.com/zalando-incubator/stackset-controller/pkg/client/clientset/versioned/scheme" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// PlatformCredentialsSetsGetter has a method to return a PlatformCredentialsSetInterface. +// A group's client should implement this interface. +type PlatformCredentialsSetsGetter interface { + PlatformCredentialsSets(namespace string) PlatformCredentialsSetInterface +} + +// PlatformCredentialsSetInterface has methods to work with PlatformCredentialsSet resources. +type PlatformCredentialsSetInterface interface { + Create(ctx context.Context, platformCredentialsSet *v1.PlatformCredentialsSet, opts metav1.CreateOptions) (*v1.PlatformCredentialsSet, error) + Update(ctx context.Context, platformCredentialsSet *v1.PlatformCredentialsSet, opts metav1.UpdateOptions) (*v1.PlatformCredentialsSet, error) + UpdateStatus(ctx context.Context, platformCredentialsSet *v1.PlatformCredentialsSet, opts metav1.UpdateOptions) (*v1.PlatformCredentialsSet, error) + Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error + Get(ctx context.Context, name string, opts metav1.GetOptions) (*v1.PlatformCredentialsSet, error) + List(ctx context.Context, opts metav1.ListOptions) (*v1.PlatformCredentialsSetList, error) + Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PlatformCredentialsSet, err error) + PlatformCredentialsSetExpansion +} + +// platformCredentialsSets implements PlatformCredentialsSetInterface +type platformCredentialsSets struct { + client rest.Interface + ns string +} + +// newPlatformCredentialsSets returns a PlatformCredentialsSets +func newPlatformCredentialsSets(c *ZalandoV1Client, namespace string) *platformCredentialsSets { + return &platformCredentialsSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the platformCredentialsSet, and returns the corresponding platformCredentialsSet object, and an error if there is any. +func (c *platformCredentialsSets) Get(ctx context.Context, name string, options metav1.GetOptions) (result *v1.PlatformCredentialsSet, err error) { + result = &v1.PlatformCredentialsSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("platformcredentialssets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of PlatformCredentialsSets that match those selectors. +func (c *platformCredentialsSets) List(ctx context.Context, opts metav1.ListOptions) (result *v1.PlatformCredentialsSetList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.PlatformCredentialsSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("platformcredentialssets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested platformCredentialsSets. +func (c *platformCredentialsSets) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("platformcredentialssets"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a platformCredentialsSet and creates it. Returns the server's representation of the platformCredentialsSet, and an error, if there is any. +func (c *platformCredentialsSets) Create(ctx context.Context, platformCredentialsSet *v1.PlatformCredentialsSet, opts metav1.CreateOptions) (result *v1.PlatformCredentialsSet, err error) { + result = &v1.PlatformCredentialsSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("platformcredentialssets"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(platformCredentialsSet). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a platformCredentialsSet and updates it. Returns the server's representation of the platformCredentialsSet, and an error, if there is any. +func (c *platformCredentialsSets) Update(ctx context.Context, platformCredentialsSet *v1.PlatformCredentialsSet, opts metav1.UpdateOptions) (result *v1.PlatformCredentialsSet, err error) { + result = &v1.PlatformCredentialsSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("platformcredentialssets"). + Name(platformCredentialsSet.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(platformCredentialsSet). + Do(ctx). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *platformCredentialsSets) UpdateStatus(ctx context.Context, platformCredentialsSet *v1.PlatformCredentialsSet, opts metav1.UpdateOptions) (result *v1.PlatformCredentialsSet, err error) { + result = &v1.PlatformCredentialsSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("platformcredentialssets"). + Name(platformCredentialsSet.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(platformCredentialsSet). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the platformCredentialsSet and deletes it. Returns an error if one occurs. +func (c *platformCredentialsSets) Delete(ctx context.Context, name string, opts metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("platformcredentialssets"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *platformCredentialsSets) DeleteCollection(ctx context.Context, opts metav1.DeleteOptions, listOpts metav1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("platformcredentialssets"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched platformCredentialsSet. +func (c *platformCredentialsSets) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.PlatformCredentialsSet, err error) { + result = &v1.PlatformCredentialsSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("platformcredentialssets"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/zalando.org/v1/zalando.org_client.go b/pkg/client/clientset/versioned/typed/zalando.org/v1/zalando.org_client.go index 720bc0a2..9738f927 100644 --- a/pkg/client/clientset/versioned/typed/zalando.org/v1/zalando.org_client.go +++ b/pkg/client/clientset/versioned/typed/zalando.org/v1/zalando.org_client.go @@ -28,6 +28,7 @@ import ( type ZalandoV1Interface interface { RESTClient() rest.Interface + PlatformCredentialsSetsGetter StacksGetter StackSetsGetter } @@ -37,6 +38,10 @@ type ZalandoV1Client struct { restClient rest.Interface } +func (c *ZalandoV1Client) PlatformCredentialsSets(namespace string) PlatformCredentialsSetInterface { + return newPlatformCredentialsSets(c, namespace) +} + func (c *ZalandoV1Client) Stacks(namespace string) StackInterface { return newStacks(c, namespace) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 0e8a7fe0..7081ee32 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -53,6 +53,8 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=zalando.org, Version=v1 + case v1.SchemeGroupVersion.WithResource("platformcredentialssets"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Zalando().V1().PlatformCredentialsSets().Informer()}, nil case v1.SchemeGroupVersion.WithResource("stacks"): return &genericInformer{resource: resource.GroupResource(), informer: f.Zalando().V1().Stacks().Informer()}, nil case v1.SchemeGroupVersion.WithResource("stacksets"): diff --git a/pkg/client/informers/externalversions/zalando.org/v1/interface.go b/pkg/client/informers/externalversions/zalando.org/v1/interface.go index a601388a..738161e0 100644 --- a/pkg/client/informers/externalversions/zalando.org/v1/interface.go +++ b/pkg/client/informers/externalversions/zalando.org/v1/interface.go @@ -24,6 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { + // PlatformCredentialsSets returns a PlatformCredentialsSetInformer. + PlatformCredentialsSets() PlatformCredentialsSetInformer // Stacks returns a StackInformer. Stacks() StackInformer // StackSets returns a StackSetInformer. @@ -41,6 +43,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// PlatformCredentialsSets returns a PlatformCredentialsSetInformer. +func (v *version) PlatformCredentialsSets() PlatformCredentialsSetInformer { + return &platformCredentialsSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // Stacks returns a StackInformer. func (v *version) Stacks() StackInformer { return &stackInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/zalando.org/v1/platformcredentialsset.go b/pkg/client/informers/externalversions/zalando.org/v1/platformcredentialsset.go new file mode 100644 index 00000000..6309efab --- /dev/null +++ b/pkg/client/informers/externalversions/zalando.org/v1/platformcredentialsset.go @@ -0,0 +1,90 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1 + +import ( + "context" + time "time" + + zalandoorgv1 "github.com/zalando-incubator/stackset-controller/pkg/apis/zalando.org/v1" + versioned "github.com/zalando-incubator/stackset-controller/pkg/client/clientset/versioned" + internalinterfaces "github.com/zalando-incubator/stackset-controller/pkg/client/informers/externalversions/internalinterfaces" + v1 "github.com/zalando-incubator/stackset-controller/pkg/client/listers/zalando.org/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// PlatformCredentialsSetInformer provides access to a shared informer and lister for +// PlatformCredentialsSets. +type PlatformCredentialsSetInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.PlatformCredentialsSetLister +} + +type platformCredentialsSetInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewPlatformCredentialsSetInformer constructs a new informer for PlatformCredentialsSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewPlatformCredentialsSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredPlatformCredentialsSetInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredPlatformCredentialsSetInformer constructs a new informer for PlatformCredentialsSet type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredPlatformCredentialsSetInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ZalandoV1().PlatformCredentialsSets(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.ZalandoV1().PlatformCredentialsSets(namespace).Watch(context.TODO(), options) + }, + }, + &zalandoorgv1.PlatformCredentialsSet{}, + resyncPeriod, + indexers, + ) +} + +func (f *platformCredentialsSetInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredPlatformCredentialsSetInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *platformCredentialsSetInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&zalandoorgv1.PlatformCredentialsSet{}, f.defaultInformer) +} + +func (f *platformCredentialsSetInformer) Lister() v1.PlatformCredentialsSetLister { + return v1.NewPlatformCredentialsSetLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/listers/zalando.org/v1/expansion_generated.go b/pkg/client/listers/zalando.org/v1/expansion_generated.go index dd7a3252..7487d46d 100644 --- a/pkg/client/listers/zalando.org/v1/expansion_generated.go +++ b/pkg/client/listers/zalando.org/v1/expansion_generated.go @@ -18,6 +18,14 @@ limitations under the License. package v1 +// PlatformCredentialsSetListerExpansion allows custom methods to be added to +// PlatformCredentialsSetLister. +type PlatformCredentialsSetListerExpansion interface{} + +// PlatformCredentialsSetNamespaceListerExpansion allows custom methods to be added to +// PlatformCredentialsSetNamespaceLister. +type PlatformCredentialsSetNamespaceListerExpansion interface{} + // StackListerExpansion allows custom methods to be added to // StackLister. type StackListerExpansion interface{} diff --git a/pkg/client/listers/zalando.org/v1/platformcredentialsset.go b/pkg/client/listers/zalando.org/v1/platformcredentialsset.go new file mode 100644 index 00000000..cbb66ae3 --- /dev/null +++ b/pkg/client/listers/zalando.org/v1/platformcredentialsset.go @@ -0,0 +1,99 @@ +/* +Copyright 2024 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "github.com/zalando-incubator/stackset-controller/pkg/apis/zalando.org/v1" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// PlatformCredentialsSetLister helps list PlatformCredentialsSets. +// All objects returned here must be treated as read-only. +type PlatformCredentialsSetLister interface { + // List lists all PlatformCredentialsSets in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PlatformCredentialsSet, err error) + // PlatformCredentialsSets returns an object that can list and get PlatformCredentialsSets. + PlatformCredentialsSets(namespace string) PlatformCredentialsSetNamespaceLister + PlatformCredentialsSetListerExpansion +} + +// platformCredentialsSetLister implements the PlatformCredentialsSetLister interface. +type platformCredentialsSetLister struct { + indexer cache.Indexer +} + +// NewPlatformCredentialsSetLister returns a new PlatformCredentialsSetLister. +func NewPlatformCredentialsSetLister(indexer cache.Indexer) PlatformCredentialsSetLister { + return &platformCredentialsSetLister{indexer: indexer} +} + +// List lists all PlatformCredentialsSets in the indexer. +func (s *platformCredentialsSetLister) List(selector labels.Selector) (ret []*v1.PlatformCredentialsSet, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PlatformCredentialsSet)) + }) + return ret, err +} + +// PlatformCredentialsSets returns an object that can list and get PlatformCredentialsSets. +func (s *platformCredentialsSetLister) PlatformCredentialsSets(namespace string) PlatformCredentialsSetNamespaceLister { + return platformCredentialsSetNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// PlatformCredentialsSetNamespaceLister helps list and get PlatformCredentialsSets. +// All objects returned here must be treated as read-only. +type PlatformCredentialsSetNamespaceLister interface { + // List lists all PlatformCredentialsSets in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1.PlatformCredentialsSet, err error) + // Get retrieves the PlatformCredentialsSet from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1.PlatformCredentialsSet, error) + PlatformCredentialsSetNamespaceListerExpansion +} + +// platformCredentialsSetNamespaceLister implements the PlatformCredentialsSetNamespaceLister +// interface. +type platformCredentialsSetNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all PlatformCredentialsSets in the indexer for a given namespace. +func (s platformCredentialsSetNamespaceLister) List(selector labels.Selector) (ret []*v1.PlatformCredentialsSet, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.PlatformCredentialsSet)) + }) + return ret, err +} + +// Get retrieves the PlatformCredentialsSet from the indexer for a given namespace and name. +func (s platformCredentialsSetNamespaceLister) Get(name string) (*v1.PlatformCredentialsSet, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("platformcredentialsset"), name) + } + return obj.(*v1.PlatformCredentialsSet), nil +}