Skip to content

Commit 79ae205

Browse files
committed
AppCred support
1 parent b102924 commit 79ae205

31 files changed

+3892
-109
lines changed

api/bases/core.openstack.org_openstackcontrolplanes.yaml

Lines changed: 658 additions & 0 deletions
Large diffs are not rendered by default.

api/core/v1beta1/openstackcontrolplane_types.go

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,14 @@ type OpenStackControlPlaneSpec struct {
225225
// +operator-sdk:csv:customresourcedefinitions:type=spec
226226
// Watcher - Parameters related to the Watcher service
227227
Watcher WatcherSection `json:"watcher,omitempty"`
228+
229+
// +kubebuilder:validation:Optional
230+
// +operator-sdk:csv:customresourcedefinitions:type=spec
231+
// ApplicationCredential - Global configuration for ApplicationCredentials.
232+
// Both this global section AND the per-service applicationCredential section
233+
// must be enabled for a service to use ApplicationCredentials.
234+
// If omitted, defaults to enabled=false with standard expiration/grace periods.
235+
ApplicationCredential ApplicationCredentialSection `json:"applicationCredential,omitempty"`
228236
}
229237

230238
// TLSSection defines the desired state of TLS configuration
@@ -419,6 +427,13 @@ type PlacementSection struct {
419427
// +operator-sdk:csv:customresourcedefinitions:type=spec
420428
// APIOverride, provides the ability to override the generated manifest of several child resources.
421429
APIOverride Override `json:"apiOverride,omitempty"`
430+
431+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
432+
// +operator-sdk:csv:customresourcedefinitions:type=spec
433+
// +kubebuilder:validation:Optional
434+
// +nullable
435+
// +kubebuilder:default={enabled:false}
436+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
422437
}
423438

424439
// GlanceSection defines the desired state of Glance service
@@ -445,6 +460,13 @@ type GlanceSection struct {
445460
// Convenient to avoid podname (and thus hostname) collision between different deployments.
446461
// Useful for CI jobs as well as preproduction and production environments that use the same storage backend, etc.
447462
UniquePodNames bool `json:"uniquePodNames"`
463+
464+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
465+
// +operator-sdk:csv:customresourcedefinitions:type=spec
466+
// +kubebuilder:validation:Optional
467+
// +nullable
468+
// +kubebuilder:default={enabled:false}
469+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
448470
}
449471

450472
// CinderSection defines the desired state of Cinder service
@@ -471,6 +493,13 @@ type CinderSection struct {
471493
// Convenient to avoid podname (and thus hostname) collision between different deployments.
472494
// Useful for CI jobs as well as preproduction and production environments that use the same storage backend, etc.
473495
UniquePodNames bool `json:"uniquePodNames"`
496+
497+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
498+
// +operator-sdk:csv:customresourcedefinitions:type=spec
499+
// +kubebuilder:validation:Optional
500+
// +nullable
501+
// +kubebuilder:default={enabled:false}
502+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
474503
}
475504

476505
// GaleraSection defines the desired state of Galera services
@@ -564,6 +593,13 @@ type NeutronSection struct {
564593
// +operator-sdk:csv:customresourcedefinitions:type=spec
565594
// APIOverride, provides the ability to override the generated manifest of several child resources.
566595
APIOverride Override `json:"apiOverride,omitempty"`
596+
597+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
598+
// +operator-sdk:csv:customresourcedefinitions:type=spec
599+
// +kubebuilder:validation:Optional
600+
// +nullable
601+
// +kubebuilder:default={enabled:false}
602+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
567603
}
568604

