diff --git a/config/v1/tests/infrastructures.config.openshift.io/AAA_ungated.yaml b/config/v1/tests/infrastructures.config.openshift.io/AAA_ungated.yaml index 8fd3cdf76a7..8c8dc40347d 100644 --- a/config/v1/tests/infrastructures.config.openshift.io/AAA_ungated.yaml +++ b/config/v1/tests/infrastructures.config.openshift.io/AAA_ungated.yaml @@ -216,38 +216,6 @@ tests: - IBMCloud2 port: 443 server: server2.dev.cluster.com -# expected: | -# apiVersion: config.openshift.io/v1 -# kind: Infrastructure -# spec: -# platformSpec: -# type: VSphere -# vsphere: -# failureDomains: -# - name: generated-failure-domain -# region: generated-region -# server: server1.dev.cluster.com -# topology: -# computeCluster: /IBMCloud/host/vcs-8e-workload -# datacenter: IBMCloud -# datastore: /IBMCloud/datastore/mdcnc-ds-shared -# networks: -# - ocp-ci-seg-13 -# resourcePool: /IBMCloud/host/vcs-8e-workload/Resources -# template: /IBMCloud/vm/ngirard-dev-rqh5s-rhcos-generated-region-generated-zone -# zone: generated-zone -# nodeNetworking: -# external: {} -# internal: {} -# vcenters: -# - datacenters: -# - IBMCloud -# port: 443 -# server: server1.dev.cluster.com -# - datacenters: -# - IBMCloud2 -# port: 443 -# server: server2.dev.cluster.com expectedError: "Too many: 2: must have at most 1 items" onUpdate: - name: Should be able to change External platformName from unknown to something else diff --git a/example/v1/types_stable.go b/example/v1/types_stable.go index 4357f678f76..6d3393af50d 100644 --- a/example/v1/types_stable.go +++ b/example/v1/types_stable.go @@ -67,6 +67,14 @@ type StableConfigTypeSpec struct { // celUnion demonstrates how to validate a discrminated union using CEL // +optional CELUnion CELUnion `json:"celUnion,omitempty"` + + // evolvingCollection demonstrates how to have a collection where the maximum number of items varies on cluster type. + // For default clusters, this will be "1" but on TechPreview clusters, this value will be "3". + // +openshift:validation:FeatureGateAwareMaxItems:featureGate="",maxItems=1 + // +openshift:validation:FeatureGateAwareMaxItems:featureGate=Example,maxItems=3 + // +optional + // +listType=atomic + EvolvingCollection []string `json:"evolvingCollection,omitempty"` } type EvolvingUnion struct { diff --git a/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-CustomNoUpgrade.crd.yaml b/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-CustomNoUpgrade.crd.yaml index 72481c00b5e..6b069e4f144 100644 --- a/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-CustomNoUpgrade.crd.yaml +++ b/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-CustomNoUpgrade.crd.yaml @@ -71,6 +71,16 @@ spec: description: coolNewField is a field that is for tech preview only. On normal clusters this shouldn't be present type: string + evolvingCollection: + description: evolvingCollection demonstrates how to have a collection + where the maximum number of items varies on cluster type. For default + clusters, this will be "1" but on TechPreview clusters, this value + will be "3". + items: + type: string + maxItems: 3 + type: array + x-kubernetes-list-type: atomic evolvingUnion: description: evolvingUnion demonstrates how to phase in new values into discriminated union diff --git a/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-Default.crd.yaml b/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-Default.crd.yaml index 296ba041642..5df3624b563 100644 --- a/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-Default.crd.yaml +++ b/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-Default.crd.yaml @@ -67,6 +67,16 @@ spec: - message: optionalMember is forbidden when type is not OptionalMember rule: 'has(self.type) && self.type == ''OptionalMember'' ? true : !has(self.optionalMember)' + evolvingCollection: + description: evolvingCollection demonstrates how to have a collection + where the maximum number of items varies on cluster type. For default + clusters, this will be "1" but on TechPreview clusters, this value + will be "3". + items: + type: string + maxItems: 1 + type: array + x-kubernetes-list-type: atomic evolvingUnion: description: evolvingUnion demonstrates how to phase in new values into discriminated union diff --git a/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-DevPreviewNoUpgrade.crd.yaml b/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-DevPreviewNoUpgrade.crd.yaml index 969d1a94ace..a72ddef31a3 100644 --- a/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-DevPreviewNoUpgrade.crd.yaml +++ b/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-DevPreviewNoUpgrade.crd.yaml @@ -71,6 +71,16 @@ spec: description: coolNewField is a field that is for tech preview only. On normal clusters this shouldn't be present type: string + evolvingCollection: + description: evolvingCollection demonstrates how to have a collection + where the maximum number of items varies on cluster type. For default + clusters, this will be "1" but on TechPreview clusters, this value + will be "3". + items: + type: string + maxItems: 3 + type: array + x-kubernetes-list-type: atomic evolvingUnion: description: evolvingUnion demonstrates how to phase in new values into discriminated union diff --git a/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-TechPreviewNoUpgrade.crd.yaml b/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-TechPreviewNoUpgrade.crd.yaml index dafb51e2101..e5051484602 100644 --- a/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-TechPreviewNoUpgrade.crd.yaml +++ b/example/v1/zz_generated.crd-manifests/0000_50_my-operator_01_stableconfigtypes-TechPreviewNoUpgrade.crd.yaml @@ -71,6 +71,16 @@ spec: description: coolNewField is a field that is for tech preview only. On normal clusters this shouldn't be present type: string + evolvingCollection: + description: evolvingCollection demonstrates how to have a collection + where the maximum number of items varies on cluster type. For default + clusters, this will be "1" but on TechPreview clusters, this value + will be "3". + items: + type: string + maxItems: 3 + type: array + x-kubernetes-list-type: atomic evolvingUnion: description: evolvingUnion demonstrates how to phase in new values into discriminated union diff --git a/example/v1/zz_generated.deepcopy.go b/example/v1/zz_generated.deepcopy.go index 73f7b1901ad..be7fc00e467 100644 --- a/example/v1/zz_generated.deepcopy.go +++ b/example/v1/zz_generated.deepcopy.go @@ -118,6 +118,11 @@ func (in *StableConfigTypeSpec) DeepCopyInto(out *StableConfigTypeSpec) { *out = *in out.EvolvingUnion = in.EvolvingUnion in.CELUnion.DeepCopyInto(&out.CELUnion) + if in.EvolvingCollection != nil { + in, out := &in.EvolvingCollection, &out.EvolvingCollection + *out = make([]string, len(*in)) + copy(*out, *in) + } return } diff --git a/example/v1/zz_generated.featuregated-crd-manifests/stableconfigtypes.example.openshift.io/AAA_ungated.yaml b/example/v1/zz_generated.featuregated-crd-manifests/stableconfigtypes.example.openshift.io/AAA_ungated.yaml index f966ddf1dd3..fe568b434f1 100644 --- a/example/v1/zz_generated.featuregated-crd-manifests/stableconfigtypes.example.openshift.io/AAA_ungated.yaml +++ b/example/v1/zz_generated.featuregated-crd-manifests/stableconfigtypes.example.openshift.io/AAA_ungated.yaml @@ -67,6 +67,16 @@ spec: - message: optionalMember is forbidden when type is not OptionalMember rule: 'has(self.type) && self.type == ''OptionalMember'' ? true : !has(self.optionalMember)' + evolvingCollection: + description: evolvingCollection demonstrates how to have a collection + where the maximum number of items varies on cluster type. For default + clusters, this will be "1" but on TechPreview clusters, this value + will be "3". + items: + type: string + maxItems: 1 + type: array + x-kubernetes-list-type: atomic evolvingUnion: description: evolvingUnion demonstrates how to phase in new values into discriminated union diff --git a/example/v1/zz_generated.featuregated-crd-manifests/stableconfigtypes.example.openshift.io/Example.yaml b/example/v1/zz_generated.featuregated-crd-manifests/stableconfigtypes.example.openshift.io/Example.yaml index 22594f8a214..c658fb6416e 100644 --- a/example/v1/zz_generated.featuregated-crd-manifests/stableconfigtypes.example.openshift.io/Example.yaml +++ b/example/v1/zz_generated.featuregated-crd-manifests/stableconfigtypes.example.openshift.io/Example.yaml @@ -71,6 +71,16 @@ spec: description: coolNewField is a field that is for tech preview only. On normal clusters this shouldn't be present type: string + evolvingCollection: + description: evolvingCollection demonstrates how to have a collection + where the maximum number of items varies on cluster type. For default + clusters, this will be "1" but on TechPreview clusters, this value + will be "3". + items: + type: string + maxItems: 3 + type: array + x-kubernetes-list-type: atomic evolvingUnion: description: evolvingUnion demonstrates how to phase in new values into discriminated union diff --git a/example/v1/zz_generated.swagger_doc_generated.go b/example/v1/zz_generated.swagger_doc_generated.go index 498f58b87f7..083c1cf6ce3 100644 --- a/example/v1/zz_generated.swagger_doc_generated.go +++ b/example/v1/zz_generated.swagger_doc_generated.go @@ -58,6 +58,7 @@ var map_StableConfigTypeSpec = map[string]string{ "optionalImmutableField": "optionalImmutableField is a field that is immutable once set. It is optional but may not be changed once set.", "evolvingUnion": "evolvingUnion demonstrates how to phase in new values into discriminated union", "celUnion": "celUnion demonstrates how to validate a discrminated union using CEL", + "evolvingCollection": "evolvingCollection demonstrates how to have a collection where the maximum number of items varies on cluster type. For default clusters, this will be \"1\" but on TechPreview clusters, this value will be \"3\".", } func (StableConfigTypeSpec) SwaggerDoc() map[string]string { diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index e78e33409d5..e94a4b297c4 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -23289,6 +23289,26 @@ func schema_openshift_api_example_v1_StableConfigTypeSpec(ref common.ReferenceCa Ref: ref("github.com/openshift/api/example/v1.CELUnion"), }, }, + "evolvingCollection": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "evolvingCollection demonstrates how to have a collection where the maximum number of items varies on cluster type. For default clusters, this will be \"1\" but on TechPreview clusters, this value will be \"3\".", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, }, Required: []string{"immutableField"}, }, diff --git a/openapi/openapi.json b/openapi/openapi.json index f8bd08efd4f..b0ce244b726 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -12904,6 +12904,15 @@ "type": "string", "default": "" }, + "evolvingCollection": { + "description": "evolvingCollection demonstrates how to have a collection where the maximum number of items varies on cluster type. For default clusters, this will be \"1\" but on TechPreview clusters, this value will be \"3\".", + "type": "array", + "items": { + "type": "string", + "default": "" + }, + "x-kubernetes-list-type": "atomic" + }, "evolvingUnion": { "description": "evolvingUnion demonstrates how to phase in new values into discriminated union", "default": {},