Skip to content

Commit 51dae1b

Browse files
authored
Merge pull request #363 from nunnatsa/r0.11-revert-v1-capi-api-to-beta1
Revert moving to claster-api v1beta2
2 parents d5b434a + c673043 commit 51dae1b

23 files changed

+298
-813
lines changed

api/v1alpha1/condition_consts.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ limitations under the License.
1616

1717
package v1alpha1
1818

19+
import clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" //nolint SA1019
20+
1921
// Conditions and condition Reasons for the KubevirtMachine object
2022

2123
const (
2224
// VMProvisionedCondition documents the status of the provisioning of the VM
2325
// generated by a KubevirtMachine.
24-
VMProvisionedCondition = "VMProvisioned"
26+
VMProvisionedCondition clusterv1.ConditionType = "VMProvisioned"
2527

2628
// WaitingForClusterInfrastructureReason (Severity=Info) documents a KubevirtMachine waiting for the cluster
2729
// infrastructure to be ready before starting to create the container that provides the KubevirtMachine
@@ -37,15 +39,15 @@ const (
3739
VMCreateFailedReason = "VMCreateFailed"
3840

3941
// VMLiveMigratableCondition documents whether the VM is live-migratable or not
40-
VMLiveMigratableCondition = "VMLiveMigratable"
42+
VMLiveMigratableCondition clusterv1.ConditionType = "VMLiveMigratable"
4143
)
4244

4345
const (
4446
// BootstrapExecSucceededCondition provides an observation of the KubevirtMachine bootstrap process.
4547
// It is set based on successful execution of bootstrap commands and on the existence of
4648
// the /run/cluster-api/bootstrap-success.complete file.
4749
// The condition gets generated after VMProvisionedCondition is True.
48-
BootstrapExecSucceededCondition = "BootstrapExecSucceeded"
50+
BootstrapExecSucceededCondition clusterv1.ConditionType = "BootstrapExecSucceeded"
4951

5052
// BootstrappingReason documents (Severity=Info) a KubevirtMachine currently executing the bootstrap
5153
// script that creates the Kubernetes node on the newly provisioned machine infrastructure.
@@ -61,7 +63,7 @@ const (
6163

6264
const (
6365
// LoadBalancerAvailableCondition documents the availability of the service that implements the cluster load balancer.
64-
LoadBalancerAvailableCondition = "LoadBalancerAvailable"
66+
LoadBalancerAvailableCondition clusterv1.ConditionType = "LoadBalancerAvailable"
6567

6668
// LoadBalancerProvisioningFailedReason (Severity=Warning) documents a KubevirtCluster controller detecting
6769
// an error while provisioning the service that provides the cluster load balancer; those kind of

api/v1alpha1/kubevirtcluster_types.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package v1alpha1
1919
import (
2020
corev1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22-
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
22+
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" //nolint SA1019
2323
)
2424

2525
const (
@@ -74,11 +74,11 @@ type KubevirtClusterStatus struct {
7474

7575
// FailureDomains don't mean much in CAPD since it's all local, but we can see how the rest of cluster API
7676
// will use this if we populate it.
77-
FailureDomains []clusterv1.FailureDomain `json:"failureDomains,omitempty"`
77+
FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"`
7878

7979
// Conditions defines current service state of the KubevirtCluster.
8080
// +optional
81-
Conditions []metav1.Condition `json:"conditions,omitempty"`
81+
Conditions []clusterv1.Condition `json:"conditions,omitempty"`
8282
}
8383

8484
// APIEndpoint represents a reachable Kubernetes API endpoint.
@@ -140,11 +140,11 @@ type KubevirtCluster struct {
140140
Status KubevirtClusterStatus `json:"status,omitempty"`
141141
}
142142

143-
func (c *KubevirtCluster) GetConditions() []metav1.Condition {
143+
func (c *KubevirtCluster) GetConditions() clusterv1.Conditions {
144144
return c.Status.Conditions
145145
}
146146

147-
func (c *KubevirtCluster) SetConditions(conditions []metav1.Condition) {
147+
func (c *KubevirtCluster) SetConditions(conditions clusterv1.Conditions) {
148148
c.Status.Conditions = conditions
149149
}
150150

api/v1alpha1/kubevirtclustertemplate_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package v1alpha1
1818

1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21-
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
21+
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" //nolint SA1019
2222
)
2323

2424
// KubevirtClusterTemplateResource describes the data needed to create a KubevirtCluster from a template.

api/v1alpha1/kubevirtmachine_types.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ import (
2020
corev1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2222
kubevirtv1 "kubevirt.io/api/core/v1"
23-
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
23+
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" //nolint SA1019
24+
"sigs.k8s.io/cluster-api/errors" //nolint SA1019
2425
)
2526

2627
const (
@@ -84,7 +85,7 @@ type KubevirtMachineStatus struct {
8485

8586
// Conditions defines current service state of the KubevirtMachine.
8687
// +optional
87-
Conditions []metav1.Condition `json:"conditions,omitempty"`
88+
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
8889

8990
// NodeUpdated denotes that the ProviderID is updated on Node of this KubevirtMachine
9091
// +optional
@@ -107,7 +108,7 @@ type KubevirtMachineStatus struct {
107108
// can be added as events to the Machine object and/or logged in the
108109
// controller's output.
109110
// +optional
110-
FailureReason string `json:"failureReason,omitempty"`
111+
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
111112

112113
// FailureMessage will be set in the event that there is a terminal problem
113114
// reconciling the Machine and will contain a more verbose string suitable
@@ -145,11 +146,11 @@ type KubevirtMachine struct {
145146
Status KubevirtMachineStatus `json:"status,omitempty"`
146147
}
147148

148-
func (c *KubevirtMachine) GetConditions() []metav1.Condition {
149+
func (c *KubevirtMachine) GetConditions() clusterv1.Conditions {
149150
return c.Status.Conditions
150151
}
151152

152-
func (c *KubevirtMachine) SetConditions(conditions []metav1.Condition) {
153+
func (c *KubevirtMachine) SetConditions(conditions clusterv1.Conditions) {
153154
c.Status.Conditions = conditions
154155
}
155156

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 13 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_kubevirtclusters.yaml

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -190,67 +190,59 @@ spec:
190190
conditions:
191191
description: Conditions defines current service state of the KubevirtCluster.
192192
items:
193-
description: Condition contains details for one aspect of the current
194-
state of this API Resource.
193+
description: Condition defines an observation of a Cluster API resource
194+
operational state.
195195
properties:
196196
lastTransitionTime:
197197
description: |-
198198
lastTransitionTime is the last time the condition transitioned from one status to another.
199-
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
199+
This should be when the underlying condition changed. If that is not known, then using the time when
200+
the API field changed is acceptable.
200201
format: date-time
201202
type: string
202203
message:
203204
description: |-
204205
message is a human readable message indicating details about the transition.
205-
This may be an empty string.
206-
maxLength: 32768
206+
This field may be empty.
207+
maxLength: 10240
208+
minLength: 1
207209
type: string
208-
observedGeneration:
209-
description: |-
210-
observedGeneration represents the .metadata.generation that the condition was set based upon.
211-
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
212-
with respect to the current state of the instance.
213-
format: int64
214-
minimum: 0
215-
type: integer
216210
reason:
217211
description: |-
218-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
219-
Producers of specific condition types may define expected values and meanings for this field,
220-
and whether the values are considered a guaranteed API.
221-
The value should be a CamelCase string.
222-
This field may not be empty.
223-
maxLength: 1024
212+
reason is the reason for the condition's last transition in CamelCase.
213+
The specific API may choose whether or not this field is considered a guaranteed API.
214+
This field may be empty.
215+
maxLength: 256
224216
minLength: 1
225-
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
217+
type: string
218+
severity:
219+
description: |-
220+
severity provides an explicit classification of Reason code, so the users or machines can immediately
221+
understand the current situation and act accordingly.
222+
The Severity field MUST be set only when Status=False.
223+
maxLength: 32
226224
type: string
227225
status:
228226
description: status of the condition, one of True, False, Unknown.
229-
enum:
230-
- "True"
231-
- "False"
232-
- Unknown
233227
type: string
234228
type:
235-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
236-
maxLength: 316
237-
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])$
229+
description: |-
230+
type of condition in CamelCase or in foo.example.com/CamelCase.
231+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
232+
can be useful (see .node.status.conditions), the ability to deconflict is important.
233+
maxLength: 256
234+
minLength: 1
238235
type: string
239236
required:
240237
- lastTransitionTime
241-
- message
242-
- reason
243238
- status
244239
- type
245240
type: object
246241
type: array
247242
failureDomains:
248-
description: |-
249-
FailureDomains don't mean much in CAPD since it's all local, but we can see how the rest of cluster API
250-
will use this if we populate it.
251-
items:
243+
additionalProperties:
252244
description: |-
253-
FailureDomain is the Schema for Cluster API failure domains.
245+
FailureDomainSpec is the Schema for Cluster API failure domains.
254246
It allows controllers to understand how many failure domains a cluster can optionally span across.
255247
properties:
256248
attributes:
@@ -263,15 +255,11 @@ spec:
263255
description: controlPlane determines if this failure domain
264256
is suitable for use by control plane machines.
265257
type: boolean
266-
name:
267-
description: name is the name of the failure domain.
268-
maxLength: 256
269-
minLength: 1
270-
type: string
271-
required:
272-
- name
273258
type: object
274-
type: array
259+
description: |-
260+
FailureDomains don't mean much in CAPD since it's all local, but we can see how the rest of cluster API
261+
will use this if we populate it.
262+
type: object
275263
ready:
276264
default: false
277265
description: Ready denotes that the infrastructure is ready.

config/crd/bases/infrastructure.cluster.x-k8s.io_kubevirtclustertemplates.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ spec:
7272
7373
In future versions, controller-tools@v2 might allow overriding the type and validation for embedded
7474
types. When that happens, this hack should be revisited.
75-
minProperties: 1
7675
properties:
7776
annotations:
7877
additionalProperties:

config/crd/bases/infrastructure.cluster.x-k8s.io_kubevirtmachines.yaml

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4513,56 +4513,51 @@ spec:
45134513
conditions:
45144514
description: Conditions defines current service state of the KubevirtMachine.
45154515
items:
4516-
description: Condition contains details for one aspect of the current
4517-
state of this API Resource.
4516+
description: Condition defines an observation of a Cluster API resource
4517+
operational state.
45184518
properties:
45194519
lastTransitionTime:
45204520
description: |-
45214521
lastTransitionTime is the last time the condition transitioned from one status to another.
4522-
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
4522+
This should be when the underlying condition changed. If that is not known, then using the time when
4523+
the API field changed is acceptable.
45234524
format: date-time
45244525
type: string
45254526
message:
45264527
description: |-
45274528
message is a human readable message indicating details about the transition.
4528-
This may be an empty string.
4529-
maxLength: 32768
4529+
This field may be empty.
4530+
maxLength: 10240
4531+
minLength: 1
45304532
type: string
4531-
observedGeneration:
4532-
description: |-
4533-
observedGeneration represents the .metadata.generation that the condition was set based upon.
4534-
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
4535-
with respect to the current state of the instance.
4536-
format: int64
4537-
minimum: 0
4538-
type: integer
45394533
reason:
45404534
description: |-
4541-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
4542-
Producers of specific condition types may define expected values and meanings for this field,
4543-
and whether the values are considered a guaranteed API.
4544-
The value should be a CamelCase string.
4545-
This field may not be empty.
4546-
maxLength: 1024
4535+
reason is the reason for the condition's last transition in CamelCase.
4536+
The specific API may choose whether or not this field is considered a guaranteed API.
4537+
This field may be empty.
4538+
maxLength: 256
45474539
minLength: 1
4548-
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
4540+
type: string
4541+
severity:
4542+
description: |-
4543+
severity provides an explicit classification of Reason code, so the users or machines can immediately
4544+
understand the current situation and act accordingly.
4545+
The Severity field MUST be set only when Status=False.
4546+
maxLength: 32
45494547
type: string
45504548
status:
45514549
description: status of the condition, one of True, False, Unknown.
4552-
enum:
4553-
- "True"
4554-
- "False"
4555-
- Unknown
45564550
type: string
45574551
type:
4558-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
4559-
maxLength: 316
4560-
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])$
4552+
description: |-
4553+
type of condition in CamelCase or in foo.example.com/CamelCase.
4554+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
4555+
can be useful (see .node.status.conditions), the ability to deconflict is important.
4556+
maxLength: 256
4557+
minLength: 1
45614558
type: string
45624559
required:
45634560
- lastTransitionTime
4564-
- message
4565-
- reason
45664561
- status
45674562
- type
45684563
type: object

0 commit comments

Comments
 (0)