Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit fcb446f

Browse files
committed
Add conditions for OpenStackClusterStackRelease
Signed-off-by: Matej Feder <[email protected]>
1 parent 668228d commit fcb446f

File tree

7 files changed

+192
-14
lines changed

7 files changed

+192
-14
lines changed

api/v1alpha1/openstackclusterstackrelease_types.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package v1alpha1
1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
apiv1alpha7 "sigs.k8s.io/cluster-api-provider-openstack/api/v1alpha7"
22+
clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
2223
)
2324

2425
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
@@ -37,12 +38,17 @@ type OpenStackClusterStackReleaseStatus struct {
3738
// +optional
3839
// +kubebuilder:default:=false
3940
Ready bool `json:"ready,omitempty"`
41+
// Conditions defines current service state of the ClusterAddon.
42+
// +optional
43+
Conditions clusterv1beta1.Conditions `json:"conditions,omitempty"`
4044
}
4145

4246
//+kubebuilder:object:root=true
4347
//+kubebuilder:subresource:status
4448
//+kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready"
4549
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of OpenStackClusterStackRelease"
50+
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].reason"
51+
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].message"
4652

4753
// OpenStackClusterStackRelease is the Schema for the openstackclusterstackreleases API.
4854
type OpenStackClusterStackRelease struct {
@@ -53,6 +59,16 @@ type OpenStackClusterStackRelease struct {
5359
Status OpenStackClusterStackReleaseStatus `json:"status,omitempty"`
5460
}
5561

62+
// GetConditions returns the observations of the operational state of the ClusterAddon resource.
63+
func (r *OpenStackClusterStackRelease) GetConditions() clusterv1beta1.Conditions {
64+
return r.Status.Conditions
65+
}
66+
67+
// SetConditions sets the underlying service state of the ClusterAddon to the predescribed clusterv1.Conditions.
68+
func (r *OpenStackClusterStackRelease) SetConditions(conditions clusterv1beta1.Conditions) {
69+
r.Status.Conditions = conditions
70+
}
71+
5672
//+kubebuilder:object:root=true
5773

5874
// OpenStackClusterStackReleaseList contains a list of OpenStackClusterStackRelease.

api/v1alpha1/zz_generated.deepcopy.go

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

config/crd/bases/infrastructure.clusterstack.x-k8s.io_openstackclusterstackreleases.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ spec:
2222
jsonPath: .metadata.creationTimestamp
2323
name: Age
2424
type: date
25+
- jsonPath: .status.conditions[?(@.type=='Ready')].reason
26+
name: Reason
27+
type: string
28+
- jsonPath: .status.conditions[?(@.type=='Ready')].message
29+
name: Message
30+
type: string
2531
name: v1alpha1
2632
schema:
2733
openAPIV3Schema:
@@ -72,6 +78,51 @@ spec:
7278
description: OpenStackClusterStackReleaseStatus defines the observed state
7379
of OpenStackClusterStackRelease.
7480
properties:
81+
conditions:
82+
description: Conditions defines current service state of the ClusterAddon.
83+
items:
84+
description: Condition defines an observation of a Cluster API resource
85+
operational state.
86+
properties:
87+
lastTransitionTime:
88+
description: Last time the condition transitioned from one status
89+
to another. This should be when the underlying condition changed.
90+
If that is not known, then using the time when the API field
91+
changed is acceptable.
92+
format: date-time
93+
type: string
94+
message:
95+
description: A human readable message indicating details about
96+
the transition. This field may be empty.
97+
type: string
98+
reason:
99+
description: The reason for the condition's last transition
100+
in CamelCase. The specific API may choose whether or not this
101+
field is considered a guaranteed API. This field may not be
102+
empty.
103+
type: string
104+
severity:
105+
description: Severity provides an explicit classification of
106+
Reason code, so the users or machines can immediately understand
107+
the current situation and act accordingly. The Severity field
108+
MUST be set only when Status=False.
109+
type: string
110+
status:
111+
description: Status of the condition, one of True, False, Unknown.
112+
type: string
113+
type:
114+
description: Type of condition in CamelCase or in foo.example.com/CamelCase.
115+
Many .condition.type values are consistent across resources
116+
like Available, but because arbitrary conditions can be useful
117+
(see .node.status.conditions), the ability to deconflict is
118+
important.
119+
type: string
120+
required:
121+
- lastTransitionTime
122+
- status
123+
- type
124+
type: object
125+
type: array
75126
ready:
76127
default: false
77128
type: boolean

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ require (
1717
require (
1818
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
1919
github.com/beorn7/perks v1.0.1 // indirect
20+
github.com/blang/semver/v4 v4.0.0 // indirect
2021
github.com/cespare/xxhash/v2 v2.2.0 // indirect
2122
github.com/cloudflare/circl v1.3.3 // indirect
2223
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -29,6 +30,7 @@ require (
2930
github.com/go-openapi/jsonreference v0.20.2 // indirect
3031
github.com/go-openapi/swag v0.22.3 // indirect
3132
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
33+
github.com/gobuffalo/flect v1.0.2 // indirect
3234
github.com/gogo/protobuf v1.3.2 // indirect
3335
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3436
github.com/golang/protobuf v1.5.3 // indirect

0 commit comments

Comments
 (0)