569605
// NovaSection defines the desired state of Nova services
@@ -590,6 +626,13 @@ type NovaSection struct {
590626
// for a nova cell. cell0 never have compute nodes and therefore it won't have a noVNCProxy deployed.
591627
// Providing an override for cell0 noVNCProxy does not have an effect.
592628
CellOverride map[string]NovaCellOverrideSpec `json:"cellOverride,omitempty"`
629+
630+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
631+
// +operator-sdk:csv:customresourcedefinitions:type=spec
632+
// +kubebuilder:validation:Optional
633+
// +nullable
634+
// +kubebuilder:default={enabled:false}
635+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
593636
}
594637

595638
// NovaCellOverrideSpec to override the generated manifest of several child resources.
@@ -620,6 +663,13 @@ type HeatSection struct {
620663
// +operator-sdk:csv:customresourcedefinitions:type=spec
621664
// CnfAPIOverride, provides the ability to override the generated manifest of several child resources.
622665
CnfAPIOverride Override `json:"cnfAPIOverride,omitempty"`
666+
667+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
668+
// +operator-sdk:csv:customresourcedefinitions:type=spec
669+
// +kubebuilder:validation:Optional
670+
// +nullable
671+
// +kubebuilder:default={enabled:false}
672+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
623673
}
624674

625675
// IronicSection defines the desired state of Ironic services
@@ -644,6 +694,13 @@ type IronicSection struct {
644694
// +operator-sdk:csv:customresourcedefinitions:type=spec
645695
// InspectorOverride, provides the ability to override the generated manifest of several child resources.
646696
InspectorOverride Override `json:"inspectorOverride,omitempty"`
697+
698+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
699+
// +operator-sdk:csv:customresourcedefinitions:type=spec
700+
// +kubebuilder:validation:Optional
701+
// +nullable
702+
// +kubebuilder:default={enabled:false}
703+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
647704
}
648705

649706
// ManilaSection defines the desired state of Manila service
@@ -663,6 +720,13 @@ type ManilaSection struct {
663720
// +operator-sdk:csv:customresourcedefinitions:type=spec
664721
// APIOverride, provides the ability to override the generated manifest of several child resources.
665722
APIOverride Override `json:"apiOverride,omitempty"`
723+
724+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
725+
// +operator-sdk:csv:customresourcedefinitions:type=spec
726+
// +kubebuilder:validation:Optional
727+
// +nullable
728+
// +kubebuilder:default={enabled:false}
729+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
666730
}
667731

668732
// HorizonSection defines the desired state of Horizon services
@@ -716,6 +780,20 @@ type TelemetrySection struct {
716780
// +operator-sdk:csv:customresourcedefinitions:type=spec
717781
// AlertmanagerOverride, provides the ability to override the generated manifest of several child resources.
718782
AlertmanagerOverride Override `json:"alertmanagerOverride,omitempty"`
783+
784+
// ApplicationCredentialCeilometer allows service-specific overrides of the global AC configuration for Ceilometer.
785+
// +operator-sdk:csv:customresourcedefinitions:type=spec
786+
// +kubebuilder:validation:Optional
787+
// +nullable
788+
// +kubebuilder:default={enabled:false}
789+
ApplicationCredentialCeilometer *ServiceAppCredSection `json:"applicationCredentialCeilometer"`
790+
791+
// ApplicationCredentialAodh allows service-specific overrides of the global AC configuration for Aodh.
792+
// +operator-sdk:csv:customresourcedefinitions:type=spec
793+
// +kubebuilder:validation:Optional
794+
// +nullable
795+
// +kubebuilder:default={enabled:false}
796+
ApplicationCredentialAodh *ServiceAppCredSection `json:"applicationCredentialAodh"`
719797
}
720798

721799
// SwiftSection defines the desired state of Swift service
@@ -735,6 +813,13 @@ type SwiftSection struct {
735813
// +operator-sdk:csv:customresourcedefinitions:type=spec
736814
// ProxyOverride, provides the ability to override the generated manifest of several child resources.
737815
ProxyOverride Override `json:"proxyOverride,omitempty"`
816+
817+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
818+
// +operator-sdk:csv:customresourcedefinitions:type=spec
819+
// +kubebuilder:validation:Optional
820+
// +nullable
821+
// +kubebuilder:default={enabled:false}
822+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
738823
}
739824

