-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add machineconfiguration API group #620
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LorbusChris The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/cc @yuqi-zhang |
|
kind: CustomResourceDefinition | ||
metadata: | ||
# name must match the spec fields below, and be in the form: <plural>.<group> | ||
name: controllerconfigs.machineconfiguration.openshift.io |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure this should be part of the openshift/api since this looks like an machine-config-operator internal API..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
they are in the same group at the moment (machineconfiguration.openshift.io
). Should we move them out of that group into an MCO-internal group? Are there conventions around this?
machineconfiguration/v1/helpers.go
Outdated
) | ||
|
||
// NewMachineConfigPoolCondition creates a new MachineConfigPool condition. | ||
func NewMachineConfigPoolCondition(condType MachineConfigPoolConditionType, status corev1.ConditionStatus, reason, message string) *MachineConfigPoolCondition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm.. the helper functions usually end up in library-go instead of the API..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like they're not used anywhere else and they could stay in the MCO repo for now.
Just to verify, the |
This moves over all external API from the github.com/openshift/machine-config-operator repo, and adds swagger doc generation for it.
I've removed the controllerconfig CRD and API from this PR. Please let me know if I should add it back. |
I'm not very familiar with how we structure CRDs. It'd obviously be nicer from a maintenance perspective if everything in the |
) | ||
|
||
const ( | ||
GroupName = "machineconfiguration.openshift.io" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this group already exists and this is a straight move?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plural: containerruntimeconfigs | ||
singular: containerruntimeconfig | ||
shortNames: | ||
- ctrcfg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this already present in your CRD manifest today? We discourage shortnames on resources that are infrequently used by cluster-admins.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, already present
|
||
// MachineConfigRoleLabelKey is metadata key in the MachineConfig. Specifies the node role that config should be applied to. | ||
// For example: `master` or `worker` | ||
const MachineConfigRoleLabelKey = "machineconfiguration.openshift.io/role" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
general API note. if you own the schema of the struct, why wasn't this just a top level field?
type MachineConfigPoolSpec struct { | ||
// machineConfigSelector specifies a label selector for MachineConfigs. | ||
// Refer https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ on how label and selectors work. | ||
MachineConfigSelector *metav1.LabelSelector `json:"machineConfigSelector,omitempty" protobuf:"bytes,1,opt,name=machineConfigSelector"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to explain what nil means here. All, none, somethign else?
MachineConfigSelector *metav1.LabelSelector `json:"machineConfigSelector,omitempty" protobuf:"bytes,1,opt,name=machineConfigSelector"` | ||
|
||
// nodeSelector specifies a label selector for Machines | ||
NodeSelector *metav1.LabelSelector `json:"nodeSelector,omitempty" protobuf:"bytes,2,opt,name=nodeSelector"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe the meaning of nil
// +nullable | ||
KernelArguments []string `json:"kernelArguments" protobuf:"bytes,3,rep,name=kernelArguments"` | ||
|
||
FIPS bool `json:"fips" protobuf:"varint,4,opt,name=fips"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing doc
type MachineConfigSpec struct { | ||
// OSImageURL specifies the remote location that will be used to | ||
// fetch the OS. | ||
OSImageURL string `json:"osImageURL" protobuf:"bytes,1,opt,name=osImageURL"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing required/optional if optional, what does empty string mean?
// fetch the OS. | ||
OSImageURL string `json:"osImageURL" protobuf:"bytes,1,opt,name=osImageURL"` | ||
// Config is a Ignition Config object. | ||
Config runtime.RawExtension `json:"config" protobuf:"bytes,2,opt,name=config"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine. You're interpretting the value elsewhere but this eliminated the problematic compile time dep?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. This is parsed into Ignition.Config by the MCO
// OSImageURL specifies the remote location that will be used to | ||
// fetch the OS. | ||
OSImageURL string `json:"osImageURL" protobuf:"bytes,1,opt,name=osImageURL"` | ||
// Config is a Ignition Config object. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
point to where the schema is please.
Config runtime.RawExtension `json:"config" protobuf:"bytes,2,opt,name=config"` | ||
|
||
// +nullable | ||
KernelArguments []string `json:"kernelArguments" protobuf:"bytes,3,rep,name=kernelArguments"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs doc.
|
||
// maxUnavailable specifies the percentage or constant number of machines that can be updating at any given time. | ||
// default is 1. | ||
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty" protobuf:"bytes,4,opt,name=maxUnavailable"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does zero mean here? based on comment, this would end poorly.
// MachineConfigPoolStatusConfiguration stores the current configuration for the pool, and | ||
// optionally also stores the list of MachineConfig objects used to generate the configuration. | ||
type MachineConfigPoolStatusConfiguration struct { | ||
corev1.ObjectReference `json:",inline" protobuf:"bytes,1,opt,name=objectReference"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't honor all the fields of this struct. We encourage creating specific reference objects so you can provide precise docs. This will need revisiting.
|
||
// source is the list of MachineConfig objects that were used to generate the single MachineConfig object specified in `content`. | ||
// +optional | ||
Source []corev1.ObjectReference `json:"source,omitempty" protobuf:"bytes,2,rep,name=source"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably don't honor all the fields of this struct. We encourage creating specific reference objects so you can provide precise docs. This will need revisiting.
|
||
// KubeletConfigSpec defines the desired state of KubeletConfig | ||
type KubeletConfigSpec struct { | ||
MachineConfigPoolSelector *metav1.LabelSelector `json:"machineConfigPoolSelector,omitempty" protobuf:"bytes,1,opt,name=machineConfigPoolSelector"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to describe the meaning of nil
// KubeletConfigSpec defines the desired state of KubeletConfig | ||
type KubeletConfigSpec struct { | ||
MachineConfigPoolSelector *metav1.LabelSelector `json:"machineConfigPoolSelector,omitempty" protobuf:"bytes,1,opt,name=machineConfigPoolSelector"` | ||
KubeletConfig *runtime.RawExtension `json:"kubeletConfig,omitempty" protobuf:"bytes,2,opt,name=kubeletConfig"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe the meaning of nil and point to what schema is accepted here.
KubeletConfigSuccess KubeletConfigStatusConditionType = "Success" | ||
|
||
// KubeletConfigFailure designates a failure applying a KubeletConfig CR. | ||
KubeletConfigFailure KubeletConfigStatusConditionType = "Failure" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these conditions are a bit odd, since Failure is usually Success == false.
deferring to @runcom to answer these questions. I'd prefer to have these issues fixed in the MCO repo before the move |
This removes the hand-rafted API Validation for the RawExtension that contains Ignitition.Config WIP
This is stale. Someone from the MCO team should create a new PR once the API move task has been prioritized and scheduled for a sprint. |
@LorbusChris: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
This moves over the machineconfiguration API from the
github.com/openshift/machine-config-operator repo,
and adds swagger doc generation for it.
TODO:
/cc @runcom