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

Initial Kubevirt provider implementation #3416

Merged
merged 1 commit into from
Oct 31, 2024
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
13 changes: 12 additions & 1 deletion docs/api_reference/v1beta2.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "v1beta2 API Reference"
date = 2024-09-24T22:27:32+03:00
date = 2024-10-25T14:43:23+02:00
weight = 11
+++
## v1beta2
Expand Down Expand Up @@ -43,6 +43,7 @@ weight = 11
* [KubeOneCluster](#kubeonecluster)
* [KubeProxyConfig](#kubeproxyconfig)
* [KubeletConfig](#kubeletconfig)
* [KubevirtSpec](#kubevirtspec)
* [LoggingConfig](#loggingconfig)
* [MachineControllerConfig](#machinecontrollerconfig)
* [MetricsServer](#metricsserver)
Expand Down Expand Up @@ -177,6 +178,7 @@ Only one cloud provider must be defined at the single time.
| digitalocean | DigitalOcean | *[DigitalOceanSpec](#digitaloceanspec) | false |
| gce | GCE | *[GCESpec](#gcespec) | false |
| hetzner | Hetzner | *[HetznerSpec](#hetznerspec) | false |
| kubevirt | Kubevirt | *[KubevirtSpec](#kubevirtspec) | false |
| nutanix | Nutanix | *[NutanixSpec](#nutanixspec) | false |
| openstack | Openstack | *[OpenstackSpec](#openstackspec) | false |
| equinixmetal | EquinixMetal | *[EquinixMetalSpec](#equinixmetalspec) | false |
Expand Down Expand Up @@ -562,6 +564,15 @@ KubeletConfig provides some kubelet configuration options

[Back to Group](#v1beta2)

### KubevirtSpec

KubevirtSpec defines the Kubevirt provider

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |

[Back to Group](#v1beta2)

### LoggingConfig

LoggingConfig configures the Kubelet's log rotation
Expand Down
13 changes: 12 additions & 1 deletion docs/api_reference/v1beta3.en.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
+++
title = "v1beta3 API Reference"
date = 2024-09-24T22:27:32+03:00
date = 2024-10-25T14:43:23+02:00
weight = 11
+++
## v1beta3
Expand Down Expand Up @@ -43,6 +43,7 @@ weight = 11
* [KubeOneCluster](#kubeonecluster)
* [KubeProxyConfig](#kubeproxyconfig)
* [KubeletConfig](#kubeletconfig)
* [KubevirtSpec](#kubevirtspec)
* [LoggingConfig](#loggingconfig)
* [MachineControllerConfig](#machinecontrollerconfig)
* [MetricsServer](#metricsserver)
Expand Down Expand Up @@ -190,6 +191,7 @@ Only one cloud provider must be defined at the single time.
| digitalocean | DigitalOcean | *[DigitalOceanSpec](#digitaloceanspec) | false |
| gce | GCE | *[GCESpec](#gcespec) | false |
| hetzner | Hetzner | *[HetznerSpec](#hetznerspec) | false |
| kubevirt | Kubevirt | *[KubevirtSpec](#kubevirtspec) | false |
| nutanix | Nutanix | *[NutanixSpec](#nutanixspec) | false |
| openstack | Openstack | *[OpenstackSpec](#openstackspec) | false |
| equinixmetal | EquinixMetal | *[EquinixMetalSpec](#equinixmetalspec) | false |
Expand Down Expand Up @@ -564,6 +566,15 @@ KubeletConfig provides some kubelet configuration options

[Back to Group](#v1beta3)

### KubevirtSpec

KubevirtSpec defines the Kubevirt provider

| Field | Description | Scheme | Required |
| ----- | ----------- | ------ | -------- |

[Back to Group](#v1beta3)

### LoggingConfig

LoggingConfig configures the Kubelet's log rotation
Expand Down
2 changes: 2 additions & 0 deletions pkg/apis/kubeone/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ func (p CloudProviderSpec) CloudProviderName() string {
return "gce"
case p.Hetzner != nil:
return "hetzner"
case p.Kubevirt != nil:
return "kubevirt"
case p.Nutanix != nil:
return "nutanix"
case p.Openstack != nil:
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/kubeone/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ type CloudProviderSpec struct {
// Hetzner
Hetzner *HetznerSpec `json:"hetzner,omitempty"`

// Kubevirt
Kubevirt *KubevirtSpec `json:"kubevirt,omitempty"`

// Nutanix
Nutanix *NutanixSpec `json:"nutanix,omitempty"`

Expand Down Expand Up @@ -435,6 +438,9 @@ type HetznerSpec struct {
NetworkID string `json:"networkID,omitempty"`
}

// KubevirtSpec defines the Kubevirt provider
type KubevirtSpec struct{}

// NutanixSpec defines the Nutanix provider
type NutanixSpec struct{}

Expand Down
7 changes: 4 additions & 3 deletions pkg/apis/kubeone/v1beta2/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ func SetDefaults_CloudProvider(obj *KubeOneCluster) {
// if kubernetes version is 1.29+
// and cloud provider is configured
if gteKube129Condition.Check(actualVer) && obj.CloudProvider.None == nil {
// and cloud provider is NOT VMwareCloudDirector, to prevent kubelet --cloud-provider=external situation where
// there will be no CCM (VMwareCloudDirector have no CCM) to initialize the Node
if obj.CloudProvider.VMwareCloudDirector == nil {
// and cloud provider is NOT Kubevirt and NOT VMwareCloudDirector,
// to prevent kubelet --cloud-provider=external situation where
// there will be no CCM to initialize the Node
if obj.CloudProvider.Kubevirt == nil && obj.CloudProvider.VMwareCloudDirector == nil {
obj.CloudProvider.External = true
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/kubeone/v1beta2/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func SetCloudProvider(cp *CloudProviderSpec, name string) error {
cp.GCE = &GCESpec{}
case "hetzner":
cp.Hetzner = &HetznerSpec{}
case "kubevirt":
cp.Kubevirt = &KubevirtSpec{}
case "nutanix":
cp.Nutanix = &NutanixSpec{}
case "openstack":
Expand Down Expand Up @@ -69,6 +71,8 @@ func (cps *CloudProviderSpec) Name() string {
return "gce"
case cps.Hetzner != nil:
return "hetzner"
case cps.Kubevirt != nil:
return "kubevirt"
case cps.Nutanix != nil:
return "nutanix"
case cps.Openstack != nil:
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/kubeone/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ type CloudProviderSpec struct {
// Hetzner
Hetzner *HetznerSpec `json:"hetzner,omitempty"`

// Kubevirt
Kubevirt *KubevirtSpec `json:"kubevirt,omitempty"`

// Nutanix
Nutanix *NutanixSpec `json:"nutanix,omitempty"`

Expand Down Expand Up @@ -440,6 +443,9 @@ type HetznerSpec struct {
NetworkID string `json:"networkID,omitempty"`
}

// KubevirtSpec defines the Kubevirt provider
type KubevirtSpec struct{}

// NutanixSpec defines the Nutanix provider
type NutanixSpec struct{}

Expand Down
30 changes: 30 additions & 0 deletions pkg/apis/kubeone/v1beta2/zz_generated.conversion.go

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

21 changes: 21 additions & 0 deletions pkg/apis/kubeone/v1beta2/zz_generated.deepcopy.go

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

7 changes: 4 additions & 3 deletions pkg/apis/kubeone/v1beta3/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ func SetDefaults_CloudProvider(obj *KubeOneCluster) {
// if kubernetes version is 1.29+
// and cloud provider is configured
if gteKube129Condition.Check(actualVer) && obj.CloudProvider.None == nil {
// and cloud provider is NOT VMwareCloudDirector, to prevent kubelet --cloud-provider=external situation where
// there will be no CCM (VMwareCloudDirector have no CCM) to initialize the Node
if obj.CloudProvider.VMwareCloudDirector == nil {
// and cloud provider is NOT VMwareCloudDirector and NOT Kubevirt,
// to prevent kubelet --cloud-provider=external situation where
// there will be no CCM to initialize the Node
if obj.CloudProvider.Kubevirt == nil && obj.CloudProvider.VMwareCloudDirector == nil {
obj.CloudProvider.External = true
}
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/kubeone/v1beta3/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ func SetCloudProvider(cp *CloudProviderSpec, name string) error {
cp.GCE = &GCESpec{}
case "hetzner":
cp.Hetzner = &HetznerSpec{}
case "kubevirt":
cp.Kubevirt = &KubevirtSpec{}
case "nutanix":
cp.Nutanix = &NutanixSpec{}
case "openstack":
Expand Down Expand Up @@ -69,6 +71,8 @@ func (cps *CloudProviderSpec) Name() string {
return "gce"
case cps.Hetzner != nil:
return "hetzner"
case cps.Kubevirt != nil:
return "kubevirt"
case cps.Nutanix != nil:
return "nutanix"
case cps.Openstack != nil:
Expand Down
6 changes: 6 additions & 0 deletions pkg/apis/kubeone/v1beta3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,9 @@ type CloudProviderSpec struct {
// Hetzner
Hetzner *HetznerSpec `json:"hetzner,omitempty"`

// Kubevirt
Kubevirt *KubevirtSpec `json:"kubevirt,omitempty"`

// Nutanix
Nutanix *NutanixSpec `json:"nutanix,omitempty"`

Expand Down Expand Up @@ -432,6 +435,9 @@ type HetznerSpec struct {
NetworkID string `json:"networkID,omitempty"`
}

// KubevirtSpec defines the Kubevirt provider
type KubevirtSpec struct{}

// NutanixSpec defines the Nutanix provider
type NutanixSpec struct{}

Expand Down
30 changes: 30 additions & 0 deletions pkg/apis/kubeone/v1beta3/zz_generated.conversion.go

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

21 changes: 21 additions & 0 deletions pkg/apis/kubeone/v1beta3/zz_generated.deepcopy.go

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

Loading