Skip to content

Commit d27d392

Browse files
committed
WIP
1 parent 016c808 commit d27d392

17 files changed

Lines changed: 1757 additions & 6 deletions
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*
2+
SPDX-FileCopyrightText: Copyright 2024 SAP SE or an SAP affiliate company and cobaltcore-dev contributors
3+
SPDX-License-Identifier: Apache-2.0
4+
5+
Licensed under the Apache License, LibVirtVersion 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package v1
19+
20+
import (
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
)
23+
24+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
26+
// Important: Run "make" to regenerate code after modifying this file
27+
28+
// HypervisorConfigOverrideSpec overrides the desired state of Hypervisor
29+
type HypervisorConfigOverrideSpec struct {
30+
// Reason describes the reason for the override
31+
Reason string `json:"reason"`
32+
Override HypervisorConfigSpec `json:"override"`
33+
}
34+
35+
// HypervisorConfigOverrideStatus defines the observed state of HypervisorConfigOverride
36+
type HypervisorConfigOverrideStatus struct {
37+
// Represents the Hypervisor node conditions.
38+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
39+
40+
SpecHash string `json:"specHash,omitempty"`
41+
}
42+
43+
// +kubebuilder:object:root=true
44+
// +kubebuilder:subresource:status
45+
// +kubebuilder:resource:scope=Cluster,shortName=hvco
46+
// +kubebuilder:printcolumn:JSONPath=".spec.reason",name="Reason",type="string"
47+
// +kubebuilder:printcolumn:JSONPath=".spec.override.lifecycleEnabled",name="Lifecycle",type="boolean"
48+
// +kubebuilder:printcolumn:JSONPath=".spec.override.highAvailability",name="High Availability",type="boolean"
49+
// +kubebuilder:printcolumn:JSONPath=".spec.override.skipTests",name="Skip Tests",type="boolean"
50+
// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type="date"
51+
52+
// HypervisorConfigOverride is the Schema for overriding the config of one hypervisor crd API
53+
type HypervisorConfigOverride struct {
54+
metav1.TypeMeta `json:",inline"`
55+
metav1.ObjectMeta `json:"metadata,omitempty"`
56+
57+
Spec HypervisorConfigOverrideSpec `json:"spec,omitempty"`
58+
Status HypervisorConfigOverrideStatus `json:"status,omitempty"`
59+
}
60+
61+
// +kubebuilder:object:root=true
62+
63+
// HypervisorConfigOverrideList contains a list of HypervisorConfigOverride
64+
type HypervisorConfigOverrideList struct {
65+
metav1.TypeMeta `json:",inline"`
66+
metav1.ListMeta `json:"metadata,omitempty"`
67+
Items []HypervisorConfigOverride `json:"items"`
68+
}
69+
70+
func init() {
71+
SchemeBuilder.Register(&HypervisorConfigOverride{}, &HypervisorConfigOverrideList{})
72+
}
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
SPDX-FileCopyrightText: Copyright 2024 SAP SE or an SAP affiliate company and cobaltcore-dev contributors
3+
SPDX-License-Identifier: Apache-2.0
4+
5+
Licensed under the Apache License, LibVirtVersion 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package v1
19+
20+
import (
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
)
23+
24+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
26+
// Important: Run "make" to regenerate code after modifying this file
27+
28+
// HypervisorConfigOverrideSpec overrides the desired state of Hypervisor
29+
type HypervisorConfigSetSpec struct {
30+
Selector *metav1.LabelSelector `json:"selector"`
31+
Template HypervisorConfigSetTemplate `json:"template"`
32+
}
33+
34+
// HypervisorConfigSpec defines (in parts) the desired state of Hypervisor
35+
type HypervisorConfigSpec struct {
36+
// +kubebuilder:validation:Optional
37+
// OperatingSystemVersion represents the desired operating system version.
38+
OperatingSystemVersion *string `json:"version,omitempty"`
39+
40+
// +kubebuilder:validation:Optional
41+
// Reboot request an reboot after successful installation of an upgrade.
42+
Reboot *bool `json:"reboot,omitempty"`
43+
44+
// +kubebuilder:validation:Optional
45+
// EvacuateOnReboot request an evacuation of all instances before reboot.
46+
EvacuateOnReboot *bool `json:"evacuateOnReboot,omitempty"`
47+
48+
// +kubebuilder:optional
49+
// LifecycleEnabled enables the lifecycle management of the hypervisor via hypervisor-operator.
50+
LifecycleEnabled *bool `json:"lifecycleEnabled,omitempty"`
51+
52+
// +kubebuilder:validation:Optional
53+
// SkipTests skips the tests during the onboarding process.
54+
SkipTests *bool `json:"skipTests,omitempty"`
55+
56+
// +kubebuilder:optional
57+
// CustomTraits are used to apply custom traits to the hypervisor.
58+
CustomTraits *[]string `json:"customTraits,omitempty"`
59+
60+
// +kubebuilder:optional
61+
// Aggregates are used to apply aggregates to the hypervisor.
62+
Aggregates *[]string `json:"aggregates,omitempty"`
63+
64+
// +kubebuilder:optional
65+
// HighAvailability is used to enable the high availability handling of the hypervisor.
66+
HighAvailability *bool `json:"highAvailability,omitempty"`
67+
68+
// +kubebuilder:optional
69+
// Require to issue a certificate from cert-manager for the hypervisor, to be used for
70+
// secure communication with the libvirt API.
71+
CreateCertManagerCertificate *bool `json:"createCertManagerCertificate,omitempty"`
72+
73+
// +kubebuilder:optional
74+
// InstallCertificate is used to enable the installations of the certificates via kvm-node-agent.
75+
InstallCertificate *bool `json:"installCertificate,omitempty"`
76+
77+
// +kubebuilder:optional
78+
// +kubebuilder:validation:Enum:="";manual;auto;ha
79+
// Maintenance indicates whether the hypervisor is in maintenance mode.
80+
Maintenance *string `json:"maintenance,omitempty"`
81+
}
82+
83+
// A template for the hypervisor defining the values for a whole set
84+
type HypervisorConfigSetTemplate struct {
85+
Spec HypervisorConfigSpec `json:"spec"`
86+
}
87+
88+
// HypervisorConfigSetStatus defines the observed state of HypervisorConfigSet
89+
type HypervisorConfigSetStatus struct {
90+
// Represents the Hypervisor node conditions.
91+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
92+
93+
SpecHash string `json:"specHash,omitempty"`
94+
}
95+
96+
// +kubebuilder:object:root=true
97+
// +kubebuilder:subresource:status
98+
// +kubebuilder:resource:scope=Cluster,shortName=hvcs
99+
// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name="Age",type="date"
100+
101+
// HypervisorConfigSet is the Schema for a set of hypervisor configs
102+
type HypervisorConfigSet struct {
103+
metav1.TypeMeta `json:",inline"`
104+
metav1.ObjectMeta `json:"metadata,omitempty"`
105+
106+
Spec HypervisorConfigSetSpec `json:"spec,omitempty"`
107+
Status HypervisorConfigSetStatus `json:"status,omitempty"`
108+
}
109+
110+
// +kubebuilder:object:root=true
111+
// HypervisorConfigSetList contains a list of HypervisorConfigSet
112+
type HypervisorConfigSetList struct {
113+
metav1.TypeMeta `json:",inline"`
114+
metav1.ListMeta `json:"metadata,omitempty"`
115+
Items []HypervisorConfigSet `json:"items"`
116+
}
117+
118+
func init() {
119+
SchemeBuilder.Register(&HypervisorConfigSet{}, &HypervisorConfigSetList{})
120+
}

0 commit comments

Comments
 (0)