Skip to content

Commit 5f545ae

Browse files
authored
Merge pull request #2947 from bnallapeta/v1beta2-api-types
⚠️ Add api/v1beta2 types with CAPI v1beta2 contract
2 parents c59ed02 + 0b80193 commit 5f545ae

15 files changed

+10921
-0
lines changed

api/v1beta2/conditions_consts.go

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta2
18+
19+
const (
20+
// InstanceReadyCondition reports on current status of the OpenStack instance. Ready indicates the instance is in a Running state.
21+
InstanceReadyCondition string = "InstanceReady"
22+
23+
// WaitingForClusterInfrastructureReason used when machine is waiting for cluster infrastructure to be ready before proceeding.
24+
WaitingForClusterInfrastructureReason = "WaitingForClusterInfrastructure"
25+
// WaitingForBootstrapDataReason used when machine is waiting for bootstrap data to be ready before proceeding.
26+
WaitingForBootstrapDataReason = "WaitingForBootstrapData"
27+
// InvalidMachineSpecReason used when the machine spec is invalid.
28+
InvalidMachineSpecReason = "InvalidMachineSpec"
29+
// InstanceCreateFailedReason used when creating the instance failed.
30+
InstanceCreateFailedReason = "InstanceCreateFailed"
31+
// InstanceNotFoundReason used when the instance couldn't be retrieved.
32+
InstanceNotFoundReason = "InstanceNotFound"
33+
// InstanceStateErrorReason used when the instance is in error state.
34+
InstanceStateErrorReason = "InstanceStateError"
35+
// InstanceDeletedReason used when the instance is in a deleted state.
36+
InstanceDeletedReason = "InstanceDeleted"
37+
// InstanceNotReadyReason used when the instance is in a pending state.
38+
InstanceNotReadyReason = "InstanceNotReady"
39+
// InstanceDeleteFailedReason used when deleting the instance failed.
40+
InstanceDeleteFailedReason = "InstanceDeleteFailed"
41+
// OpenstackErrorReason used when there is an error communicating with OpenStack.
42+
OpenStackErrorReason = "OpenStackError"
43+
// DependencyFailedReason indicates that a dependent object failed.
44+
DependencyFailedReason = "DependencyFailed"
45+
46+
// ServerUnexpectedDeletedMessage is the message used when the server is unexpectedly deleted via an external agent.
47+
ServerUnexpectedDeletedMessage = "The server was unexpectedly deleted"
48+
)
49+
50+
const (
51+
// APIServerIngressReadyCondition reports on the current status of the network ingress (Loadbalancer, Floating IP) for Control Plane machines. Ready indicates that the instance can receive requests.
52+
APIServerIngressReadyCondition string = "APIServerIngressReadyCondition"
53+
54+
// LoadBalancerMemberErrorReason used when the instance could not be added as a loadbalancer member.
55+
LoadBalancerMemberErrorReason = "LoadBalancerMemberError"
56+
// FloatingIPErrorReason used when the floating ip could not be created or attached.
57+
FloatingIPErrorReason = "FloatingIPError"
58+
)
59+
60+
const (
61+
// FloatingAddressFromPoolReadyCondition reports on the current status of the Floating IPs from ipam pool.
62+
FloatingAddressFromPoolReadyCondition string = "FloatingAddressFromPoolReady"
63+
// WaitingForIpamProviderReason used when machine is waiting for ipam provider to be ready before proceeding.
64+
FloatingAddressFromPoolWaitingForIpamProviderReason = "WaitingForIPAMProvider"
65+
// FloatingAddressFromPoolErrorReason is used when there is an error attaching an IP from the pool to an machine.
66+
FloatingAddressFromPoolErrorReason = "FloatingIPError"
67+
// UnableToFindFloatingIPNetworkReason is used when the floating ip network is not found.
68+
UnableToFindFloatingIPNetworkReason = "UnableToFindFloatingIPNetwork"
69+
)
70+
71+
const (
72+
// NetworkReadyCondition reports on the current status of the cluster network infrastructure.
73+
// Ready indicates that the network, subnets, and related resources have been successfully provisioned.
74+
NetworkReadyCondition string = "NetworkReady"
75+
76+
// RouterReadyCondition reports on the current status of the cluster router infrastructure.
77+
// Ready indicates that the router and its interfaces have been successfully provisioned.
78+
RouterReadyCondition string = "RouterReady"
79+
80+
// SecurityGroupsReadyCondition reports on the current status of the cluster security groups.
81+
// Ready indicates that all required security groups have been successfully provisioned.
82+
SecurityGroupsReadyCondition string = "SecurityGroupsReady"
83+
84+
// APIEndpointReadyCondition reports on the current status of the cluster API endpoint.
85+
// Ready indicates that the control plane endpoint has been successfully configured.
86+
APIEndpointReadyCondition string = "APIEndpointReady"
87+
88+
// NetworkReconcileFailedReason is used when network reconciliation fails.
89+
NetworkReconcileFailedReason = "NetworkCreateFailed"
90+
// SubnetReconcileFailedReason is used when subnet reconciliation fails.
91+
SubnetReconcileFailedReason = "SubnetCreateFailed"
92+
// RouterReconcileFailedReason is used when router reconciliation fails.
93+
RouterReconcileFailedReason = "RouterCreateFailed"
94+
// SecurityGroupReconcileFailedReason is used when security group reconciliation fails.
95+
SecurityGroupReconcileFailedReason = "SecurityGroupCreateFailed"
96+
// APIEndpointConfigFailedReason is used when API endpoint configuration fails.
97+
APIEndpointConfigFailedReason = "APIEndpointConfigFailed"
98+
)

