Skip to content

Commit 7e74505

Browse files
committed
AppCred support
1 parent 5cc8994 commit 7e74505

30 files changed

+3657
-86
lines changed

apis/bases/core.openstack.org_openstackcontrolplanes.yaml

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

apis/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
@@ -711,6 +775,20 @@ type TelemetrySection struct {
711775
// +operator-sdk:csv:customresourcedefinitions:type=spec
712776
// AlertmanagerOverride, provides the ability to override the generated manifest of several child resources.
713777
AlertmanagerOverride Override `json:"alertmanagerOverride,omitempty"`
778+
779+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
780+
// +operator-sdk:csv:customresourcedefinitions:type=spec
781+
// +kubebuilder:validation:Optional
782+
// +nullable
783+
// +kubebuilder:default={enabled:false}
784+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
785+
786+
// AodhApplicationCredential allows service-specific overrides of the global AC configuration for Aodh.
787+
// +operator-sdk:csv:customresourcedefinitions:type=spec
788+
// +kubebuilder:validation:Optional
789+
// +nullable
790+
// +kubebuilder:default={enabled:false}
791+
AodhApplicationCredential *ServiceAppCredSection `json:"aodhApplicationCredential"`
714792
}
715793

716794
// SwiftSection defines the desired state of Swift service
@@ -730,6 +808,13 @@ type SwiftSection struct {
730808
// +operator-sdk:csv:customresourcedefinitions:type=spec
731809
// ProxyOverride, provides the ability to override the generated manifest of several child resources.
732810
ProxyOverride Override `json:"proxyOverride,omitempty"`
811+
812+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
813+
// +operator-sdk:csv:customresourcedefinitions:type=spec
814+
// +kubebuilder:validation:Optional
815+
// +nullable
816+
// +kubebuilder:default={enabled:false}
817+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
733818
}
734819

735820
// OctaviaSection defines the desired state of the Octavia service
@@ -749,6 +834,13 @@ type OctaviaSection struct {
749834
// +operator-sdk:csv:customresourcedefinitions:type=spec
750835
// APIOverride, provides the ability to override the generated manifest of several child resources.
751836
APIOverride Override `json:"apiOverride,omitempty"`
837+
838+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
839+
// +operator-sdk:csv:customresourcedefinitions:type=spec
840+
// +kubebuilder:validation:Optional
841+
// +nullable
842+
// +kubebuilder:default={enabled:false}
843+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
752844
}
753845

754846
// DesignateSection defines the desired state of the Designate service
@@ -768,6 +860,13 @@ type DesignateSection struct {
768860
// +operator-sdk:csv:customresourcedefinitions:type=spec
769861
// APIOverride, provides the ability to override the generated manifest of several child resources.
770862
APIOverride Override `json:"apiOverride,omitempty"`
863+
864+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
865+
// +operator-sdk:csv:customresourcedefinitions:type=spec
866+
// +kubebuilder:validation:Optional
867+
// +nullable
868+
// +kubebuilder:default={enabled:false}
869+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
771870
}
772871

773872
// BarbicanSection defines the desired state of Barbican service
@@ -787,6 +886,13 @@ type BarbicanSection struct {
787886
// +operator-sdk:csv:customresourcedefinitions:type=spec
788887
// APIOverride, provides the ability to override the generated manifest of several child resources.
789888
APIOverride Override `json:"apiOverride,omitempty"`
889+
890+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
891+
// +operator-sdk:csv:customresourcedefinitions:type=spec
892+
// +kubebuilder:validation:Optional
893+
// +nullable
894+
// +kubebuilder:default={enabled:false}
895+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
790896
}
791897

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

8331027
// OpenStackControlPlaneStatus defines the observed state of OpenStackControlPlane

0 commit comments

Comments
 (0)