Skip to content

Commit 21c7c74

Browse files
committed
AppCred support
Signed-off-by: Veronika Fisarova <vfisarov@redhat.com>
1 parent 5f8fbc7 commit 21c7c74

35 files changed

+2475
-8
lines changed

apis/bases/core.openstack.org_openstackcontrolplanes.yaml

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

apis/core/v1beta1/openstackcontrolplane_types.go

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,11 @@ type OpenStackControlPlaneSpec struct {
212212
// TopologyRef to apply the Topology defined by the associated CR referenced
213213
// by name
214214
TopologyRef *topologyv1.TopoRef `json:"topologyRef,omitempty"`
215+
216+
// +kubebuilder:validation:Optional
217+
// +operator-sdk:csv:customresourcedefinitions:type=spec
218+
// ApplicationCredential - Parameters related to the ApplicationCredential
219+
ApplicationCredential ApplicationCredentialSection `json:"applicationCredential"`
215220
}
216221

217222
// TLSSection defines the desired state of TLS configuration
@@ -406,6 +411,13 @@ type PlacementSection struct {
406411
// +operator-sdk:csv:customresourcedefinitions:type=spec
407412
// APIOverride, provides the ability to override the generated manifest of several child resources.
408413
APIOverride Override `json:"apiOverride,omitempty"`
414+
415+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
416+
// +operator-sdk:csv:customresourcedefinitions:type=spec
417+
// +kubebuilder:validation:Optional
418+
// +nullable
419+
// +kubebuilder:default={enabled:false}
420+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
409421
}
410422

411423
// GlanceSection defines the desired state of Glance service
@@ -432,6 +444,13 @@ type GlanceSection struct {
432444
// Convenient to avoid podname (and thus hostname) collision between different deployments.
433445
// Useful for CI jobs as well as preproduction and production environments that use the same storage backend, etc.
434446
UniquePodNames bool `json:"uniquePodNames"`
447+
448+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
449+
// +operator-sdk:csv:customresourcedefinitions:type=spec
450+
// +kubebuilder:validation:Optional
451+
// +nullable
452+
// +kubebuilder:default={enabled:false}
453+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
435454
}
436455

437456
// CinderSection defines the desired state of Cinder service
@@ -458,6 +477,13 @@ type CinderSection struct {
458477
// Convenient to avoid podname (and thus hostname) collision between different deployments.
459478
// Useful for CI jobs as well as preproduction and production environments that use the same storage backend, etc.
460479
UniquePodNames bool `json:"uniquePodNames"`
480+
481+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
482+
// +operator-sdk:csv:customresourcedefinitions:type=spec
483+
// +kubebuilder:validation:Optional
484+
// +nullable
485+
// +kubebuilder:default={enabled:false}
486+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
461487
}
462488

463489
// GaleraSection defines the desired state of Galera services
@@ -551,6 +577,13 @@ type NeutronSection struct {
551577
// +operator-sdk:csv:customresourcedefinitions:type=spec
552578
// APIOverride, provides the ability to override the generated manifest of several child resources.
553579
APIOverride Override `json:"apiOverride,omitempty"`
580+
581+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
582+
// +operator-sdk:csv:customresourcedefinitions:type=spec
583+
// +kubebuilder:validation:Optional
584+
// +nullable
585+
// +kubebuilder:default={enabled:false}
586+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
554587
}
555588

556589
// NovaSection defines the desired state of Nova services
@@ -577,6 +610,13 @@ type NovaSection struct {
577610
// for a nova cell. cell0 never have compute nodes and therefore it won't have a noVNCProxy deployed.
578611
// Providing an override for cell0 noVNCProxy does not have an effect.
579612
CellOverride map[string]NovaCellOverrideSpec `json:"cellOverride,omitempty"`
613+
614+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
615+
// +operator-sdk:csv:customresourcedefinitions:type=spec
616+
// +kubebuilder:validation:Optional
617+
// +nullable
618+
// +kubebuilder:default={enabled:false}
619+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
580620
}
581621

582622
// NovaCellOverrideSpec to override the generated manifest of several child resources.
@@ -698,6 +738,13 @@ type TelemetrySection struct {
698738
// +operator-sdk:csv:customresourcedefinitions:type=spec
699739
// AlertmanagerOverride, provides the ability to override the generated manifest of several child resources.
700740
AlertmanagerOverride Override `json:"alertmanagerOverride,omitempty"`
741+
742+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
743+
// +operator-sdk:csv:customresourcedefinitions:type=spec
744+
// +kubebuilder:validation:Optional
745+
// +nullable
746+
// +kubebuilder:default={enabled:false}
747+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
701748
}
702749

703750
// SwiftSection defines the desired state of Swift service
@@ -717,6 +764,13 @@ type SwiftSection struct {
717764
// +operator-sdk:csv:customresourcedefinitions:type=spec
718765
// ProxyOverride, provides the ability to override the generated manifest of several child resources.
719766
ProxyOverride Override `json:"proxyOverride,omitempty"`
767+
768+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
769+
// +operator-sdk:csv:customresourcedefinitions:type=spec
770+
// +kubebuilder:validation:Optional
771+
// +nullable
772+
// +kubebuilder:default={enabled:false}
773+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
720774
}
721775

