Skip to content

Commit 5a9b312

Browse files
committed
AppCred support
Signed-off-by: Veronika Fisarova <vfisarov@redhat.com>
1 parent 1483c08 commit 5a9b312

31 files changed

+2270
-137
lines changed

apis/bases/core.openstack.org_openstackcontrolplanes.yaml

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

apis/core/v1beta1/openstackcontrolplane_types.go

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@ type OpenStackControlPlaneSpec struct {
218218
// +operator-sdk:csv:customresourcedefinitions:type=spec
219219
// Watcher - Parameters related to the Watcher service
220220
Watcher WatcherSection `json:"watcher,omitempty"`
221+
222+
// ApplicationCredential - Parameters related to the ApplicationCredential
223+
ApplicationCredential ApplicationCredentialSection `json:"applicationCredential"`
221224
}
222225

223226
// TLSSection defines the desired state of TLS configuration
@@ -412,6 +415,13 @@ type PlacementSection struct {
412415
// +operator-sdk:csv:customresourcedefinitions:type=spec
413416
// APIOverride, provides the ability to override the generated manifest of several child resources.
414417
APIOverride Override `json:"apiOverride,omitempty"`
418+
419+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
420+
// +operator-sdk:csv:customresourcedefinitions:type=spec
421+
// +kubebuilder:validation:Optional
422+
// +nullable
423+
// +kubebuilder:default={enabled:false}
424+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
415425
}
416426

417427
// GlanceSection defines the desired state of Glance service
@@ -438,6 +448,13 @@ type GlanceSection struct {
438448
// Convenient to avoid podname (and thus hostname) collision between different deployments.
439449
// Useful for CI jobs as well as preproduction and production environments that use the same storage backend, etc.
440450
UniquePodNames bool `json:"uniquePodNames"`
451+
452+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
453+
// +operator-sdk:csv:customresourcedefinitions:type=spec
454+
// +kubebuilder:validation:Optional
455+
// +nullable
456+
// +kubebuilder:default={enabled:false}
457+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
441458
}
442459

443460
// CinderSection defines the desired state of Cinder service
@@ -464,6 +481,13 @@ type CinderSection struct {
464481
// Convenient to avoid podname (and thus hostname) collision between different deployments.
465482
// Useful for CI jobs as well as preproduction and production environments that use the same storage backend, etc.
466483
UniquePodNames bool `json:"uniquePodNames"`
484+
485+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
486+
// +operator-sdk:csv:customresourcedefinitions:type=spec
487+
// +kubebuilder:validation:Optional
488+
// +nullable
489+
// +kubebuilder:default={enabled:false}
490+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
467491
}
468492

469493
// GaleraSection defines the desired state of Galera services
@@ -557,6 +581,13 @@ type NeutronSection struct {
557581
// +operator-sdk:csv:customresourcedefinitions:type=spec
558582
// APIOverride, provides the ability to override the generated manifest of several child resources.
559583
APIOverride Override `json:"apiOverride,omitempty"`
584+
585+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
586+
// +operator-sdk:csv:customresourcedefinitions:type=spec
587+
// +kubebuilder:validation:Optional
588+
// +nullable
589+
// +kubebuilder:default={enabled:false}
590+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
560591
}
561592

562593
// NovaSection defines the desired state of Nova services
@@ -583,6 +614,13 @@ type NovaSection struct {
583614
// for a nova cell. cell0 never have compute nodes and therefore it won't have a noVNCProxy deployed.
584615
// Providing an override for cell0 noVNCProxy does not have an effect.
585616
CellOverride map[string]NovaCellOverrideSpec `json:"cellOverride,omitempty"`
617+
618+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
619+
// +operator-sdk:csv:customresourcedefinitions:type=spec
620+
// +kubebuilder:validation:Optional
621+
// +nullable
622+
// +kubebuilder:default={enabled:false}
623+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
586624
}
587625

588626
// NovaCellOverrideSpec to override the generated manifest of several child resources.
@@ -704,6 +742,13 @@ type TelemetrySection struct {
704742
// +operator-sdk:csv:customresourcedefinitions:type=spec
705743
// AlertmanagerOverride, provides the ability to override the generated manifest of several child resources.
706744
AlertmanagerOverride Override `json:"alertmanagerOverride,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"`
707752
}
708753

709754
// SwiftSection defines the desired state of Swift service
@@ -723,6 +768,13 @@ type SwiftSection struct {
723768
// +operator-sdk:csv:customresourcedefinitions:type=spec
724769
// ProxyOverride, provides the ability to override the generated manifest of several child resources.
725770
ProxyOverride Override `json:"proxyOverride,omitempty"`
771+
772+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
773+
// +operator-sdk:csv:customresourcedefinitions:type=spec
774+
// +kubebuilder:validation:Optional
775+
// +nullable
776+
// +kubebuilder:default={enabled:false}
777+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
726778
}
727779

