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 API #1107

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
56 changes: 56 additions & 0 deletions pkg/apis/kubeone/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,59 @@ func (p CloudProviderSpec) CloudProviderInTree() bool {

return false
}

func (p CloudProviderSpec) CSIMigrationFeatureGates() map[string]bool {
featureGates := map[string]bool{}

switch {
case p.AWS != nil:
if p.AWS.CSIMigration {
featureGates["CSIMigration"] = true
featureGates["CSIMigrationAWS"] = true
}
if p.AWS.CSIMigrationComplete {
featureGates["CSIMigrationAWSComplete"] = true
}
case p.Azure != nil:
if p.Azure.CSIMigrationDisk {
featureGates["CSIMigration"] = true
featureGates["CSIMigrationAzureDisk"] = true
}
if p.Azure.CSIMigrationDiskComplete {
featureGates["CSIMigrationAzureDiskComplete"] = true
}
if p.Azure.CSIMigrationFile {
featureGates["CSIMigration"] = true
featureGates["CSIMigrationAzureFile"] = true
}
if p.Azure.CSIMigrationFileComplete {
featureGates["CSIMigrationAzureFileComplete"] = true
}
case p.GCE != nil:
if p.GCE.CSIMigration {
featureGates["CSIMigration"] = true
featureGates["CSIMigrationGCE"] = true
}
if p.GCE.CSIMigrationComplete {
featureGates["CSIMigrationGCEComplete"] = true
}
case p.Openstack != nil:
if p.Openstack.CSIMigration {
featureGates["CSIMigration"] = true
featureGates["CSIMigrationOpenStack"] = true
}
if p.Openstack.CSIMigrationComplete {
featureGates["CSIMigrationOpenStackComplete"] = true
}
case p.Vsphere != nil:
if p.Vsphere.CSIMigration {
featureGates["CSIMigration"] = true
featureGates["CSIMigrationvSphere"] = true
}
if p.Vsphere.CSIMigrationComplete {
featureGates["CSIMigrationvSphereComplete"] = true
}
}

return featureGates
}
27 changes: 22 additions & 5 deletions pkg/apis/kubeone/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,27 @@ type CloudProviderSpec struct {
}

// AWSSpec defines the AWS cloud provider
type AWSSpec struct{}
type AWSSpec struct {
CSIMigration bool `json:"csiMigration,omitempty"`
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
}

// AzureSpec defines the Azure cloud provider
type AzureSpec struct{}
type AzureSpec struct {
CSIMigrationFile bool `json:"csiMigrationFile,omitempty"`
CSIMigrationDisk bool `json:"csiMigrationDisk,omitempty"`
CSIMigrationFileComplete bool `json:"csiMigrationFileComplete,omitempty"`
CSIMigrationDiskComplete bool `json:"csiMigrationDiskComplete,omitempty"`
}

// DigitalOceanSpec defines the DigitalOcean cloud provider
type DigitalOceanSpec struct{}

// GCESpec defines the GCE cloud provider
type GCESpec struct{}
type GCESpec struct {
CSIMigration bool `json:"csiMigration,omitempty"`
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
}

// HetznerSpec defines the Hetzner cloud provider
type HetznerSpec struct {
Expand All @@ -193,13 +204,19 @@ type HetznerSpec struct {
}

// OpenstackSpec defines the Openstack provider
type OpenstackSpec struct{}
type OpenstackSpec struct {
CSIMigration bool `json:"csiMigration,omitempty"`
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
}

// PacketSpec defines the Packet cloud provider
type PacketSpec struct{}

// VsphereSpec defines the vSphere provider
type VsphereSpec struct{}
type VsphereSpec struct {
CSIMigration bool `json:"csiMigration,omitempty"`
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
}

// NoneSpec defines a none provider
type NoneSpec struct{}
Expand Down
27 changes: 22 additions & 5 deletions pkg/apis/kubeone/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,27 @@ type CloudProviderSpec struct {
}

// AWSSpec defines the AWS cloud provider
type AWSSpec struct{}
type AWSSpec struct {
CSIMigration bool `json:"csiMigration,omitempty"`
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
}

// AzureSpec defines the Azure cloud provider
type AzureSpec struct{}
type AzureSpec struct {
CSIMigrationFile bool `json:"csiMigrationFile,omitempty"`
CSIMigrationDisk bool `json:"csiMigrationDisk,omitempty"`
CSIMigrationFileComplete bool `json:"csiMigrationFileComplete,omitempty"`
CSIMigrationDiskComplete bool `json:"csiMigrationDiskComplete,omitempty"`
}

// DigitalOceanSpec defines the DigitalOcean cloud provider
type DigitalOceanSpec struct{}

// GCESpec defines the GCE cloud provider
type GCESpec struct{}
type GCESpec struct {
CSIMigration bool `json:"csiMigration,omitempty"`
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
}

// HetznerSpec defines the Hetzner cloud provider
type HetznerSpec struct {
Expand All @@ -193,13 +204,19 @@ type HetznerSpec struct {
}

// OpenstackSpec defines the Openstack provider
type OpenstackSpec struct{}
type OpenstackSpec struct {
CSIMigration bool `json:"csiMigration,omitempty"`
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
}

// PacketSpec defines the Packet cloud provider
type PacketSpec struct{}

// VsphereSpec defines the vSphere provider
type VsphereSpec struct{}
type VsphereSpec struct {
CSIMigration bool `json:"csiMigration,omitempty"`
CSIMigrationComplete bool `json:"csiMigrationComplete,omitempty"`
}

// NoneSpec defines a none provider
type NoneSpec struct{}
Expand Down
24 changes: 24 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.