-
Notifications
You must be signed in to change notification settings - Fork 613
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,59 @@ 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. | ||
| // An empty audience string means the token uses the kube-apiserver's default APIAudiences. | ||
| // +optional | ||
| // +listType=atomic | ||
| TokenRequests []SecretsStoreTokenRequest `json:"tokenRequests,omitempty"` | ||
|
Comment on lines
+405
to
+411
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. Document omitted behavior for new optional fields.
As per coding guidelines, Documentation for Also applies to: 445-448 🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
| // SecretsStoreSecretRotation configures the automatic secret rotation behavior | ||
| // for the Secrets Store CSI driver. | ||
| type SecretsStoreSecretRotation struct { | ||
| // enabled controls whether automatic secret rotation is active. | ||
| // When true, the CSIDriver object sets requiresRepublish and the driver | ||
| // re-fetches secrets from providers. | ||
| // When false, secrets are only fetched at initial pod mount time. | ||
| // Default is true. | ||
| // +kubebuilder:default=true | ||
| // +optional | ||
| Enabled *bool `json:"enabled,omitempty"` | ||
|
|
||
| // rotationPollInterval is the minimum duration between secret rotation attempts. | ||
| // The driver skips provider calls if less than this interval has elapsed since | ||
| // the last successful rotation. Format is a Go duration string (e.g. "2m", "1h30m"). | ||
| // Default is "2m". | ||
| // +kubebuilder:default="2m" | ||
| // +kubebuilder:validation:Pattern=`^([0-9]+(\.[0-9]+)?(s|m|h))+$` | ||
| // +kubebuilder:validation:Type:=string | ||
| // +optional | ||
| RotationPollInterval *metav1.Duration `json:"rotationPollInterval,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. | ||
| // +required | ||
| Audience string `json:"audience"` | ||
|
|
||
| // expirationSeconds is the requested duration of validity of the service account token. | ||
| // The token issuer may return a token with a different validity duration. | ||
| // +optional | ||
| ExpirationSeconds *int64 `json:"expirationSeconds,omitempty"` | ||
| } | ||
|
|
||
| // ClusterCSIDriverStatus is the observed status of CSI driver operator | ||
| type ClusterCSIDriverStatus struct { | ||
| OperatorStatus `json:",inline"` | ||
|
|
||
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