722776
// OctaviaSection defines the desired state of the Octavia service
@@ -774,6 +828,13 @@ type BarbicanSection struct {
774828
// +operator-sdk:csv:customresourcedefinitions:type=spec
775829
// APIOverride, provides the ability to override the generated manifest of several child resources.
776830
APIOverride Override `json:"apiOverride,omitempty"`
831+
832+
// ApplicationCredential allows service-specific overrides of the global AC configuration.
833+
// +operator-sdk:csv:customresourcedefinitions:type=spec
834+
// +kubebuilder:validation:Optional
835+
// +nullable
836+
// +kubebuilder:default={enabled:false}
837+
ApplicationCredential *ServiceAppCredSection `json:"applicationCredential"`
777838
}
778839

779840
// RedisSection defines the desired state of the Redis service
@@ -798,6 +859,87 @@ type OpenStackClientSection struct {
798859
Template v1beta1.OpenStackClientSpecCore `json:"template,omitempty"`
799860
}
800861

862+
// +kubebuilder:validation:XValidation:rule="self.gracePeriodDays < self.expirationDays",message="gracePeriodDays must be smaller than expirationDays"
863+
// ApplicationCredentialSection defines the desired configuration for ApplicationCredentials
864+
type ApplicationCredentialSection struct {
865+
// Enabled indicates whether an ApplicationCredential should be created
866+
// +kubebuilder:validation:Optional
867+
// +kubebuilder:default=false
868+
Enabled bool `json:"enabled"`
869+
870+
// ExpirationDays sets the lifetime in days for the AC
871+
// +kubebuilder:validation:Optional
872+
// +kubebuilder:default=365
873+
// +kubebuilder:validation:Minimum=2
874+
ExpirationDays *int `json:"expirationDays,omitempty"`
875+
876+
// GracePeriodDays sets how many days before expiration the AC should be rotated
877+
// +kubebuilder:validation:Optional
878+
// +kubebuilder:default=182
879+
// +kubebuilder:validation:Minimum=1
880+
GracePeriodDays *int `json:"gracePeriodDays,omitempty"`
881+
882+
// +kubebuilder:validation:Optional
883+
// +kubebuilder:default={"service"}
884+
// +kubebuilder:validation:MinItems=1
885+
// Roles to assign to the ApplicationCredential
886+
Roles []string `json:"roles,omitempty"`
887+
888+
// +kubebuilder:validation:Optional
889+
// +kubebuilder:default=false
890+
// Whether the AC should be unrestricted
891+
Unrestricted *bool `json:"unrestricted,omitempty"`
892+
893+
// AccessRules lets supply a custom list of rules
894+
// If unset, no accessRules field is emitted
895+
// +kubebuilder:validation:Optional
896+
// +listType=atomic
897+
AccessRules []ACRule `json:"accessRules,omitempty"`
898+
}
899+
900+
// +kubebuilder:validation:XValidation:rule="!(has(self.expirationDays) && has(self.gracePeriodDays)) || self.gracePeriodDays < self.expirationDays",message="gracePeriodDays must be smaller than expirationDays"
901+
// ServiceAppCredSection allows service-specific overrides of the global AC configuration
902+
type ServiceAppCredSection struct {
903+
// +kubebuilder:validation:Optional
904+
// +kubebuilder:default=false
905+
Enabled bool `json:"enabled"`
906+
907+
// +kubebuilder:validation:Optional
908+
// +kubebuilder:validation:Minimum=2
909+
ExpirationDays *int `json:"expirationDays,omitempty"`
910+
911+
// +kubebuilder:validation:Optional
912+
// +kubebuilder:validation:Minimum=1
913+
GracePeriodDays *int `json:"gracePeriodDays,omitempty"`
914+
915+
// +kubebuilder:validation:Optional
916+
// Roles to assign to the ApplicationCredential
917+
Roles []string `json:"roles,omitempty"`
918+
919+
// +kubebuilder:validation:Optional
920+
// Whether the AC should be unrestricted
921+
Unrestricted *bool `json:"unrestricted,omitempty"`
922+
923+
// AccessRules lets the service override either the global rules
924+
// +kubebuilder:validation:Optional
925+
// +listType=atomic
926+
AccessRules []ACRule `json:"accessRules,omitempty"`
927+
}
928+
929+
// ACRule describes a single access rule for an ApplicationCredential
930+
// +k8s:openapi-gen=true
931+
type ACRule struct {
932+
// Service is the name of the service to target (e.g. "identity").
933+
// +kubebuilder:validation:Required
934+
Service string `json:"service"`
935+
// Path is the HTTP path (e.g. "/v3/auth/tokens").
936+
// +kubebuilder:validation:Required
937+
Path string `json:"path"`
938+
// Method is the HTTP method to allow (e.g. "POST").
939+
// +kubebuilder:validation:Required
940+
Method string `json:"method"`
941+
}
942+
801943
// OpenStackControlPlaneStatus defines the observed state of OpenStackControlPlane
802944
type OpenStackControlPlaneStatus struct {
803945
// +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:io.kubernetes.conditions"}

0 commit comments

Comments
 (0)