740825
// OctaviaSection defines the desired state of the Octavia service
@@ -754,6 +839,13 @@ type OctaviaSection struct {
754839
// +operator-sdk:csv:customresourcedefinitions:type=spec
755840
// APIOverride, provides the ability to override the generated manifest of several child resources.
756841
APIOverride Override `json:"apiOverride,omitempty"`
842+
843+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
844+
// +operator-sdk:csv:customresourcedefinitions:type=spec
845+
// +kubebuilder:validation:Optional
846+
// +nullable
847+
// +kubebuilder:default={enabled:false}
848+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
757849
}
758850

759851
// DesignateSection defines the desired state of the Designate service
@@ -773,6 +865,13 @@ type DesignateSection struct {
773865
// +operator-sdk:csv:customresourcedefinitions:type=spec
774866
// APIOverride, provides the ability to override the generated manifest of several child resources.
775867
APIOverride Override `json:"apiOverride,omitempty"`
868+
869+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
870+
// +operator-sdk:csv:customresourcedefinitions:type=spec
871+
// +kubebuilder:validation:Optional
872+
// +nullable
873+
// +kubebuilder:default={enabled:false}
874+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
776875
}
777876

778877
// BarbicanSection defines the desired state of Barbican service
@@ -792,6 +891,13 @@ type BarbicanSection struct {
792891
// +operator-sdk:csv:customresourcedefinitions:type=spec
793892
// APIOverride, provides the ability to override the generated manifest of several child resources.
794893
APIOverride Override `json:"apiOverride,omitempty"`
894+
895+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
896+
// +operator-sdk:csv:customresourcedefinitions:type=spec
897+
// +kubebuilder:validation:Optional
898+
// +nullable
899+
// +kubebuilder:default={enabled:false}
900+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
795901
}
796902

