Skip to content

Commit bfa868a

Browse files
Merge pull request #2451 from jatinsu/OKD-featuregates
OKD-259: Support an "OKD" featureset to be enabled by default on OKD clusters
2 parents cafbd60 + d1bbe4d commit bfa868a

File tree

50 files changed

+24681
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+24681
-164
lines changed

config/v1/tests/featuregates.config.openshift.io/AAA_ungated.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ tests:
2929
kind: FeatureGate
3030
spec:
3131
featureSet: bar
32-
expectedError: "spec.featureSet: Unsupported value: \"bar\": supported values: \"CustomNoUpgrade\", \"DevPreviewNoUpgrade\", \"TechPreviewNoUpgrade\", \"\""
32+
expectedError: "spec.featureSet: Unsupported value: \"bar\": supported values: \"CustomNoUpgrade\", \"DevPreviewNoUpgrade\", \"TechPreviewNoUpgrade\", \"OKD\", \"\""
3333
onUpdate:
3434
- name: Default to TechPreview
3535
initial: |
@@ -121,4 +121,4 @@ tests:
121121
kind: FeatureGate
122122
spec:
123123
featureSet: "bar"
124-
expectedError: "spec.featureSet: Unsupported value: \"bar\": supported values: \"CustomNoUpgrade\", \"DevPreviewNoUpgrade\", \"TechPreviewNoUpgrade\", \"\""
124+
expectedError: "spec.featureSet: Unsupported value: \"bar\": supported values: \"CustomNoUpgrade\", \"DevPreviewNoUpgrade\", \"TechPreviewNoUpgrade\", \"OKD\", \"\""

config/v1/types_feature.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ var (
5353
// your cluster may fail in an unrecoverable way.
5454
CustomNoUpgrade FeatureSet = "CustomNoUpgrade"
5555

56+
// OKD turns on features for OKD. Turning this feature set ON is supported for OKD clusters, but NOT for OpenShift clusters.
57+
// Once enabled, this feature set cannot be changed back to Default, but can be changed to other feature sets and it allows upgrades.
58+
OKD FeatureSet = "OKD"
59+
5660
// AllFixedFeatureSets are the featuresets that have known featuregates. Custom doesn't for instance. LatencySensitive is dead
57-
AllFixedFeatureSets = []FeatureSet{Default, TechPreviewNoUpgrade, DevPreviewNoUpgrade}
61+
AllFixedFeatureSets = []FeatureSet{Default, TechPreviewNoUpgrade, DevPreviewNoUpgrade, OKD}
5862
)
5963

