Skip to content

Commit

Permalink
Add MachineState 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 Sep 25, 2023
1 parent ce1b46d commit d5de927
Show file tree
Hide file tree
Showing 7 changed files with 587 additions and 0 deletions.
5 changes: 5 additions & 0 deletions machineconfiguration/v1/0000_80_controllerconfig.crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1046,6 +1046,11 @@ spec:
type: string
nullable: true
x-kubernetes-embedded-resource: true
internalRegistryPullSecret:
description: internalRegistryPullSecret is the pull secret for the internal registry
type: string
format: byte
nullable: true
ipFamilies:
description: ipFamilies indicates the IP families in use by the cluster network
type: string
Expand Down
186 changes: 186 additions & 0 deletions machineconfiguration/v1/0000_80_machinestate.crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: machinestates.machineconfiguration.openshift.io
labels:
"openshift.io/operator-managed": ""
annotations:
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"
spec:
# group name to use for REST API: /apis/<group>/<version>
group: machineconfiguration.openshift.io
scope: Cluster
names:
kind: MachineState
singular: machinestate
plural: machinestates
shortnames:
- state
versions:
- name: v1
# 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: .spec.machineStateKind
name: Type
type: string
- jsonPath: .status.healthy
name: Healthy
type: boolean
- jsonPath: .status.allStates[0].state
name: Progress
type: string
- jsonPath: .status.allStates[0].name
name: Object
type: string
- jsonPath: .status.allStates[0].kind
name: ObjectType
type: string
- jsonPath: .status.allStates[0].reason
name: Action
type: string
- jsonPath: .status.error
name: Error
type: string
schema:
openAPIV3Schema:
description: "MachineState describes the health of the Machines on the system \n Compatibility level 1: Stable within a major release for a minimum of 12 months or 3 minor releases (whichever is longer)."
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: MachineStateSpec describes the type of State we are managing
type: object
properties:
configuration:
description: MachineStateConfig describes the configuration of a MachineState
type: object
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
x-kubernetes-map-type: atomic
machineStateKind:
description: Kind describes the type of MachineState
type: string
status:
description: MachineStateStatus holds the reported information on a particular MachineState
type: object
properties:
allStates:
description: Progression describes the 20 Most Recent MachineStates
type: array
items:
description: ProgressionCondition is the base struct that contains all information about an event reported from an MCO component
type: object
properties:
kind:
description: Kind describes the type of object for this condition (node, mcp, etc)
type: string
name:
description: Name is the object's name
type: string
phase:
description: Phase is the general action occuring
type: string
reason:
description: Reason is a more detailed description of the phase
type: string
state:
description: State describes what is happening with this object
type: string
time:
description: Time is the timestamp of this event
type: string
format: date-time
configuration:
description: Config Describes the Kind of MachineState
type: object
properties:
apiVersion:
description: API version of the referent.
type: string
fieldPath:
description: 'If referring to a piece of an object instead of an entire object, this string should contain a valid JSON/Go field access statement, such as desiredState.manifest.containers[2]. For example, if the object reference is to a container within a pod, this would take on a value like: "spec.containers{name}" (where "name" refers to the name of the container that triggered the event) or if no container name is specified "spec.containers[2]" (container with index 2 in this pod). This syntax is chosen only to have some well-defined way of referencing a part of an object. TODO: this design is not final and this field is subject to change in the future.'
type: string
kind:
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
type: string
namespace:
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
type: string
resourceVersion:
description: 'Specific resourceVersion to which this reference is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
type: string
uid:
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
type: string
x-kubernetes-map-type: atomic
error:
description: MostRecentError is populated if the State reports an error.
type: string
healthy:
description: Healthy reports if the state is Healthy Overall
type: boolean
progress:
description: MostRecentState MCO Object Mapped to a Progress Condition
type: object
additionalProperties:
description: ProgressionCondition is the base struct that contains all information about an event reported from an MCO component
type: object
properties:
kind:
description: Kind describes the type of object for this condition (node, mcp, etc)
type: string
name:
description: Name is the object's name
type: string
phase:
description: Phase is the general action occuring
type: string
reason:
description: Reason is a more detailed description of the phase
type: string
state:
description: State describes what is happening with this object
type: string
time:
description: Time is the timestamp of this event
type: string
format: date-time
2 changes: 2 additions & 0 deletions machineconfiguration/v1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&MachineConfigList{},
&MachineConfigPool{},
&MachineConfigPoolList{},
&MachineState{},
&MachineStateList{},
)

metav1.AddToGroupVersion(scheme, GroupVersion)
Expand Down
15 changes: 15 additions & 0 deletions machineconfiguration/v1/stable.machinestate.testsuite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this
name: "[Stable] MachineState"
crd: 0000_80_machinestate.crd.yaml
tests:
onCreate:
- name: Should be able to create a minimal MachineState
initial: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineState
spec: {}
expected: |
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineState
spec: {}
Loading

0 comments on commit d5de927

Please sign in to comment.