797903
// RedisSection defines the desired state of the Redis service
@@ -833,6 +939,94 @@ type WatcherSection struct {
833939
// +operator-sdk:csv:customresourcedefinitions:type=spec
834940
// APIOverride, provides the ability to override the generated manifest of several child resources.
835941
APIOverride Override `json:"apiOverride,omitempty"`
942+
943+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
944+
// +operator-sdk:csv:customresourcedefinitions:type=spec
945+
// +kubebuilder:validation:Optional
946+
// +nullable
947+
// +kubebuilder:default={enabled:false}
948+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
949+
}
950+
951+
// +kubebuilder:validation:XValidation:rule="self.gracePeriodDays < self.expirationDays",message="gracePeriodDays must be smaller than expirationDays"
952+
// ApplicationCredentialSection defines the desired configuration for ApplicationCredentials
953+
type ApplicationCredentialSection struct {
954+
// Enabled indicates whether an ApplicationCredential should be created
955+
// +kubebuilder:validation:Optional
956+
// +kubebuilder:default=false
957+
Enabled bool `json:"enabled"`
958+
959+
// ExpirationDays sets the lifetime in days for the AC
960+
// +kubebuilder:validation:Optional
961+
// +kubebuilder:default=365
962+
// +kubebuilder:validation:Minimum=2
963+
ExpirationDays *int `json:"expirationDays"`
964+
965+
// GracePeriodDays sets how many days before expiration the AC should be rotated
966+
// +kubebuilder:validation:Optional
967+
// +kubebuilder:default=182
968+
// +kubebuilder:validation:Minimum=1
969+
GracePeriodDays *int `json:"gracePeriodDays"`
970+
971+
// +kubebuilder:validation:Optional
972+
// +kubebuilder:default={"service"}
973+
// +kubebuilder:validation:MinItems=1
974+
// Roles to assign to the ApplicationCredential
975+
Roles []string `json:"roles"`
976+
977+
// +kubebuilder:validation:Optional
978+
// +kubebuilder:default=false
979+
// Whether the AC should be unrestricted
980+
Unrestricted *bool `json:"unrestricted"`
981+
982+
// AccessRules lets supply a custom list of rules
983+
// If unset, no accessRules field is emitted
984+
// +kubebuilder:validation:Optional
985+
// +listType=atomic
986+
AccessRules []ACRule `json:"accessRules,omitempty"`
987+
}
988+
989+
// +kubebuilder:validation:XValidation:rule="!(has(self.expirationDays) && has(self.gracePeriodDays)) || self.gracePeriodDays < self.expirationDays",message="gracePeriodDays must be smaller than expirationDays"
990+
// ServiceAppCredSection allows service-specific overrides of the global AC configuration
991+
type ServiceAppCredSection struct {
992+
// +kubebuilder:validation:Optional
993+
// +kubebuilder:default=false
994+
Enabled bool `json:"enabled"`
995+
996+
// +kubebuilder:validation:Optional
997+
// +kubebuilder:validation:Minimum=2
998+
ExpirationDays *int `json:"expirationDays,omitempty"`
999+
1000+
// +kubebuilder:validation:Optional
1001+
// +kubebuilder:validation:Minimum=1
1002+
GracePeriodDays *int `json:"gracePeriodDays,omitempty"`
1003+
1004+
// +kubebuilder:validation:Optional
1005+
// Roles to assign to the ApplicationCredential
1006+
Roles []string `json:"roles,omitempty"`
1007+
1008+
// +kubebuilder:validation:Optional
1009+
// Whether the AC should be unrestricted
1010+
Unrestricted *bool `json:"unrestricted,omitempty"`
1011+
1012+
// AccessRules lets the service override either the global rules
1013+
// +kubebuilder:validation:Optional
1014+
// +listType=atomic
1015+
AccessRules []ACRule `json:"accessRules,omitempty"`
1016+
}
1017+
1018+
// ACRule describes a single access rule for an ApplicationCredential
1019+
// +k8s:openapi-gen=true
1020+
type ACRule struct {
1021+
// Service is the name of the service to target (e.g. "identity").
1022+
// +kubebuilder:validation:Required
1023+
Service string `json:"service"`
1024+
// Path is the HTTP path (e.g. "/v3/auth/tokens").
1025+
// +kubebuilder:validation:Required
1026+
Path string `json:"path"`
1027+
// Method is the HTTP method to allow (e.g. "POST").
1028+
// +kubebuilder:validation:Required
1029+
Method string `json:"method"`
8361030
}
8371031

8381032
// OpenStackControlPlaneStatus defines the observed state of OpenStackControlPlane

api/core/v1beta1/openstackcontrolplane_webhook.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,12 @@ func (r *OpenStackControlPlane) DefaultServices() {
10811081
}
10821082
}
10831083

1084+
// Initialize ApplicationCredential (watcher specific) field to avoid null value
1085+
// This ensures consistent behavior with other services.
1086+
if r.Spec.Watcher.ApplicationCredential == nil {
1087+
r.Spec.Watcher.ApplicationCredential = &ServiceAppCredSection{Enabled: false}
1088+
}
1089+
10841090
}
10851091

10861092
// DefaultLabel - adding default label to the OpenStackControlPlane
@@ -1147,7 +1153,7 @@ func (r *OpenStackControlPlane) ValidateNotificationsBusInstance(basePath *field
11471153
// NotificationsBusInstance is set and must be equal to an existing
11481154
// deployed rabbitmq instance, otherwise we should fail because it
11491155
// does not represent a valid string
1150-
for k := range(*r.Spec.Rabbitmq.Templates) {
1156+
for k := range *r.Spec.Rabbitmq.Templates {
11511157
if *r.Spec.NotificationsBusInstance == k {
11521158
return nil
11531159
}

0 commit comments

Comments
 (0)