728780
// OctaviaSection defines the desired state of the Octavia service
@@ -780,6 +832,13 @@ type BarbicanSection struct {
780832
// +operator-sdk:csv:customresourcedefinitions:type=spec
781833
// APIOverride, provides the ability to override the generated manifest of several child resources.
782834
APIOverride Override `json:"apiOverride,omitempty"`
835+
836+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
837+
// +operator-sdk:csv:customresourcedefinitions:type=spec
838+
// +kubebuilder:validation:Optional
839+
// +nullable
840+
// +kubebuilder:default={enabled:false}
841+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
783842
}
784843

785844
// RedisSection defines the desired state of the Redis service
@@ -823,6 +882,87 @@ type WatcherSection struct {
823882
APIOverride Override `json:"apiOverride,omitempty"`
824883
}
825884

885+
// +kubebuilder:validation:XValidation:rule="self.gracePeriodDays < self.expirationDays",message="gracePeriodDays must be smaller than expirationDays"
886+
// ApplicationCredentialSection defines the desired configuration for ApplicationCredentials
887+
type ApplicationCredentialSection struct {
888+
// Enabled indicates whether an ApplicationCredential should be created
889+
// +kubebuilder:validation:Optional
890+
// +kubebuilder:default=false
891+
Enabled bool `json:"enabled"`
892+
893+
// ExpirationDays sets the lifetime in days for the AC
894+
// +kubebuilder:validation:Optional
895+
// +kubebuilder:default=365
896+
// +kubebuilder:validation:Minimum=2
897+
ExpirationDays *int `json:"expirationDays,omitempty"`
898+
899+
// GracePeriodDays sets how many days before expiration the AC should be rotated
900+
// +kubebuilder:validation:Optional
901+
// +kubebuilder:default=182
902+
// +kubebuilder:validation:Minimum=1
903+
GracePeriodDays *int `json:"gracePeriodDays,omitempty"`
904+
905+
// +kubebuilder:validation:Optional
906+
// +kubebuilder:default={"service"}
907+
// +kubebuilder:validation:MinItems=1
908+
// Roles to assign to the ApplicationCredential
909+
Roles []string `json:"roles,omitempty"`
910+
911+
// +kubebuilder:validation:Optional
912+
// +kubebuilder:default=false
913+
// Whether the AC should be unrestricted
914+
Unrestricted *bool `json:"unrestricted,omitempty"`
915+
916+
// AccessRules lets supply a custom list of rules
917+
// If unset, no accessRules field is emitted
918+
// +kubebuilder:validation:Optional
919+
// +listType=atomic
920+
AccessRules []ACRule `json:"accessRules,omitempty"`
921+
}
922+
923+
// +kubebuilder:validation:XValidation:rule="!(has(self.expirationDays) && has(self.gracePeriodDays)) || self.gracePeriodDays < self.expirationDays",message="gracePeriodDays must be smaller than expirationDays"
924+
// ServiceAppCredSection allows service-specific overrides of the global AC configuration
925+
type ServiceAppCredSection struct {
926+
// +kubebuilder:validation:Optional
927+
// +kubebuilder:default=false
928+
Enabled bool `json:"enabled"`
929+
930+
// +kubebuilder:validation:Optional
931+
// +kubebuilder:validation:Minimum=2
932+
ExpirationDays *int `json:"expirationDays,omitempty"`
933+
934+
// +kubebuilder:validation:Optional
935+
// +kubebuilder:validation:Minimum=1
936+
GracePeriodDays *int `json:"gracePeriodDays,omitempty"`
937+
938+
// +kubebuilder:validation:Optional
939+
// Roles to assign to the ApplicationCredential
940+
Roles []string `json:"roles,omitempty"`
941+
942+
// +kubebuilder:validation:Optional
943+
// Whether the AC should be unrestricted
944+
Unrestricted *bool `json:"unrestricted,omitempty"`
945+
946+
// AccessRules lets the service override either the global rules
947+
// +kubebuilder:validation:Optional
948+
// +listType=atomic
949+
AccessRules []ACRule `json:"accessRules,omitempty"`
950+
}
951+
952+
// ACRule describes a single access rule for an ApplicationCredential
953+
// +k8s:openapi-gen=true
954+
type ACRule struct {
955+
// Service is the name of the service to target (e.g. "identity").
956+
// +kubebuilder:validation:Required
957+
Service string `json:"service"`
958+
// Path is the HTTP path (e.g. "/v3/auth/tokens").
959+
// +kubebuilder:validation:Required
960+
Path string `json:"path"`
961+
// Method is the HTTP method to allow (e.g. "POST").
962+
// +kubebuilder:validation:Required
963+
Method string `json:"method"`
964+
}
965+
826966
// OpenStackControlPlaneStatus defines the observed state of OpenStackControlPlane
827967
type OpenStackControlPlaneStatus struct {
828968
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:io.kubernetes.conditions"}

0 commit comments

Comments
 (0)