Skip to content

Commit

Permalink
add boot images update opt-in & mcp degrade type
Browse files Browse the repository at this point in the history
  • Loading branch information
djoshy committed Dec 7, 2023
1 parent e1845c5 commit 3ee2435
Show file tree
Hide file tree
Showing 7 changed files with 275 additions and 1 deletion.
3 changes: 3 additions & 0 deletions machineconfiguration/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,9 @@ const (
// MachineConfigPoolRenderDegraded means the rendered configuration for the pool cannot be generated because of an error
MachineConfigPoolRenderDegraded MachineConfigPoolConditionType = "RenderDegraded"

// MachineConfigPoolMachineSetDegraded means the machineset reconciliation for the pool could not be completed because of an error
MachineConfigPoolMachineSetDegraded MachineConfigPoolConditionType = "MachineSetDegraded"

// MachineConfigPoolDegraded is the overall status of the pool based, today, on whether we fail with NodeDegraded or RenderDegraded
MachineConfigPoolDegraded MachineConfigPoolConditionType = "Degraded"

Expand Down
72 changes: 71 additions & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -27931,6 +27931,11 @@
"description": "logLevel is an intent based logging for an overall component. It does not give fine grained control, but it is a simple way to manage coarse grained logging choices that operators have to interpret for their operands.\n\nValid values are: \"Normal\", \"Debug\", \"Trace\", \"TraceAll\". Defaults to \"Normal\".",
"type": "string"
},
"managedBootImageConfig": {
"description": "managedBootImageConfig contains configuration data for the bootimages management feature",
"default": {},
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ManagedBootImageConfig"
},
"managementState": {
"description": "managementState indicates whether and how the operator should manage the component",
"type": "string",
Expand Down Expand Up @@ -28013,6 +28018,38 @@
}
}
},
"com.github.openshift.api.operator.v1.ManagedBootImageConfig": {
"description": "ManagedBootImageConfig contains configuration data for the bootimages management feature",
"type": "object",
"properties": {
"customConfig": {
"description": "customConfig provides granular control of the ManagedBootImages feature to the user. Only permitted when mode is set to \"CustomConfig\".",
"$ref": "#/definitions/com.github.openshift.api.operator.v1.ManagedBootImageConfigCustomization"
},
"mode": {
"description": "mode determines which of the union members should be populated.",
"type": "string"
}
},
"x-kubernetes-unions": [
{
"discriminator": "mode",
"fields-to-discriminateBy": {
"customConfig": "CustomConfig"
}
}
]
},
"com.github.openshift.api.operator.v1.ManagedBootImageConfigCustomization": {
"description": "ManagedBootImageConfigCustomization provides granular control of the ManagedBootImages feature. This object is only permitted when mode is set to \"CustomConfig\".",
"type": "object",
"properties": {
"machineSetSelector": {
"description": "machineSetSelector specifies a label selector for MachinesSets that will be managed by this feature. An empty MachineSetSelector will enroll all MachineSets.",
"$ref": "#/definitions/io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector"
}
}
},
"com.github.openshift.api.operator.v1.MyOperatorResource": {
"description": "MyOperatorResource is an example operator configuration type\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.",
"type": "object",
Expand Down
51 changes: 51 additions & 0 deletions operator/v1/0000_80_machine-config-operator_01_config.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,57 @@ spec:
- Debug
- Trace
- TraceAll
managedBootImageConfig:
description: managedBootImageConfig contains configuration data for the bootimages management feature
type: object
required:
- mode
properties:
customConfig:
description: customConfig provides granular control of the ManagedBootImages feature to the user. Only permitted when mode is set to "CustomConfig".
type: object
properties:
machineSetSelector:
description: machineSetSelector specifies a label selector for MachinesSets that will be managed by this feature. An empty MachineSetSelector will enroll all MachineSets.
type: object
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements. The requirements are ANDed.
type: array
items:
description: A label selector requirement is a selector that contains values, a key, and an operator that relates the key and values.
type: object
required:
- key
- operator
properties:
key:
description: key is the label key that the selector 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.
type: array
items:
type: string
matchLabels:
description: matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is "key", the operator is "In", and the values array contains only "value". The requirements are ANDed.
type: object
additionalProperties:
type: string
x-kubernetes-map-type: atomic
mode:
description: mode determines which of the union members should be populated.
type: string
enum:
- Enabled
- Disabled
- CustomConfig
x-kubernetes-validations:
- rule: 'has(self.mode) && self.mode == ''CustomConfig'' ? has(self.customConfig) : !has(self.customConfig)'
message: customConfig is required when type is CustomConfig, and forbidden otherwise
managementState:
description: managementState indicates whether and how the operator should manage the component
type: string
Expand Down
43 changes: 43 additions & 0 deletions operator/v1/types_machineconfiguration.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ type MachineConfigurationSpec struct {
StaticPodOperatorSpec `json:",inline"`

// TODO(jkyros): This is where we put our knobs and dials

// managedBootImageConfig contains configuration data for the bootimages management feature
// +optional
ManagedBootImageConfig ManagedBootImageConfig `json:"managedBootImageConfig,omitempty"`
}

type MachineConfigurationStatus struct {
Expand All @@ -56,3 +60,42 @@ type MachineConfigurationList struct {
// Items contains the items
Items []MachineConfiguration `json:"items"`
}

// ManagedBootImageConfig contains configuration data for the bootimages management feature
// +kubebuilder:validation:XValidation:rule="has(self.mode) && self.mode == 'CustomConfig' ? has(self.customConfig) : !has(self.customConfig)",message="customConfig is required when type is CustomConfig, and forbidden otherwise"
// +union
type ManagedBootImageConfig struct {
// mode determines which of the union members should be populated.
// +unionDiscriminator
// +kubebuilder:validation:Required
Mode ManagedBootImageConfigMode `json:"mode,omitempty"`

// customConfig provides granular control of the ManagedBootImages feature to the user.
// Only permitted when mode is set to "CustomConfig".
// +optional
CustomConfig *ManagedBootImageConfigCustomization `json:"customConfig,omitempty"`
}

// ManagedBootImageMode is a union discriminator for ManagedBootImageConfig.
// +kubebuilder:validation:Enum:="Enabled";"Disabled";"CustomConfig"
type ManagedBootImageConfigMode string

const (
// Enabled represents an operator that will manage all machinesets.
Enabled ManagedBootImageConfigMode = "Enabled"

// Disabled represents an operator that will not manage any machinesets.
Disabled ManagedBootImageConfigMode = "Disabled"

// CustomConfig represents an operator that will manage machinesets specified by a ManagedBootImageConfigCustomization object.
CustomConfig ManagedBootImageConfigMode = "CustomConfig"
)

// ManagedBootImageConfigCustomization provides granular control of the ManagedBootImages feature.
// This object is only permitted when mode is set to "CustomConfig".
type ManagedBootImageConfigCustomization struct {
// machineSetSelector specifies a label selector for MachinesSets that will be managed by this feature.
// An empty MachineSetSelector will enroll all MachineSets.
// +optional
MachineSetSelector *metav1.LabelSelector `json:"machineSetSelector,omitempty"`
}
43 changes: 43 additions & 0 deletions operator/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions operator/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3ee2435

Please sign in to comment.