Skip to content

Commit

Permalink
Add MachineConfigNode types to machineconfiguration
Browse files Browse the repository at this point in the history
Signed-off-by: Charlie Doern <cdoern@redhat.com>
  • Loading branch information
cdoern committed Oct 31, 2023
1 parent 693f5c5 commit 728764d
Show file tree
Hide file tree
Showing 15 changed files with 2,909 additions and 1,432 deletions.
6 changes: 6 additions & 0 deletions machineconfiguration/.codegen.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
schemapatch:
requiredFeatureSets:
- ""
- "Default"
- "TechPreviewNoUpgrade"
- "CustomNoUpgrade"
swaggerdocs:
commentPolicy: Warn
3 changes: 2 additions & 1 deletion machineconfiguration/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"

machineconfigurationv1 "github.com/openshift/api/machineconfiguration/v1"
machineconfigurationv1alpha "github.com/openshift/api/machineconfiguration/v1alpha1"
)

// GroupName defines the API group for machineconfiguration.
const GroupName = "machineconfiguration.openshift.io"

var (
SchemeBuilder = runtime.NewSchemeBuilder(machineconfigurationv1.Install)
SchemeBuilder = runtime.NewSchemeBuilder(machineconfigurationv1.Install, machineconfigurationv1alpha.Install)
// Install is a function which adds every version of this group to a scheme
Install = SchemeBuilder.AddToScheme
)
Expand Down
1 change: 1 addition & 0 deletions machineconfiguration/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ type ControllerConfigStatus struct {
// +listType=atomic
// +optional
Conditions []ControllerConfigStatusCondition `json:"conditions"`

// controllerCertificates represents the latest available observations of the automatically rotating certificates in the MCO.
// +listType=atomic
// +optional
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: machineconfignodes.machineconfiguration.openshift.io
labels:
"openshift.io/operator-managed": ""
annotations:
api-approved.openshift.io: https://github.com/openshift/api/pull/1596
include.release.openshift.io/ibm-cloud-managed: "true"
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
release.openshift.io/feature-set: CustomNoUpgrade
spec:
# group name to use for REST API: /apis/<group>/<version>
group: machineconfiguration.openshift.io
scope: Cluster
names:
kind: MachineConfigNode
singular: machineconfignode
plural: machineconfignodes
versions:
- name: v1alpha1
# Each version can be enabled/disabled by Served flag.
served: true
# One and only one version must be marked as the storage version.
storage: true
subresources:
status: {}
additionalPrinterColumns:
- jsonPath: .status.conditions[?(@.type=="Updated")].status
name: Updated
type: string
- jsonPath: .status.conditions[?(@.type=="UpdatePrepared")].status
name: UpdatePrepared
type: string
- jsonPath: .status.conditions[?(@.type=="UpdateExecuted")].status
name: UpdateExecuted
type: string
- jsonPath: .status.conditions[?(@.type=="UpdatePostActionComplete")].status
name: UpdatePostActionComplete
type: string
- jsonPath: .status.conditions[?(@.type=="UpdateComplete")].status
name: UpdateComplete
type: string
- jsonPath: .status.conditions[?(@.type=="Resumed")].status
name: Resumed
type: string
- jsonPath: .status.conditions[?(@.type=="UpdateCompatible")].status
name: UpdateCompatible
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type=="AppliedFilesAndOS")].status
name: UpdatedFilesAndOS
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type=="CordonedNode")].status
name: CordonedNode
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type=="DrainedNode")].status
name: DrainedNode
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type=="RebootedNode")].status
name: RebootedNode
priority: 1
type: string
- jsonPath: .status.conditions[?(@.type=="ReloadedCRIO")].status
name: ReloadedCRIO
priority: 1
type: string
schema:
openAPIV3Schema:
description: 'MachineConfigNode describes the health of the Machines on the system Compatibility 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
required:
- spec
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: spec describes the configuration of the machine config node.
type: object
required:
- configVersion
- node
- pool
properties:
configVersion:
description: configVersion holds the desired config version for the node targeted by this machine config node resource. The desired version represents the machine config the node will attempt to update to once it is validated by the machine config operator.
type: object
required:
- desired
properties:
desired:
description: desired is the name of the machine config that the the node should be upgraded to. This value is set when the machine config pool generates a new version of its rendered configuration. When this value is changed, the machine config daemon starts the node upgrade process. If the transition of this value is accepted, the new desired version will be updated in the .status.configVersion.desired field and the upgrade will proceed. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and period s(.) and must be at most 253 characters in length.
type: string
maxLength: 253
pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$
node:
description: node contains a reference to the node for this machine config node.
type: object
required:
- name
properties:
name:
description: name is the object name. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.
type: string
maxLength: 253
pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$
pool:
description: pool contains a reference to the machine config pool that this machine config node's referenced node belongs to.
type: object
required:
- name
properties:
name:
description: name is the object name. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.
type: string
maxLength: 253
pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$
status:
description: status describes the last observed state of this machine config node.
type: object
required:
- configVersion
properties:
conditions:
description: conditions represent the observations of a machine config node's current state.
type: array
items:
description: "Condition contains details for one aspect of the current state of this API Resource. --- This struct is intended for direct use as an array at the field path .status.conditions. For example, \n type FooStatus struct{ // Represents the observations of a foo's current state. // Known .status.conditions.type are: \"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge // +listType=map // +listMapKey=type Conditions []metav1.Condition `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
type: object
required:
- lastTransitionTime
- message
- reason
- status
- type
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
type: string
format: date-time
message:
description: message is a human readable message indicating details about the transition. This may be an empty string.
type: string
maxLength: 32768
observedGeneration:
description: observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
type: integer
format: int64
minimum: 0
reason:
description: reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
status:
description: status of the condition, one of True, False, Unknown.
type: string
enum:
- "True"
- "False"
- Unknown
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase. --- Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to deconflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
type: string
maxLength: 316
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])$
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
configVersion:
description: configVersion describes the current and desired machine config for this node. The current version represents the current machine config for the node and is updated after a successful update. The desired version represents the machine config the node will attempt to update to. This desiredConfig has been validated in the machine config operator as one that is valid and that exists.
type: object
required:
- desired
properties:
current:
description: current is the name of the machine config currently in use on the node. This value is updated once the machine config daemon has completed the update of the configuration for the node. This value should match the desired version unless an upgrade is in progress. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.
type: string
maxLength: 253
pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$
desired:
description: desired is the MachineConfig the node wants to upgrade to. The machine config operator sets this value once it has generated a new machine config for the node to upgrade to. Must be a lowercase RFC-1123 hostname (https://tools.ietf.org/html/rfc1123) It may consist of only alphanumeric characters, hyphens (-) and periods (.) and must be at most 253 characters in length.
type: string
maxLength: 253
pattern: ^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$
observedGeneration:
description: observedGeneration represents the generation observed by the controller. This field is updated when the controller observes a change to the desiredConfig in the configVersion of the machine config node spec.
type: integer
format: int64
x-kubernetes-validations:
- rule: self.metadata.name == self.spec.node.name
message: spec.node.name should match metadata.name
Loading

0 comments on commit 728764d

Please sign in to comment.