Skip to content

Commit 97e4754

Browse files
committed
AppCred support
Signed-off-by: Veronika Fisarova <vfisarov@redhat.com>
1 parent 3602e24 commit 97e4754

78 files changed

Lines changed: 4971 additions & 164 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/bases/core.openstack.org_openstackcontrolplanes.yaml

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

api/core/v1beta1/openstackcontrolplane_types.go

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ type OpenStackControlPlaneSpec struct {
235235
// +operator-sdk:csv:customresourcedefinitions:type=spec
236236
// Watcher - Parameters related to the Watcher service
237237
Watcher WatcherSection `json:"watcher,omitempty"`
238+
239+
// +kubebuilder:validation:Optional
240+
// +operator-sdk:csv:customresourcedefinitions:type=spec
241+
// ApplicationCredential - Global configuration for ApplicationCredentials.
242+
// Both this global section AND the per-service applicationCredential section
243+
// must be enabled for a service to use ApplicationCredentials.
244+
// If omitted, defaults to enabled=false with standard expiration/grace periods.
245+
ApplicationCredential ApplicationCredentialSection `json:"applicationCredential,omitempty"`
238246
}
239247

240248
// TLSSection defines the desired state of TLS configuration
@@ -429,6 +437,13 @@ type PlacementSection struct {
429437
// +operator-sdk:csv:customresourcedefinitions:type=spec
430438
// APIOverride, provides the ability to override the generated manifest of several child resources.
431439
APIOverride Override `json:"apiOverride,omitempty"`
440+
441+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
442+
// +operator-sdk:csv:customresourcedefinitions:type=spec
443+
// +kubebuilder:validation:Optional
444+
// +nullable
445+
// +kubebuilder:default={enabled:false}
446+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
432447
}
433448

434449
// GlanceSection defines the desired state of Glance service
@@ -461,6 +476,13 @@ type GlanceSection struct {
461476
// This field preserves the service name (with UID suffix) across reconciliations and restores,
462477
// ensuring consistent resource naming even when the CR is recreated. Should not be manually set.
463478
ServiceName string `json:"serviceName,omitempty"`
479+
480+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
481+
// +operator-sdk:csv:customresourcedefinitions:type=spec
482+
// +kubebuilder:validation:Optional
483+
// +nullable
484+
// +kubebuilder:default={enabled:false}
485+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
464486
}
465487

466488
// CinderSection defines the desired state of Cinder service
@@ -493,6 +515,13 @@ type CinderSection struct {
493515
// This field preserves the service name (with UID suffix) across reconciliations and restores,
494516
// ensuring consistent resource naming even when the CR is recreated. Should not be manually set.
495517
ServiceName string `json:"serviceName,omitempty"`
518+
519+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
520+
// +operator-sdk:csv:customresourcedefinitions:type=spec
521+
// +kubebuilder:validation:Optional
522+
// +nullable
523+
// +kubebuilder:default={enabled:false}
524+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
496525
}
497526

498527
// GaleraSection defines the desired state of Galera services
@@ -586,6 +615,13 @@ type NeutronSection struct {
586615
// +operator-sdk:csv:customresourcedefinitions:type=spec
587616
// APIOverride, provides the ability to override the generated manifest of several child resources.
588617
APIOverride Override `json:"apiOverride,omitempty"`
618+
619+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
620+
// +operator-sdk:csv:customresourcedefinitions:type=spec
621+
// +kubebuilder:validation:Optional
622+
// +nullable
623+
// +kubebuilder:default={enabled:false}
624+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
589625
}
590626

591627
// NovaSection defines the desired state of Nova services
@@ -612,6 +648,13 @@ type NovaSection struct {
612648
// for a nova cell. cell0 never have compute nodes and therefore it won't have a noVNCProxy deployed.
613649
// Providing an override for cell0 noVNCProxy does not have an effect.
614650
CellOverride map[string]NovaCellOverrideSpec `json:"cellOverride,omitempty"`
651+
652+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
653+
// +operator-sdk:csv:customresourcedefinitions:type=spec
654+
// +kubebuilder:validation:Optional
655+
// +nullable
656+
// +kubebuilder:default={enabled:false}
657+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
615658
}
616659

