@@ -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
2834type 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
8692type 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() {
186214func (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+ }
0 commit comments