Skip to content

Commit 891c4f3

Browse files
committed
[WIP] Add Aetos to MetricStorage
Generated-By: Claude-Code claude-opus-4-6
1 parent f672700 commit 891c4f3

30 files changed

Lines changed: 952 additions & 11 deletions

‎api/bases/telemetry.openstack.org_autoscalings.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ spec:
314314
description: PasswordSelectors - Selectors to identify the service
315315
from the Secret
316316
properties:
317+
aetosService:
318+
default: AetosPassword
319+
description: AetosService - Selector to get the aetos service
320+
password from the Secret
321+
type: string
317322
aodhService:
318323
default: AodhPassword
319324
description: AodhService - Selector to get the aodh service

‎api/bases/telemetry.openstack.org_ceilometers.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ spec:
230230
description: PasswordSelectors - Selectors to identify the service
231231
from the Secret
232232
properties:
233+
aetosService:
234+
default: AetosPassword
235+
description: AetosService - Selector to get the aetos service
236+
password from the Secret
237+
type: string
233238
aodhService:
234239
default: AodhPassword
235240
description: AodhService - Selector to get the aodh service password

‎api/bases/telemetry.openstack.org_cloudkitties.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,11 @@ spec:
588588
description: PasswordsSelectors - Selectors to identify the ServiceUser
589589
password from the Secret
590590
properties:
591+
aetosService:
592+
default: AetosPassword
593+
description: AetosService - Selector to get the aetos service
594+
password from the Secret
595+
type: string
591596
aodhService:
592597
default: AodhPassword
593598
description: AodhService - Selector to get the aodh service password

‎api/bases/telemetry.openstack.org_cloudkittyapis.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ spec:
268268
description: PasswordsSelectors - Selectors to identify the ServiceUser
269269
password from the Secret
270270
properties:
271+
aetosService:
272+
default: AetosPassword
273+
description: AetosService - Selector to get the aetos service
274+
password from the Secret
275+
type: string
271276
aodhService:
272277
default: AodhPassword
273278
description: AodhService - Selector to get the aodh service password

‎api/bases/telemetry.openstack.org_cloudkittyprocs.yaml‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ spec:
114114
description: PasswordsSelectors - Selectors to identify the ServiceUser
115115
password from the Secret
116116
properties:
117+
aetosService:
118+
default: AetosPassword
119+
description: AetosService - Selector to get the aetos service
120+
password from the Secret
121+
type: string
117122
aodhService:
118123
default: AodhPassword
119124
description: AodhService - Selector to get the aodh service password

‎api/bases/telemetry.openstack.org_metricstorages.yaml‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ spec:
5252
spec:
5353
description: MetricStorageSpec defines the desired state of MetricStorage
5454
properties:
55+
aetosImage:
56+
type: string
5557
alertmanagerTls:
5658
description: |-
5759
TLS - Parameters related to the Alertmanager TLS.
@@ -1866,6 +1868,33 @@ spec:
18661868
OpenStackLightspeedNamespace defines the namespace where OpenStack Lightspeed
18671869
is deployed. Used for discovering Lightspeed metrics services.
18681870
type: string
1871+
passwordSelector:
1872+
default:
1873+
aetosService: AetosPassword
1874+
description: PasswordSelectors - Selectors to identify the service
1875+
from the Secret
1876+
properties:
1877+
aetosService:
1878+
default: AetosPassword
1879+
description: AetosService - Selector to get the aetos service
1880+
password from the Secret
1881+
type: string
1882+
aodhService:
1883+
default: AodhPassword
1884+
description: AodhService - Selector to get the aodh service password
1885+
from the Secret
1886+
type: string
1887+
ceilometerService:
1888+
default: CeilometerPassword
1889+
description: CeilometerService - Selector to get the ceilometer
1890+
service password from the Secret
1891+
type: string
1892+
cloudKittyService:
1893+
default: CloudKittyPassword
1894+
description: CloudKittyService - Selector to get the CloudKitty
1895+
service password from the Secret
1896+
type: string
1897+
type: object
18691898
prometheusClientCertSecret:
18701899
description: |-
18711900
PrometheusClientCertSecret - Secret containing client cert and key
@@ -1887,6 +1916,18 @@ spec:
18871916
description: SecretName - holding the cert, key for the service
18881917
type: string
18891918
type: object
1919+
secret:
1920+
default: osp-secret
1921+
description: Secret containing OpenStack password information for
1922+
aetos
1923+
type: string
1924+
serviceUser:
1925+
default: aetos
1926+
description: ServiceUser - optional username used for this service
1927+
to register in keystone
1928+
type: string
1929+
required:
1930+
- secret
18901931
type: object
18911932
status:
18921933
description: MetricStorageStatus defines the observed state of MetricStorage

‎api/bases/telemetry.openstack.org_telemetries.yaml‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ spec:
317317
description: PasswordSelectors - Selectors to identify the
318318
service from the Secret
319319
properties:
320+
aetosService:
321+
default: AetosPassword
322+
description: AetosService - Selector to get the aetos
323+
service password from the Secret
324+
type: string
320325
aodhService:
321326
default: AodhPassword
322327
description: AodhService - Selector to get the aodh service
@@ -583,6 +588,11 @@ spec:
583588
description: PasswordSelectors - Selectors to identify the service
584589
from the Secret
585590
properties:
591+
aetosService:
592+
default: AetosPassword
593+
description: AetosService - Selector to get the aetos service
594+
password from the Secret
595+
type: string
586596
aodhService:
587597
default: AodhPassword
588598
description: AodhService - Selector to get the aodh service
@@ -1207,6 +1217,11 @@ spec:
12071217
description: PasswordsSelectors - Selectors to identify the ServiceUser
12081218
password from the Secret
12091219
properties:
1220+
aetosService:
1221+
default: AetosPassword
1222+
description: AetosService - Selector to get the aetos service
1223+
password from the Secret
1224+
type: string
12101225
aodhService:
12111226
default: AodhPassword
12121227
description: AodhService - Selector to get the aodh service
@@ -1433,6 +1448,8 @@ spec:
14331448
metricStorage:
14341449
description: MetricStorage - Parameters related to the metricStorage
14351450
properties:
1451+
aetosImage:
1452+
type: string
14361453
alertmanagerTls:
14371454
description: |-
14381455
TLS - Parameters related to the Alertmanager TLS.
@@ -3267,6 +3284,33 @@ spec:
32673284
OpenStackLightspeedNamespace defines the namespace where OpenStack Lightspeed
32683285
is deployed. Used for discovering Lightspeed metrics services.
32693286
type: string
3287+
passwordSelector:
3288+
default:
3289+
aetosService: AetosPassword
3290+
description: PasswordSelectors - Selectors to identify the service
3291+
from the Secret
3292+
properties:
3293+
aetosService:
3294+
default: AetosPassword
3295+
description: AetosService - Selector to get the aetos service
3296+
password from the Secret
3297+
type: string
3298+
aodhService:
3299+
default: AodhPassword
3300+
description: AodhService - Selector to get the aodh service
3301+
password from the Secret
3302+
type: string
3303+
ceilometerService:
3304+
default: CeilometerPassword
3305+
description: CeilometerService - Selector to get the ceilometer
3306+
service password from the Secret
3307+
type: string
3308+
cloudKittyService:
3309+
default: CloudKittyPassword
3310+
description: CloudKittyService - Selector to get the CloudKitty
3311+
service password from the Secret
3312+
type: string
3313+
type: object
32703314
prometheusClientCertSecret:
32713315
description: |-
32723316
PrometheusClientCertSecret - Secret containing client cert and key
@@ -3288,6 +3332,18 @@ spec:
32883332
description: SecretName - holding the cert, key for the service
32893333
type: string
32903334
type: object
3335+
secret:
3336+
default: osp-secret
3337+
description: Secret containing OpenStack password information
3338+
for aetos
3339+
type: string
3340+
serviceUser:
3341+
default: aetos
3342+
description: ServiceUser - optional username used for this service
3343+
to register in keystone
3344+
type: string
3345+
required:
3346+
- secret
32913347
type: object
32923348
nodeSelector:
32933349
additionalProperties:

‎api/v1beta1/conditions.go‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ const (
8686
// KSMCreateServiceReadyCondition Status=True condition when k8s service for the KSM created ok
8787
KSMCreateServiceReadyCondition condition.Type = "KSMCreateServiceReady"
8888

89+
// AetosReadyCondition Status=True condition which indicates if the Aetos sidecar is configured and operational
90+
AetosReadyCondition condition.Type = "AetosReady"
91+
92+
// AetosKeystoneServiceReadyCondition Status=True condition which indicates if the Aetos Keystone service is registered
93+
AetosKeystoneServiceReadyCondition condition.Type = "AetosKeystoneServiceReady"
94+
95+
// AetosKeystoneEndpointReadyCondition Status=True condition which indicates if the Aetos Keystone endpoint is registered
96+
AetosKeystoneEndpointReadyCondition condition.Type = "AetosKeystoneEndpointReady"
97+
8998
// MysqldExporter conditions
9099
MysqldExporterDBReadyCondition condition.Type = "MysqldExporterDBReady"
91100

@@ -188,6 +197,21 @@ const (
188197
ScrapeConfigUnableToOwnMessage = "Error occured when trying to own %s"
189198

190199
//
200+
//
201+
// AetosReady condition messages
202+
//
203+
// AetosReadyInitMessage
204+
AetosReadyInitMessage = "Aetos sidecar not started"
205+
206+
// AetosReadyImageMissingMessage
207+
AetosReadyImageMissingMessage = "Aetos container image is not set. Ensure the MetricStorage webhook is running and the AetosImage field is defaulted."
208+
209+
// AetosKeystoneServiceReadyInitMessage
210+
AetosKeystoneServiceReadyInitMessage = "Aetos Keystone service not started"
211+
212+
// AetosKeystoneEndpointReadyInitMessage
213+
AetosKeystoneEndpointReadyInitMessage = "Aetos Keystone endpoint not started"
214+
191215
// PrometheusReady condition messages
192216
//
193217
// PrometheusReadyInitMessage

‎api/v1beta1/metricstorage_types.go‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,16 @@ import (
2020
infranetworkv1 "github.com/openstack-k8s-operators/infra-operator/apis/network/v1beta1"
2121
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2222
tls "github.com/openstack-k8s-operators/lib-common/modules/common/tls"
23+
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
2324
obov1 "github.com/rhobs/observability-operator/pkg/apis/monitoring/v1alpha1"
2425
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2526
)
2627

28+
const (
29+
// AetosContainerImage - default fall-back image for Aetos
30+
AetosContainerImage = "quay.io/openstack-s2i-containers/openstack-aetos:master-latest"
31+
)
32+
2733
// PersistentStorage defines storage options used for persistent storage
2834
type PersistentStorage struct {
2935
// PvcStorageRequest The amount of storage to request in PVC
@@ -84,6 +90,14 @@ type MonitoringStack struct {
8490

8591
// MetricStorageSpec defines the desired state of MetricStorage
8692
type MetricStorageSpec struct {
93+
MetricStorageSpecCore `json:",inline"`
94+
95+
// +kubebuilder:validation:Optional
96+
AetosImage string `json:"aetosImage"`
97+
}
98+
99+
// MetricStorageSpecCore defines the desired state of MetricStorage. This version is used by the OpenStackControlplane (no image parameters)
100+
type MetricStorageSpecCore struct {
87101
// DashboardsEnabled allows to enable or disable dashboards and related artifacts
88102
// +kubebuilder:validation:Optional
89103
// +kubebuilder:default=false
@@ -136,6 +150,20 @@ type MetricStorageSpec struct {
136150
// TLS - Parameters related to the Alertmanager TLS.
137151
// The value of caBundleSecretName is currently ignored.
138152
AlertmanagerTLS tls.SimpleService `json:"alertmanagerTls,omitempty"`
153+
154+
// ServiceUser - optional username used for this service to register in keystone
155+
// +kubebuilder:validation:Optional
156+
// +kubebuilder:default=aetos
157+
ServiceUser string `json:"serviceUser"`
158+
159+
// Secret containing OpenStack password information for aetos
160+
// +kubebuilder:validation:Required
161+
// +kubebuilder:default=osp-secret
162+
Secret string `json:"secret"`
163+
164+
// PasswordSelectors - Selectors to identify the service from the Secret
165+
// +kubebuilder:default:={aetosService: AetosPassword}
166+
PasswordSelectors PasswordsSelector `json:"passwordSelector,omitempty"`
139167
}
140168

141169
// MetricStorageStatus defines the observed state of MetricStorage
@@ -186,3 +214,12 @@ func init() {
186214
func (instance MetricStorage) IsReady() bool {
187215
return instance.Status.Conditions.IsTrue(condition.ReadyCondition)
188216
}
217+
218+
// SetupDefaultsMetricStorage - initializes any CRD field defaults based on environment variables (the defaulting mechanism itself is implemented via webhooks)
219+
func SetupDefaultsMetricStorage() {
220+
metricStorageDefaults := MetricStorageDefaults{
221+
AetosContainerImageURL: util.GetEnvVar("RELATED_IMAGE_AETOS_IMAGE_URL_DEFAULT", AetosContainerImage),
222+
}
223+
224+
SetupMetricStorageDefaults(metricStorageDefaults)
225+
}

‎api/v1beta1/metricstorage_webhook.go‎

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,38 @@ import (
2222
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2323
)
2424

25+
// MetricStorageDefaults -
26+
type MetricStorageDefaults struct {
27+
AetosContainerImageURL string
28+
}
29+
30+
var metricStorageDefaults MetricStorageDefaults
31+
2532
// log is for logging in this package.
2633
var metricstoragelog = logf.Log.WithName("metricstorage-resource")
2734

35+
// SetupMetricStorageDefaults - initialize MetricStorage spec defaults for use with either internal or external webhooks
36+
func SetupMetricStorageDefaults(defaults MetricStorageDefaults) {
37+
metricStorageDefaults = defaults
38+
metricstoragelog.Info("MetricStorage defaults initialized", "defaults", defaults)
39+
}
40+
2841
// Default sets default values for the MetricStorage spec
2942
func (r *MetricStorage) Default() {
3043
r.Spec.Default()
3144
}
3245

3346
// Default - set defaults for the MetricStorage spec
3447
func (spec *MetricStorageSpec) Default() {
48+
if spec.AetosImage == "" {
49+
spec.AetosImage = metricStorageDefaults.AetosContainerImageURL
50+
}
51+
52+
spec.MetricStorageSpecCore.Default()
53+
}
54+
55+
// Default - set defaults for the MetricStorage spec core. NOTE: this version is used by the OpenStackControlplane webhook
56+
func (spec *MetricStorageSpecCore) Default() {
3557
if spec.MonitoringStack == nil && spec.CustomMonitoringStack == nil {
3658
spec.MonitoringStack = &MonitoringStack{}
3759
// Set the AlertingEnabled to true here as the empty value means false
@@ -43,7 +65,7 @@ func (spec *MetricStorageSpec) Default() {
4365
// it here like Alerting above
4466
}
4567

46-
if *spec.DataplaneNetwork == "" {
68+
if spec.DataplaneNetwork != nil && *spec.DataplaneNetwork == "" {
4769
*spec.DataplaneNetwork = "ctlplane"
4870
}
4971

0 commit comments

Comments
 (0)