6064
type FeatureGateSpec struct {
@@ -67,10 +71,11 @@ type FeatureGateSelection struct {
6771
// Turning on or off features may cause irreversible changes in your cluster which cannot be undone.
6872
// +unionDiscriminator
6973
// +optional
70-
// +kubebuilder:validation:Enum=CustomNoUpgrade;DevPreviewNoUpgrade;TechPreviewNoUpgrade;""
74+
// +kubebuilder:validation:Enum=CustomNoUpgrade;DevPreviewNoUpgrade;TechPreviewNoUpgrade;OKD;""
7175
// +kubebuilder:validation:XValidation:rule="oldSelf == 'CustomNoUpgrade' ? self == 'CustomNoUpgrade' : true",message="CustomNoUpgrade may not be changed"
7276
// +kubebuilder:validation:XValidation:rule="oldSelf == 'TechPreviewNoUpgrade' ? self == 'TechPreviewNoUpgrade' : true",message="TechPreviewNoUpgrade may not be changed"
7377
// +kubebuilder:validation:XValidation:rule="oldSelf == 'DevPreviewNoUpgrade' ? self == 'DevPreviewNoUpgrade' : true",message="DevPreviewNoUpgrade may not be changed"
78+
// +kubebuilder:validation:XValidation:rule="oldSelf == 'OKD' ? self != '' : true",message="OKD cannot transition to Default"
7479
FeatureSet FeatureSet `json:"featureSet,omitempty"`
7580

7681
// customNoUpgrade allows the enabling or disabling of any feature. Turning this feature set on IS NOT SUPPORTED, CANNOT BE UNDONE, and PREVENTS UPGRADES.

config/v1/zz_generated.crd-manifests/0000_00_cluster-version-operator_01_clusterversions-OKD.crd.yaml

Lines changed: 794 additions & 0 deletions
Large diffs are not rendered by default.

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_apiservers-OKD.crd.yaml

Lines changed: 437 additions & 0 deletions
Large diffs are not rendered by default.

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_featuregates.crd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ spec:
7979
- CustomNoUpgrade
8080
- DevPreviewNoUpgrade
8181
- TechPreviewNoUpgrade
82+
- OKD
8283
- ""
8384
type: string
8485
x-kubernetes-validations:
@@ -91,6 +92,8 @@ spec:
9192
- message: DevPreviewNoUpgrade may not be changed
9293
rule: 'oldSelf == ''DevPreviewNoUpgrade'' ? self == ''DevPreviewNoUpgrade''
9394
: true'
95+
- message: OKD cannot transition to Default
96+
rule: 'oldSelf == ''OKD'' ? self != '''' : true'
9497
type: object
9598
x-kubernetes-validations:
9699
- message: .spec.featureSet cannot be removed

config/v1/zz_generated.crd-manifests/0000_10_config-operator_01_infrastructures-OKD.crd.yaml

Lines changed: 2338 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
api-approved.openshift.io: https://github.com/openshift/api/pull/1107
6+
api.openshift.io/merged-by-featuregates: "true"
7+
include.release.openshift.io/ibm-cloud-managed: "true"
8+
include.release.openshift.io/self-managed-high-availability: "true"
9+
release.openshift.io/bootstrap-required: "true"
10+
release.openshift.io/feature-set: OKD
11+
name: nodes.config.openshift.io
12+
spec:
13+
group: config.openshift.io
14+
names:
15+
kind: Node
16+
listKind: NodeList
17+
plural: nodes
18+
singular: node
19+
scope: Cluster
20+
versions:
21+
- name: v1
22+
schema:
23+
openAPIV3Schema:
24+
description: |-
25+
Node holds cluster-wide information about node specific features.
26+
27+
Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
28+
properties:
29+
apiVersion:
30+
description: |-
31+
APIVersion defines the versioned schema of this representation of an object.
32+
Servers should convert recognized schemas to the latest internal value, and
33+
may reject unrecognized values.
34+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
35+
type: string
36+
kind:
37+
description: |-
38+
Kind is a string value representing the REST resource this object represents.
39+
Servers may infer this from the endpoint the client submits requests to.
40+
Cannot be updated.
41+
In CamelCase.
42+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
43+
type: string
44+
metadata:
45+
type: object
46+
spec:
47+
description: spec holds user settable values for configuration
48+
properties:
49+
cgroupMode:
50+
description: cgroupMode determines the cgroups version on the node
51+
enum:
52+
- v2
53+
- ""
54+
type: string
55+
workerLatencyProfile:
56+
description: |-
57+
workerLatencyProfile determins the how fast the kubelet is updating
58+
the status and corresponding reaction of the cluster
59+
enum:
60+
- Default
61+
- MediumUpdateAverageReaction
62+
- LowUpdateSlowReaction
63+
type: string
64+
type: object
65+
status:
66+
description: status holds observed values.
67+
properties:
68+
conditions:
69+
description: conditions contain the details and the current state
70+
of the nodes.config object
71+
items:
72+
description: Condition contains details for one aspect of the current
73+
state of this API Resource.
74+
properties:
75+
lastTransitionTime:
76+
description: |-
77+
lastTransitionTime is the last time the condition transitioned from one status to another.
78+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
79+
format: date-time
80+
type: string
81+
message:
82+
description: |-
83+
message is a human readable message indicating details about the transition.
84+
This may be an empty string.
85+
maxLength: 32768
86+
type: string
87+
observedGeneration:
88+
description: |-
89+
observedGeneration represents the .metadata.generation that the condition was set based upon.
90+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
91+
with respect to the current state of the instance.
92+
format: int64
93+
minimum: 0
94+
type: integer
95+
reason:
96+
description: |-
97+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
98+
Producers of specific condition types may define expected values and meanings for this field,
99+
and whether the values are considered a guaranteed API.
100+
The value should be a CamelCase string.
101+
This field may not be empty.
102+
maxLength: 1024
103+
minLength: 1
104+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
105+
type: string
106+
status:
107+
description: status of the condition, one of True, False, Unknown.
108+
enum:
109+
- "True"
110+
- "False"
111+
- Unknown
112+
type: string
113+
type:
114+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
115+
maxLength: 316
116+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
117+
type: string
118+
required:
119+
- lastTransitionTime
120+
- message
121+
- reason
122+
- status
123+
- type
124+
type: object
125+
type: array
126+
x-kubernetes-list-map-keys:
127+
- type
128+
x-kubernetes-list-type: map
129+
type: object
130+
required:
131+
- spec
132+
type: object
133+
served: true
134+
storage: true
135+
subresources:
136+
status: {}
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
api-approved.openshift.io: https://github.com/openshift/api/pull/470
6+
api.openshift.io/merged-by-featuregates: "true"
7+
include.release.openshift.io/self-managed-high-availability: "true"
8+
release.openshift.io/bootstrap-required: "true"
9+
release.openshift.io/feature-set: OKD
10+
name: schedulers.config.openshift.io
11+
spec:
12+
group: config.openshift.io
13+
names:
14+
kind: Scheduler
15+
listKind: SchedulerList
16+
plural: schedulers
17+
singular: scheduler
18+
scope: Cluster
19+
versions:
20+
- name: v1
21+
schema:
22+
openAPIV3Schema:
23+
description: |-
24+
Scheduler holds cluster-wide config information to run the Kubernetes Scheduler
25+
and influence its placement decisions. The canonical name for this config is `cluster`.
26+
27+
Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer).
28+
properties:
29+
apiVersion:
30+
description: |-
31+
APIVersion defines the versioned schema of this representation of an object.
32+
Servers should convert recognized schemas to the latest internal value, and
33+
may reject unrecognized values.
34+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
35+
type: string
36+
kind:
37+
description: |-
38+
Kind is a string value representing the REST resource this object represents.
39+
Servers may infer this from the endpoint the client submits requests to.
40+
Cannot be updated.
41+
In CamelCase.
42+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
43+
type: string
44+
metadata:
45+
type: object
46+
spec:
47+
description: spec holds user settable values for configuration
48+
properties:
49+
defaultNodeSelector:
50+
description: |-
51+
defaultNodeSelector helps set the cluster-wide default node selector to
52+
restrict pod placement to specific nodes. This is applied to the pods
53+
created in all namespaces and creates an intersection with any existing
54+
nodeSelectors already set on a pod, additionally constraining that pod's selector.
55+
For example,
56+
defaultNodeSelector: "type=user-node,region=east" would set nodeSelector
57+
field in pod spec to "type=user-node,region=east" to all pods created
58+
in all namespaces. Namespaces having project-wide node selectors won't be
59+
impacted even if this field is set. This adds an annotation section to
60+
the namespace.
61+
For example, if a new namespace is created with
62+
node-selector='type=user-node,region=east',
63+
the annotation openshift.io/node-selector: type=user-node,region=east
64+
gets added to the project. When the openshift.io/node-selector annotation
65+
is set on the project the value is used in preference to the value we are setting
66+
for defaultNodeSelector field.
67+
For instance,
68+
openshift.io/node-selector: "type=user-node,region=west" means
69+
that the default of "type=user-node,region=east" set in defaultNodeSelector
70+
would not be applied.
71+
type: string
72+
mastersSchedulable:
73+
description: |-
74+
mastersSchedulable allows masters nodes to be schedulable. When this flag is
75+
turned on, all the master nodes in the cluster will be made schedulable,
76+
so that workload pods can run on them. The default value for this field is false,
77+
meaning none of the master nodes are schedulable.
78+
Important Note: Once the workload pods start running on the master nodes,
79+
extreme care must be taken to ensure that cluster-critical control plane components
80+
are not impacted.
81+
Please turn on this field after doing due diligence.
82+
type: boolean
83+
policy:
84+
description: |-
85+
DEPRECATED: the scheduler Policy API has been deprecated and will be removed in a future release.
86+
policy is a reference to a ConfigMap containing scheduler policy which has
87+
user specified predicates and priorities. If this ConfigMap is not available
88+
scheduler will default to use DefaultAlgorithmProvider.
89+
The namespace for this configmap is openshift-config.
90+
properties:
91+
name:
92+
description: name is the metadata.name of the referenced config
93+
map
94+
type: string
95+
required:
96+
- name
97+
type: object
98+
profile:
99+
description: |-
100+
profile sets which scheduling profile should be set in order to configure scheduling
101+
decisions for new pods.
102+
103+
Valid values are "LowNodeUtilization", "HighNodeUtilization", "NoScoring"
104+
Defaults to "LowNodeUtilization"
105+
enum:
106+
- ""
107+
- LowNodeUtilization
108+
- HighNodeUtilization
109+
- NoScoring
110+
type: string
111+
type: object
112+
status:
113+
description: status holds observed values from the cluster. They may not
114+
be overridden.
115+
type: object
116+
required:
117+
- spec
118+
type: object
119+
served: true
120+
storage: true
121+
subresources:
122+
status: {}

config/v1/zz_generated.featuregated-crd-manifests/featuregates.config.openshift.io/AAA_ungated.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ spec:
8080
- CustomNoUpgrade
8181
- DevPreviewNoUpgrade
8282
- TechPreviewNoUpgrade
83+
- OKD
8384
- ""
8485
type: string
8586
x-kubernetes-validations:
@@ -92,6 +93,8 @@ spec:
9293
- message: DevPreviewNoUpgrade may not be changed
9394
rule: 'oldSelf == ''DevPreviewNoUpgrade'' ? self == ''DevPreviewNoUpgrade''
9495
: true'
96+
- message: OKD cannot transition to Default
97+
rule: 'oldSelf == ''OKD'' ? self != '''' : true'
9598
type: object
9699
x-kubernetes-validations:
97100
- message: .spec.featureSet cannot be removed

example/v1/types_stable.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ type SubnetsWithExclusions struct {
204204
// The subnets in this list must be subnetworks of the subnets in the subnets list.
205205
// +kubebuilder:validation:MaxItems=25
206206
// +optional
207+
// +listType=atomic
207208
ExcludeSubnets []CIDR `json:"excludeSubnets,omitempty"`
208209
}
209210

0 commit comments

Comments
 (0)