[node operator] controller client doubles

Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
Malte Poll 2022-06-29 09:43:10 +02:00 committed by Malte Poll
parent daf236975f
commit 9e1cb8ec47
7 changed files with 1014 additions and 89 deletions

View file

@ -2,25 +2,38 @@
package v1alpha1
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// NodeImageSpec defines the desired state of NodeImage
type NodeImageSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
// Foo is an example field of NodeImage. Edit nodeimage_types.go to remove/update
Foo string `json:"foo,omitempty"`
// ImageReference is the image to use for all nodes.
ImageReference string `json:"image,omitempty"`
}
// NodeImageStatus defines the observed state of NodeImage
type NodeImageStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// 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.
UpToDate []corev1.ObjectReference `json:"upToDate,omitempty"`
// Donors is a list of outdated nodes that donate labels to heirs.
Donors []corev1.ObjectReference `json:"donors,omitempty"`
// Heirs is a list of nodes using the latest image that still need to inherit labels from donors.
Heirs []corev1.ObjectReference `json:"heirs,omitempty"`
// Mints is a list of up to date nodes that will become heirs.
Mints []corev1.ObjectReference `json:"mints,omitempty"`
// Pending is a list of pending nodes (joining or leaving the cluster).
Pending []corev1.ObjectReference `json:"pending,omitempty"`
// Obsolete is a list of obsolete nodes (nodes that have been created by the operator but are no longer needed).
Obsolete []corev1.ObjectReference `json:"obsolete,omitempty"`
// Invalid is a list of invalid nodes (nodes that cannot be processed by the operator due to missing information or transient faults).
Invalid []corev1.ObjectReference `json:"invalid,omitempty"`
// Budget is the amount of extra nodes that can be created as replacements for outdated nodes.
Budget uint32 `json:"budget"`
// Conditions represent the latest available observations of an object's state
Conditions []metav1.Condition `json:"conditions"`
}
//+kubebuilder:object:root=true

View file

@ -7,6 +7,8 @@
package v1alpha1
import (
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
@ -105,7 +107,7 @@ func (in *NodeImage) DeepCopyInto(out *NodeImage) {
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
out.Spec = in.Spec
out.Status = in.Status
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeImage.
@ -176,6 +178,53 @@ func (in *NodeImageSpec) DeepCopy() *NodeImageSpec {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeImageStatus) DeepCopyInto(out *NodeImageStatus) {
*out = *in
if in.Outdated != nil {
in, out := &in.Outdated, &out.Outdated
*out = make([]v1.ObjectReference, len(*in))
copy(*out, *in)
}
if in.UpToDate != nil {
in, out := &in.UpToDate, &out.UpToDate
*out = make([]v1.ObjectReference, len(*in))
copy(*out, *in)
}
if in.Donors != nil {
in, out := &in.Donors, &out.Donors
*out = make([]v1.ObjectReference, len(*in))
copy(*out, *in)
}
if in.Heirs != nil {
in, out := &in.Heirs, &out.Heirs
*out = make([]v1.ObjectReference, len(*in))
copy(*out, *in)
}
if in.Mints != nil {
in, out := &in.Mints, &out.Mints
*out = make([]v1.ObjectReference, len(*in))
copy(*out, *in)
}
if in.Pending != nil {
in, out := &in.Pending, &out.Pending
*out = make([]v1.ObjectReference, len(*in))
copy(*out, *in)
}
if in.Obsolete != nil {
in, out := &in.Obsolete, &out.Obsolete
*out = make([]v1.ObjectReference, len(*in))
copy(*out, *in)
}
if in.Invalid != nil {
in, out := &in.Invalid, &out.Invalid
*out = make([]v1.ObjectReference, len(*in))
copy(*out, *in)
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]metav1.Condition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeImageStatus.