diff --git a/.typos.toml b/.typos.toml index b88a671..998b0b3 100644 --- a/.typos.toml +++ b/.typos.toml @@ -3,6 +3,8 @@ # SPDX-License-Identifier: Apache-2.0 [default.extend-words] +# Standard Kubernetes label selector wording in generated CRD YAML +ANDed = "ANDed" [files] diff --git a/api/v1/hypervisor_config_override_types.go b/api/v1/hypervisor_config_override_types.go new file mode 100644 index 0000000..b8a2b42 --- /dev/null +++ b/api/v1/hypervisor_config_override_types.go @@ -0,0 +1,76 @@ +/* +SPDX-FileCopyrightText: Copyright 2024 SAP SE or an SAP affiliate company and cobaltcore-dev contributors +SPDX-License-Identifier: Apache-2.0 + +Licensed under the Apache License, LibVirtVersion 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. +// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster +// Important: Run "make" to regenerate code after modifying this file + +// HypervisorConfigOverrideSpec overrides the desired state of Hypervisor +type HypervisorConfigOverrideSpec struct { + // Reason describes the reason for the override + Reason string `json:"reason"` + Override HypervisorConfigSpec `json:"override"` +} + +// HypervisorConfigOverrideStatus defines the observed state of HypervisorConfigOverride +type HypervisorConfigOverrideStatus struct { + // Represents the Hypervisor node conditions. + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + SpecHash string `json:"specHash,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,shortName=hvco +// +kubebuilder:printcolumn:JSONPath=".spec.reason",name="Reason",type="string" +// +kubebuilder:printcolumn:JSONPath=".spec.override.lifecycleEnabled",name="Lifecycle",type="boolean" +// +kubebuilder:printcolumn:JSONPath=".spec.override.highAvailability",name="High Availability",type="boolean" +// +kubebuilder:printcolumn:JSONPath=".spec.override.skipTests",name="Skip Tests",type="boolean" +// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type="date" + +// HypervisorConfigOverride is the Schema for overriding the config of one hypervisor crd API +type HypervisorConfigOverride struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec HypervisorConfigOverrideSpec `json:"spec,omitempty"` + Status HypervisorConfigOverrideStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// HypervisorConfigOverrideList contains a list of HypervisorConfigOverride +type HypervisorConfigOverrideList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []HypervisorConfigOverride `json:"items"` +} + +func init() { + SchemeBuilder.Register(func(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(GroupVersion, &HypervisorConfigOverride{}, &HypervisorConfigOverrideList{}) + return nil + }) +} diff --git a/api/v1/hypervisor_config_set_types.go b/api/v1/hypervisor_config_set_types.go new file mode 100644 index 0000000..269f045 --- /dev/null +++ b/api/v1/hypervisor_config_set_types.go @@ -0,0 +1,124 @@ +/* +SPDX-FileCopyrightText: Copyright 2024 SAP SE or an SAP affiliate company and cobaltcore-dev contributors +SPDX-License-Identifier: Apache-2.0 + +Licensed under the Apache License, LibVirtVersion 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" +) + +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. +// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster +// Important: Run "make" to regenerate code after modifying this file + +// HypervisorConfigOverrideSpec overrides the desired state of Hypervisor +type HypervisorConfigSetSpec struct { + Selector *metav1.LabelSelector `json:"selector"` + Template HypervisorConfigSetTemplate `json:"template"` +} + +// HypervisorConfigSpec defines (in parts) the desired state of Hypervisor +type HypervisorConfigSpec struct { + // +kubebuilder:validation:Optional + // OperatingSystemVersion represents the desired operating system version. + OperatingSystemVersion *string `json:"version,omitempty"` + + // +kubebuilder:validation:Optional + // Reboot request an reboot after successful installation of an upgrade. + Reboot *bool `json:"reboot,omitempty"` + + // +kubebuilder:validation:Optional + // EvacuateOnReboot request an evacuation of all instances before reboot. + EvacuateOnReboot *bool `json:"evacuateOnReboot,omitempty"` + + // +kubebuilder:optional + // LifecycleEnabled enables the lifecycle management of the hypervisor via hypervisor-operator. + LifecycleEnabled *bool `json:"lifecycleEnabled,omitempty"` + + // +kubebuilder:validation:Optional + // SkipTests skips the tests during the onboarding process. + SkipTests *bool `json:"skipTests,omitempty"` + + // +kubebuilder:optional + // CustomTraits are used to apply custom traits to the hypervisor. + CustomTraits *[]string `json:"customTraits,omitempty"` + + // +kubebuilder:optional + // Aggregates are used to apply aggregates to the hypervisor. + Aggregates *[]string `json:"aggregates,omitempty"` + + // +kubebuilder:optional + // HighAvailability is used to enable the high availability handling of the hypervisor. + HighAvailability *bool `json:"highAvailability,omitempty"` + + // +kubebuilder:optional + // Require to issue a certificate from cert-manager for the hypervisor, to be used for + // secure communication with the libvirt API. + CreateCertManagerCertificate *bool `json:"createCertManagerCertificate,omitempty"` + + // +kubebuilder:optional + // InstallCertificate is used to enable the installations of the certificates via kvm-node-agent. + InstallCertificate *bool `json:"installCertificate,omitempty"` + + // +kubebuilder:optional + // +kubebuilder:validation:Enum:="";manual;auto;ha + // Maintenance indicates whether the hypervisor is in maintenance mode. + Maintenance *string `json:"maintenance,omitempty"` +} + +// A template for the hypervisor defining the values for a whole set +type HypervisorConfigSetTemplate struct { + Spec HypervisorConfigSpec `json:"spec"` +} + +// HypervisorConfigSetStatus defines the observed state of HypervisorConfigSet +type HypervisorConfigSetStatus struct { + // Represents the Hypervisor node conditions. + Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` + + SpecHash string `json:"specHash,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,shortName=hvcs +// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type="date" + +// HypervisorConfigSet is the Schema for a set of hypervisor configs +type HypervisorConfigSet struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec HypervisorConfigSetSpec `json:"spec,omitempty"` + Status HypervisorConfigSetStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true +// HypervisorConfigSetList contains a list of HypervisorConfigSet +type HypervisorConfigSetList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []HypervisorConfigSet `json:"items"` +} + +func init() { + SchemeBuilder.Register(func(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(GroupVersion, &HypervisorConfigSet{}, &HypervisorConfigSetList{}) + return nil + }) +} diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index e4cf7c7..a6001a1 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -322,6 +322,299 @@ func (in *Hypervisor) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigOverride) DeepCopyInto(out *HypervisorConfigOverride) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HypervisorConfigOverride. +func (in *HypervisorConfigOverride) DeepCopy() *HypervisorConfigOverride { + if in == nil { + return nil + } + out := new(HypervisorConfigOverride) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HypervisorConfigOverride) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigOverrideList) DeepCopyInto(out *HypervisorConfigOverrideList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HypervisorConfigOverride, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HypervisorConfigOverrideList. +func (in *HypervisorConfigOverrideList) DeepCopy() *HypervisorConfigOverrideList { + if in == nil { + return nil + } + out := new(HypervisorConfigOverrideList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HypervisorConfigOverrideList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigOverrideSpec) DeepCopyInto(out *HypervisorConfigOverrideSpec) { + *out = *in + in.Override.DeepCopyInto(&out.Override) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HypervisorConfigOverrideSpec. +func (in *HypervisorConfigOverrideSpec) DeepCopy() *HypervisorConfigOverrideSpec { + if in == nil { + return nil + } + out := new(HypervisorConfigOverrideSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigOverrideStatus) DeepCopyInto(out *HypervisorConfigOverrideStatus) { + *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 HypervisorConfigOverrideStatus. +func (in *HypervisorConfigOverrideStatus) DeepCopy() *HypervisorConfigOverrideStatus { + if in == nil { + return nil + } + out := new(HypervisorConfigOverrideStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigSet) DeepCopyInto(out *HypervisorConfigSet) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HypervisorConfigSet. +func (in *HypervisorConfigSet) DeepCopy() *HypervisorConfigSet { + if in == nil { + return nil + } + out := new(HypervisorConfigSet) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HypervisorConfigSet) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigSetList) DeepCopyInto(out *HypervisorConfigSetList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]HypervisorConfigSet, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HypervisorConfigSetList. +func (in *HypervisorConfigSetList) DeepCopy() *HypervisorConfigSetList { + if in == nil { + return nil + } + out := new(HypervisorConfigSetList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *HypervisorConfigSetList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigSetSpec) DeepCopyInto(out *HypervisorConfigSetSpec) { + *out = *in + if in.Selector != nil { + in, out := &in.Selector, &out.Selector + *out = new(metav1.LabelSelector) + (*in).DeepCopyInto(*out) + } + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HypervisorConfigSetSpec. +func (in *HypervisorConfigSetSpec) DeepCopy() *HypervisorConfigSetSpec { + if in == nil { + return nil + } + out := new(HypervisorConfigSetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigSetStatus) DeepCopyInto(out *HypervisorConfigSetStatus) { + *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 HypervisorConfigSetStatus. +func (in *HypervisorConfigSetStatus) DeepCopy() *HypervisorConfigSetStatus { + if in == nil { + return nil + } + out := new(HypervisorConfigSetStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigSetTemplate) DeepCopyInto(out *HypervisorConfigSetTemplate) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HypervisorConfigSetTemplate. +func (in *HypervisorConfigSetTemplate) DeepCopy() *HypervisorConfigSetTemplate { + if in == nil { + return nil + } + out := new(HypervisorConfigSetTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *HypervisorConfigSpec) DeepCopyInto(out *HypervisorConfigSpec) { + *out = *in + if in.OperatingSystemVersion != nil { + in, out := &in.OperatingSystemVersion, &out.OperatingSystemVersion + *out = new(string) + **out = **in + } + if in.Reboot != nil { + in, out := &in.Reboot, &out.Reboot + *out = new(bool) + **out = **in + } + if in.EvacuateOnReboot != nil { + in, out := &in.EvacuateOnReboot, &out.EvacuateOnReboot + *out = new(bool) + **out = **in + } + if in.LifecycleEnabled != nil { + in, out := &in.LifecycleEnabled, &out.LifecycleEnabled + *out = new(bool) + **out = **in + } + if in.SkipTests != nil { + in, out := &in.SkipTests, &out.SkipTests + *out = new(bool) + **out = **in + } + if in.CustomTraits != nil { + in, out := &in.CustomTraits, &out.CustomTraits + *out = new([]string) + if **in != nil { + in, out := *in, *out + *out = make([]string, len(*in)) + copy(*out, *in) + } + } + if in.Aggregates != nil { + in, out := &in.Aggregates, &out.Aggregates + *out = new([]string) + if **in != nil { + in, out := *in, *out + *out = make([]string, len(*in)) + copy(*out, *in) + } + } + if in.HighAvailability != nil { + in, out := &in.HighAvailability, &out.HighAvailability + *out = new(bool) + **out = **in + } + if in.CreateCertManagerCertificate != nil { + in, out := &in.CreateCertManagerCertificate, &out.CreateCertManagerCertificate + *out = new(bool) + **out = **in + } + if in.InstallCertificate != nil { + in, out := &in.InstallCertificate, &out.InstallCertificate + *out = new(bool) + **out = **in + } + if in.Maintenance != nil { + in, out := &in.Maintenance, &out.Maintenance + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HypervisorConfigSpec. +func (in *HypervisorConfigSpec) DeepCopy() *HypervisorConfigSpec { + if in == nil { + return nil + } + out := new(HypervisorConfigSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *HypervisorList) DeepCopyInto(out *HypervisorList) { *out = *in diff --git a/applyconfigurations/api/v1/hypervisorconfigoverride.go b/applyconfigurations/api/v1/hypervisorconfigoverride.go new file mode 100644 index 0000000..ca66e97 --- /dev/null +++ b/applyconfigurations/api/v1/hypervisorconfigoverride.go @@ -0,0 +1,271 @@ +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + apiv1 "github.com/cobaltcore-dev/openstack-hypervisor-operator/api/v1" + internal "github.com/cobaltcore-dev/openstack-hypervisor-operator/applyconfigurations/internal" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// HypervisorConfigOverrideApplyConfiguration represents a declarative configuration of the HypervisorConfigOverride type for use +// with apply. +// +// HypervisorConfigOverride is the Schema for overriding the config of one hypervisor crd API +type HypervisorConfigOverrideApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:",inline"` + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *HypervisorConfigOverrideSpecApplyConfiguration `json:"spec,omitempty"` + Status *HypervisorConfigOverrideStatusApplyConfiguration `json:"status,omitempty"` +} + +// HypervisorConfigOverride constructs a declarative configuration of the HypervisorConfigOverride type for use with +// apply. +func HypervisorConfigOverride(name string) *HypervisorConfigOverrideApplyConfiguration { + b := &HypervisorConfigOverrideApplyConfiguration{} + b.WithName(name) + b.WithKind("HypervisorConfigOverride") + b.WithAPIVersion("kvm.cloud.sap/v1") + return b +} + +// ExtractHypervisorConfigOverrideFrom extracts the applied configuration owned by fieldManager from +// hypervisorConfigOverride for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// hypervisorConfigOverride must be a unmodified HypervisorConfigOverride API object that was retrieved from the Kubernetes API. +// ExtractHypervisorConfigOverrideFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractHypervisorConfigOverrideFrom(hypervisorConfigOverride *apiv1.HypervisorConfigOverride, fieldManager string, subresource string) (*HypervisorConfigOverrideApplyConfiguration, error) { + b := &HypervisorConfigOverrideApplyConfiguration{} + err := managedfields.ExtractInto(hypervisorConfigOverride, internal.Parser().Type("com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigOverride"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(hypervisorConfigOverride.Name) + + b.WithKind("HypervisorConfigOverride") + b.WithAPIVersion("kvm.cloud.sap/v1") + return b, nil +} + +// ExtractHypervisorConfigOverride extracts the applied configuration owned by fieldManager from +// hypervisorConfigOverride. If no managedFields are found in hypervisorConfigOverride for fieldManager, a +// HypervisorConfigOverrideApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// hypervisorConfigOverride must be a unmodified HypervisorConfigOverride API object that was retrieved from the Kubernetes API. +// ExtractHypervisorConfigOverride provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractHypervisorConfigOverride(hypervisorConfigOverride *apiv1.HypervisorConfigOverride, fieldManager string) (*HypervisorConfigOverrideApplyConfiguration, error) { + return ExtractHypervisorConfigOverrideFrom(hypervisorConfigOverride, fieldManager, "") +} + +// ExtractHypervisorConfigOverrideStatus extracts the applied configuration owned by fieldManager from +// hypervisorConfigOverride for the status subresource. +func ExtractHypervisorConfigOverrideStatus(hypervisorConfigOverride *apiv1.HypervisorConfigOverride, fieldManager string) (*HypervisorConfigOverrideApplyConfiguration, error) { + return ExtractHypervisorConfigOverrideFrom(hypervisorConfigOverride, fieldManager, "status") +} + +func (b HypervisorConfigOverrideApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithKind(value string) *HypervisorConfigOverrideApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithAPIVersion(value string) *HypervisorConfigOverrideApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithName(value string) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithGenerateName(value string) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithNamespace(value string) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithUID(value types.UID) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithResourceVersion(value string) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithGeneration(value int64) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *HypervisorConfigOverrideApplyConfiguration) WithLabels(entries map[string]string) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *HypervisorConfigOverrideApplyConfiguration) WithAnnotations(entries map[string]string) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *HypervisorConfigOverrideApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *HypervisorConfigOverrideApplyConfiguration) WithFinalizers(values ...string) *HypervisorConfigOverrideApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *HypervisorConfigOverrideApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithSpec(value *HypervisorConfigOverrideSpecApplyConfiguration) *HypervisorConfigOverrideApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *HypervisorConfigOverrideApplyConfiguration) WithStatus(value *HypervisorConfigOverrideStatusApplyConfiguration) *HypervisorConfigOverrideApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *HypervisorConfigOverrideApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *HypervisorConfigOverrideApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *HypervisorConfigOverrideApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *HypervisorConfigOverrideApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/applyconfigurations/api/v1/hypervisorconfigoverridespec.go b/applyconfigurations/api/v1/hypervisorconfigoverridespec.go new file mode 100644 index 0000000..919a115 --- /dev/null +++ b/applyconfigurations/api/v1/hypervisorconfigoverridespec.go @@ -0,0 +1,38 @@ +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// HypervisorConfigOverrideSpecApplyConfiguration represents a declarative configuration of the HypervisorConfigOverrideSpec type for use +// with apply. +// +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. +// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster +// Important: Run "make" to regenerate code after modifying this file +// HypervisorConfigOverrideSpec overrides the desired state of Hypervisor +type HypervisorConfigOverrideSpecApplyConfiguration struct { + // Reason describes the reason for the override + Reason *string `json:"reason,omitempty"` + Override *HypervisorConfigSpecApplyConfiguration `json:"override,omitempty"` +} + +// HypervisorConfigOverrideSpecApplyConfiguration constructs a declarative configuration of the HypervisorConfigOverrideSpec type for use with +// apply. +func HypervisorConfigOverrideSpec() *HypervisorConfigOverrideSpecApplyConfiguration { + return &HypervisorConfigOverrideSpecApplyConfiguration{} +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *HypervisorConfigOverrideSpecApplyConfiguration) WithReason(value string) *HypervisorConfigOverrideSpecApplyConfiguration { + b.Reason = &value + return b +} + +// WithOverride sets the Override field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Override field is set to the value of the last call. +func (b *HypervisorConfigOverrideSpecApplyConfiguration) WithOverride(value *HypervisorConfigSpecApplyConfiguration) *HypervisorConfigOverrideSpecApplyConfiguration { + b.Override = value + return b +} diff --git a/applyconfigurations/api/v1/hypervisorconfigoverridestatus.go b/applyconfigurations/api/v1/hypervisorconfigoverridestatus.go new file mode 100644 index 0000000..14fde1d --- /dev/null +++ b/applyconfigurations/api/v1/hypervisorconfigoverridestatus.go @@ -0,0 +1,44 @@ +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// HypervisorConfigOverrideStatusApplyConfiguration represents a declarative configuration of the HypervisorConfigOverrideStatus type for use +// with apply. +// +// HypervisorConfigOverrideStatus defines the observed state of HypervisorConfigOverride +type HypervisorConfigOverrideStatusApplyConfiguration struct { + // Represents the Hypervisor node conditions. + Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` + SpecHash *string `json:"specHash,omitempty"` +} + +// HypervisorConfigOverrideStatusApplyConfiguration constructs a declarative configuration of the HypervisorConfigOverrideStatus type for use with +// apply. +func HypervisorConfigOverrideStatus() *HypervisorConfigOverrideStatusApplyConfiguration { + return &HypervisorConfigOverrideStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *HypervisorConfigOverrideStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *HypervisorConfigOverrideStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithSpecHash sets the SpecHash field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SpecHash field is set to the value of the last call. +func (b *HypervisorConfigOverrideStatusApplyConfiguration) WithSpecHash(value string) *HypervisorConfigOverrideStatusApplyConfiguration { + b.SpecHash = &value + return b +} diff --git a/applyconfigurations/api/v1/hypervisorconfigset.go b/applyconfigurations/api/v1/hypervisorconfigset.go new file mode 100644 index 0000000..004abd7 --- /dev/null +++ b/applyconfigurations/api/v1/hypervisorconfigset.go @@ -0,0 +1,271 @@ +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + apiv1 "github.com/cobaltcore-dev/openstack-hypervisor-operator/api/v1" + internal "github.com/cobaltcore-dev/openstack-hypervisor-operator/applyconfigurations/internal" + apismetav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// HypervisorConfigSetApplyConfiguration represents a declarative configuration of the HypervisorConfigSet type for use +// with apply. +// +// HypervisorConfigSet is the Schema for a set of hypervisor configs +type HypervisorConfigSetApplyConfiguration struct { + metav1.TypeMetaApplyConfiguration `json:",inline"` + *metav1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *HypervisorConfigSetSpecApplyConfiguration `json:"spec,omitempty"` + Status *HypervisorConfigSetStatusApplyConfiguration `json:"status,omitempty"` +} + +// HypervisorConfigSet constructs a declarative configuration of the HypervisorConfigSet type for use with +// apply. +func HypervisorConfigSet(name string) *HypervisorConfigSetApplyConfiguration { + b := &HypervisorConfigSetApplyConfiguration{} + b.WithName(name) + b.WithKind("HypervisorConfigSet") + b.WithAPIVersion("kvm.cloud.sap/v1") + return b +} + +// ExtractHypervisorConfigSetFrom extracts the applied configuration owned by fieldManager from +// hypervisorConfigSet for the specified subresource. Pass an empty string for subresource to extract +// the main resource. Common subresources include "status", "scale", etc. +// hypervisorConfigSet must be a unmodified HypervisorConfigSet API object that was retrieved from the Kubernetes API. +// ExtractHypervisorConfigSetFrom provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractHypervisorConfigSetFrom(hypervisorConfigSet *apiv1.HypervisorConfigSet, fieldManager string, subresource string) (*HypervisorConfigSetApplyConfiguration, error) { + b := &HypervisorConfigSetApplyConfiguration{} + err := managedfields.ExtractInto(hypervisorConfigSet, internal.Parser().Type("com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSet"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(hypervisorConfigSet.Name) + + b.WithKind("HypervisorConfigSet") + b.WithAPIVersion("kvm.cloud.sap/v1") + return b, nil +} + +// ExtractHypervisorConfigSet extracts the applied configuration owned by fieldManager from +// hypervisorConfigSet. If no managedFields are found in hypervisorConfigSet for fieldManager, a +// HypervisorConfigSetApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// hypervisorConfigSet must be a unmodified HypervisorConfigSet API object that was retrieved from the Kubernetes API. +// ExtractHypervisorConfigSet provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +func ExtractHypervisorConfigSet(hypervisorConfigSet *apiv1.HypervisorConfigSet, fieldManager string) (*HypervisorConfigSetApplyConfiguration, error) { + return ExtractHypervisorConfigSetFrom(hypervisorConfigSet, fieldManager, "") +} + +// ExtractHypervisorConfigSetStatus extracts the applied configuration owned by fieldManager from +// hypervisorConfigSet for the status subresource. +func ExtractHypervisorConfigSetStatus(hypervisorConfigSet *apiv1.HypervisorConfigSet, fieldManager string) (*HypervisorConfigSetApplyConfiguration, error) { + return ExtractHypervisorConfigSetFrom(hypervisorConfigSet, fieldManager, "status") +} + +func (b HypervisorConfigSetApplyConfiguration) IsApplyConfiguration() {} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithKind(value string) *HypervisorConfigSetApplyConfiguration { + b.TypeMetaApplyConfiguration.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithAPIVersion(value string) *HypervisorConfigSetApplyConfiguration { + b.TypeMetaApplyConfiguration.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithName(value string) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithGenerateName(value string) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithNamespace(value string) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithUID(value types.UID) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithResourceVersion(value string) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithGeneration(value int64) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithCreationTimestamp(value apismetav1.Time) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithDeletionTimestamp(value apismetav1.Time) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *HypervisorConfigSetApplyConfiguration) WithLabels(entries map[string]string) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *HypervisorConfigSetApplyConfiguration) WithAnnotations(entries map[string]string) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 { + b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.ObjectMetaApplyConfiguration.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *HypervisorConfigSetApplyConfiguration) WithOwnerReferences(values ...*metav1.OwnerReferenceApplyConfiguration) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *HypervisorConfigSetApplyConfiguration) WithFinalizers(values ...string) *HypervisorConfigSetApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i]) + } + return b +} + +func (b *HypervisorConfigSetApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &metav1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithSpec(value *HypervisorConfigSetSpecApplyConfiguration) *HypervisorConfigSetApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *HypervisorConfigSetApplyConfiguration) WithStatus(value *HypervisorConfigSetStatusApplyConfiguration) *HypervisorConfigSetApplyConfiguration { + b.Status = value + return b +} + +// GetKind retrieves the value of the Kind field in the declarative configuration. +func (b *HypervisorConfigSetApplyConfiguration) GetKind() *string { + return b.TypeMetaApplyConfiguration.Kind +} + +// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration. +func (b *HypervisorConfigSetApplyConfiguration) GetAPIVersion() *string { + return b.TypeMetaApplyConfiguration.APIVersion +} + +// GetName retrieves the value of the Name field in the declarative configuration. +func (b *HypervisorConfigSetApplyConfiguration) GetName() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Name +} + +// GetNamespace retrieves the value of the Namespace field in the declarative configuration. +func (b *HypervisorConfigSetApplyConfiguration) GetNamespace() *string { + b.ensureObjectMetaApplyConfigurationExists() + return b.ObjectMetaApplyConfiguration.Namespace +} diff --git a/applyconfigurations/api/v1/hypervisorconfigsetspec.go b/applyconfigurations/api/v1/hypervisorconfigsetspec.go new file mode 100644 index 0000000..8ff5145 --- /dev/null +++ b/applyconfigurations/api/v1/hypervisorconfigsetspec.go @@ -0,0 +1,41 @@ +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// HypervisorConfigSetSpecApplyConfiguration represents a declarative configuration of the HypervisorConfigSetSpec type for use +// with apply. +// +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. +// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster +// Important: Run "make" to regenerate code after modifying this file +// HypervisorConfigOverrideSpec overrides the desired state of Hypervisor +type HypervisorConfigSetSpecApplyConfiguration struct { + Selector *metav1.LabelSelectorApplyConfiguration `json:"selector,omitempty"` + Template *HypervisorConfigSetTemplateApplyConfiguration `json:"template,omitempty"` +} + +// HypervisorConfigSetSpecApplyConfiguration constructs a declarative configuration of the HypervisorConfigSetSpec type for use with +// apply. +func HypervisorConfigSetSpec() *HypervisorConfigSetSpecApplyConfiguration { + return &HypervisorConfigSetSpecApplyConfiguration{} +} + +// WithSelector sets the Selector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Selector field is set to the value of the last call. +func (b *HypervisorConfigSetSpecApplyConfiguration) WithSelector(value *metav1.LabelSelectorApplyConfiguration) *HypervisorConfigSetSpecApplyConfiguration { + b.Selector = value + return b +} + +// WithTemplate sets the Template field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Template field is set to the value of the last call. +func (b *HypervisorConfigSetSpecApplyConfiguration) WithTemplate(value *HypervisorConfigSetTemplateApplyConfiguration) *HypervisorConfigSetSpecApplyConfiguration { + b.Template = value + return b +} diff --git a/applyconfigurations/api/v1/hypervisorconfigsetstatus.go b/applyconfigurations/api/v1/hypervisorconfigsetstatus.go new file mode 100644 index 0000000..2210e14 --- /dev/null +++ b/applyconfigurations/api/v1/hypervisorconfigsetstatus.go @@ -0,0 +1,44 @@ +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +import ( + metav1 "k8s.io/client-go/applyconfigurations/meta/v1" +) + +// HypervisorConfigSetStatusApplyConfiguration represents a declarative configuration of the HypervisorConfigSetStatus type for use +// with apply. +// +// HypervisorConfigSetStatus defines the observed state of HypervisorConfigSet +type HypervisorConfigSetStatusApplyConfiguration struct { + // Represents the Hypervisor node conditions. + Conditions []metav1.ConditionApplyConfiguration `json:"conditions,omitempty"` + SpecHash *string `json:"specHash,omitempty"` +} + +// HypervisorConfigSetStatusApplyConfiguration constructs a declarative configuration of the HypervisorConfigSetStatus type for use with +// apply. +func HypervisorConfigSetStatus() *HypervisorConfigSetStatusApplyConfiguration { + return &HypervisorConfigSetStatusApplyConfiguration{} +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *HypervisorConfigSetStatusApplyConfiguration) WithConditions(values ...*metav1.ConditionApplyConfiguration) *HypervisorConfigSetStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithSpecHash sets the SpecHash field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SpecHash field is set to the value of the last call. +func (b *HypervisorConfigSetStatusApplyConfiguration) WithSpecHash(value string) *HypervisorConfigSetStatusApplyConfiguration { + b.SpecHash = &value + return b +} diff --git a/applyconfigurations/api/v1/hypervisorconfigsettemplate.go b/applyconfigurations/api/v1/hypervisorconfigsettemplate.go new file mode 100644 index 0000000..3603ccc --- /dev/null +++ b/applyconfigurations/api/v1/hypervisorconfigsettemplate.go @@ -0,0 +1,25 @@ +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// HypervisorConfigSetTemplateApplyConfiguration represents a declarative configuration of the HypervisorConfigSetTemplate type for use +// with apply. +// +// A template for the hypervisor defining the values for a whole set +type HypervisorConfigSetTemplateApplyConfiguration struct { + Spec *HypervisorConfigSpecApplyConfiguration `json:"spec,omitempty"` +} + +// HypervisorConfigSetTemplateApplyConfiguration constructs a declarative configuration of the HypervisorConfigSetTemplate type for use with +// apply. +func HypervisorConfigSetTemplate() *HypervisorConfigSetTemplateApplyConfiguration { + return &HypervisorConfigSetTemplateApplyConfiguration{} +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *HypervisorConfigSetTemplateApplyConfiguration) WithSpec(value *HypervisorConfigSpecApplyConfiguration) *HypervisorConfigSetTemplateApplyConfiguration { + b.Spec = value + return b +} diff --git a/applyconfigurations/api/v1/hypervisorconfigspec.go b/applyconfigurations/api/v1/hypervisorconfigspec.go new file mode 100644 index 0000000..495a6ce --- /dev/null +++ b/applyconfigurations/api/v1/hypervisorconfigspec.go @@ -0,0 +1,127 @@ +// Code generated by controller-gen. DO NOT EDIT. + +package v1 + +// HypervisorConfigSpecApplyConfiguration represents a declarative configuration of the HypervisorConfigSpec type for use +// with apply. +// +// HypervisorConfigSpec defines (in parts) the desired state of Hypervisor +type HypervisorConfigSpecApplyConfiguration struct { + // OperatingSystemVersion represents the desired operating system version. + OperatingSystemVersion *string `json:"version,omitempty"` + // Reboot request an reboot after successful installation of an upgrade. + Reboot *bool `json:"reboot,omitempty"` + // EvacuateOnReboot request an evacuation of all instances before reboot. + EvacuateOnReboot *bool `json:"evacuateOnReboot,omitempty"` + // LifecycleEnabled enables the lifecycle management of the hypervisor via hypervisor-operator. + LifecycleEnabled *bool `json:"lifecycleEnabled,omitempty"` + // SkipTests skips the tests during the onboarding process. + SkipTests *bool `json:"skipTests,omitempty"` + // CustomTraits are used to apply custom traits to the hypervisor. + CustomTraits *[]string `json:"customTraits,omitempty"` + // Aggregates are used to apply aggregates to the hypervisor. + Aggregates *[]string `json:"aggregates,omitempty"` + // HighAvailability is used to enable the high availability handling of the hypervisor. + HighAvailability *bool `json:"highAvailability,omitempty"` + // Require to issue a certificate from cert-manager for the hypervisor, to be used for + // secure communication with the libvirt API. + CreateCertManagerCertificate *bool `json:"createCertManagerCertificate,omitempty"` + // InstallCertificate is used to enable the installations of the certificates via kvm-node-agent. + InstallCertificate *bool `json:"installCertificate,omitempty"` + // Maintenance indicates whether the hypervisor is in maintenance mode. + Maintenance *string `json:"maintenance,omitempty"` +} + +// HypervisorConfigSpecApplyConfiguration constructs a declarative configuration of the HypervisorConfigSpec type for use with +// apply. +func HypervisorConfigSpec() *HypervisorConfigSpecApplyConfiguration { + return &HypervisorConfigSpecApplyConfiguration{} +} + +// WithOperatingSystemVersion sets the OperatingSystemVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the OperatingSystemVersion field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithOperatingSystemVersion(value string) *HypervisorConfigSpecApplyConfiguration { + b.OperatingSystemVersion = &value + return b +} + +// WithReboot sets the Reboot field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reboot field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithReboot(value bool) *HypervisorConfigSpecApplyConfiguration { + b.Reboot = &value + return b +} + +// WithEvacuateOnReboot sets the EvacuateOnReboot field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EvacuateOnReboot field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithEvacuateOnReboot(value bool) *HypervisorConfigSpecApplyConfiguration { + b.EvacuateOnReboot = &value + return b +} + +// WithLifecycleEnabled sets the LifecycleEnabled field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LifecycleEnabled field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithLifecycleEnabled(value bool) *HypervisorConfigSpecApplyConfiguration { + b.LifecycleEnabled = &value + return b +} + +// WithSkipTests sets the SkipTests field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SkipTests field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithSkipTests(value bool) *HypervisorConfigSpecApplyConfiguration { + b.SkipTests = &value + return b +} + +// WithCustomTraits sets the CustomTraits field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CustomTraits field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithCustomTraits(value []string) *HypervisorConfigSpecApplyConfiguration { + b.CustomTraits = &value + return b +} + +// WithAggregates sets the Aggregates field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Aggregates field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithAggregates(value []string) *HypervisorConfigSpecApplyConfiguration { + b.Aggregates = &value + return b +} + +// WithHighAvailability sets the HighAvailability field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the HighAvailability field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithHighAvailability(value bool) *HypervisorConfigSpecApplyConfiguration { + b.HighAvailability = &value + return b +} + +// WithCreateCertManagerCertificate sets the CreateCertManagerCertificate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreateCertManagerCertificate field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithCreateCertManagerCertificate(value bool) *HypervisorConfigSpecApplyConfiguration { + b.CreateCertManagerCertificate = &value + return b +} + +// WithInstallCertificate sets the InstallCertificate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the InstallCertificate field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithInstallCertificate(value bool) *HypervisorConfigSpecApplyConfiguration { + b.InstallCertificate = &value + return b +} + +// WithMaintenance sets the Maintenance field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Maintenance field is set to the value of the last call. +func (b *HypervisorConfigSpecApplyConfiguration) WithMaintenance(value string) *HypervisorConfigSpecApplyConfiguration { + b.Maintenance = &value + return b +} diff --git a/applyconfigurations/internal/internal.go b/applyconfigurations/internal/internal.go index 1c9d678..319fb5d 100644 --- a/applyconfigurations/internal/internal.go +++ b/applyconfigurations/internal/internal.go @@ -210,6 +210,132 @@ var schemaYAML = typed.YAMLObject(`types: - name: status type: namedType: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorStatus +- name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigOverride + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigOverrideSpec + - name: status + type: + namedType: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigOverrideStatus +- name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigOverrideSpec + map: + fields: + - name: override + type: + namedType: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSpec + - name: reason + type: + scalar: string +- name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigOverrideStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: atomic + - name: specHash + type: + scalar: string +- name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSet + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + - name: spec + type: + namedType: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSetSpec + - name: status + type: + namedType: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSetStatus +- name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSetSpec + map: + fields: + - name: selector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: template + type: + namedType: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSetTemplate +- name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSetStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition + elementRelationship: atomic + - name: specHash + type: + scalar: string +- name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSetTemplate + map: + fields: + - name: spec + type: + namedType: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSpec +- name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorConfigSpec + map: + fields: + - name: aggregates + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: createCertManagerCertificate + type: + scalar: boolean + - name: customTraits + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: evacuateOnReboot + type: + scalar: boolean + - name: highAvailability + type: + scalar: boolean + - name: installCertificate + type: + scalar: boolean + - name: lifecycleEnabled + type: + scalar: boolean + - name: maintenance + type: + scalar: string + - name: reboot + type: + scalar: boolean + - name: skipTests + type: + scalar: boolean + - name: version + type: + scalar: string - name: com.github.cobaltcore-dev.openstack-hypervisor-operator.api.v1.HypervisorSpec map: fields: @@ -485,6 +611,38 @@ var schemaYAML = typed.YAMLObject(`types: elementType: namedType: __untyped_deduced_ elementRelationship: separable +- name: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + map: + fields: + - name: matchExpressions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement + elementRelationship: atomic + - name: matchLabels + type: + map: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorOperator + scalar: string +- name: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement + map: + fields: + - name: key + type: + scalar: string + - name: operator + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorOperator + - name: values + type: + list: + elementType: + scalar: string + elementRelationship: atomic - name: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry map: fields: diff --git a/applyconfigurations/utils.go b/applyconfigurations/utils.go index 5bc0d22..d26adc0 100644 --- a/applyconfigurations/utils.go +++ b/applyconfigurations/utils.go @@ -36,6 +36,22 @@ func ForKind(kind schema.GroupVersionKind) interface{} { return &apiv1.GroupApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("Hypervisor"): return &apiv1.HypervisorApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HypervisorConfigOverride"): + return &apiv1.HypervisorConfigOverrideApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HypervisorConfigOverrideSpec"): + return &apiv1.HypervisorConfigOverrideSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HypervisorConfigOverrideStatus"): + return &apiv1.HypervisorConfigOverrideStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HypervisorConfigSet"): + return &apiv1.HypervisorConfigSetApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HypervisorConfigSetSpec"): + return &apiv1.HypervisorConfigSetSpecApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HypervisorConfigSetStatus"): + return &apiv1.HypervisorConfigSetStatusApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HypervisorConfigSetTemplate"): + return &apiv1.HypervisorConfigSetTemplateApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("HypervisorConfigSpec"): + return &apiv1.HypervisorConfigSpecApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("HypervisorSpec"): return &apiv1.HypervisorSpecApplyConfiguration{} case v1.SchemeGroupVersion.WithKind("HypervisorStatus"): diff --git a/charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_hypervisorconfigoverrides.yaml b/charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_hypervisorconfigoverrides.yaml new file mode 100644 index 0000000..7419156 --- /dev/null +++ b/charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_hypervisorconfigoverrides.yaml @@ -0,0 +1,194 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.21.0 + name: hypervisorconfigoverrides.kvm.cloud.sap +spec: + group: kvm.cloud.sap + names: + kind: HypervisorConfigOverride + listKind: HypervisorConfigOverrideList + plural: hypervisorconfigoverrides + shortNames: + - hvco + singular: hypervisorconfigoverride + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .spec.reason + name: Reason + type: string + - jsonPath: .spec.override.lifecycleEnabled + name: Lifecycle + type: boolean + - jsonPath: .spec.override.highAvailability + name: High Availability + type: boolean + - jsonPath: .spec.override.skipTests + name: Skip Tests + type: boolean + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: HypervisorConfigOverride is the Schema for overriding the config + of one hypervisor crd API + 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: HypervisorConfigOverrideSpec overrides the desired state + of Hypervisor + properties: + override: + description: HypervisorConfigSpec defines (in parts) the desired state + of Hypervisor + properties: + aggregates: + description: Aggregates are used to apply aggregates to the hypervisor. + items: + type: string + type: array + createCertManagerCertificate: + description: |- + Require to issue a certificate from cert-manager for the hypervisor, to be used for + secure communication with the libvirt API. + type: boolean + customTraits: + description: CustomTraits are used to apply custom traits to the + hypervisor. + items: + type: string + type: array + evacuateOnReboot: + description: EvacuateOnReboot request an evacuation of all instances + before reboot. + type: boolean + highAvailability: + description: HighAvailability is used to enable the high availability + handling of the hypervisor. + type: boolean + installCertificate: + description: InstallCertificate is used to enable the installations + of the certificates via kvm-node-agent. + type: boolean + lifecycleEnabled: + description: LifecycleEnabled enables the lifecycle management + of the hypervisor via hypervisor-operator. + type: boolean + maintenance: + description: Maintenance indicates whether the hypervisor is in + maintenance mode. + enum: + - "" + - manual + - auto + - ha + type: string + reboot: + description: Reboot request an reboot after successful installation + of an upgrade. + type: boolean + skipTests: + description: SkipTests skips the tests during the onboarding process. + type: boolean + version: + description: OperatingSystemVersion represents the desired operating + system version. + type: string + type: object + reason: + description: Reason describes the reason for the override + type: string + required: + - override + - reason + type: object + status: + description: HypervisorConfigOverrideStatus defines the observed state + of HypervisorConfigOverride + properties: + conditions: + description: Represents the Hypervisor node conditions. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + 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. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + 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. + format: int64 + minimum: 0 + type: integer + 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. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + 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])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + specHash: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_hypervisorconfigsets.yaml b/charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_hypervisorconfigsets.yaml new file mode 100644 index 0000000..14510b5 --- /dev/null +++ b/charts/openstack-hypervisor-operator/crds/kvm.cloud.sap_hypervisorconfigsets.yaml @@ -0,0 +1,235 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.21.0 + name: hypervisorconfigsets.kvm.cloud.sap +spec: + group: kvm.cloud.sap + names: + kind: HypervisorConfigSet + listKind: HypervisorConfigSetList + plural: hypervisorconfigsets + shortNames: + - hvcs + singular: hypervisorconfigset + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1 + schema: + openAPIV3Schema: + description: HypervisorConfigSet is the Schema for a set of hypervisor configs + 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: HypervisorConfigOverrideSpec overrides the desired state + of Hypervisor + properties: + selector: + description: |- + A label selector is a label query over a set of resources. The result of matchLabels and + matchExpressions are ANDed. An empty label selector matches all objects. A null + label selector matches no objects. + properties: + matchExpressions: + description: matchExpressions is a list of label selector requirements. + The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector applies + to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + template: + description: A template for the hypervisor defining the values for + a whole set + properties: + spec: + description: HypervisorConfigSpec defines (in parts) the desired + state of Hypervisor + properties: + aggregates: + description: Aggregates are used to apply aggregates to the + hypervisor. + items: + type: string + type: array + createCertManagerCertificate: + description: |- + Require to issue a certificate from cert-manager for the hypervisor, to be used for + secure communication with the libvirt API. + type: boolean + customTraits: + description: CustomTraits are used to apply custom traits + to the hypervisor. + items: + type: string + type: array + evacuateOnReboot: + description: EvacuateOnReboot request an evacuation of all + instances before reboot. + type: boolean + highAvailability: + description: HighAvailability is used to enable the high availability + handling of the hypervisor. + type: boolean + installCertificate: + description: InstallCertificate is used to enable the installations + of the certificates via kvm-node-agent. + type: boolean + lifecycleEnabled: + description: LifecycleEnabled enables the lifecycle management + of the hypervisor via hypervisor-operator. + type: boolean + maintenance: + description: Maintenance indicates whether the hypervisor + is in maintenance mode. + enum: + - "" + - manual + - auto + - ha + type: string + reboot: + description: Reboot request an reboot after successful installation + of an upgrade. + type: boolean + skipTests: + description: SkipTests skips the tests during the onboarding + process. + type: boolean + version: + description: OperatingSystemVersion represents the desired + operating system version. + type: string + type: object + required: + - spec + type: object + required: + - selector + - template + type: object + status: + description: HypervisorConfigSetStatus defines the observed state of HypervisorConfigSet + properties: + conditions: + description: Represents the Hypervisor node conditions. + items: + description: Condition contains details for one aspect of the current + state of this API Resource. + 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. + format: date-time + type: string + message: + description: |- + message is a human readable message indicating details about the transition. + This may be an empty string. + maxLength: 32768 + type: string + 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. + format: int64 + minimum: 0 + type: integer + 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. + maxLength: 1024 + minLength: 1 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ + type: string + status: + description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown + type: string + type: + description: type of condition in CamelCase or in foo.example.com/CamelCase. + 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])$ + type: string + required: + - lastTransitionTime + - message + - reason + - status + - type + type: object + type: array + specHash: + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/charts/openstack-hypervisor-operator/templates/role.yaml b/charts/openstack-hypervisor-operator/templates/role.yaml index 3b1ecda..e207737 100644 --- a/charts/openstack-hypervisor-operator/templates/role.yaml +++ b/charts/openstack-hypervisor-operator/templates/role.yaml @@ -76,6 +76,14 @@ rules: - get - patch - update +- apiGroups: + - kvm.cloud.sap + resources: + - hypervisorconfigoverrides + verbs: + - get + - list + - watch - apiGroups: - kvm.cloud.sap resources: diff --git a/internal/controller/hypervisor_controller.go b/internal/controller/hypervisor_controller.go index a81839b..bb116f5 100644 --- a/internal/controller/hypervisor_controller.go +++ b/internal/controller/hypervisor_controller.go @@ -78,6 +78,7 @@ type HypervisorController struct { // +kubebuilder:rbac:groups="",resources=pods,verbs=list // +kubebuilder:rbac:groups=kvm.cloud.sap,resources=hypervisors,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=kvm.cloud.sap,resources=hypervisors/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=kvm.cloud.sap,resources=hypervisorconfigoverrides,verbs=get;list;watch func (hv *HypervisorController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { log := logger.FromContext(ctx).WithName(req.Name)