upgrade: support Kubernetes components (#839)

* upgrade: add Kubernetes components to NodeVersion

* update rfc
This commit is contained in:
3u13r 2023-01-03 12:09:53 +01:00 committed by GitHub
parent 4b43311fbd
commit f14af0c3eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
56 changed files with 897 additions and 738 deletions

View file

@ -14,8 +14,8 @@ import (
type JoiningNodeSpec struct {
// Name of the node expected to join.
Name string `json:"name,omitempty"`
// ComponentsHash is the hash of the components that were sent to the node by the join service.
ComponentsHash string `json:"componentshash,omitempty"`
// ComponentsReference is the reference to the ConfigMap containing the components.
ComponentsReference string `json:"componentsreference,omitempty"`
// IsControlPlane is true if the node is a control plane node.
IsControlPlane bool `json:"iscontrolplane,omitempty"`
// Deadline is the time after which the joining node is considered to have failed.

View file

@ -11,16 +11,18 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NodeImageSpec defines the desired state of NodeImage.
type NodeImageSpec struct {
// NodeVersionSpec defines the desired state of NodeVersion.
type NodeVersionSpec struct {
// ImageReference is the image to use for all nodes.
ImageReference string `json:"image,omitempty"`
// ImageVersion is the CSP independent version of the image to use for all nodes.
ImageVersion string `json:"imageVersion,omitempty"`
// KubernetesComponentsReference is a reference to the ConfigMap containing the Kubernetes components to use for all nodes.
KubernetesComponentsReference string `json:"kubernetesComponentsReference,omitempty"`
}
// NodeImageStatus defines the observed state of NodeImage.
type NodeImageStatus struct {
// NodeVersionStatus defines the observed state of NodeVersion.
type NodeVersionStatus struct {
// Outdated is a list of nodes that are using an outdated image.
Outdated []corev1.ObjectReference `json:"outdated,omitempty"`
// UpToDate is a list of nodes that are using the latest image and labels.
@ -47,24 +49,24 @@ type NodeImageStatus struct {
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster
// NodeImage is the Schema for the nodeimages API.
type NodeImage struct {
// NodeVersion is the Schema for the nodeversions API.
type NodeVersion struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec NodeImageSpec `json:"spec,omitempty"`
Status NodeImageStatus `json:"status,omitempty"`
Spec NodeVersionSpec `json:"spec,omitempty"`
Status NodeVersionStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// NodeImageList contains a list of NodeImage.
type NodeImageList struct {
// NodeVersionList contains a list of NodeVersion.
type NodeVersionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []NodeImage `json:"items"`
Items []NodeVersion `json:"items"`
}
func init() {
SchemeBuilder.Register(&NodeImage{}, &NodeImageList{})
SchemeBuilder.Register(&NodeVersion{}, &NodeVersionList{})
}

View file

@ -22,8 +22,8 @@ const (
// ScalingGroupSpec defines the desired state of ScalingGroup.
type ScalingGroupSpec struct {
// NodeImage is the name of the NodeImage resource.
NodeImage string `json:"nodeImage,omitempty"`
// NodeVersion is the name of the NodeVersion resource.
NodeVersion string `json:"nodeImage,omitempty"`
// GroupID is the CSP specific, canonical identifier of a scaling group.
GroupID string `json:"groupId,omitempty"`
// AutoscalerGroupName is name that is expected by the autoscaler.

View file

@ -201,7 +201,7 @@ func (in *JoiningNodeStatus) DeepCopy() *JoiningNodeStatus {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeImage) DeepCopyInto(out *NodeImage) {
func (in *NodeVersion) DeepCopyInto(out *NodeVersion) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
@ -209,18 +209,18 @@ func (in *NodeImage) DeepCopyInto(out *NodeImage) {
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeImage.
func (in *NodeImage) DeepCopy() *NodeImage {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeVersion.
func (in *NodeVersion) DeepCopy() *NodeVersion {
if in == nil {
return nil
}
out := new(NodeImage)
out := new(NodeVersion)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *NodeImage) DeepCopyObject() runtime.Object {
func (in *NodeVersion) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
@ -228,31 +228,31 @@ func (in *NodeImage) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeImageList) DeepCopyInto(out *NodeImageList) {
func (in *NodeVersionList) DeepCopyInto(out *NodeVersionList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]NodeImage, len(*in))
*out = make([]NodeVersion, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeImageList.
func (in *NodeImageList) DeepCopy() *NodeImageList {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeVersionList.
func (in *NodeVersionList) DeepCopy() *NodeVersionList {
if in == nil {
return nil
}
out := new(NodeImageList)
out := new(NodeVersionList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *NodeImageList) DeepCopyObject() runtime.Object {
func (in *NodeVersionList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
@ -260,22 +260,22 @@ func (in *NodeImageList) DeepCopyObject() runtime.Object {
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeImageSpec) DeepCopyInto(out *NodeImageSpec) {
func (in *NodeVersionSpec) DeepCopyInto(out *NodeVersionSpec) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeImageSpec.
func (in *NodeImageSpec) DeepCopy() *NodeImageSpec {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeVersionSpec.
func (in *NodeVersionSpec) DeepCopy() *NodeVersionSpec {
if in == nil {
return nil
}
out := new(NodeImageSpec)
out := new(NodeVersionSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeImageStatus) DeepCopyInto(out *NodeImageStatus) {
func (in *NodeVersionStatus) DeepCopyInto(out *NodeVersionStatus) {
*out = *in
if in.Outdated != nil {
in, out := &in.Outdated, &out.Outdated
@ -326,12 +326,12 @@ func (in *NodeImageStatus) DeepCopyInto(out *NodeImageStatus) {
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeImageStatus.
func (in *NodeImageStatus) DeepCopy() *NodeImageStatus {
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeVersionStatus.
func (in *NodeVersionStatus) DeepCopy() *NodeVersionStatus {
if in == nil {
return nil
}
out := new(NodeImageStatus)
out := new(NodeVersionStatus)
in.DeepCopyInto(out)
return out
}