Skip to content

Commit 8225d5f

Browse files
committed
Extend OpenStackMachineTemplate.status api
Extend OpenStackMachineTemplate.status api with required field for autoscaling from zero. Note: Cpu architecture is not added as there are no standardized settings on openstack where we can retrieve this info
1 parent a160df5 commit 8225d5f

File tree

13 files changed

+435
-3
lines changed

13 files changed

+435
-3
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ generate-codegen: generate-controller-gen $(OPENAPI_GEN) $(APPLYCONFIGURATION_GE
333333
k8s.io/api/core/v1 \
334334
k8s.io/apimachinery/pkg/apis/meta/v1 \
335335
k8s.io/apimachinery/pkg/runtime \
336+
k8s.io/apimachinery/pkg/api/resource \
336337
k8s.io/apimachinery/pkg/version
337338
@echo "** Generating openapi.json **"
338339
go run ./cmd/models-schema | jq > ./openapi.json

api/v1beta1/openstackmachinetemplate_types.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
corev1 "k8s.io/api/core/v1"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

@@ -25,6 +26,26 @@ type OpenStackMachineTemplateSpec struct {
2526
Template OpenStackMachineTemplateResource `json:"template"`
2627
}
2728

29+
// OpenStackMachineTemplateStatus defines the observed state of OpenStackMachineTemplate.
30+
type OpenStackMachineTemplateStatus struct {
31+
// Capacity defines the resource capacity for this machine.
32+
// This value is used for autoscaling from zero operations as defined in:
33+
// https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20210310-opt-in-autoscaling-from-zero.md
34+
// +optional
35+
Capacity corev1.ResourceList `json:"capacity,omitempty"`
36+
// +optional
37+
NodeInfo NodeInfo `json:"nodeInfo,omitempty,omitzero"`
38+
}
39+
40+
// NodeInfo contains information about the node's architecture and operating system.
41+
// +kubebuilder:validation:MinProperties=1
42+
type NodeInfo struct {
43+
// operatingSystem is a string representing the operating system of the node.
44+
// This may be a string like 'linux' or 'windows'.
45+
// +optional
46+
OperatingSystem string `json:"operatingSystem,omitempty"`
47+
}
48+
2849
// +genclient
2950
// +kubebuilder:object:root=true
3051
// +kubebuilder:storageversion
@@ -35,7 +56,8 @@ type OpenStackMachineTemplate struct {
3556
metav1.TypeMeta `json:",inline"`
3657
metav1.ObjectMeta `json:"metadata,omitempty"`
3758

38-
Spec OpenStackMachineTemplateSpec `json:"spec,omitempty"`
59+
Spec OpenStackMachineTemplateSpec `json:"spec,omitempty"`
60+
Status OpenStackMachineTemplateStatus `json:"status,omitempty"`
3961
}
4062

4163
// +kubebuilder:object:root=true

api/v1beta1/zz_generated.deepcopy.go

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

api_violations.report

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ API rule violation: names_match,k8s.io/api/core/v1,RBDVolumeSource,RBDPool
7373
API rule violation: names_match,k8s.io/api/core/v1,RBDVolumeSource,RadosUser
7474
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,CephFS
7575
API rule violation: names_match,k8s.io/api/core/v1,VolumeSource,StorageOS
76+
API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,Format
77+
API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,d
78+
API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,i
79+
API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,Quantity,s
80+
API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,int64Amount,scale
81+
API rule violation: names_match,k8s.io/apimachinery/pkg/api/resource,int64Amount,value
7682
API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,APIResourceList,APIResources
7783
API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Duration,Duration
7884
API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,InternalEvent,Object

cmd/models-schema/zz_generated.openapi.go

Lines changed: 115 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)