Skip to content
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

Add the CSIMigration and CSIMigrationComplete fields to the API #1109

Merged
merged 3 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions pkg/apis/kubeone/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ type APIEndpoint struct {
type CloudProviderSpec struct {
// External
External bool `json:"external,omitempty"`
// CSIMigration enables the CSIMigration and CSIMigration{Provider} feature gates
// for providers that support the CSI migration.
// The CSI migration stability depends on the provider.
// More details about stability can be found in the Feature Gates document:
// https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
//
// Note: Azure has two type of CSI drivers (AzureFile and AzureDisk) and two different
// feature gates (CSIMigrationAzureDisk and CSIMigrationAzureFile). Enabling CSI migration
// enables both feature gates. If one CSI driver is not deployed, the volume operations
// for volumes with missing CSI driver will fallback to the in-tree volume plugin.
CSIMigration bool `json:"csiMigration,omitempty"`
// CSIMigrationComplete enables the CSIMigration{Provider}Complete feature gate
// for providers that support the CSI migration.
// This feature gate disables fallback to the in-tree volume plugins, therefore,
// it should be enabled only if the CSI driver is deploy on all nodes, and after
// ensuring that the CSI driver works properly.
//
// Note: If you're running on Azure, make sure that you have both AzureFile
// and AzureDisk CSI drivers deployed, as enabling this feature disables the fallback
// to the in-tree volume plugins. See description for the CSIMigration field for
// more details.
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
// CloudConfig
CloudConfig string `json:"cloudConfig,omitempty"`
// AWS
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kubeone/v1alpha1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions pkg/apis/kubeone/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,28 @@ type APIEndpoint struct {
type CloudProviderSpec struct {
// External
External bool `json:"external,omitempty"`
// CSIMigration enables the CSIMigration and CSIMigration{Provider} feature gates
// for providers that support the CSI migration.
// The CSI migration stability depends on the provider.
// More details about stability can be found in the Feature Gates document:
// https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
//
// Note: Azure has two type of CSI drivers (AzureFile and AzureDisk) and two different
// feature gates (CSIMigrationAzureDisk and CSIMigrationAzureFile). Enabling CSI migration
// enables both feature gates. If one CSI driver is not deployed, the volume operations
// for volumes with missing CSI driver will fallback to the in-tree volume plugin.
CSIMigration bool `json:"csiMigration,omitempty"`
// CSIMigrationComplete enables the CSIMigration{Provider}Complete feature gate
// for providers that support the CSI migration.
// This feature gate disables fallback to the in-tree volume plugins, therefore,
// it should be enabled only if the CSI driver is deploy on all nodes, and after
// ensuring that the CSI driver works properly.
//
// Note: If you're running on Azure, make sure that you have both AzureFile
// and AzureDisk CSI drivers deployed, as enabling this feature disables the fallback
// to the in-tree volume plugins. See description for the CSIMigration field for
// more details.
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
// CloudConfig
CloudConfig string `json:"cloudConfig,omitempty"`
// AWS
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/kubeone/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/apis/kubeone/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@ func ValidateCloudProviderSpec(p kubeone.CloudProviderSpec, fldPath *field.Path)
allErrs = append(allErrs, field.Invalid(fldPath, "", "provider must be specified"))
}

if p.CSIMigrationComplete && !p.CSIMigration {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("csiMigrationComplete"), "csiMigrationComplete requires csiMigration to be enabled"))
}

return allErrs
}

Expand Down
26 changes: 26 additions & 0 deletions pkg/apis/kubeone/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,32 @@ func TestValidateCloudProviderSpec(t *testing.T) {
providerConfig: kubeone.CloudProviderSpec{},
expectedError: true,
},
{
name: "CSIMigration enabled",
providerConfig: kubeone.CloudProviderSpec{
CSIMigration: true,
AWS: &kubeone.AWSSpec{},
},
expectedError: false,
},
{
name: "CSIMigration and CSIMigrationComplete enabled",
providerConfig: kubeone.CloudProviderSpec{
CSIMigration: true,
CSIMigrationComplete: true,
AWS: &kubeone.AWSSpec{},
},
expectedError: false,
},
{
name: "CSIMigrationComplete enabled without CSIMigration",
providerConfig: kubeone.CloudProviderSpec{
CSIMigration: false,
CSIMigrationComplete: true,
AWS: &kubeone.AWSSpec{},
},
expectedError: true,
},
}
for _, tc := range tests {
tc := tc
Expand Down
22 changes: 22 additions & 0 deletions pkg/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,28 @@ cloudProvider:
{{ .CloudProviderName }}: {}
# Set the kubelet flag '--cloud-provider=external' and deploy the external CCM for supported providers
external: {{ .CloudProviderExternal }}
# csiMigration enables the CSIMigration and CSIMigration{Provider} feature gates
# for providers that support the CSI migration.
# The CSI migration stability depends on the provider.
# More details about stability can be found in the Feature Gates document:
# https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/
#
# Note: Azure has two type of CSI drivers (AzureFile and AzureDisk) and two different
# feature gates (CSIMigrationAzureDisk and CSIMigrationAzureFile). Enabling CSI migration
# enables both feature gates. If one CSI driver is not deployed, the volume operations
# for volumes with missing CSI driver will fallback to the in-tree volume plugin.
csiMigration: false
# csiMigrationComplete enables the CSIMigration{Provider}Complete feature gate
# for providers that support the CSI migration.
# This feature gate disables fallback to the in-tree volume plugins, therefore,
# it should be enabled only if the CSI driver is deploy on all nodes, and after
# ensuring that the CSI driver works properly.
#
# Note: If you're running on Azure, make sure that you have both AzureFile
# and AzureDisk CSI drivers deployed, as enabling this feature disables the fallback
# to the in-tree volume plugins. See description for the CSIMigration field for
# more details.
csiMigrationComplete: false
# Path to file that will be uploaded and used as custom '--cloud-config' file.
cloudConfig: "{{ .CloudProviderCloudCfg }}"

Expand Down