-
Notifications
You must be signed in to change notification settings - Fork 615
Add Secrets Store CSI driver configuration to ClusterCSIDriver API #2846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -113,25 +113,27 @@ type ClusterCSIDriverSpec struct { | |||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // CSIDriverType indicates type of CSI driver being configured. | ||||||||||||||||||||||||||||
| // +kubebuilder:validation:Enum="";AWS;Azure;GCP;IBMCloud;vSphere | ||||||||||||||||||||||||||||
| // +kubebuilder:validation:Enum="";AWS;Azure;GCP;IBMCloud;vSphere;SecretsStore | ||||||||||||||||||||||||||||
| type CSIDriverType string | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const ( | ||||||||||||||||||||||||||||
| AWSDriverType CSIDriverType = "AWS" | ||||||||||||||||||||||||||||
| AzureDriverType CSIDriverType = "Azure" | ||||||||||||||||||||||||||||
| GCPDriverType CSIDriverType = "GCP" | ||||||||||||||||||||||||||||
| IBMCloudDriverType CSIDriverType = "IBMCloud" | ||||||||||||||||||||||||||||
| VSphereDriverType CSIDriverType = "vSphere" | ||||||||||||||||||||||||||||
| AWSDriverType CSIDriverType = "AWS" | ||||||||||||||||||||||||||||
| AzureDriverType CSIDriverType = "Azure" | ||||||||||||||||||||||||||||
| GCPDriverType CSIDriverType = "GCP" | ||||||||||||||||||||||||||||
| IBMCloudDriverType CSIDriverType = "IBMCloud" | ||||||||||||||||||||||||||||
| VSphereDriverType CSIDriverType = "vSphere" | ||||||||||||||||||||||||||||
| SecretsStoreDriverType CSIDriverType = "SecretsStore" | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // CSIDriverConfigSpec defines configuration spec that can be | ||||||||||||||||||||||||||||
| // used to optionally configure a specific CSI Driver. | ||||||||||||||||||||||||||||
| // +kubebuilder:validation:XValidation:rule="has(self.driverType) && self.driverType == 'IBMCloud' ? has(self.ibmcloud) : !has(self.ibmcloud)",message="ibmcloud must be set if driverType is 'IBMCloud', but remain unset otherwise" | ||||||||||||||||||||||||||||
| // +kubebuilder:validation:XValidation:rule="has(self.driverType) && self.driverType == 'SecretsStore' ? has(self.secretsStore) : !has(self.secretsStore)",message="secretsStore must be set if driverType is 'SecretsStore', but remain unset otherwise" | ||||||||||||||||||||||||||||
| // +union | ||||||||||||||||||||||||||||
| type CSIDriverConfigSpec struct { | ||||||||||||||||||||||||||||
| // driverType indicates type of CSI driver for which the | ||||||||||||||||||||||||||||
| // driverConfig is being applied to. | ||||||||||||||||||||||||||||
| // Valid values are: AWS, Azure, GCP, IBMCloud, vSphere and omitted. | ||||||||||||||||||||||||||||
| // Valid values are: AWS, Azure, GCP, IBMCloud, vSphere, SecretsStore and omitted. | ||||||||||||||||||||||||||||
| // Consumers should treat unknown values as a NO-OP. | ||||||||||||||||||||||||||||
| // +required | ||||||||||||||||||||||||||||
| // +unionDiscriminator | ||||||||||||||||||||||||||||
|
|
@@ -156,6 +158,10 @@ type CSIDriverConfigSpec struct { | |||||||||||||||||||||||||||
| // vSphere is used to configure the vsphere CSI driver. | ||||||||||||||||||||||||||||
| // +optional | ||||||||||||||||||||||||||||
| VSphere *VSphereCSIDriverConfigSpec `json:"vSphere,omitempty"` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // secretsStore is used to configure the Secrets Store CSI driver. | ||||||||||||||||||||||||||||
| // +optional | ||||||||||||||||||||||||||||
| SecretsStore *SecretsStoreCSIDriverConfigSpec `json:"secretsStore,omitempty"` | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // AWSCSIDriverConfigSpec defines properties that can be configured for the AWS CSI driver. | ||||||||||||||||||||||||||||
|
|
@@ -389,6 +395,70 @@ type VSphereCSIDriverConfigSpec struct { | |||||||||||||||||||||||||||
| MaxAllowedBlockVolumesPerNode int32 `json:"maxAllowedBlockVolumesPerNode,omitempty"` | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // SecretsStoreCSIDriverConfigSpec defines properties that can be configured for the Secrets Store CSI driver. | ||||||||||||||||||||||||||||
| type SecretsStoreCSIDriverConfigSpec struct { | ||||||||||||||||||||||||||||
| // secretRotation controls automatic secret rotation behavior. | ||||||||||||||||||||||||||||
| // When omitted, secret rotation is enabled with a default poll interval of 2 minutes. | ||||||||||||||||||||||||||||
| // +optional | ||||||||||||||||||||||||||||
| SecretRotation *SecretsStoreSecretRotation `json:"secretRotation,omitempty"` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // tokenRequests specifies service account token audiences that kubelet will provide | ||||||||||||||||||||||||||||
| // to the CSI driver during NodePublishVolume calls. These tokens enable workload | ||||||||||||||||||||||||||||
| // identity federation (WIF) with cloud providers such as AWS, Azure, and GCP. | ||||||||||||||||||||||||||||
| // When omitted or empty, no service account tokens are provided to the CSI driver | ||||||||||||||||||||||||||||
| // and workload identity federation is not available. | ||||||||||||||||||||||||||||
| // +optional | ||||||||||||||||||||||||||||
| // +listType=atomic | ||||||||||||||||||||||||||||
| TokenRequests []SecretsStoreTokenRequest `json:"tokenRequests,omitempty"` | ||||||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // SecretRotationPolicy determines whether automatic secret rotation is active | ||||||||||||||||||||||||||||
| // for the Secrets Store CSI driver. | ||||||||||||||||||||||||||||
| // +kubebuilder:validation:Enum=Enabled;Disabled | ||||||||||||||||||||||||||||
| type SecretRotationPolicy string | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| const ( | ||||||||||||||||||||||||||||
| SecretRotationEnabled SecretRotationPolicy = "Enabled" | ||||||||||||||||||||||||||||
| SecretRotationDisabled SecretRotationPolicy = "Disabled" | ||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // SecretsStoreSecretRotation configures the automatic secret rotation behavior | ||||||||||||||||||||||||||||
| // for the Secrets Store CSI driver. | ||||||||||||||||||||||||||||
| type SecretsStoreSecretRotation struct { | ||||||||||||||||||||||||||||
| // policy controls whether automatic secret rotation is active. | ||||||||||||||||||||||||||||
| // When "Enabled", the CSIDriver object sets requiresRepublish and the driver | ||||||||||||||||||||||||||||
| // re-fetches secrets from providers. | ||||||||||||||||||||||||||||
| // When "Disabled", secrets are only fetched at initial pod mount time. | ||||||||||||||||||||||||||||
| // +default="Enabled" | ||||||||||||||||||||||||||||
| // +optional | ||||||||||||||||||||||||||||
| Policy SecretRotationPolicy `json:"policy,omitempty"` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // rotationPollIntervalSeconds is the minimum time in seconds between secret | ||||||||||||||||||||||||||||
| // rotation attempts. The driver skips provider calls if less than this interval | ||||||||||||||||||||||||||||
| // has elapsed since the last successful rotation. | ||||||||||||||||||||||||||||
| // Default is 120 (2 minutes). | ||||||||||||||||||||||||||||
| // +default=120 | ||||||||||||||||||||||||||||
| // +optional | ||||||||||||||||||||||||||||
| RotationPollIntervalSeconds *int32 `json:"rotationPollIntervalSeconds,omitempty"` | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // SecretsStoreTokenRequest specifies a service account token audience configuration | ||||||||||||||||||||||||||||
| // for workload identity federation (WIF) with the Secrets Store CSI driver. | ||||||||||||||||||||||||||||
| type SecretsStoreTokenRequest struct { | ||||||||||||||||||||||||||||
| // audience is the intended audience of the service account token. | ||||||||||||||||||||||||||||
| // An empty string means the issued token will use the kube-apiserver's default APIAudiences. | ||||||||||||||||||||||||||||
| // +kubebuilder:validation:MaxLength=253 | ||||||||||||||||||||||||||||
| // +required | ||||||||||||||||||||||||||||
| Audience *string `json:"audience,omitempty"` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // expirationSeconds is the requested duration of validity of the service account token. | ||||||||||||||||||||||||||||
| // The token issuer may return a token with a different validity duration. | ||||||||||||||||||||||||||||
| // When omitted, the token expiration is determined by the kube-apiserver. | ||||||||||||||||||||||||||||
| // Must be at least 600 seconds (10 minutes). | ||||||||||||||||||||||||||||
| // +optional | ||||||||||||||||||||||||||||
| ExpirationSeconds *int64 `json:"expirationSeconds,omitempty"` | ||||||||||||||||||||||||||||
|
Comment on lines
+454
to
+459
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enforce the documented 600-second minimum. Line 457 says Suggested fix // expirationSeconds is the requested duration of validity of the service account token.
// The token issuer may return a token with a different validity duration.
// When omitted, the token expiration is determined by the kube-apiserver.
// Must be at least 600 seconds (10 minutes).
+ // +kubebuilder:validation:Minimum=600
// +optional
ExpirationSeconds *int64 `json:"expirationSeconds,omitempty"`📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // ClusterCSIDriverStatus is the observed status of CSI driver operator | ||||||||||||||||||||||||||||
| type ClusterCSIDriverStatus struct { | ||||||||||||||||||||||||||||
| OperatorStatus `json:",inline"` | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gate the new stable v1 field behind a feature gate.
Line 162 introduces a new stable API field without a
+openshift:enable:FeatureGate=...marker. That violates the stable API rollout requirement and can expose partially-supported config in GA surface.Suggested direction
// secretsStore is used to configure the Secrets Store CSI driver. + // +openshift:enable:FeatureGate=SecretsStoreCSIDriver // +optional SecretsStore *SecretsStoreCSIDriverConfigSpec `json:"secretsStore,omitempty"`As per coding guidelines,
**/types*.go: New fields on stable APIs should be introduced behind a feature gate using+openshift:enable:FeatureGate=MyFeatureGate.📝 Committable suggestion
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a day2 operator, not an OpenShift core operator. I think we can add this feature to GA directly.
@mytreya-rh what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.