617660
// NovaCellOverrideSpec to override the generated manifest of several child resources.
@@ -642,6 +685,13 @@ type HeatSection struct {
642685
// +operator-sdk:csv:customresourcedefinitions:type=spec
643686
// CnfAPIOverride, provides the ability to override the generated manifest of several child resources.
644687
CnfAPIOverride Override `json:"cnfAPIOverride,omitempty"`
688+
689+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
690+
// +operator-sdk:csv:customresourcedefinitions:type=spec
691+
// +kubebuilder:validation:Optional
692+
// +nullable
693+
// +kubebuilder:default={enabled:false}
694+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
645695
}
646696

647697
// IronicSection defines the desired state of Ironic services
@@ -666,6 +716,13 @@ type IronicSection struct {
666716
// +operator-sdk:csv:customresourcedefinitions:type=spec
667717
// InspectorOverride, provides the ability to override the generated manifest of several child resources.
668718
InspectorOverride Override `json:"inspectorOverride,omitempty"`
719+
720+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
721+
// +operator-sdk:csv:customresourcedefinitions:type=spec
722+
// +kubebuilder:validation:Optional
723+
// +nullable
724+
// +kubebuilder:default={enabled:false}
725+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
669726
}
670727

671728
// ManilaSection defines the desired state of Manila service
@@ -685,6 +742,13 @@ type ManilaSection struct {
685742
// +operator-sdk:csv:customresourcedefinitions:type=spec
686743
// APIOverride, provides the ability to override the generated manifest of several child resources.
687744
APIOverride Override `json:"apiOverride,omitempty"`
745+
746+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
747+
// +operator-sdk:csv:customresourcedefinitions:type=spec
748+
// +kubebuilder:validation:Optional
749+
// +nullable
750+
// +kubebuilder:default={enabled:false}
751+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
688752
}
689753

690754
// HorizonSection defines the desired state of Horizon services
@@ -738,6 +802,27 @@ type TelemetrySection struct {
738802
// +operator-sdk:csv:customresourcedefinitions:type=spec
739803
// AlertmanagerOverride, provides the ability to override the generated manifest of several child resources.
740804
AlertmanagerOverride Override `json:"alertmanagerOverride,omitempty"`
805+
806+
// ApplicationCredentialCeilometer allows service-specific overrides of the global AC configuration for Ceilometer.
807+
// +operator-sdk:csv:customresourcedefinitions:type=spec
808+
// +kubebuilder:validation:Optional
809+
// +nullable
810+
// +kubebuilder:default={enabled:false}
811+
ApplicationCredentialCeilometer *ServiceAppCredSection `json:"applicationCredentialCeilometer"`
812+
813+
// ApplicationCredentialAodh allows service-specific overrides of the global AC configuration for Aodh.
814+
// +operator-sdk:csv:customresourcedefinitions:type=spec
815+
// +kubebuilder:validation:Optional
816+
// +nullable
817+
// +kubebuilder:default={enabled:false}
818+
ApplicationCredentialAodh *ServiceAppCredSection `json:"applicationCredentialAodh"`
819+
820+
// ApplicationCredentialCloudKitty allows service-specific overrides of the global AC configuration for CloudKitty.
821+
// +operator-sdk:csv:customresourcedefinitions:type=spec
822+
// +kubebuilder:validation:Optional
823+
// +nullable
824+
// +kubebuilder:default={enabled:false}
825+
ApplicationCredentialCloudKitty *ServiceAppCredSection `json:"applicationCredentialCloudKitty"`
741826
}
742827