api/v1beta2/conversion.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta2
18+
19+
// NOTE: v1beta2 will become the Hub in a future PR.
20+
// For now, v1beta1 remains the Hub to avoid breaking changes.
21+
// Conversion webhooks will be implemented in PR #2.

api/v1beta2/doc.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1beta2 contains API Schema definitions for the infrastructure v1beta2 API group.
18+
// +kubebuilder:object:generate=true
19+
// +groupName=infrastructure.cluster.x-k8s.io
20+
// +k8s:openapi-gen=true
21+
package v1beta2

api/v1beta2/groupversion_info.go

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// package v1beta2 contains API Schema definitions for the infrastructure v1beta2 API group
18+
// +kubebuilder:object:generate=true
19+
// +groupName=infrastructure.cluster.x-k8s.io
20+
package v1beta2
21+
22+
import (
23+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
24+
"k8s.io/apimachinery/pkg/runtime"
25+
"k8s.io/apimachinery/pkg/runtime/schema"
26+
)
27+
28+
// GroupName is the group name use in this package.
29+
const GroupName = "infrastructure.cluster.x-k8s.io"
30+
31+
// SchemeGroupVersion is group version used to register these objects.
32+
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta2"}
33+
34+
// Resource takes an unqualified resource and returns a Group qualified GroupResource.
35+
func Resource(resource string) schema.GroupResource {
36+
return SchemeGroupVersion.WithResource(resource).GroupResource()
37+
}
38+
39+
var (
40+
// schemeBuilder is used to add go types to the GroupVersionKind scheme.
41+
schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
42+
43+
// AddToScheme adds the types in this group-version to the given scheme.
44+
AddToScheme = schemeBuilder.AddToScheme
45+
46+
objectTypes = []runtime.Object{}
47+
)
48+
49+
func addKnownTypes(scheme *runtime.Scheme) error {
50+
scheme.AddKnownTypes(SchemeGroupVersion, objectTypes...)
51+
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
52+
return nil
53+
}

api/v1beta2/identity_types.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1beta2
18+
19+
// OpenStackIdentityReference is a reference to an infrastructure
20+
// provider identity to be used to provision cluster resources.
21+
// +kubebuilder:validation:XValidation:rule="(!has(self.region) && !has(oldSelf.region)) || self.region == oldSelf.region",message="region is immutable"
22+
type OpenStackIdentityReference struct {
23+
// Type specifies the identity reference type. Defaults to Secret for backward compatibility.
24+
// +kubebuilder:validation:Enum=Secret;ClusterIdentity
25+
// +kubebuilder:default=Secret
26+
// +kubebuilder:validation:Required
27+
Type string `json:"type,omitempty"`
28+
29+
// Name is the name of a Secret (type=Secret) in the same namespace as the resource being provisioned,
30+
// or the name of an OpenStackClusterIdentity (type=ClusterIdentity).
31+
// The Secret must contain a key named `clouds.yaml` which contains an OpenStack clouds.yaml file.
32+
// The Secret may optionally contain a key named `cacert` containing a PEM-encoded CA certificate.
33+
// +kubebuilder:validation:Required
34+
// +kubebuilder:validation:MinLength=1
35+
Name string `json:"name"`
36+
37+
// CloudName specifies the name of the entry in the clouds.yaml file to use.
38+
// +kubebuilder:validation:Required
39+
// +kubebuilder:validation:MinLength=1
40+
CloudName string `json:"cloudName"`
41+
42+
// Region specifies an OpenStack region to use. If specified, it overrides
43+
// any value in clouds.yaml. If specified for an OpenStackMachine, its
44+
// value will be included in providerID.
45+
// +optional
46+
Region string `json:"region,omitempty"`
47+
}
48+
49+
// IdentityRefProvider is an interface for obtaining OpenStack credentials from an API object
50+
// +kubebuilder:object:generate:=false
51+
type IdentityRefProvider interface {
52+
// GetIdentifyRef returns the object's namespace and IdentityRef if it has an IdentityRef, or nulls if it does not
53+
GetIdentityRef() (*string, *OpenStackIdentityReference)
54+
}

0 commit comments

Comments
 (0)