743828
// SwiftSection defines the desired state of Swift service
@@ -757,6 +842,13 @@ type SwiftSection struct {
757842
// +operator-sdk:csv:customresourcedefinitions:type=spec
758843
// ProxyOverride, provides the ability to override the generated manifest of several child resources.
759844
ProxyOverride Override `json:"proxyOverride,omitempty"`
845+
846+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
847+
// +operator-sdk:csv:customresourcedefinitions:type=spec
848+
// +kubebuilder:validation:Optional
849+
// +nullable
850+
// +kubebuilder:default={enabled:false}
851+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
760852
}
761853

762854
// OctaviaSection defines the desired state of the Octavia service
@@ -776,6 +868,13 @@ type OctaviaSection struct {
776868
// +operator-sdk:csv:customresourcedefinitions:type=spec
777869
// APIOverride, provides the ability to override the generated manifest of several child resources.
778870
APIOverride Override `json:"apiOverride,omitempty"`
871+
872+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
873+
// +operator-sdk:csv:customresourcedefinitions:type=spec
874+
// +kubebuilder:validation:Optional
875+
// +nullable
876+
// +kubebuilder:default={enabled:false}
877+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
779878
}
780879

781880
// DesignateSection defines the desired state of the Designate service
@@ -795,6 +894,13 @@ type DesignateSection struct {
795894
// +operator-sdk:csv:customresourcedefinitions:type=spec
796895
// APIOverride, provides the ability to override the generated manifest of several child resources.
797896
APIOverride Override `json:"apiOverride,omitempty"`
897+
898+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
899+
// +operator-sdk:csv:customresourcedefinitions:type=spec
900+
// +kubebuilder:validation:Optional
901+
// +nullable
902+
// +kubebuilder:default={enabled:false}
903+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
798904
}
799905

800906
// BarbicanSection defines the desired state of Barbican service
@@ -814,6 +920,13 @@ type BarbicanSection struct {
814920
// +operator-sdk:csv:customresourcedefinitions:type=spec
815921
// APIOverride, provides the ability to override the generated manifest of several child resources.
816922
APIOverride Override `json:"apiOverride,omitempty"`
923+
924+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
925+
// +operator-sdk:csv:customresourcedefinitions:type=spec
926+
// +kubebuilder:validation:Optional
927+
// +nullable
928+
// +kubebuilder:default={enabled:false}
929+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
817930
}
818931

819932
// RedisSection defines the desired state of the Redis service
@@ -855,6 +968,97 @@ type WatcherSection struct {
855968
// +operator-sdk:csv:customresourcedefinitions:type=spec
856969
// APIOverride, provides the ability to override the generated manifest of several child resources.
857970
APIOverride Override `json:"apiOverride,omitempty"`
971+
972+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
973+
// +operator-sdk:csv:customresourcedefinitions:type=spec
974+
// +kubebuilder:validation:Optional
975+
// +nullable
976+
// +kubebuilder:default={enabled:false}
977+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
978+
}
979+
980+
// +kubebuilder:validation:XValidation:rule="self.gracePeriodDays < self.expirationDays",message="gracePeriodDays must be smaller than expirationDays"
981+
// ApplicationCredentialSection defines the desired configuration for ApplicationCredentials
982+
type ApplicationCredentialSection struct {
983+
// Enabled indicates whether an ApplicationCredential should be created
984+
// +kubebuilder:validation:Optional
985+
// +kubebuilder:default=false
986+
Enabled bool `json:"enabled"`
987+
988+
// ExpirationDays sets the lifetime in days for the AC
989+
// +kubebuilder:validation:Optional
990+
// +kubebuilder:default=730
991+
// +kubebuilder:validation:Minimum=2
992+
ExpirationDays *int `json:"expirationDays"`
993+
994+
// GracePeriodDays sets how many days before expiration the AC should be rotated
995+
// +kubebuilder:validation:Optional
996+
// +kubebuilder:default=364
997+
// +kubebuilder:validation:Minimum=1
998+
GracePeriodDays *int `json:"gracePeriodDays"`
999+
1000+
// +kubebuilder:validation:Optional
1001+
// +kubebuilder:default={"admin","service"}
1002+
// +kubebuilder:validation:MinItems=1
1003+
// Roles to assign to the ApplicationCredential
1004+
Roles []string `json:"roles"`
1005+
1006+
// +kubebuilder:validation:Optional
1007+
// +kubebuilder:default=false
1008+
// Whether the AC should be unrestricted
1009+
Unrestricted *bool `json:"unrestricted"`
1010+
1011+
// AccessRules lets supply a custom list of rules
1012+
// If unset, no accessRules field is emitted
1013+
// +kubebuilder:validation:Optional
1014+
// +listType=atomic
1015+
AccessRules []ACRule `json:"accessRules,omitempty"`
1016+
}
1017+
1018+
// +kubebuilder:validation:XValidation:rule="!(has(self.expirationDays) && has(self.gracePeriodDays)) || self.gracePeriodDays < self.expirationDays",message="gracePeriodDays must be smaller than expirationDays"
1019+
// ServiceAppCredSection allows service-specific overrides of the global AC configuration
1020+
type ServiceAppCredSection struct {
1021+
// +kubebuilder:validation:Optional
1022+
// +kubebuilder:default=false
1023+
Enabled bool `json:"enabled"`
1024+
1025+
// +kubebuilder:validation:Optional
1026+
// +kubebuilder:validation:Minimum=2
1027+
ExpirationDays *int `json:"expirationDays,omitempty"`
1028+
1029+
// +kubebuilder:validation:Optional
1030+
// +kubebuilder:validation:Minimum=1
1031+
GracePeriodDays *int `json:"gracePeriodDays,omitempty"`
1032+
1033+
// +kubebuilder:validation:Optional
1034+
// Roles to assign to the ApplicationCredential
1035+
Roles []string `json:"roles,omitempty"`
1036+
1037+
// +kubebuilder:validation:Optional
1038+
// Whether the AC should be unrestricted
1039+
Unrestricted *bool `json:"unrestricted,omitempty"`
1040+
1041+
// AccessRules lets the service override the global AccessRules if specified
1042+
// +kubebuilder:validation:Optional
1043+
// +listType=atomic
1044+
AccessRules []ACRule `json:"accessRules,omitempty"`
1045+
}
1046+
1047+
// ACRule describes a single access rule for an ApplicationCredential
1048+
// +k8s:openapi-gen=true
1049+
type ACRule struct {
1050+
// Service is the name of the service to target (e.g. "identity").
1051+
// +kubebuilder:validation:Required
1052+
// +kubebuilder:validation:MinLength=1
1053+
Service string `json:"service"`
1054+
// Path is the HTTP path (e.g. "/v3/auth/tokens").
1055+
// +kubebuilder:validation:Required
1056+
// +kubebuilder:validation:MinLength=1
1057+
Path string `json:"path"`
1058+
// Method is the HTTP method to allow (e.g. "POST").
1059+
// +kubebuilder:validation:Required
1060+
// +kubebuilder:validation:MinLength=1
1061+
Method string `json:"method"`
8581062
}
8591063

8601064
// OpenStackControlPlaneStatus defines the observed state of OpenStackControlPlane

api/core/v1beta1/openstackcontrolplane_webhook.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,7 @@ func (r *OpenStackControlPlane) DefaultServices() {
937937
r.Spec.Glance.APIOverride = map[string]Override{}
938938
}
939939
for name, glanceAPI := range r.Spec.Glance.Template.GlanceAPIs {
940+
940941
var override Override
941942
var ok bool
942943

@@ -1244,7 +1245,7 @@ func (r *OpenStackControlPlane) ValidateNotificationsBusInstance(basePath *field
12441245
// NotificationsBusInstance is set and must be equal to an existing
12451246
// deployed rabbitmq instance, otherwise we should fail because it
12461247
// does not represent a valid string
1247-
for k := range(*r.Spec.Rabbitmq.Templates) {
1248+
for k := range *r.Spec.Rabbitmq.Templates {
12481249
if *r.Spec.NotificationsBusInstance == k {
12491250
return nil
12501251
}

0 commit comments

Comments
 (0)