diff --git a/.gitignore b/.gitignore
index 7abbeb352..000046f55 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,7 @@ kubectl
# Output of the go coverage tool, specifically when used with LiteIDE
*coverprofile.out*
+
+# Autogen tags
+tags
+docs/docs
diff --git a/Makefile b/Makefile
index b748590a0..37399af56 100644
--- a/Makefile
+++ b/Makefile
@@ -71,13 +71,6 @@ start:
--namespace=${CONTROL_NAMESPACE} \
--safety-up=2 \
--safety-down=1 \
- --machine-creation-timeout=20m \
- --machine-drain-timeout=5m \
- --machine-pv-detach-timeout=2m \
- --machine-health-timeout=10m \
- --machine-safety-apiserver-statuscheck-timeout=30s \
- --machine-safety-apiserver-statuscheck-period=1m \
- --machine-safety-orphan-vms-period=30m \
--machine-safety-overshooting-period=$(MACHINE_SAFETY_OVERSHOOTING_PERIOD) \
--leader-elect=$(LEADER_ELECT) \
--v=3
diff --git a/README.md b/README.md
index 3d8abed00..9ad9608df 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,8 @@
[![CI Build status](https://concourse.ci.gardener.cloud/api/v1/teams/gardener/pipelines/machine-controller-manager-master/jobs/master-head-update-job/badge)](https://concourse.ci.gardener.cloud/teams/gardener/pipelines/machine-controller-manager-master/jobs/master-head-update-job)
[![Go Report Card](https://goreportcard.com/badge/github.com/gardener/machine-controller-manager)](https://goreportcard.com/report/github.com/gardener/machine-controller-manager)
-:warning: We are in the progress of migrating and deprecating all the in-tree providers to OOT. Please avoid making any new feature enhancements to the intree providers. Kindly make it on the [OOT providers available here](https://github.com/gardener/?q=machine-controller-manager-provider&type=&language=). More details on adding [new OOT providers can be found here](https://github.com/gardener/machine-controller-manager/blob/master/docs/development/cp_support_new.md).
+**Note**
+One can add support for a new cloud provider by following [Adding support for new provider](https://github.com/gardener/machine-controller-manager/blob/master/docs/development/cp_support_new.md).
# Overview
@@ -87,7 +88,7 @@ See [here](docs/documents/apis.md) for CRD API Documentation
MachineDeployment controller |
- Machine Deployment controller reconciles the MachineDeployment objects and manages the lifecycle of MachineSet objects. MachineDeployment consumes provider specific MachineClass` in its spec.template.spec which is the template of the VM spec that would be spawned on the cloud by MCM. |
+ Machine Deployment controller reconciles the MachineDeployment objects and manages the lifecycle of MachineSet objects. MachineDeployment consumes provider specific MachineClass in its spec.template.spec which is the template of the VM spec that would be spawned on the cloud by MCM. |
MachineSet controller |
diff --git a/cmd/machine-controller-manager-cli/main.go b/cmd/machine-controller-manager-cli/main.go
deleted file mode 100644
index eee458ac9..000000000
--- a/cmd/machine-controller-manager-cli/main.go
+++ /dev/null
@@ -1,129 +0,0 @@
-package main
-
-import (
- "bytes"
- "flag"
- "fmt"
- "io/ioutil"
- "log"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/driver"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/yaml"
-)
-
-var (
- secretFilename string
- machineclassFilename string
- classKind string
- machineName string
- machineID string
-)
-
-// func NewDriver(machineID string, secretRef *corev1.Secret, classKind string, machineClass interface{}, machineName string) Driver {
-
-// CreateFlags adds flags for a specific CMServer to the specified FlagSet
-func CreateFlags() {
-
- flag.StringVar(&secretFilename, "secret", "", "infrastructure secret")
- flag.StringVar(&machineclassFilename, "machineclass", "", "infrastructure machineclass")
- flag.StringVar(&classKind, "classkind", "", "infrastructure class kind")
- flag.StringVar(&machineName, "machinename", "", "machine name")
- flag.StringVar(&machineID, "machineid", "", "machine id")
-
- flag.Parse()
-}
-
-func main() {
-
- CreateFlags()
-
- var (
- machineclass interface{}
- )
-
- if machineName == "" {
- log.Fatalf("machine name required")
- }
-
- if machineclassFilename == "" {
- log.Fatalf("machine class filename required")
- }
-
- if secretFilename == "" {
- log.Fatalf("secret filename required")
- }
- secret := corev1.Secret{}
- err := Read(secretFilename, &secret)
- if err != nil {
- log.Fatalf("Could not parse secret yaml: %s", err)
- }
-
- switch classKind {
- case "OpenStackMachineClass", "openstack":
- class := v1alpha1.OpenStackMachineClass{}
- machineclass = &class
- classKind = "OpenStackMachineClass"
-
- case "AWSMachineClass", "aws":
- class := v1alpha1.AWSMachineClass{}
- machineclass = &class
- classKind = "AWSMachineClass"
-
- case "AzureMachineClass", "azure":
- class := v1alpha1.AzureMachineClass{}
- machineclass = &class
- classKind = "AzureMachineClass"
-
- case "GCPMachineClass", "gcp":
- class := v1alpha1.GCPMachineClass{}
- machineclass = &class
- classKind = "GCPMachineClass"
-
- case "AlicloudMachineClass", "alicloud":
- class := v1alpha1.AlicloudMachineClass{}
- machineclass = &class
- classKind = "AlicloudMachineClass"
-
- case "PacketMachineClass", "packet":
- class := v1alpha1.PacketMachineClass{}
- machineclass = &class
- classKind = "PacketMachineClass"
-
- default:
- log.Fatalf("Unknown class kind %s", classKind)
- }
- err = Read(machineclassFilename, machineclass)
- if err != nil {
- log.Fatalf("Could not parse machine class yaml: %s", err)
- }
-
- driver := driver.NewDriver(machineID, secret.Data, classKind, machineclass, machineName)
-
- if machineID == "" {
- id, name, err := driver.Create()
- if err != nil {
- log.Fatalf("Could not create %s : %s", machineName, err)
- }
- fmt.Printf("Machine id: %s\n", id)
- fmt.Printf("Name: %s\n", name)
- } else {
- err = driver.Delete(machineID)
- if err != nil {
- log.Fatalf("Could not delete %s : %s", machineID, err)
- }
- }
-
-}
-
-// Read function decodes the yaml file passed to it
-func Read(fileName string, decodedObj interface{}) error {
- m, err := ioutil.ReadFile(fileName)
- if err != nil {
- log.Fatalf("Could not read %s: %s", fileName, err)
- }
- decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(m), 1024)
-
- return decoder.Decode(decodedObj)
-}
diff --git a/cmd/machine-controller-manager/app/controllermanager.go b/cmd/machine-controller-manager/app/controllermanager.go
index 3e90019c2..5f9e66168 100644
--- a/cmd/machine-controller-manager/app/controllermanager.go
+++ b/cmd/machine-controller-manager/app/controllermanager.go
@@ -254,29 +254,17 @@ func StartControllers(s *options.MCMServer,
machineSharedInformers := controlMachineInformerFactory.Machine().V1alpha1()
klog.V(5).Infof("Creating controllers...")
- mcmcontroller, err := mcmcontroller.NewController(
+ mcmController, err := mcmcontroller.NewController(
s.Namespace,
controlMachineClient,
controlCoreClient,
targetCoreClient,
- targetCoreInformerFactory.Core().V1().PersistentVolumeClaims(),
- targetCoreInformerFactory.Core().V1().PersistentVolumes(),
- controlCoreInformerFactory.Core().V1().Secrets(),
targetCoreInformerFactory.Core().V1().Nodes(),
- machineSharedInformers.OpenStackMachineClasses(),
- machineSharedInformers.AWSMachineClasses(),
- machineSharedInformers.AzureMachineClasses(),
- machineSharedInformers.GCPMachineClasses(),
- machineSharedInformers.AlicloudMachineClasses(),
- machineSharedInformers.PacketMachineClasses(),
machineSharedInformers.Machines(),
machineSharedInformers.MachineSets(),
machineSharedInformers.MachineDeployments(),
recorder,
s.SafetyOptions,
- s.NodeConditions,
- s.BootstrapTokenAuthExtraGroups,
- s.DeleteMigratedMachineClass,
s.AutoscalerScaleDownAnnotationDuringRollout,
)
if err != nil {
@@ -289,7 +277,7 @@ func StartControllers(s *options.MCMServer,
targetCoreInformerFactory.Start(stop)
klog.V(5).Info("Running controller")
- go mcmcontroller.Run(int(s.ConcurrentNodeSyncs), stop)
+ go mcmController.Run(int(s.ConcurrentNodeSyncs), stop)
} else {
return fmt.Errorf("unable to start machine controller: API GroupVersion %q or %q or %q is not available; \nFound: %#v", machineGVR, machineSetGVR, machineDeploymentGVR, availableResources)
@@ -342,12 +330,12 @@ func getAvailableResources(clientBuilder corecontroller.ClientBuilder) (map[sche
allResources := map[schema.GroupVersionResource]bool{}
for _, apiResourceList := range resourceMap {
- version, err := schema.ParseGroupVersion(apiResourceList.GroupVersion)
+ v, err := schema.ParseGroupVersion(apiResourceList.GroupVersion)
if err != nil {
return nil, err
}
for _, apiResource := range apiResourceList.APIResources {
- allResources[version.WithResource(apiResource.Name)] = true
+ allResources[v.WithResource(apiResource.Name)] = true
}
}
diff --git a/cmd/machine-controller-manager/app/options/options.go b/cmd/machine-controller-manager/app/options/options.go
index 50bd7a7a1..f16ac0341 100644
--- a/cmd/machine-controller-manager/app/options/options.go
+++ b/cmd/machine-controller-manager/app/options/options.go
@@ -31,7 +31,6 @@ import (
"github.com/gardener/machine-controller-manager/pkg/util/client/leaderelectionconfig"
- "github.com/gardener/machine-controller-manager/pkg/controller"
// add the machine feature gates
_ "github.com/gardener/machine-controller-manager/pkg/features"
)
@@ -56,7 +55,6 @@ func NewMCMServer() *MCMServer {
Address: "0.0.0.0",
ConcurrentNodeSyncs: 10,
ContentType: "application/vnd.kubernetes.protobuf",
- NodeConditions: "KernelDeadlock,ReadonlyFilesystem,DiskPressure,NetworkUnavailable",
MinResyncPeriod: metav1.Duration{Duration: 12 * time.Hour},
KubeAPIQPS: 20.0,
KubeAPIBurst: 30,
@@ -64,17 +62,9 @@ func NewMCMServer() *MCMServer {
ControllerStartInterval: metav1.Duration{Duration: 0 * time.Second},
AutoscalerScaleDownAnnotationDuringRollout: true,
SafetyOptions: machineconfig.SafetyOptions{
- SafetyUp: 2,
- SafetyDown: 1,
- MachineCreationTimeout: metav1.Duration{Duration: 20 * time.Minute},
- MachineHealthTimeout: metav1.Duration{Duration: 10 * time.Minute},
- MachineDrainTimeout: metav1.Duration{Duration: controller.DefaultMachineDrainTimeout},
- MaxEvictRetries: controller.DefaultMaxEvictRetries,
- PvDetachTimeout: metav1.Duration{Duration: 2 * time.Minute},
- MachineSafetyOrphanVMsPeriod: metav1.Duration{Duration: 30 * time.Minute},
- MachineSafetyOvershootingPeriod: metav1.Duration{Duration: 1 * time.Minute},
- MachineSafetyAPIServerStatusCheckPeriod: metav1.Duration{Duration: 1 * time.Minute},
- MachineSafetyAPIServerStatusCheckTimeout: metav1.Duration{Duration: 30 * time.Second},
+ SafetyUp: 2,
+ SafetyDown: 1,
+ MachineSafetyOvershootingPeriod: metav1.Duration{Duration: 1 * time.Minute},
},
},
}
@@ -102,19 +92,7 @@ func (s *MCMServer) AddFlags(fs *pflag.FlagSet) {
fs.Int32Var(&s.SafetyOptions.SafetyUp, "safety-up", s.SafetyOptions.SafetyUp, "The number of excess machine objects permitted for any machineSet/machineDeployment beyond its expected number of replicas based on desired and max-surge, we call this the upper-limit. When this upper-limit is reached, the objects are temporarily frozen until the number of objects reduce. upper-limit = desired + maxSurge (if applicable) + safetyUp.")
fs.Int32Var(&s.SafetyOptions.SafetyDown, "safety-down", s.SafetyOptions.SafetyDown, "Upper-limit minus safety-down value gives the lower-limit. This is the limits below which any temporarily frozen machineSet/machineDeployment object is unfrozen. lower-limit = desired + maxSurge (if applicable) + safetyUp - safetyDown.")
- fs.DurationVar(&s.SafetyOptions.MachineCreationTimeout.Duration, "machine-creation-timeout", s.SafetyOptions.MachineCreationTimeout.Duration, "Timeout (in duration) used while joining (during creation) of machine before it is declared as failed.")
- fs.DurationVar(&s.SafetyOptions.MachineHealthTimeout.Duration, "machine-health-timeout", s.SafetyOptions.MachineHealthTimeout.Duration, "Timeout (in duration) used while re-joining (in case of temporary health issues) of machine before it is declared as failed.")
- fs.DurationVar(&s.SafetyOptions.MachineDrainTimeout.Duration, "machine-drain-timeout", controller.DefaultMachineDrainTimeout, "Timeout (in duration) used while draining of machine before deletion, beyond which MCM forcefully deletes machine.")
- fs.Int32Var(&s.SafetyOptions.MaxEvictRetries, "machine-max-evict-retries", controller.DefaultMaxEvictRetries, "Maximum number of times evicts would be attempted on a pod before it is forcibly deleted during draining of a machine.")
- fs.DurationVar(&s.SafetyOptions.PvDetachTimeout.Duration, "machine-pv-detach-timeout", s.SafetyOptions.PvDetachTimeout.Duration, "Timeout (in duration) used while waiting for detach of PV while evicting/deleting pods")
- fs.DurationVar(&s.SafetyOptions.MachineSafetyAPIServerStatusCheckTimeout.Duration, "machine-safety-apiserver-statuscheck-timeout", s.SafetyOptions.MachineSafetyAPIServerStatusCheckTimeout.Duration, "Timeout (in duration) for which the APIServer can be down before declare the machine controller frozen by safety controller")
-
- fs.DurationVar(&s.SafetyOptions.MachineSafetyOrphanVMsPeriod.Duration, "machine-safety-orphan-vms-period", s.SafetyOptions.MachineSafetyOrphanVMsPeriod.Duration, "Time period (in duration) used to poll for orphan VMs by safety controller.")
fs.DurationVar(&s.SafetyOptions.MachineSafetyOvershootingPeriod.Duration, "machine-safety-overshooting-period", s.SafetyOptions.MachineSafetyOvershootingPeriod.Duration, "Time period (in duration) used to poll for overshooting of machine objects backing a machineSet by safety controller.")
- fs.DurationVar(&s.SafetyOptions.MachineSafetyAPIServerStatusCheckPeriod.Duration, "machine-safety-apiserver-statuscheck-period", s.SafetyOptions.MachineSafetyAPIServerStatusCheckPeriod.Duration, "Time period (in duration) used to poll for APIServer's health by safety controller")
- fs.StringVar(&s.NodeConditions, "node-conditions", s.NodeConditions, "List of comma-separated/case-sensitive node-conditions which when set to True will change machine to a failed state after MachineHealthTimeout duration. It may further be replaced with a new machine if the machine is backed by a machine-set object.")
- fs.StringVar(&s.BootstrapTokenAuthExtraGroups, "bootstrap-token-auth-extra-groups", s.BootstrapTokenAuthExtraGroups, "Comma-separated list of groups to set bootstrap token's \"auth-extra-groups\" field to")
- fs.BoolVar(&s.DeleteMigratedMachineClass, "delete-migrated-machine-class", false, "Deletes any (provider specific) machine class that has the machine.sapcloud.io/migrated annotation")
fs.BoolVar(&s.AutoscalerScaleDownAnnotationDuringRollout, "autoscaler-scaldown-annotation-during-rollout", true, "Add cluster autoscaler scale-down disabled annotation during roll-out.")
diff --git a/docs/FAQ.md b/docs/FAQ.md
index 9bbede825..989c8d732 100644
--- a/docs/FAQ.md
+++ b/docs/FAQ.md
@@ -94,8 +94,8 @@ MCM mainly contains the following sub-controllers:
MCM can be installed in a cluster with following steps:
-* Apply all the CRDs from [here](https://github.com/gardener/machine-controller-manager/tree/master/kubernetes/deployment/in-tree)
-* Apply all the deployment, role-related objects from [here](https://github.com/gardener/machine-controller-manager/tree/master/kubernetes/deployment/in-tree).
+* Apply all the CRDs from [here](https://github.com/gardener/machine-controller-manager/tree/master/kubernetes/crds)
+* Apply all the deployment, role-related objects from [here](https://github.com/gardener/machine-controller-manager/tree/master/kubernetes/deployment/out-of-tree).
* Control cluster is the one where the `machine-*` objects are stored. Target cluster is where all the node objects are registered.
diff --git a/docs/README.md b/docs/README.md
index 704f052f1..a68fd3de8 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -4,22 +4,3 @@
#### Development
* [Adding support for a new cloud provider](development/cp_support_new.md)
-
-## Using In-Tree provider support (:warning: DEPRECATED!)
-
-##### Development
-
-* [Adding support for a new cloud provider](development/cp_support_old.md)
-* [Setting up a local development environment](development/local_setup.md)
-* [Testing and Dependency Management](development/testing_and_dependencies.md)
-
-#### Usage
-
-* [Setting up your usage environment](usage/prerequisite.md)
-* [Creating/Deleting machines (VM)](usage/machine.md)
-* [Maintaining machine replicas using machines-sets](usage/machine_set.md)
-* [Updating machines using machines-deployments](usage/machine_deployment.md)
-
-#### Deployment
-
-* [Deploying the MCM into a Kubernetes cluster using IN-TREE providers](deployment/kubernetes.md)
diff --git a/docs/deployment/kubernetes.md b/docs/deployment/kubernetes.md
index 697279270..475c14811 100644
--- a/docs/deployment/kubernetes.md
+++ b/docs/deployment/kubernetes.md
@@ -17,7 +17,7 @@ As already mentioned, the Machine Controller Manager is designed to run as contr
- Connect to the remote kubernetes cluster where you plan to deploy the Machine Controller Manager using the kubectl. Set the environment variable KUBECONFIG to the path of the yaml file containing the cluster info.
- Now, create the required CRDs on the remote cluster using the following command,
```bash
-$ kubectl apply -f kubernetes/crds.yaml
+$ kubectl apply -f kubernetes/crds
```
## Build the Docker image
@@ -37,19 +37,19 @@ $ make docker-image
$ make push
```
-- Now you can deploy this docker image to your cluster. A sample development [file is given at](/kubernetes/deployment/in-tree/deployment.yaml). By default, the deployment manages the cluster it is running in. Optionally, the kubeconfig could also be passed as a flag as described in `/kubernetes/deployment/in-tree/deployment.yaml`. This is done when you want your controller running outside the cluster to be managed from.
+- Now you can deploy this docker image to your cluster. A [sample development file](/kubernetes/deployment/out-of-tree/deployment.yaml) is provided. By default, the deployment manages the cluster it is running in. Optionally, the kubeconfig could also be passed as a flag as described in `/kubernetes/deployment/out-of-tree/deployment.yaml`. This is done when you want your controller running outside the cluster to be managed from.
```bash
-$ kubectl apply -f kubernetes/deployment/in-tree/deployment.yaml
+$ kubectl apply -f kubernetes/deployment/out-of-tree/deployment.yaml
```
- Also deploy the required clusterRole and clusterRoleBindings
```bash
-$ kubectl apply -f kubernetes/deployment/in-tree/clusterrole.yaml
-$ kubectl apply -f kubernetes/deployment/in-tree/clusterrolebinding.yaml
+$ kubectl apply -f kubernetes/deployment/out-of-tree/clusterrole.yaml
+$ kubectl apply -f kubernetes/deployment/out-of-tree/clusterrolebinding.yaml
```
## Configuring optional parameters while deploying
-Machine-controller-manager supports several configurable parameters while deploying. Refer to [the following lines](/kubernetes/deployment/in-tree/deployment.yaml#L21-L30), to know how each parameter can be configured, and what it's purpose is for.
+Machine-controller-manager supports several configurable parameters while deploying. Refer to [the following lines](/kubernetes/deployment/out-of-tree/deployment.yaml#L21-L30), to know how each parameter can be configured, and what it's purpose is for.
## Usage
diff --git a/docs/development/cp_support_old.md b/docs/development/cp_support_old.md
deleted file mode 100644
index 598cb5082..000000000
--- a/docs/development/cp_support_old.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: Adding Support for a Cloud Provider (Legacy)
----
-
-# Adding support for a new cloud provider
-
-For adding support for a new cloud provider in the Machine Controller Manager, follow the steps described below. Replace provider with your provider-name.
-
-1. Add a ProviderMachineClass CRD similar to existing AWSMachineClass into `kubernetes/crds.yaml`.
-1. Add ProviderMachineClass structs similar to existing AWSMachineClass into the machine APIs into `pkg/apis/machine/types.go` and `pkg/apis/machine/v1alpha1/types.go`. This would be the machineClass template used to describe provider specific configurations.
-1. Add the Go structures of your machine class (list) to `pkg/apis/machine/register.go` and `pkg/apis/machine/v1alpha1/register.go` to allow reporting events on these objects.
-1. Regenerate the machine API clients by running `./hack/generate-code`
-1. Add validation for the new provider machine class at `pkg/apis/machine/validation/providermachineclass.go` similar to `pkg/apis/machine/validation/awsmachineclass.go`
-1. Update `pkg/controller/machine_util.go` to allow validation of the new provider.
-1. Add a new driver into `pkg/driver/driver_provider.go` similar to `pkg/driver/driver_aws.go` to implement the driver interface.
-1. Update `pkg/driver/driver.go` to add a new switch case to support the new provider driver.
-1. Add a new method in `pkg/controller/machine_safety.go` called checkProviderMachineClass similar to the existing method called checkAWSMachineClass present in the same file. Now invoke this method as a go-routine in the method checkVMObjects.
-1. Extend the `StartControllers()` function in `cmd/machine-controller-manager/app/controllermanager.go` to only start if your new machine class is under the available resources.
-1. Update `pkg/controller/controller.go` to add new providerMachineClassLister, providerMachineClassQueue, awsMachineClassSynced into the controller struct. Also initialize them in NewController() method.
-1. Add a new file `pkg/controller/providermachineclass.go` that allows re-queuing of machines which refer to an modified providerMachineClass.
-1. Update `pkg/controller/controller.go` to extend `WaitForCacheSync` and `.Shutdown()` similar to other cloud providers.
-1. Update the example ClusterRole in `kubernetes/deployment/in-tree/clusterrole.yaml` to allow operations on your new machine class.
-1. Update `pkg/controller/controller.go`, `pkg/controller/secret.go`, `pkg/controller/secret_util.go` to add event handlers to add/remove finalizers referenced by your machine Class. Refer [this commit](https://github.com/gardener/machine-controller-manager/pull/104/commits/013f70726b1057aed1cf7fe0f0449922ab9a256a).
diff --git a/kubernetes/Secrets/alicloud-secret.yaml b/kubernetes/Secrets/alicloud-secret.yaml
deleted file mode 100644
index b6e3e53ad..000000000
--- a/kubernetes/Secrets/alicloud-secret.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-# Sample secret
-
-apiVersion: v1
-kind: Secret
-metadata:
- name: test-secret # Name of the secret
- namespace: default # Namespace of the secret
-data:
- userData: "encoded-cloud-config" # Alicloud cloud config file (base64 encoded)
- alicloudAccessKeyID: "alicloud-access-key-id" # Alicloud access key ID (base64 encoded)
- alicloudAccessKeySecret: "alicloud-access-key-secret" # Alicloud secret access key (base64 encoded)
-### Alternative data keys are:
-# accessKeyID: "alicloud-access-key-id" # Alicloud access key ID (base64 encoded)
-# accessKeySecret: "alicloud-access-key-secret" # Alicloud secret access key (base64 encoded)
-type: Opaque
diff --git a/kubernetes/Secrets/aws-secret.yaml b/kubernetes/Secrets/aws-secret.yaml
deleted file mode 100644
index 2e050d13d..000000000
--- a/kubernetes/Secrets/aws-secret.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-# Sample secret
-
-apiVersion: v1
-kind: Secret
-metadata:
- name: test-secret # Name of the secret
- namespace: default # Namespace of the secret
-data:
- userData: "encoded-cloud-config" # AWS cloud config file (base64 encoded)
- providerAccessKeyId: "pqrstu67890" # AWS access key id (base64 encoded)
- providerSecretAccessKey: "abcdef123456" # AWS secret access key (base64 encoded)
-### Alternative data keys are:
-# accessKeyId: "pqrstu67890" # AWS access key id (base64 encoded)
-# secretAccessKey: "abcdef123456" # AWS secret access key (base64 encoded)
-type: Opaque
diff --git a/kubernetes/Secrets/azure-secret.yaml b/kubernetes/Secrets/azure-secret.yaml
deleted file mode 100644
index c9e7296e0..000000000
--- a/kubernetes/Secrets/azure-secret.yaml
+++ /dev/null
@@ -1,19 +0,0 @@
-# Sample secret
-
-apiVersion: v1
-kind: Secret
-metadata:
- name: test-secret # Name of the secret
- namespace: default # Namespace of the secret
-data:
- userData: "encoded-cloud-config" # AWS cloud config file (base64 encoded)
- azureClientId: "azure-client-id" # Azure client id (base64 encoded)
- azureClientSecret: "azure-client-secret" # Azure client secret (base64 encoded)
- azureSubscriptionId: "azure-subscription-id" # Azure subscription id (base64 encoded)
- azureTenantId: "azure-tenant-id" # Azure tenant id (base64 encoded)
-### Alternative data keys are:
-# clientID: "azure-client-id" # Azure client id (base64 encoded)
-# clientSecret: "azure-client-secret" # Azure client secret (base64 encoded)
-# subscriptionID: "azure-subscription-id" # Azure subscription id (base64 encoded)
-# tenantID: "azure-tenant-id" # Azure tenant id (base64 encoded)
-type: Opaque
diff --git a/kubernetes/Secrets/gcp-secret.yaml b/kubernetes/Secrets/gcp-secret.yaml
deleted file mode 100644
index 9cdb87452..000000000
--- a/kubernetes/Secrets/gcp-secret.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-# Sample secret for GCP
-
-apiVersion: v1
-kind: Secret
-metadata:
- name: test-secret # Name of the secret
- namespace: default # Namespace of the secret
-data:
- userData: "encoded-cloud-config" # GCP cloud config file (base64 encoded)
- serviceAccountJSON: "{...}" # GCP service account json object (base64 encoded)
-### Alternative data keys are:
-# serviceaccount.json: "{...}" # GCP service account json object (base64 encoded)
-type: Opaque
diff --git a/kubernetes/Secrets/openstack-secret.yaml b/kubernetes/Secrets/openstack-secret.yaml
deleted file mode 100644
index 8a40abad7..000000000
--- a/kubernetes/Secrets/openstack-secret.yaml
+++ /dev/null
@@ -1,24 +0,0 @@
-# Sample OpenStack secret
-
-apiVersion: v1
-kind: Secret
-metadata:
- name: test-secret # Name of the secret
- namespace: default # Namespace of the secret
-data: # base64 encoded
- userData: # Cloud init file for used by the machines
- authURL: # Keystone auth endpoint address
- username: # Keystone username
- password: # Keystone password
- domainName: # Keystone domain name
- # domainID: # Keystone domaine id (optional)
- tenantName: # Keystone tenant name
- # tenantID: # Keystone tenant id (optional)
- # userDomainName: # Keystone user domain name (optional)
- # userDomainID: # Keystone user domain id (optional)
- insecure: "true" # | "false" # optional: if running against a self signed OpenStack endpoints
- # optional certificate/autherization block
- caCert: # Custom certificate of your OpenStack endpoints
- clientCert: # Client certificate
- clientKey: # Client jey
-type: Opaque
diff --git a/kubernetes/Secrets/packet-secret.yaml b/kubernetes/Secrets/packet-secret.yaml
deleted file mode 100644
index a4dd3a9aa..000000000
--- a/kubernetes/Secrets/packet-secret.yaml
+++ /dev/null
@@ -1,11 +0,0 @@
-# Sample secret for GCP
-
-apiVersion: v1
-kind: Secret
-metadata:
- name: test-secret # Name of the secret
- namespace: default # Namespace of the secret
-data:
- userData: "encoded-cloud-config" # packet cloud config file (base64 encoded)
- apiToken: "{...}" # packet API key (base64 encoded)
-type: Opaque
diff --git a/kubernetes/crds/machine.sapcloud.io_alicloudmachineclasses.yaml b/kubernetes/crds/machine.sapcloud.io_alicloudmachineclasses.yaml
deleted file mode 100644
index a8745bf36..000000000
--- a/kubernetes/crds/machine.sapcloud.io_alicloudmachineclasses.yaml
+++ /dev/null
@@ -1,150 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.9.2
- creationTimestamp: null
- name: alicloudmachineclasses.machine.sapcloud.io
-spec:
- group: machine.sapcloud.io
- names:
- kind: AlicloudMachineClass
- listKind: AlicloudMachineClassList
- plural: alicloudmachineclasses
- singular: alicloudmachineclass
- scope: Namespaced
- versions:
- - additionalPrinterColumns:
- - jsonPath: .spec.instanceType
- name: Instance Type
- type: string
- - jsonPath: .spec.region
- name: Region
- priority: 1
- type: string
- - description: |-
- CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
- Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
- jsonPath: .metadata.creationTimestamp
- name: Age
- type: date
- name: v1alpha1
- schema:
- openAPIV3Schema:
- description: AlicloudMachineClass TODO
- properties:
- apiVersion:
- description: 'APIVersion defines the versioned schema of this representation
- of an object. Servers should convert recognized schemas to the latest
- internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- type: string
- kind:
- description: 'Kind is a string value representing the REST resource this
- object represents. Servers may infer this from the endpoint the client
- submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- type: string
- metadata:
- type: object
- spec:
- description: AlicloudMachineClassSpec is the specification of a AlicloudMachineClass.
- properties:
- IoOptimized:
- type: string
- credentialsSecretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- dataDisks:
- items:
- properties:
- category:
- type: string
- deleteWithInstance:
- type: boolean
- description:
- type: string
- encrypted:
- type: boolean
- name:
- type: string
- size:
- type: integer
- type: object
- type: array
- imageID:
- type: string
- instanceChargeType:
- type: string
- instanceType:
- type: string
- internetChargeType:
- type: string
- internetMaxBandwidthIn:
- type: integer
- internetMaxBandwidthOut:
- type: integer
- keyPairName:
- type: string
- privateIPAddress:
- type: string
- region:
- type: string
- secretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- securityGroupID:
- type: string
- spotStrategy:
- type: string
- systemDisk:
- description: AlicloudSystemDisk describes SystemDisk for Alicloud.
- properties:
- category:
- type: string
- size:
- type: integer
- required:
- - category
- - size
- type: object
- tags:
- additionalProperties:
- type: string
- type: object
- vSwitchID:
- type: string
- zoneID:
- type: string
- required:
- - imageID
- - instanceType
- - keyPairName
- - region
- - vSwitchID
- type: object
- type: object
- served: true
- storage: true
- subresources: {}
diff --git a/kubernetes/crds/machine.sapcloud.io_awsmachineclasses.yaml b/kubernetes/crds/machine.sapcloud.io_awsmachineclasses.yaml
deleted file mode 100644
index 3841cdd38..000000000
--- a/kubernetes/crds/machine.sapcloud.io_awsmachineclasses.yaml
+++ /dev/null
@@ -1,234 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.9.2
- creationTimestamp: null
- name: awsmachineclasses.machine.sapcloud.io
-spec:
- group: machine.sapcloud.io
- names:
- kind: AWSMachineClass
- listKind: AWSMachineClassList
- plural: awsmachineclasses
- singular: awsmachineclass
- scope: Namespaced
- versions:
- - additionalPrinterColumns:
- - jsonPath: .spec.machineType
- name: Machine Type
- type: string
- - jsonPath: .spec.ami
- name: AMI
- type: string
- - jsonPath: .spec.region
- name: Region
- priority: 1
- type: string
- - description: |-
- CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
- Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
- jsonPath: .metadata.creationTimestamp
- name: Age
- type: date
- name: v1alpha1
- schema:
- openAPIV3Schema:
- description: AWSMachineClass TODO
- properties:
- apiVersion:
- description: 'APIVersion defines the versioned schema of this representation
- of an object. Servers should convert recognized schemas to the latest
- internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- type: string
- kind:
- description: 'Kind is a string value representing the REST resource this
- object represents. Servers may infer this from the endpoint the client
- submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- type: string
- metadata:
- type: object
- spec:
- description: AWSMachineClassSpec is the specification of a AWSMachineClass.
- properties:
- ami:
- type: string
- blockDevices:
- items:
- properties:
- deviceName:
- description: The device name exposed to the machine (for example,
- /dev/sdh or xvdh).
- type: string
- ebs:
- description: Parameters used to automatically set up EBS volumes
- when the machine is launched.
- properties:
- deleteOnTermination:
- description: Indicates whether the EBS volume is deleted
- on machine termination.
- type: boolean
- encrypted:
- description: Indicates whether the EBS volume is encrypted.
- Encrypted Amazon EBS volumes may only be attached to machines
- that support Amazon EBS encryption.
- type: boolean
- iops:
- description: "The number of I/O operations per second (IOPS)
- that the volume supports. For io1, this represents the
- number of IOPS that are provisioned for the volume. For
- gp2, this represents the baseline performance of the volume
- and the rate at which the volume accumulates I/O credits
- for bursting. For more information about General Purpose
- SSD baseline performance, I/O credits, and bursting, see
- Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
- in the Amazon Elastic Compute Cloud User Guide. \n Constraint:
- Range is 100-20000 IOPS for io1 volumes and 100-10000
- IOPS for gp2 volumes. \n Condition: This parameter is
- required for requests to create io1 volumes; it is not
- used in requests to create gp2, st1, sc1, or standard
- volumes."
- format: int64
- type: integer
- kmsKeyID:
- description: "Identifier (key ID, key alias, ID ARN, or
- alias ARN) for a customer managed CMK under which the
- EBS volume is encrypted. \n This parameter is only supported
- on BlockDeviceMapping objects called by RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html),
- RequestSpotFleet (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html),
- and RequestSpotInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html)."
- type: string
- snapshotID:
- description: The ID of the snapshot.
- type: string
- volumeSize:
- description: "The size of the volume, in GiB. \n Constraints:
- 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned
- IOPS SSD (io1), 500-16384 for Throughput Optimized HDD
- (st1), 500-16384 for Cold HDD (sc1), and 1-1024 for Magnetic
- (standard) volumes. If you specify a snapshot, the volume
- size must be equal to or larger than the snapshot size.
- \n Default: If you're creating the volume from a snapshot
- and don't specify a volume size, the default is the snapshot
- size."
- format: int64
- type: integer
- volumeType:
- description: "The volume type: gp2, io1, st1, sc1, or standard.
- \n Default: standard"
- type: string
- type: object
- noDevice:
- description: Suppresses the specified device included in the
- block device mapping of the AMI.
- type: string
- virtualName:
- description: "The virtual device name (ephemeralN). Machine
- store volumes are numbered starting from 0. An machine type
- with 2 available machine store volumes can specify mappings
- for ephemeral0 and ephemeral1.The number of available machine
- store volumes depends on the machine type. After you connect
- to the machine, you must mount the volume. \n Constraints:
- For M3 machines, you must specify machine store volumes in
- the block device mapping for the machine. When you launch
- an M3 machine, we ignore any machine store volumes specified
- in the block device mapping for the AMI."
- type: string
- type: object
- type: array
- credentialsSecretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- ebsOptimized:
- type: boolean
- iam:
- description: Describes an IAM machine profile.
- properties:
- arn:
- description: The Amazon Resource Name (ARN) of the machine profile.
- type: string
- name:
- description: The name of the machine profile.
- type: string
- type: object
- keyName:
- type: string
- machineType:
- type: string
- monitoring:
- type: boolean
- networkInterfaces:
- items:
- description: Describes a network interface. Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MachineAWSNetworkInterfaceSpecification
- properties:
- associatePublicIPAddress:
- description: Indicates whether to assign a public IPv4 address
- to an machine you launch in a VPC. The public IP address can
- only be assigned to a network interface for eth0, and can
- only be assigned to a new network interface, not an existing
- one. You cannot specify more than one network interface in
- the request. If launching into a default subnet, the default
- value is true.
- type: boolean
- deleteOnTermination:
- description: If set to true, the interface is deleted when the
- machine is terminated. You can specify true only if creating
- a new network interface when launching an machine.
- type: boolean
- description:
- description: The description of the network interface. Applies
- only if creating a network interface when launching an machine.
- type: string
- securityGroupIDs:
- description: The IDs of the security groups for the network
- interface. Applies only if creating a network interface when
- launching an machine.
- items:
- type: string
- type: array
- subnetID:
- description: The ID of the subnet associated with the network
- string. Applies only if creating a network interface when
- launching an machine.
- type: string
- type: object
- type: array
- region:
- type: string
- secretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- spotPrice:
- type: string
- tags:
- additionalProperties:
- type: string
- type: object
- type: object
- type: object
- served: true
- storage: true
- subresources: {}
diff --git a/kubernetes/crds/machine.sapcloud.io_azuremachineclasses.yaml b/kubernetes/crds/machine.sapcloud.io_azuremachineclasses.yaml
deleted file mode 100644
index a4a72ce7a..000000000
--- a/kubernetes/crds/machine.sapcloud.io_azuremachineclasses.yaml
+++ /dev/null
@@ -1,260 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.9.2
- creationTimestamp: null
- name: azuremachineclasses.machine.sapcloud.io
-spec:
- group: machine.sapcloud.io
- names:
- kind: AzureMachineClass
- listKind: AzureMachineClassList
- plural: azuremachineclasses
- singular: azuremachineclass
- scope: Namespaced
- versions:
- - additionalPrinterColumns:
- - jsonPath: .spec.properties.hardwareProfile.vmSize
- name: VM Size
- type: string
- - jsonPath: .spec.location
- name: Location
- priority: 1
- type: string
- - description: |-
- CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
- Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
- jsonPath: .metadata.creationTimestamp
- name: Age
- type: date
- name: v1alpha1
- schema:
- openAPIV3Schema:
- description: AzureMachineClass TODO
- properties:
- apiVersion:
- description: 'APIVersion defines the versioned schema of this representation
- of an object. Servers should convert recognized schemas to the latest
- internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- type: string
- kind:
- description: 'Kind is a string value representing the REST resource this
- object represents. Servers may infer this from the endpoint the client
- submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- type: string
- metadata:
- type: object
- spec:
- description: AzureMachineClassSpec is the specification of a AzureMachineClass.
- properties:
- credentialsSecretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- location:
- type: string
- properties:
- description: AzureVirtualMachineProperties is describes the properties
- of a Virtual Machine.
- properties:
- availabilitySet:
- description: AzureSubResource is the Sub Resource definition.
- properties:
- id:
- type: string
- type: object
- hardwareProfile:
- description: AzureHardwareProfile is specifies the hardware settings
- for the virtual machine. Refer github.com/Azure/azure-sdk-for-go/arm/compute/models.go
- for VMSizes
- properties:
- vmSize:
- type: string
- type: object
- identityID:
- type: string
- machineSet:
- description: AzureMachineSetConfig contains the information about
- the machine set
- properties:
- id:
- type: string
- kind:
- type: string
- required:
- - id
- - kind
- type: object
- networkProfile:
- description: AzureNetworkProfile is specifies the network interfaces
- of the virtual machine.
- properties:
- acceleratedNetworking:
- type: boolean
- networkInterfaces:
- description: AzureNetworkInterfaceReference is describes a
- network interface reference.
- properties:
- id:
- type: string
- properties:
- description: AzureNetworkInterfaceReferenceProperties
- is describes a network interface reference properties.
- properties:
- primary:
- type: boolean
- type: object
- type: object
- type: object
- osProfile:
- description: AzureOSProfile is specifies the operating system
- settings for the virtual machine.
- properties:
- adminPassword:
- type: string
- adminUsername:
- type: string
- computerName:
- type: string
- customData:
- type: string
- linuxConfiguration:
- description: AzureLinuxConfiguration is specifies the Linux
- operating system settings on the virtual machine.
For
- a list of supported Linux distributions, see [Linux on Azure-Endorsed
- Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
-
For running non-endorsed distributions, see [Information
- for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
- properties:
- disablePasswordAuthentication:
- type: boolean
- ssh:
- description: AzureSSHConfiguration is SSH configuration
- for Linux based VMs running on Azure
- properties:
- publicKeys:
- description: AzureSSHPublicKey is contains information
- about SSH certificate public key and the path on
- the Linux VM where the public key is placed.
- properties:
- keyData:
- type: string
- path:
- type: string
- type: object
- type: object
- type: object
- type: object
- storageProfile:
- description: AzureStorageProfile is specifies the storage settings
- for the virtual machine disks.
- properties:
- dataDisks:
- items:
- properties:
- caching:
- type: string
- diskSizeGB:
- format: int32
- type: integer
- lun:
- format: int32
- type: integer
- name:
- type: string
- storageAccountType:
- type: string
- type: object
- type: array
- imageReference:
- description: AzureImageReference is specifies information
- about the image to use. You can specify information about
- platform images, marketplace images, or virtual machine
- images. This element is required when you want to use a
- platform image, marketplace image, or virtual machine image,
- but is not used in other creation operations.
- properties:
- id:
- type: string
- urn:
- description: Uniform Resource Name of the OS image to
- be used , it has the format 'publisher:offer:sku:version'
- type: string
- type: object
- osDisk:
- description: AzureOSDisk is specifies information about the
- operating system disk used by the virtual machine.
- For more information about disks, see [About disks and VHDs
- for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
- properties:
- caching:
- type: string
- createOption:
- type: string
- diskSizeGB:
- format: int32
- type: integer
- managedDisk:
- description: AzureManagedDiskParameters is the parameters
- of a managed disk.
- properties:
- id:
- type: string
- storageAccountType:
- type: string
- type: object
- name:
- type: string
- type: object
- type: object
- zone:
- type: integer
- type: object
- resourceGroup:
- type: string
- secretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- subnetInfo:
- description: AzureSubnetInfo is the information containing the subnet
- details
- properties:
- subnetName:
- type: string
- vnetName:
- type: string
- vnetResourceGroup:
- type: string
- type: object
- tags:
- additionalProperties:
- type: string
- type: object
- type: object
- type: object
- served: true
- storage: true
- subresources: {}
diff --git a/kubernetes/crds/machine.sapcloud.io_gcpmachineclasses.yaml b/kubernetes/crds/machine.sapcloud.io_gcpmachineclasses.yaml
deleted file mode 100644
index d7f3a87c5..000000000
--- a/kubernetes/crds/machine.sapcloud.io_gcpmachineclasses.yaml
+++ /dev/null
@@ -1,199 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.9.2
- creationTimestamp: null
- name: gcpmachineclasses.machine.sapcloud.io
-spec:
- group: machine.sapcloud.io
- names:
- kind: GCPMachineClass
- listKind: GCPMachineClassList
- plural: gcpmachineclasses
- singular: gcpmachineclass
- scope: Namespaced
- versions:
- - additionalPrinterColumns:
- - jsonPath: .spec.machineType
- name: Machine Type
- type: string
- - jsonPath: .spec.region
- name: Region
- priority: 1
- type: string
- - description: |-
- CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
- Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
- jsonPath: .metadata.creationTimestamp
- name: Age
- type: date
- name: v1alpha1
- schema:
- openAPIV3Schema:
- description: GCPMachineClass TODO
- properties:
- apiVersion:
- description: 'APIVersion defines the versioned schema of this representation
- of an object. Servers should convert recognized schemas to the latest
- internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- type: string
- kind:
- description: 'Kind is a string value representing the REST resource this
- object represents. Servers may infer this from the endpoint the client
- submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- type: string
- metadata:
- type: object
- spec:
- description: GCPMachineClassSpec is the specification of a GCPMachineClass.
- properties:
- canIpForward:
- type: boolean
- credentialsSecretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- deletionProtection:
- type: boolean
- description:
- type: string
- disks:
- items:
- description: GCPDisk describes disks for GCP.
- properties:
- autoDelete:
- type: boolean
- boot:
- type: boolean
- image:
- type: string
- interface:
- type: string
- labels:
- additionalProperties:
- type: string
- type: object
- sizeGb:
- format: int64
- type: integer
- type:
- type: string
- required:
- - autoDelete
- - boot
- - image
- - interface
- - labels
- - sizeGb
- - type
- type: object
- type: array
- labels:
- additionalProperties:
- type: string
- type: object
- machineType:
- type: string
- metadata:
- items:
- description: GCPMetadata describes metadata for GCP.
- properties:
- key:
- type: string
- value:
- type: string
- required:
- - key
- - value
- type: object
- type: array
- networkInterfaces:
- items:
- description: GCPNetworkInterface describes network interfaces for
- GCP
- properties:
- disableExternalIP:
- type: boolean
- network:
- type: string
- subnetwork:
- type: string
- type: object
- type: array
- region:
- type: string
- scheduling:
- description: GCPScheduling describes scheduling configuration for
- GCP.
- properties:
- automaticRestart:
- type: boolean
- onHostMaintenance:
- type: string
- preemptible:
- type: boolean
- required:
- - automaticRestart
- - onHostMaintenance
- - preemptible
- type: object
- secretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- serviceAccounts:
- items:
- description: GCPServiceAccount describes service accounts for GCP.
- properties:
- email:
- type: string
- scopes:
- items:
- type: string
- type: array
- required:
- - email
- - scopes
- type: object
- type: array
- tags:
- items:
- type: string
- type: array
- zone:
- type: string
- required:
- - canIpForward
- - deletionProtection
- - machineType
- - region
- - scheduling
- - serviceAccounts
- - zone
- type: object
- type: object
- served: true
- storage: true
- subresources: {}
diff --git a/kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml b/kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml
index 51d1d966a..36e5242fa 100644
--- a/kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml
+++ b/kubernetes/crds/machine.sapcloud.io_machinedeployments.yaml
@@ -81,7 +81,7 @@ spec:
a condition with a ProgressDeadlineExceeded reason will be surfaced
in the MachineDeployment status. Note that progress will not be
estimated during the time a MachineDeployment is paused. This is
- not set by default.
+ not set by default, which is treated as infinite deadline.
format: int32
type: integer
replicas:
diff --git a/kubernetes/crds/machine.sapcloud.io_openstackmachineclasses.yaml b/kubernetes/crds/machine.sapcloud.io_openstackmachineclasses.yaml
deleted file mode 100644
index 34c67dfd1..000000000
--- a/kubernetes/crds/machine.sapcloud.io_openstackmachineclasses.yaml
+++ /dev/null
@@ -1,140 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.9.2
- creationTimestamp: null
- name: openstackmachineclasses.machine.sapcloud.io
-spec:
- group: machine.sapcloud.io
- names:
- kind: OpenStackMachineClass
- listKind: OpenStackMachineClassList
- plural: openstackmachineclasses
- singular: openstackmachineclass
- scope: Namespaced
- versions:
- - additionalPrinterColumns:
- - jsonPath: .spec.flavorName
- name: Flavor
- type: string
- - jsonPath: .spec.imageName
- name: Image
- type: string
- - jsonPath: .spec.region
- name: Region
- priority: 1
- type: string
- - description: |-
- CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
- Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
- jsonPath: .metadata.creationTimestamp
- name: Age
- type: date
- name: v1alpha1
- schema:
- openAPIV3Schema:
- description: OpenStackMachineClass TODO
- properties:
- apiVersion:
- description: 'APIVersion defines the versioned schema of this representation
- of an object. Servers should convert recognized schemas to the latest
- internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- type: string
- kind:
- description: 'Kind is a string value representing the REST resource this
- object represents. Servers may infer this from the endpoint the client
- submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- type: string
- metadata:
- type: object
- spec:
- description: OpenStackMachineClassSpec is the specification of a OpenStackMachineClass.
- properties:
- availabilityZone:
- type: string
- credentialsSecretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- flavorName:
- type: string
- imageID:
- type: string
- imageName:
- type: string
- keyName:
- type: string
- networkID:
- type: string
- networks:
- items:
- properties:
- id:
- type: string
- name:
- type: string
- podNetwork:
- type: boolean
- type: object
- type: array
- podNetworkCidr:
- type: string
- region:
- type: string
- rootDiskSize:
- type: integer
- secretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- securityGroups:
- items:
- type: string
- type: array
- serverGroupID:
- type: string
- subnetID:
- type: string
- tags:
- additionalProperties:
- type: string
- type: object
- useConfigDrive:
- type: boolean
- required:
- - availabilityZone
- - flavorName
- - imageID
- - imageName
- - keyName
- - networkID
- - podNetworkCidr
- - region
- - securityGroups
- type: object
- type: object
- served: true
- storage: true
- subresources: {}
diff --git a/kubernetes/crds/machine.sapcloud.io_packetmachineclasses.yaml b/kubernetes/crds/machine.sapcloud.io_packetmachineclasses.yaml
deleted file mode 100644
index 4bf6ef56f..000000000
--- a/kubernetes/crds/machine.sapcloud.io_packetmachineclasses.yaml
+++ /dev/null
@@ -1,105 +0,0 @@
----
-apiVersion: apiextensions.k8s.io/v1
-kind: CustomResourceDefinition
-metadata:
- annotations:
- controller-gen.kubebuilder.io/version: v0.9.2
- creationTimestamp: null
- name: packetmachineclasses.machine.sapcloud.io
-spec:
- group: machine.sapcloud.io
- names:
- kind: PacketMachineClass
- listKind: PacketMachineClassList
- plural: packetmachineclasses
- singular: packetmachineclass
- scope: Namespaced
- versions:
- - additionalPrinterColumns:
- - description: |-
- CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.
- Populated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
- jsonPath: .metadata.creationTimestamp
- name: Age
- type: date
- name: v1alpha1
- schema:
- openAPIV3Schema:
- description: PacketMachineClass TODO
- properties:
- apiVersion:
- description: 'APIVersion defines the versioned schema of this representation
- of an object. Servers should convert recognized schemas to the latest
- internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
- type: string
- kind:
- description: 'Kind is a string value representing the REST resource this
- object represents. Servers may infer this from the endpoint the client
- submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
- type: string
- metadata:
- type: object
- spec:
- description: PacketMachineClassSpec is the specification of a PacketMachineClass.
- properties:
- OS:
- type: string
- billingCycle:
- type: string
- credentialsSecretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- facility:
- items:
- type: string
- type: array
- machineType:
- type: string
- projectID:
- type: string
- secretRef:
- description: SecretReference represents a Secret Reference. It has
- enough information to retrieve secret in any namespace
- properties:
- name:
- description: Name is unique within a namespace to reference a
- secret resource.
- type: string
- namespace:
- description: Namespace defines the space within which the secret
- name must be unique.
- type: string
- type: object
- x-kubernetes-map-type: atomic
- sshKeys:
- items:
- type: string
- type: array
- tags:
- items:
- type: string
- type: array
- userdata:
- type: string
- required:
- - OS
- - billingCycle
- - facility
- - machineType
- - projectID
- type: object
- type: object
- served: true
- storage: true
- subresources: {}
diff --git a/kubernetes/deployment/in-tree/control-cluster-role-binding.yaml b/kubernetes/deployment/in-tree/control-cluster-role-binding.yaml
deleted file mode 100644
index a1623f718..000000000
--- a/kubernetes/deployment/in-tree/control-cluster-role-binding.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: machine-controller-manager-control
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: machine-controller-manager-control
-subjects:
-- kind: ServiceAccount
- name: default
- namespace: default
\ No newline at end of file
diff --git a/kubernetes/deployment/in-tree/control-cluster-role.yaml b/kubernetes/deployment/in-tree/control-cluster-role.yaml
deleted file mode 100644
index 2e771fe2b..000000000
--- a/kubernetes/deployment/in-tree/control-cluster-role.yaml
+++ /dev/null
@@ -1,60 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: machine-controller-manager-control
-rules:
-- apiGroups:
- - machine.sapcloud.io
- resources:
- - awsmachineclasses
- - azuremachineclasses
- - gcpmachineclasses
- - openstackmachineclasses
- - alicloudmachineclasses
- - packetmachineclasses
- - machinedeployments
- - machines
- - machinesets
- verbs:
- - create
- - delete
- - deletecollection
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - ""
- resources:
- - nodes
- - nodes/status
- - configmaps
- - secrets
- - events
- verbs:
- - create
- - delete
- - deletecollection
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- verbs:
- - create
-- apiGroups:
- - coordination.k8s.io
- resources:
- - leases
- resourceNames:
- - machine-controller-manager
- - machine-controller
- verbs:
- - get
- - watch
- - update
diff --git a/kubernetes/deployment/in-tree/deployment.yaml b/kubernetes/deployment/in-tree/deployment.yaml
deleted file mode 100644
index 10d4248ce..000000000
--- a/kubernetes/deployment/in-tree/deployment.yaml
+++ /dev/null
@@ -1,46 +0,0 @@
-# Sample deployment file, used to run Machine Controller Manager on your cluster
-
-apiVersion: apps/v1 # Version may change based on kubernetes version
-kind: Deployment
-metadata:
- name: machine-controller-manager
-spec:
- replicas: 1
- selector:
- matchLabels:
- role: machine-controller-manager
- template:
- metadata:
- labels:
- role: machine-controller-manager
- spec:
- securityContext: {}
- serviceAccount: machine-controller-manager
- serviceAccountName: machine-controller-manager
- containers:
- - name: machine-controller-manager
- image: eu.gcr.io/gardener-project/gardener/machine-controller-manager:v0.28.0
- imagePullPolicy: Always
- command:
- - ./machine-controller-manager
- - --target-kubeconfig=$(TARGET_KUBECONFIG) # Mandatory Parameter - Filepath to the target cluster's kubeconfig where node objects are expected to join.
- - --control-kubeconfig=$(CONTROL_KUBECONFIG) # Optional Parameter - Default value is same as target-kubeconfig - Filepath to the control cluster's kubeconfig where machine objects would be created. Optionally you could also use "inClusterConfig" when pod is running inside control kubeconfig.
- - --namespace=$(CONTROL_NAMESPACE) # Optional Parameter - Default value for namespace is 'default' - The control namespace where the controller watches for it's machine objects.
- - --safety-up=2 # Optional Parameter - Default value 2 - The number of excess machine objects permitted for any machineSet/machineDeployment beyond its expected number of replicas based on desired and max-surge, we call this the upper-limit. When this upper-limit is reached, the objects are frozen until the number of objects reduce. upper-limit = desired + maxSurge (if applicable) + safetyUp.
- - --safety-down=1 # Optional Parameter - Default value 1 - Upper-limit minus safety-down value gives the lower-limit. This is the limits below which any temporarily frozen machineSet/machineDeployment object is unfrozen. lower-limit = desired + maxSurge (if applicable) + safetyUp - safetyDown.
- - --machine-drain-timeout=5m # Optional Parameter - Timeout (in time) used while draining of machine before deletion, beyond which MCM forcefully deletes machine.
- - --machine-health-timeout=10m # Optional Parameter - Default value 10mins - Timeout (in time) used while joining (during creation) or re-joining (in case of temporary health issues) of machine before it is declared as failed.
- - --machine-safety-orphan-vms-period=30m # Optional Parameter - Default value 30mins - Time period (in time) used to poll for orphan VMs by safety controller.
- - --machine-safety-overshooting-period=1m # Optional Parameter - Default value 1min - Time period (in time) used to poll for overshooting of machine objects backing a machineSet by safety controller.
- - --node-conditions=ReadonlyFilesystem,KernelDeadlock,DiskPressure,NetworkUnavailable # List of comma-separated/case-sensitive node-conditions which when set to True will change machine to a failed state after MachineHealthTimeout duration. It may further be replaced with a new machine if the machine is backed by a machine-set object.
- - --v=2
- livenessProbe:
- failureThreshold: 3
- httpGet:
- path: /healthz
- port: 10258
- scheme: HTTP
- initialDelaySeconds: 30
- periodSeconds: 10
- successThreshold: 1
- timeoutSeconds: 5
diff --git a/kubernetes/deployment/in-tree/target-cluster-role-binding.yaml b/kubernetes/deployment/in-tree/target-cluster-role-binding.yaml
deleted file mode 100644
index 4067bc1f2..000000000
--- a/kubernetes/deployment/in-tree/target-cluster-role-binding.yaml
+++ /dev/null
@@ -1,12 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRoleBinding
-metadata:
- name: machine-controller-manager-target
-roleRef:
- apiGroup: rbac.authorization.k8s.io
- kind: ClusterRole
- name: machine-controller-manager-target
-subjects:
-- kind: ServiceAccount
- name: default
- namespace: default
\ No newline at end of file
diff --git a/kubernetes/deployment/in-tree/target-cluster-role.yaml b/kubernetes/deployment/in-tree/target-cluster-role.yaml
deleted file mode 100644
index 7819cf485..000000000
--- a/kubernetes/deployment/in-tree/target-cluster-role.yaml
+++ /dev/null
@@ -1,51 +0,0 @@
-apiVersion: rbac.authorization.k8s.io/v1
-kind: ClusterRole
-metadata:
- name: machine-controller-manager-target
-rules:
-- apiGroups:
- - ""
- resources:
- - nodes
- - replicationcontrollers
- - pods
- verbs:
- - create
- - delete
- - deletecollection
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - ""
- resources:
- - pods/eviction
- verbs:
- - create
-- apiGroups:
- - extensions
- - apps
- resources:
- - replicasets
- - statefulsets
- - daemonsets
- - deployments
- verbs:
- - create
- - delete
- - deletecollection
- - get
- - list
- - patch
- - update
- - watch
-- apiGroups:
- - ""
- resources:
- - persistentvolumeclaims
- - persistentvolumes
- verbs:
- - list
- - watch
diff --git a/kubernetes/deployment/out-of-tree/deployment.yaml b/kubernetes/deployment/out-of-tree/deployment.yaml
index 57fdd70e5..c7f5ebebf 100644
--- a/kubernetes/deployment/out-of-tree/deployment.yaml
+++ b/kubernetes/deployment/out-of-tree/deployment.yaml
@@ -22,15 +22,10 @@ spec:
- ./machine-controller-manager
- --target-kubeconfig=$(TARGET_KUBECONFIG) # Mandatory Parameter - Filepath to the target cluster's kubeconfig where node objects are expected to join.
- --control-kubeconfig=$(CONTROL_KUBECONFIG) # Optional Parameter - Default value is same as target-kubeconfig - Filepath to the control cluster's kubeconfig where machine objects would be created. Optionally you could also use "inClusterConfig" when pod is running inside control kubeconfig.
- - --delete-migrated-machine-class=false # Optional Parameter - To specify if the migrated machine class is to be deleted. If set to true, is deleted, else is retained.
- --namespace=$(CONTROL_NAMESPACE) # Optional Parameter - Default value for namespace is 'default' - The control namespace where the controller watches for it's machine objects.
- --safety-up=2 # Optional Parameter - Default value 2 - The number of excess machine objects permitted for any machineSet/machineDeployment beyond its expected number of replicas based on desired and max-surge, we call this the upper-limit. When this upper-limit is reached, the objects are frozen until the number of objects reduce. upper-limit = desired + maxSurge (if applicable) + safetyUp.
- --safety-down=1 # Optional Parameter - Default value 1 - Upper-limit minus safety-down value gives the lower-limit. This is the limits below which any temporarily frozen machineSet/machineDeployment object is unfrozen. lower-limit = desired + maxSurge (if applicable) + safetyUp - safetyDown.
- - --machine-drain-timeout=5m # Optional Parameter - Timeout (in time) used while draining of machine before deletion, beyond which MCM forcefully deletes machine.
- - --machine-health-timeout=10m # Optional Parameter - Default value 10mins - Timeout (in time) used while joining (during creation) or re-joining (in case of temporary health issues) of machine before it is declared as failed.
- - --machine-safety-orphan-vms-period=30 # Optional Parameter - Default value 30mins - Time period (in time) used to poll for orphan VMs by safety controller.
- --machine-safety-overshooting-period=1 # Optional Parameter - Default value 1min - Time period (in time) used to poll for overshooting of machine objects backing a machineSet by safety controller.
- - --node-conditions=ReadonlyFilesystem,KernelDeadlock,DiskPressure,NetworkUnavailable # List of comma-separated/case-sensitive node-conditions which when set to True will change machine to a failed state after MachineHealthTimeout duration. It may further be replaced with a new machine if the machine is backed by a machine-set object.
- --v=2
livenessProbe:
failureThreshold: 3
diff --git a/kubernetes/machine_classes/alicloud-machine-class.yaml b/kubernetes/machine_classes/alicloud-machine-class.yaml
deleted file mode 100644
index d6b7adf0f..000000000
--- a/kubernetes/machine_classes/alicloud-machine-class.yaml
+++ /dev/null
@@ -1,47 +0,0 @@
-# Sample Alicloud machine class
-
-apiVersion: machine.sapcloud.io/v1alpha1
-kind: AlicloudMachineClass
-metadata:
- name: test-alicloud # Name of Alicloud machine class goes here
- namespace: default # Namespace in which the machine class is to be deployed
-spec:
- imageID: coreos_1745_7_0_64_30G_alibase_20180705.vhd # Alicloud machine image name goes here, e.g. centos_7_04_64_20G_alibase_201701015
- instanceType: ecs.n1.medium # Type of ecs machine ecs.t5-lc1m1.small ecs.t5-lc2m1.nano
- region: cn-hangzhou # Region in which machine is to be deployed
- zoneID: cn-hangzhou-e # Zone of the region
- securityGroupID: sg-1234567890 # ID of security group, it has to be within the same VPC of vSwitch
- vSwitchID: vsw-1234567890 # similar to AWS subnet ID
- dataDisks: # Array of disks to be associated with this instance
- - name: disk1
- size: 50
- category: cloud_ssd
- encrypted: false
- description: 50 GB disk description
- deleteWithInstance: true
- - name: disk2
- size: 40
- category: cloud_efficiency
- encrypted: true
- description: 40 GB disk description
- deleteWithInstance: true
- systemDisk:
- category: cloud_efficiency # cloud, cloud_efficiency, cloud_ssd, ephemeral_ssd
- size: 30 # 20-500
- instanceChargeType: PostPaid # Prepaid or PostPaid (default)
- internetChargeType: PayByTraffic # PayByBandwidth or PayByTraffic (default)
- internetMaxBandwidthIn: 5 # 1-200
- internetMaxBandwidthOut: 0 # 0-100
- spotStrategy: NoSpot # NoSpot, SpotWithPriceLimit, SpotAsPriceGo
- tags:
- kubernetes.io/cluster/YOUR_CLUSTER_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- kubernetes.io/role/YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- tag1: tag1-value # A set of additional tags attached to a machine (optional)
- tag2: tag2-value # A set of additional tags attached to a machine (optional)
- keyPairName: test-keypair # keypair used to access Alicloud ECS machine
- secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
- namespace: default # Namespace
- name: test-secret # Name of the secret
-# credentialsSecretRef: # Optional - Kubernetes secret containing only provider secrets (in this case the Secret in the secretRef does not need them)
-# name: "test-secret-credentials" # Name of the secret
-# namespace: "default" # Namespace of secret
diff --git a/kubernetes/machine_classes/aws-machine-class.yaml b/kubernetes/machine_classes/aws-machine-class.yaml
deleted file mode 100644
index a82eace5f..000000000
--- a/kubernetes/machine_classes/aws-machine-class.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-# Sample AWS machine class
-
-apiVersion: machine.sapcloud.io/v1alpha1
-kind: AWSMachineClass
-metadata:
- name: test-aws # Name of aws machine class goes here
- namespace: default # Namespace in which the machine class is to be deployed
-spec:
- ami: ami-123456 # Amazon machine image name goes here
- region: eu-east-1 # Region in which machine is to be deployed
- machineType: t2.large # Type of ec2 machine
- iam:
- name: iam-name # Name of the AWS Identity and Access Management
- keyName: key-value-pair-name # EC2 keypair used to access ec2 machine
- networkInterfaces:
- - subnetID: subnet-acbd1234 # The subnetID in which machine is to be deployed
- securityGroupIDs: ["sg-xyz12345"] # The security groups to which it is attached to
- tags:
- Name: sample-machine-name # Name tag that can be used to identify a machine at AWS
- kubernetes.io/cluster/YOUR_CLUSTER_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- kubernetes.io/role/YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by by this controller.
- tag1: tag1-value # A set of additional tags attached to a machine (optional)
- tag2: tag2-value # A set of additional tags attached to a machine (optional)
- secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
- namespace: default # Namespace
- name: test-secret # Name of the secret
-# credentialsSecretRef: # Optional - Kubernetes secret containing only provider secrets (in this case the Secret in the secretRef does not need them)
-# name: "test-secret-credentials" # Name of the secret
-# namespace: "default" # Namespace of secret
- blockDevices:
- - deviceName: /root
- ebs:
- volumeSize: 50 # Size of the root block device
- volumeType: gp2 # Type of the root block device
- encrypted: false
- deleteOnTermination: true
- - deviceName: /dev/sdb
- ebs:
- volumeSize: 50 # Size of the root block device
- volumeType: gp2 # Type of the root block device
- encrypted: true
- deleteOnTermination: true
diff --git a/kubernetes/machine_classes/azure-machine-class.yaml b/kubernetes/machine_classes/azure-machine-class.yaml
deleted file mode 100644
index 27704f77c..000000000
--- a/kubernetes/machine_classes/azure-machine-class.yaml
+++ /dev/null
@@ -1,63 +0,0 @@
-# Sample Azure machine class
-
-apiVersion: machine.sapcloud.io/v1alpha1
-kind: AzureMachineClass
-metadata:
- name: test-azure # Name of Azure machine class goes here
- namespace: default # Namespace in which the machine class is to be deployed
-spec:
- location: "sample-location" # Azure location in which machine is to be deployed (Eg- NorthAmerica)
- resourceGroup: "sample-resource-group" # Name of the resource group to which the node should be bound
- subnetInfo:
- vnetName: "sample-vnet" # The V-Net to which the node should belong
- subnetName: "sample-subnet-in-given-vnet" # The subnet to which the node should belong
- secretRef: # Kubernetes secret containing values for provider secrets and user-data
- name: "test-secret" # Name of the secret
- namespace: "default" # Namespace of secret
-# credentialsSecretRef: # Optional - Kubernetes secret containing only provider secrets (in this case the Secret in the secretRef does not need them)
-# name: "test-secret-credentials" # Name of the secret
-# namespace: "default" # Namespace of secret
- tags:
- kubernetes.io-cluster-YOUR_CLUSTER_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- kubernetes.io-role-YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- tag1: "key1" # A set of additional tags attached to a machine (optional)
- tag2: "key2" # A set of additional tags attached to a machine (optional)
- properties:
- hardwareProfile:
- vmSize: "sample-azure-vm-size" # VMsize based on azure machine kinds (Eg- Standard_DS1_V2)
- networkProfile:
- acceleratedNetworking: false # Enable Azure accelerated networking for the network interface of the machines. Be aware, if the machine type and/or operating system does not support the feature the machines will not have network connectivity.
- storageProfile:
- imageReference:
- urn: "image-reference-urn" # Image reference urn, it has the format 'publisher:offer:sku:version' (Eg- "CoreOS:CoreOS:Beta:1000.0.0")
- id: "image-id" # Image reference ID, useful when image is not available via URN
- osDisk:
- caching: "None" # Caching Strategy (None/ReadOnly/ReadWrite)
- diskSizeGB: 50 # Size of disk to be created in GB
- createOption: "FromImage" # Create option for disk (Empty/Attach/FromImage)
- dataDisks:
- - lun: 0
- caching: None
- diskSizeGB: 100
- storageAccountType: Standard_LRS
- name: sdb
- - lun: 1
- caching: None
- diskSizeGB: 100
- storageAccountType: Standard_LRS
- name: sdc
- osProfile:
- adminUsername: "admin-name" # Admin user name
- linuxConfiguration:
- disablePasswordAuthentication: true # Disable password authentication
- ssh:
- publicKeys:
- path: "/path/to/public-key/in/machine" # Path to public key
- keyData: "public-key-data" # Public key data
- identityID: "/subscriptions/subscription-id/resourceGroups/resource-group-name/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name" # ID of an user assigned managed identity to attach the machine to
- zone: 1 # Zone which the node will be deployed into. Either a zone or a machine set can be specified.
- machineSet: # Configuration of the machine set which the node will be assigned to.
- id: /subscriptions/subscription-id/resourceGroups/resource-group-name/providers/Microsoft.Compute/azureMachineSetResourceType/machine-set-name" # ID of machine set to attach the machine to
- kind: "availabilityset|vmo" # The kind/type of the machineset either 'vmo' or 'availabilityset'
- availabilitySet: # (DEPRECATED will be removed in future) AvailabilitySet which the node will be assigned to. Either a zone, a machineset or an AvailabilitySet can be specified.
- id: "/subscriptions/subscription-id/resourceGroups/resource-group-name/providers/Microsoft.Compute/availabilitySets/availablity-set-name" # (DEPRECATED will be removed in future) ID of availability set to attach the machine to
diff --git a/kubernetes/machine_classes/gcp-machine-class.yaml b/kubernetes/machine_classes/gcp-machine-class.yaml
deleted file mode 100644
index 7302573fa..000000000
--- a/kubernetes/machine_classes/gcp-machine-class.yaml
+++ /dev/null
@@ -1,57 +0,0 @@
-# Sample GCP machine class
-
-apiVersion: machine.sapcloud.io/v1alpha1 # API version of object
-kind: GCPMachineClass # Machine Class Kind
-metadata:
- name: test-gcp # Name of GCP machine class goes here
- namespace: default # Namespace in which the machine class is to be deployed
-spec:
- canIpForward: true # Allows this instance to send and receive packets with non-matching destination or source IPs
- deletionProtection: false # DeletionProtection: Whether the resource should be protected against deletion
- description: An optional description for machines created by that class. # Description of this resource
- disks: # Array of disks associated with this instance
- - autoDelete: true # Specifies whether the disk will be auto-deleted when the instance is deleted
- boot: true # Indicates that this is a boot disk
- sizeGb: 50 # Size of disk
- type: pd-standard # Specifies the type of the disk
- image: projects/coreos-cloud/global/images/image-name-goes-here # Disk image name
- labels:
- name: my-disk # Label assigned to the disk
- - autoDelete: true
- boot: false
- sizeGb: 50
- type: pd-standard
- image: projects/coreos-cloud/global/images/image-name-goes-here # Disk image name
- labels:
- name: my-disk
- labels:
- name: my-instance # Label assigned to the instance
- machineType: n1-standard-4 # Type of GCP instance to launch
- metadata: # Metadata key-value pairs
- - key: my-key
- value: my-value
- networkInterfaces:
- - disableExternalIP: false # If external IP is not required for the NIC, set this to true
- network: network-name # Network name to attach the instance to
- subnetwork: sub-net-name # Subnet name to attach the instance to
- scheduling:
- automaticRestart: true # Automatic restart of instance
- onHostMaintenance: MIGRATE # Host maintainance
- preemptible: false # Instance is premeptiable
- secretRef: # Kubernetes secret containing values for provider secrets and user-data
- name: "test-secret" # Name of the secret
- namespace: "default" # Namespace of secret
-# credentialsSecretRef: # Optional - Kubernetes secret containing only provider secrets (in this case the Secret in the secretRef does not need them)
-# name: "test-secret-credentials" # Name of the secret
-# namespace: "default" # Namespace of secret
- serviceAccounts:
- - email: default@project.iam.gserviceaccount.com # Service account email
- scopes: # List of scopes
- - https://www.googleapis.com/auth/compute
- tags:
- - kubernetes-io-cluster-YOUR_CLUSTER_NAME # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- - kubernetes-io-role-YOUR_ROLE_NAME # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- - key1 # A set of additional tags attached to a machine (optional)
- - key2 # A set of additional tags attached to a machine (optional)
- region: europe-west1 # Region to attach the instance
- zone: europe-west1-b # Zone to attach the instance
diff --git a/kubernetes/machine_classes/openstack-machine-class.yaml b/kubernetes/machine_classes/openstack-machine-class.yaml
deleted file mode 100644
index 92de43ae3..000000000
--- a/kubernetes/machine_classes/openstack-machine-class.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-# Sample OpenStack machine class
-
-apiVersion: machine.sapcloud.io/v1alpha1
-kind: OpenStackMachineClass
-metadata:
- name: test-openstack # Name of OpenStack machine class goes here
- namespace: default # Namespace in which the machine class is to be deployed
-spec:
- flavorName: # Name of the machine flavor
- keyName: # Name of the ssh key pair
- imageName: # Machine image name
- imageID: # Machine image id (either name or id needs to be present)
- serverGroupID: # Server group ID where the machine should be scheduled
- networkID: # Network ID where the machine should be placed
- securityGroups:
- - # List of security groups which should be used for this machine
- region: # Region where to place the machine
- availabilityZone: # Availability zone where to place the machine
- podNetworkCidr: # CIDR of the overlay Calico IP pool
- # rootDiskSize: 100 # in GB (optional) overrides the flavor provider root disk size and use a Cinder backed block device instead
- # OpenStack machine metadata block
- # Be aware, that metadata keys (tags) in OpenStack can not contain special characters likes "/"
- tags:
- kubernetes.io-cluster-YOUR_CLUSTER_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- kubernetes.io-role-YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- tag1: tag1-value # A set of additional tags attached to a machine (optional)
- tag2: tag2-value # A set of additional tags attached to a machine (optional)
- secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
- namespace: default # Namespace
- name: test-secret # Name of the secret
-# credentialsSecretRef: # Optional - Kubernetes secret containing only provider secrets (in this case the Secret in the secretRef does not need them)
-# name: "test-secret-credentials" # Name of the secret
-# namespace: "default" # Namespace of secret
diff --git a/kubernetes/machine_classes/packet-machine-class.yaml b/kubernetes/machine_classes/packet-machine-class.yaml
deleted file mode 100644
index 78ba03eb6..000000000
--- a/kubernetes/machine_classes/packet-machine-class.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-# Sample Packet machine class
-
-apiVersion: machine.sapcloud.io/v1alpha1
-kind: PacketMachineClass
-metadata:
- name: test-packet # Name of packet machine class goes here
- namespace: default # Namespace in which the machine class is to be deployed
-spec:
- projectID: f40c6787-5ac0-657e-9fe4-62d433c5df11 # UUID of a project with which you have rights
- OS: alpine_3 # OS ID or slug goes here
- facility:
- - ewr1 # Facilities wherein the server can be deployed. Can be one, two or many, or the keyword "any"
- - ams1
- machineType: x1.small # Type of packet bare-metal machine
- tags:
- Name: sample-machine-name # Name tag that can be used to identify a machine at Packet
- kubernetes.io/cluster/YOUR_CLUSTER_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by this controller.
- kubernetes.io/role/YOUR_ROLE_NAME: "1" # This is mandatory as the safety controller uses this tag to identify VMs created by by this controller.
- tag1: tag1-value # A set of additional tags attached to a machine (optional)
- tag2: tag2-value # A set of additional tags attached to a machine (optional)
- secretRef: # Secret pointing to a secret which contains the provider secret and cloudconfig
- namespace: default # Namespace
- name: test-secret # Name of the secret
-# credentialsSecretRef: # Optional - Kubernetes secret containing only provider secrets (in this case the Secret in the secretRef does not need them)
-# name: "test-secret-credentials" # Name of the secret
-# namespace: "default" # Namespace of secret
diff --git a/kubernetes/machine_objects/machine.yaml b/kubernetes/machine_objects/machine.yaml
deleted file mode 100644
index 43cfd1799..000000000
--- a/kubernetes/machine_objects/machine.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-# Sample machine object
-
-apiVersion: machine.sapcloud.io/v1alpha1
-kind: Machine
-metadata:
- name: test-machine # Name of the machine to be created
- namespace: default
- labels:
- test-label: test-label # Label used by machine-set to match (optional)
-spec:
- class:
- kind: AWSMachineClass # Machine class template used to create machine, could be AWS/GCP/Azure/Other-cloud-providers
- name: test-aws # Name of the machine class
diff --git a/pkg/apis/machine/register.go b/pkg/apis/machine/register.go
index 136a0ec43..2fff63318 100644
--- a/pkg/apis/machine/register.go
+++ b/pkg/apis/machine/register.go
@@ -49,23 +49,6 @@ var (
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
- &OpenStackMachineClass{},
- &OpenStackMachineClassList{},
-
- &AWSMachineClass{},
- &AWSMachineClassList{},
-
- &AzureMachineClass{},
- &AzureMachineClassList{},
-
- &GCPMachineClass{},
- &GCPMachineClassList{},
-
- &AlicloudMachineClass{},
- &AlicloudMachineClassList{},
-
- &PacketMachineClass{},
- &PacketMachineClassList{},
&MachineClass{},
&MachineClassList{},
diff --git a/pkg/apis/machine/types.go b/pkg/apis/machine/types.go
index 46e1d241b..bc1c8124d 100644
--- a/pkg/apis/machine/types.go
+++ b/pkg/apis/machine/types.go
@@ -619,576 +619,6 @@ type MachineDeploymentList struct {
Items []MachineDeployment
}
-/********************** OpenStackMachineClass APIs ***************/
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// OpenStackMachineClass TODO
-type OpenStackMachineClass struct {
- metav1.ObjectMeta
-
- metav1.TypeMeta
-
- Spec OpenStackMachineClassSpec
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// OpenStackMachineClassList is a collection of OpenStackMachineClasses.
-type OpenStackMachineClassList struct {
- metav1.TypeMeta
-
- metav1.ListMeta
-
- Items []OpenStackMachineClass
-}
-
-// OpenStackMachineClassSpec is the specification of a OpenStackMachineClass.
-type OpenStackMachineClassSpec struct {
- ImageID string
- ImageName string
- Region string
- AvailabilityZone string
- FlavorName string
- KeyName string
- SecurityGroups []string
- Tags map[string]string
- NetworkID string
- Networks []OpenStackNetwork
- SubnetID *string
- SecretRef *corev1.SecretReference
- CredentialsSecretRef *corev1.SecretReference
- PodNetworkCidr string
- RootDiskSize int // in GB
- UseConfigDrive *bool
- ServerGroupID *string
-}
-
-type OpenStackNetwork struct {
- Id string
- Name string
- PodNetwork bool
-}
-
-/********************** AWSMachineClass APIs ***************/
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// AWSMachineClass TODO
-type AWSMachineClass struct {
- metav1.ObjectMeta
-
- metav1.TypeMeta
-
- Spec AWSMachineClassSpec
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// AWSMachineClassList is a collection of AWSMachineClasses.
-type AWSMachineClassList struct {
- metav1.TypeMeta
-
- metav1.ListMeta
-
- Items []AWSMachineClass
-}
-
-// AWSMachineClassSpec is the specification of a AWSMachineClass.
-type AWSMachineClassSpec struct {
- AMI string
- Region string
- BlockDevices []AWSBlockDeviceMappingSpec
- EbsOptimized bool
- IAM AWSIAMProfileSpec
- MachineType string
- KeyName string
- Monitoring bool
- NetworkInterfaces []AWSNetworkInterfaceSpec
- Tags map[string]string
- SpotPrice *string
- SecretRef *corev1.SecretReference
- CredentialsSecretRef *corev1.SecretReference
-
- // TODO add more here
-}
-
-type AWSBlockDeviceMappingSpec struct {
-
- // The device name exposed to the machine (for example, /dev/sdh or xvdh).
- DeviceName string
-
- // Parameters used to automatically set up EBS volumes when the machine is
- // launched.
- Ebs AWSEbsBlockDeviceSpec
-
- // Suppresses the specified device included in the block device mapping of the
- // AMI.
- NoDevice string
-
- // The virtual device name (ephemeralN). Machine store volumes are numbered
- // starting from 0. An machine type with 2 available machine store volumes
- // can specify mappings for ephemeral0 and ephemeral1.The number of available
- // machine store volumes depends on the machine type. After you connect to
- // the machine, you must mount the volume.
- //
- // Constraints: For M3 machines, you must specify machine store volumes in
- // the block device mapping for the machine. When you launch an M3 machine,
- // we ignore any machine store volumes specified in the block device mapping
- // for the AMI.
- VirtualName string
-}
-
-// Describes a block device for an EBS volume.
-// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice
-type AWSEbsBlockDeviceSpec struct {
-
- // Indicates whether the EBS volume is deleted on machine termination.
- DeleteOnTermination *bool
-
- // Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes
- // may only be attached to machines that support Amazon EBS encryption.
- Encrypted bool
-
- // The number of I/O operations per second (IOPS) that the volume supports.
- // For io1, this represents the number of IOPS that are provisioned for the
- // volume. For gp2, this represents the baseline performance of the volume and
- // the rate at which the volume accumulates I/O credits for bursting. For more
- // information about General Purpose SSD baseline performance, I/O credits,
- // and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
- // in the Amazon Elastic Compute Cloud User Guide.
- //
- // Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for
- // gp2 volumes.
- //
- // Condition: This parameter is required for requests to create io1 volumes;
- // it is not used in requests to create gp2, st1, sc1, or standard volumes.
- Iops int64
-
- // Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed
- // CMK under which the EBS volume is encrypted.
- //
- // This parameter is only supported on BlockDeviceMapping objects called by
- // RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html),
- // RequestSpotFleet (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html),
- // and RequestSpotInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html).
- KmsKeyID *string
-
- // The ID of the snapshot.
- SnapshotID *string
-
- // The size of the volume, in GiB.
- //
- // Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned
- // IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for
- // Cold HDD (sc1), and 1-1024 for Magnetic (standard) volumes. If you specify
- // a snapshot, the volume size must be equal to or larger than the snapshot
- // size.
- //
- // Default: If you're creating the volume from a snapshot and don't specify
- // a volume size, the default is the snapshot size.
- VolumeSize int64
-
- // The volume type: gp2, io1, st1, sc1, or standard.
- //
- // Default: standard
- VolumeType string
-}
-
-// Describes an IAM machine profile.
-type AWSIAMProfileSpec struct {
- // The Amazon Resource Name (ARN) of the machine profile.
- ARN string
-
- // The name of the machine profile.
- Name string
-}
-
-// Describes a network interface.
-// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MachineAWSNetworkInterfaceSpecification
-type AWSNetworkInterfaceSpec struct {
-
- // Indicates whether to assign a public IPv4 address to an machine you launch
- // in a VPC. The public IP address can only be assigned to a network interface
- // for eth0, and can only be assigned to a new network interface, not an existing
- // one. You cannot specify more than one network interface in the request. If
- // launching into a default subnet, the default value is true.
- AssociatePublicIPAddress *bool
-
- // If set to true, the interface is deleted when the machine is terminated.
- // You can specify true only if creating a new network interface when launching
- // an machine.
- DeleteOnTermination *bool
-
- // The description of the network interface. Applies only if creating a network
- // interface when launching an machine.
- Description *string
-
- // The IDs of the security groups for the network interface. Applies only if
- // creating a network interface when launching an machine.
- SecurityGroupIDs []string
-
- // The ID of the subnet associated with the network string. Applies only if
- // creating a network interface when launching an machine.
- SubnetID string
-}
-
-/********************** AzureMachineClass APIs ***************/
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// AzureMachineClass TODO
-type AzureMachineClass struct {
- metav1.ObjectMeta
-
- metav1.TypeMeta
-
- Spec AzureMachineClassSpec
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// AzureMachineClassList is a collection of AzureMachineClasses.
-type AzureMachineClassList struct {
- metav1.TypeMeta
-
- metav1.ListMeta
-
- Items []AzureMachineClass
-}
-
-// AzureMachineClassSpec is the specification of a AzureMachineClass.
-type AzureMachineClassSpec struct {
- Location string
- Tags map[string]string
- Properties AzureVirtualMachineProperties
- ResourceGroup string
- SubnetInfo AzureSubnetInfo
- SecretRef *corev1.SecretReference
- CredentialsSecretRef *corev1.SecretReference
-}
-
-// AzureVirtualMachineProperties is describes the properties of a Virtual Machine.
-type AzureVirtualMachineProperties struct {
- HardwareProfile AzureHardwareProfile
- StorageProfile AzureStorageProfile
- OsProfile AzureOSProfile
- NetworkProfile AzureNetworkProfile
- AvailabilitySet *AzureSubResource
- IdentityID *string
- Zone *int
- MachineSet *AzureMachineSetConfig
-}
-
-// AzureHardwareProfile is specifies the hardware settings for the virtual machine.
-// Refer github.com/Azure/azure-sdk-for-go/arm/compute/models.go for VMSizes
-type AzureHardwareProfile struct {
- VMSize string
-}
-
-// AzureStorageProfile is specifies the storage settings for the virtual machine disks.
-type AzureStorageProfile struct {
- ImageReference AzureImageReference
- OsDisk AzureOSDisk
- DataDisks []AzureDataDisk
-}
-
-// AzureImageReference is specifies information about the image to use. You can specify information about platform images,
-// marketplace images, or virtual machine images. This element is required when you want to use a platform image,
-// marketplace image, or virtual machine image, but is not used in other creation operations.
-type AzureImageReference struct {
- ID string
- URN *string
-}
-
-// AzureOSDisk is specifies information about the operating system disk used by the virtual machine.
For more
-// information about disks, see [About disks and VHDs for Azure virtual
-// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
-type AzureOSDisk struct {
- Name string
- Caching string
- ManagedDisk AzureManagedDiskParameters
- DiskSizeGB int32
- CreateOption string
-}
-
-type AzureDataDisk struct {
- Name string
- Lun *int32
- Caching string
- StorageAccountType string
- DiskSizeGB int32
-}
-
-// AzureManagedDiskParameters is the parameters of a managed disk.
-type AzureManagedDiskParameters struct {
- ID string
- StorageAccountType string
-}
-
-// AzureOSProfile is specifies the operating system settings for the virtual machine.
-type AzureOSProfile struct {
- ComputerName string
- AdminUsername string
- AdminPassword string
- CustomData string
- LinuxConfiguration AzureLinuxConfiguration
-}
-
-// AzureLinuxConfiguration is specifies the Linux operating system settings on the virtual machine.
For a list of
-// supported Linux distributions, see [Linux on Azure-Endorsed
-// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
-//
For running non-endorsed distributions, see [Information for Non-Endorsed
-// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
-type AzureLinuxConfiguration struct {
- DisablePasswordAuthentication bool
- SSH AzureSSHConfiguration
-}
-
-// AzureSSHConfiguration is SSH configuration for Linux based VMs running on Azure
-type AzureSSHConfiguration struct {
- PublicKeys AzureSSHPublicKey
-}
-
-// AzureSSHPublicKey is contains information about SSH certificate public key and the path on the Linux VM where the public
-// key is placed.
-type AzureSSHPublicKey struct {
- Path string
- KeyData string
-}
-
-// AzureNetworkProfile is specifies the network interfaces of the virtual machine.
-type AzureNetworkProfile struct {
- NetworkInterfaces AzureNetworkInterfaceReference
- AcceleratedNetworking *bool
-}
-
-// AzureNetworkInterfaceReference is describes a network interface reference.
-type AzureNetworkInterfaceReference struct {
- ID string
- *AzureNetworkInterfaceReferenceProperties
-}
-
-// AzureNetworkInterfaceReferenceProperties is describes a network interface reference properties.
-type AzureNetworkInterfaceReferenceProperties struct {
- Primary bool
-}
-
-// AzureSubResource is the Sub Resource definition.
-type AzureSubResource struct {
- ID string
-}
-
-// AzureSubnetInfo is the information containing the subnet details
-type AzureSubnetInfo struct {
- VnetName string
- VnetResourceGroup *string
- SubnetName string
-}
-
-// AzureMachineSetConfig contains the information about the machine set
-type AzureMachineSetConfig struct {
- ID string
- Kind string
-}
-
-const (
- // MachineSetKindAvailabilitySet is the machine set kind for AvailabilitySet
- MachineSetKindAvailabilitySet string = "availabilityset"
- // MachineSetKindVMO is the machine set kind for VirtualMachineScaleSet Orchestration Mode VM (VMO)
- MachineSetKindVMO string = "vmo"
-)
-
-/********************** GCPMachineClass APIs ***************/
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// GCPMachineClass TODO
-type GCPMachineClass struct {
- metav1.ObjectMeta
-
- metav1.TypeMeta
-
- Spec GCPMachineClassSpec
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// GCPMachineClassList is a collection of GCPMachineClasses.
-type GCPMachineClassList struct {
- metav1.TypeMeta
-
- metav1.ListMeta
-
- Items []GCPMachineClass
-}
-
-// GCPMachineClassSpec is the specification of a GCPMachineClass.
-type GCPMachineClassSpec struct {
- CanIpForward bool
- DeletionProtection bool
- Description *string
- Disks []*GCPDisk
- Labels map[string]string
- MachineType string
- Metadata []*GCPMetadata
- NetworkInterfaces []*GCPNetworkInterface
- Scheduling GCPScheduling
- SecretRef *corev1.SecretReference
- CredentialsSecretRef *corev1.SecretReference
- ServiceAccounts []GCPServiceAccount
- Tags []string
- Region string
- Zone string
-}
-
-// GCPDisk describes disks for GCP.
-type GCPDisk struct {
- AutoDelete *bool
- Boot bool
- SizeGb int64
- Type string
- Interface string
- Image string
- Labels map[string]string
-}
-
-// GCPMetadata describes metadata for GCP.
-type GCPMetadata struct {
- Key string
- Value *string
-}
-
-// GCPNetworkInterface describes network interfaces for GCP
-type GCPNetworkInterface struct {
- DisableExternalIP bool
- Network string
- Subnetwork string
-}
-
-// GCPScheduling describes scheduling configuration for GCP.
-type GCPScheduling struct {
- AutomaticRestart bool
- OnHostMaintenance string
- Preemptible bool
-}
-
-// GCPServiceAccount describes service accounts for GCP.
-type GCPServiceAccount struct {
- Email string
- Scopes []string
-}
-
-/********************** AlicloudMachineClass APIs ***************/
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// AlicloudMachineClass
-type AlicloudMachineClass struct {
- metav1.ObjectMeta
-
- metav1.TypeMeta
-
- Spec AlicloudMachineClassSpec
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// AlicloudMachineClassList is a collection of AlicloudMachineClasses.
-type AlicloudMachineClassList struct {
- metav1.TypeMeta
-
- metav1.ListMeta
-
- Items []AlicloudMachineClass
-}
-
-// AlicloudMachineClassSpec is the specification of a AlicloudMachineClass.
-type AlicloudMachineClassSpec struct {
- ImageID string
- InstanceType string
- Region string
- ZoneID string
- SecurityGroupID string
- VSwitchID string
- PrivateIPAddress string
- SystemDisk *AlicloudSystemDisk
- DataDisks []AlicloudDataDisk
- InstanceChargeType string
- InternetChargeType string
- InternetMaxBandwidthIn *int
- InternetMaxBandwidthOut *int
- SpotStrategy string
- IoOptimized string
- Tags map[string]string
- KeyPairName string
- SecretRef *corev1.SecretReference
- CredentialsSecretRef *corev1.SecretReference
-}
-
-// AlicloudSystemDisk describes SystemDisk for Alicloud.
-type AlicloudSystemDisk struct {
- Category string
- Size int
-}
-
-// AlicloudDataDisk describes DataDisk for Alicloud.
-type AlicloudDataDisk struct {
- Name string
- Category string
- Description string
- Encrypted bool
- Size int
- DeleteWithInstance *bool
-}
-
-/********************** PacketMachineClass APIs ***************/
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// PacketMachineClass TODO
-type PacketMachineClass struct {
- metav1.ObjectMeta
-
- metav1.TypeMeta
-
- Spec PacketMachineClassSpec
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-
-// PacketMachineClassList is a collection of PacketMachineClasses.
-type PacketMachineClassList struct {
- metav1.TypeMeta
-
- metav1.ListMeta
-
- Items []PacketMachineClass
-}
-
-// PacketMachineClassSpec is the specification of a PacketMachineClass.
-type PacketMachineClassSpec struct {
- Facility []string // required
- MachineType string // required
- OS string // required
- ProjectID string // required
- BillingCycle string
- Tags []string
- SSHKeys []string
- UserData string
-
- SecretRef *corev1.SecretReference
- CredentialsSecretRef *corev1.SecretReference
-
- // TODO add more here
-}
-
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
diff --git a/pkg/apis/machine/v1alpha1/alicoud_machineclass_types.go b/pkg/apis/machine/v1alpha1/alicoud_machineclass_types.go
deleted file mode 100644
index 3c53eff7b..000000000
--- a/pkg/apis/machine/v1alpha1/alicoud_machineclass_types.go
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// WARNING!
-// IF YOU MODIFY ANY OF THE TYPES HERE COPY THEM TO ../types.go
-// AND RUN `make generate`
-
-package v1alpha1
-
-import (
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-const (
- // AlicloudAccessKeyID is a constant for a key name that is part of the Alibaba cloud credentials.
- AlicloudAccessKeyID string = "alicloudAccessKeyID"
- // AlicloudAccessKeySecret is a constant for a key name that is part of the Alibaba cloud credentials.
- AlicloudAccessKeySecret string = "alicloudAccessKeySecret"
-
- // AlicloudAlternativeAccessKeyID is a constant for a key name of a secret containing the Alibaba cloud
- // credentials (access key id).
- AlicloudAlternativeAccessKeyID = "accessKeyID"
- // AlicloudAlternativeAccessKeySecret is a constant for a key name of a secret containing the Alibaba cloud
- // credentials (access key secret).
- AlicloudAlternativeAccessKeySecret = "accessKeySecret"
-)
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-// +kubebuilder:printcolumn:name="Instance Type",type=string,JSONPath=`.spec.instanceType`
-// +kubebuilder:printcolumn:name="Region",type=string,JSONPath=`.spec.region`,priority=1
-// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
-
-// AlicloudMachineClass TODO
-type AlicloudMachineClass struct {
- // +optional
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- Spec AlicloudMachineClassSpec `json:"spec,omitempty"`
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-
-// AlicloudMachineClassList is a collection of AlicloudMachineClasses.
-type AlicloudMachineClassList struct {
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- metav1.ListMeta `json:"metadata,omitempty"`
-
- // +optional
- Items []AlicloudMachineClass `json:"items"`
-}
-
-// AlicloudMachineClassSpec is the specification of a AlicloudMachineClass.
-type AlicloudMachineClassSpec struct {
- ImageID string `json:"imageID"`
- InstanceType string `json:"instanceType"`
- Region string `json:"region"`
- ZoneID string `json:"zoneID,omitempty"`
- SecurityGroupID string `json:"securityGroupID,omitempty"`
- VSwitchID string `json:"vSwitchID"`
- PrivateIPAddress string `json:"privateIPAddress,omitempty"`
- SystemDisk *AlicloudSystemDisk `json:"systemDisk,omitempty"`
- DataDisks []AlicloudDataDisk `json:"dataDisks,omitempty"`
- InstanceChargeType string `json:"instanceChargeType,omitempty"`
- InternetChargeType string `json:"internetChargeType,omitempty"`
- InternetMaxBandwidthIn *int `json:"internetMaxBandwidthIn,omitempty"`
- InternetMaxBandwidthOut *int `json:"internetMaxBandwidthOut,omitempty"`
- SpotStrategy string `json:"spotStrategy,omitempty"`
- IoOptimized string `json:"IoOptimized,omitempty"`
- Tags map[string]string `json:"tags,omitempty"`
- KeyPairName string `json:"keyPairName"`
- SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
- CredentialsSecretRef *corev1.SecretReference `json:"credentialsSecretRef,omitempty"`
-}
-
-type AlicloudDataDisk struct {
- Name string `json:"name,omitempty"`
- Category string `json:"category,omitempty"`
- // +optional
- Description string `json:"description,omitempty"`
- Encrypted bool `json:"encrypted,omitempty"`
- DeleteWithInstance *bool `json:"deleteWithInstance,omitempty"`
- Size int `json:"size,omitempty"`
-}
-
-// AlicloudSystemDisk describes SystemDisk for Alicloud.
-type AlicloudSystemDisk struct {
- Category string `json:"category"`
- Size int `json:"size"`
-}
diff --git a/pkg/apis/machine/v1alpha1/aws_machineclass_types.go b/pkg/apis/machine/v1alpha1/aws_machineclass_types.go
deleted file mode 100644
index 9e4e54b6a..000000000
--- a/pkg/apis/machine/v1alpha1/aws_machineclass_types.go
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// WARNING!
-// IF YOU MODIFY ANY OF THE TYPES HERE COPY THEM TO ../types.go
-// AND RUN `make generate`
-
-package v1alpha1
-
-import (
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-const (
- // AWSAccessKeyID is a constant for a key name that is part of the AWS cloud credentials.
- AWSAccessKeyID string = "providerAccessKeyId"
- // AWSSecretAccessKey is a constant for a key name that is part of the AWS cloud credentials.
- AWSSecretAccessKey string = "providerSecretAccessKey"
-
- // AWSAlternativeAccessKeyID is a constant for a key name of a secret containing the AWS credentials (access key
- // id).
- AWSAlternativeAccessKeyID = "accessKeyID"
- // AWSAlternativeAccessKeySecret is a constant for a key name of a secret containing the AWS credentials (access key
- // secret).
- AWSAlternativeSecretAccessKey = "secretAccessKey"
-)
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-// +kubebuilder:printcolumn:name="Machine Type",type=string,JSONPath=`.spec.machineType`
-// +kubebuilder:printcolumn:name="AMI",type=string,JSONPath=`.spec.ami`
-// +kubebuilder:printcolumn:name="Region",type=string,JSONPath=`.spec.region`,priority=1
-// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
-
-// AWSMachineClass TODO
-type AWSMachineClass struct {
- // +optional
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- Spec AWSMachineClassSpec `json:"spec,omitempty"`
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-
-// AWSMachineClassList is a collection of AWSMachineClasses.
-type AWSMachineClassList struct {
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- metav1.ListMeta `json:"metadata,omitempty"`
-
- // +optional
- Items []AWSMachineClass `json:"items"`
-}
-
-// AWSMachineClassSpec is the specification of a AWSMachineClass.
-type AWSMachineClassSpec struct {
- AMI string `json:"ami,omitempty"`
- Region string `json:"region,omitempty"`
- BlockDevices []AWSBlockDeviceMappingSpec `json:"blockDevices,omitempty"`
- EbsOptimized bool `json:"ebsOptimized,omitempty"`
- IAM AWSIAMProfileSpec `json:"iam,omitempty"`
- MachineType string `json:"machineType,omitempty"`
- KeyName string `json:"keyName,omitempty"`
- Monitoring bool `json:"monitoring,omitempty"`
- NetworkInterfaces []AWSNetworkInterfaceSpec `json:"networkInterfaces,omitempty"`
- Tags map[string]string `json:"tags,omitempty"`
- SpotPrice *string `json:"spotPrice,omitempty"`
- SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
- CredentialsSecretRef *corev1.SecretReference `json:"credentialsSecretRef,omitempty"`
-
- // TODO add more here
-}
-
-type AWSBlockDeviceMappingSpec struct {
-
- // The device name exposed to the machine (for example, /dev/sdh or xvdh).
- DeviceName string `json:"deviceName,omitempty"`
-
- // Parameters used to automatically set up EBS volumes when the machine is
- // launched.
- Ebs AWSEbsBlockDeviceSpec `json:"ebs,omitempty"`
-
- // Suppresses the specified device included in the block device mapping of the
- // AMI.
- NoDevice string `json:"noDevice,omitempty"`
-
- // The virtual device name (ephemeralN). Machine store volumes are numbered
- // starting from 0. An machine type with 2 available machine store volumes
- // can specify mappings for ephemeral0 and ephemeral1.The number of available
- // machine store volumes depends on the machine type. After you connect to
- // the machine, you must mount the volume.
- //
- // Constraints: For M3 machines, you must specify machine store volumes in
- // the block device mapping for the machine. When you launch an M3 machine,
- // we ignore any machine store volumes specified in the block device mapping
- // for the AMI.
- VirtualName string `json:"virtualName,omitempty"`
-}
-
-// Describes a block device for an EBS volume.
-// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice
-type AWSEbsBlockDeviceSpec struct {
-
- // Indicates whether the EBS volume is deleted on machine termination.
- DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"`
-
- // Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes
- // may only be attached to machines that support Amazon EBS encryption.
- Encrypted bool `json:"encrypted,omitempty"`
-
- // The number of I/O operations per second (IOPS) that the volume supports.
- // For io1, this represents the number of IOPS that are provisioned for the
- // volume. For gp2, this represents the baseline performance of the volume and
- // the rate at which the volume accumulates I/O credits for bursting. For more
- // information about General Purpose SSD baseline performance, I/O credits,
- // and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
- // in the Amazon Elastic Compute Cloud User Guide.
- //
- // Constraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for
- // gp2 volumes.
- //
- // Condition: This parameter is required for requests to create io1 volumes;
- // it is not used in requests to create gp2, st1, sc1, or standard volumes.
- Iops int64 `json:"iops,omitempty"`
-
- // Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed
- // CMK under which the EBS volume is encrypted.
- //
- // This parameter is only supported on BlockDeviceMapping objects called by
- // RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html),
- // RequestSpotFleet (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html),
- // and RequestSpotInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html).
- KmsKeyID *string `json:"kmsKeyID,omitempty"`
-
- // The ID of the snapshot.
- SnapshotID *string `json:"snapshotID,omitempty"`
-
- // The size of the volume, in GiB.
- //
- // Constraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned
- // IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for
- // Cold HDD (sc1), and 1-1024 for Magnetic (standard) volumes. If you specify
- // a snapshot, the volume size must be equal to or larger than the snapshot
- // size.
- //
- // Default: If you're creating the volume from a snapshot and don't specify
- // a volume size, the default is the snapshot size.
- VolumeSize int64 `json:"volumeSize,omitempty"`
-
- // The volume type: gp2, io1, st1, sc1, or standard.
- //
- // Default: standard
- VolumeType string `json:"volumeType,omitempty"`
-}
-
-// Describes an IAM machine profile.
-type AWSIAMProfileSpec struct {
- // The Amazon Resource Name (ARN) of the machine profile.
- ARN string `json:"arn,omitempty"`
-
- // The name of the machine profile.
- Name string `json:"name,omitempty"`
-}
-
-// Describes a network interface.
-// Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MachineAWSNetworkInterfaceSpecification
-type AWSNetworkInterfaceSpec struct {
-
- // Indicates whether to assign a public IPv4 address to an machine you launch
- // in a VPC. The public IP address can only be assigned to a network interface
- // for eth0, and can only be assigned to a new network interface, not an existing
- // one. You cannot specify more than one network interface in the request. If
- // launching into a default subnet, the default value is true.
- AssociatePublicIPAddress *bool `json:"associatePublicIPAddress,omitempty"`
-
- // If set to true, the interface is deleted when the machine is terminated.
- // You can specify true only if creating a new network interface when launching
- // an machine.
- DeleteOnTermination *bool `json:"deleteOnTermination,omitempty"`
-
- // The description of the network interface. Applies only if creating a network
- // interface when launching an machine.
- Description *string `json:"description,omitempty"`
-
- // The IDs of the security groups for the network interface. Applies only if
- // creating a network interface when launching an machine.
- SecurityGroupIDs []string `json:"securityGroupIDs,omitempty"`
-
- // The ID of the subnet associated with the network string. Applies only if
- // creating a network interface when launching an machine.
- SubnetID string `json:"subnetID,omitempty"`
-}
diff --git a/pkg/apis/machine/v1alpha1/azure_machineclass_types.go b/pkg/apis/machine/v1alpha1/azure_machineclass_types.go
deleted file mode 100644
index 690b89dbd..000000000
--- a/pkg/apis/machine/v1alpha1/azure_machineclass_types.go
+++ /dev/null
@@ -1,223 +0,0 @@
-// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// WARNING!
-// IF YOU MODIFY ANY OF THE TYPES HERE COPY THEM TO ../types.go
-// AND RUN `make generate`
-
-package v1alpha1
-
-import (
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-const (
- // AzureClientID is a constant for a key name that is part of the Azure cloud credentials.
- AzureClientID string = "azureClientId"
- // AzureClientSecret is a constant for a key name that is part of the Azure cloud credentials.
- AzureClientSecret string = "azureClientSecret"
- // AzureSubscriptionID is a constant for a key name that is part of the Azure cloud credentials.
- AzureSubscriptionID string = "azureSubscriptionId"
- // AzureTenantID is a constant for a key name that is part of the Azure cloud credentials.
- AzureTenantID string = "azureTenantId"
-
- // AzureAlternativeClientID is a constant for a key name of a secret containing the Azure credentials (client id).
- AzureAlternativeClientID = "clientID"
- // AzureAlternativeClientSecret is a constant for a key name of a secret containing the Azure credentials (client
- // secret).
- AzureAlternativeClientSecret = "clientSecret"
- // AzureAlternativeSubscriptionID is a constant for a key name of a secret containing the Azure credentials
- // (subscription id).
- AzureAlternativeSubscriptionID = "subscriptionID"
- // AzureAlternativeTenantID is a constant for a key name of a secret containing the Azure credentials (tenant id).
- AzureAlternativeTenantID = "tenantID"
-)
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-// +kubebuilder:printcolumn:name="VM Size",type=string,JSONPath=`.spec.properties.hardwareProfile.vmSize`
-// +kubebuilder:printcolumn:name="Location",type=string,JSONPath=`.spec.location`,priority=1
-// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
-
-// AzureMachineClass TODO
-type AzureMachineClass struct {
- // +optional
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- Spec AzureMachineClassSpec `json:"spec,omitempty"`
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-
-// AzureMachineClassList is a collection of AzureMachineClasses.
-type AzureMachineClassList struct {
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- metav1.ListMeta `json:"metadata,omitempty"`
-
- // +optional
- Items []AzureMachineClass `json:"items"`
-}
-
-// AzureMachineClassSpec is the specification of a AzureMachineClass.
-type AzureMachineClassSpec struct {
- Location string `json:"location,omitempty"`
- Tags map[string]string `json:"tags,omitempty"`
- Properties AzureVirtualMachineProperties `json:"properties,omitempty"`
- ResourceGroup string `json:"resourceGroup,omitempty"`
- SubnetInfo AzureSubnetInfo `json:"subnetInfo,omitempty"`
- SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
- CredentialsSecretRef *corev1.SecretReference `json:"credentialsSecretRef,omitempty"`
-}
-
-// AzureVirtualMachineProperties is describes the properties of a Virtual Machine.
-type AzureVirtualMachineProperties struct {
- HardwareProfile AzureHardwareProfile `json:"hardwareProfile,omitempty"`
- StorageProfile AzureStorageProfile `json:"storageProfile,omitempty"`
- OsProfile AzureOSProfile `json:"osProfile,omitempty"`
- NetworkProfile AzureNetworkProfile `json:"networkProfile,omitempty"`
- AvailabilitySet *AzureSubResource `json:"availabilitySet,omitempty"`
- IdentityID *string `json:"identityID,omitempty"`
- Zone *int `json:"zone,omitempty"`
- MachineSet *AzureMachineSetConfig `json:"machineSet,omitempty"`
-}
-
-// AzureHardwareProfile is specifies the hardware settings for the virtual machine.
-// Refer github.com/Azure/azure-sdk-for-go/arm/compute/models.go for VMSizes
-type AzureHardwareProfile struct {
- VMSize string `json:"vmSize,omitempty"`
-}
-
-// AzureStorageProfile is specifies the storage settings for the virtual machine disks.
-type AzureStorageProfile struct {
- ImageReference AzureImageReference `json:"imageReference,omitempty"`
- OsDisk AzureOSDisk `json:"osDisk,omitempty"`
- DataDisks []AzureDataDisk `json:"dataDisks,omitempty"`
-}
-
-// AzureImageReference is specifies information about the image to use. You can specify information about platform images,
-// marketplace images, or virtual machine images. This element is required when you want to use a platform image,
-// marketplace image, or virtual machine image, but is not used in other creation operations.
-type AzureImageReference struct {
- ID string `json:"id,omitempty"`
- // Uniform Resource Name of the OS image to be used , it has the format 'publisher:offer:sku:version'
- URN *string `json:"urn,omitempty"`
-}
-
-// AzureOSDisk is specifies information about the operating system disk used by the virtual machine.
For more
-// information about disks, see [About disks and VHDs for Azure virtual
-// machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).
-type AzureOSDisk struct {
- Name string `json:"name,omitempty"`
- Caching string `json:"caching,omitempty"`
- ManagedDisk AzureManagedDiskParameters `json:"managedDisk,omitempty"`
- DiskSizeGB int32 `json:"diskSizeGB,omitempty"`
- CreateOption string `json:"createOption,omitempty"`
-}
-
-type AzureDataDisk struct {
- Name string `json:"name,omitempty"`
- Lun *int32 `json:"lun,omitempty"`
- Caching string `json:"caching,omitempty"`
- StorageAccountType string `json:"storageAccountType,omitempty"`
- DiskSizeGB int32 `json:"diskSizeGB,omitempty"`
-}
-
-// AzureManagedDiskParameters is the parameters of a managed disk.
-type AzureManagedDiskParameters struct {
- ID string `json:"id,omitempty"`
- StorageAccountType string `json:"storageAccountType,omitempty"`
-}
-
-// AzureOSProfile is specifies the operating system settings for the virtual machine.
-type AzureOSProfile struct {
- ComputerName string `json:"computerName,omitempty"`
- AdminUsername string `json:"adminUsername,omitempty"`
- AdminPassword string `json:"adminPassword,omitempty"`
- CustomData string `json:"customData,omitempty"`
- LinuxConfiguration AzureLinuxConfiguration `json:"linuxConfiguration,omitempty"`
-}
-
-// AzureLinuxConfiguration is specifies the Linux operating system settings on the virtual machine.
For a list of
-// supported Linux distributions, see [Linux on Azure-Endorsed
-// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
-//
For running non-endorsed distributions, see [Information for Non-Endorsed
-// Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).
-type AzureLinuxConfiguration struct {
- DisablePasswordAuthentication bool `json:"disablePasswordAuthentication,omitempty"`
- SSH AzureSSHConfiguration `json:"ssh,omitempty"`
-}
-
-// AzureSSHConfiguration is SSH configuration for Linux based VMs running on Azure
-type AzureSSHConfiguration struct {
- PublicKeys AzureSSHPublicKey `json:"publicKeys,omitempty"`
-}
-
-// AzureSSHPublicKey is contains information about SSH certificate public key and the path on the Linux VM where the public
-// key is placed.
-type AzureSSHPublicKey struct {
- Path string `json:"path,omitempty"`
- KeyData string `json:"keyData,omitempty"`
-}
-
-// AzureNetworkProfile is specifies the network interfaces of the virtual machine.
-type AzureNetworkProfile struct {
- NetworkInterfaces AzureNetworkInterfaceReference `json:"networkInterfaces,omitempty"`
- AcceleratedNetworking *bool `json:"acceleratedNetworking,omitempty"`
-}
-
-// AzureNetworkInterfaceReference is describes a network interface reference.
-type AzureNetworkInterfaceReference struct {
- ID string `json:"id,omitempty"`
- *AzureNetworkInterfaceReferenceProperties `json:"properties,omitempty"`
-}
-
-// AzureNetworkInterfaceReferenceProperties is describes a network interface reference properties.
-type AzureNetworkInterfaceReferenceProperties struct {
- Primary bool `json:"primary,omitempty"`
-}
-
-// AzureSubResource is the Sub Resource definition.
-type AzureSubResource struct {
- ID string `json:"id,omitempty"`
-}
-
-// AzureSubnetInfo is the information containing the subnet details
-type AzureSubnetInfo struct {
- VnetName string `json:"vnetName,omitempty"`
- VnetResourceGroup *string `json:"vnetResourceGroup,omitempty"`
- SubnetName string `json:"subnetName,omitempty"`
-}
-
-// AzureMachineSetConfig contains the information about the machine set
-type AzureMachineSetConfig struct {
- ID string `json:"id"`
- Kind string `json:"kind"`
-}
-
-const (
- // MachineSetKindAvailabilitySet is the machine set kind for AvailabilitySet
- MachineSetKindAvailabilitySet string = "availabilityset"
- // MachineSetKindVMO is the machine set kind for VirtualMachineScaleSet Orchestration Mode VM (VMO)
- MachineSetKindVMO string = "vmo"
-)
diff --git a/pkg/apis/machine/v1alpha1/gcp_machineclass_types.go b/pkg/apis/machine/v1alpha1/gcp_machineclass_types.go
deleted file mode 100644
index 780f61560..000000000
--- a/pkg/apis/machine/v1alpha1/gcp_machineclass_types.go
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// WARNING!
-// IF YOU MODIFY ANY OF THE TYPES HERE COPY THEM TO ../types.go
-// AND RUN `make generate`
-
-package v1alpha1
-
-import (
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-const (
- // GCPServiceAccountJSON is a constant for a key name that is part of the GCP cloud credentials.
- GCPServiceAccountJSON string = "serviceAccountJSON"
-
- // GCPAlternativeServiceAccountJSON is a constant for a key name of a secret containing the GCP credentials (service
- // account json).
- GCPAlternativeServiceAccountJSON = "serviceaccount.json"
-)
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-// +kubebuilder:printcolumn:name="Machine Type",type=string,JSONPath=`.spec.machineType`
-// +kubebuilder:printcolumn:name="Region",type=string,JSONPath=`.spec.region`,priority=1
-// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
-
-// GCPMachineClass TODO
-type GCPMachineClass struct {
- // +optional
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- Spec GCPMachineClassSpec `json:"spec,omitempty"`
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-
-// GCPMachineClassList is a collection of GCPMachineClasses.
-type GCPMachineClassList struct {
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- metav1.ListMeta `json:"metadata,omitempty"`
-
- // +optional
- Items []GCPMachineClass `json:"items"`
-}
-
-// GCPMachineClassSpec is the specification of a GCPMachineClass.
-type GCPMachineClassSpec struct {
- CanIpForward bool `json:"canIpForward"`
- DeletionProtection bool `json:"deletionProtection"`
- Description *string `json:"description,omitempty"`
- Disks []*GCPDisk `json:"disks,omitempty"`
- Labels map[string]string `json:"labels,omitempty"`
- MachineType string `json:"machineType"`
- Metadata []*GCPMetadata `json:"metadata,omitempty"`
- NetworkInterfaces []*GCPNetworkInterface `json:"networkInterfaces,omitempty"`
- Scheduling GCPScheduling `json:"scheduling"`
- SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
- CredentialsSecretRef *corev1.SecretReference `json:"credentialsSecretRef,omitempty"`
- ServiceAccounts []GCPServiceAccount `json:"serviceAccounts"`
- Tags []string `json:"tags,omitempty"`
- Region string `json:"region"`
- Zone string `json:"zone"`
-}
-
-// GCPDisk describes disks for GCP.
-type GCPDisk struct {
- AutoDelete *bool `json:"autoDelete"`
- Boot bool `json:"boot"`
- SizeGb int64 `json:"sizeGb"`
- Type string `json:"type"`
- Interface string `json:"interface"`
- Image string `json:"image"`
- Labels map[string]string `json:"labels"`
-}
-
-// GCPMetadata describes metadata for GCP.
-type GCPMetadata struct {
- Key string `json:"key"`
- Value *string `json:"value"`
-}
-
-// GCPNetworkInterface describes network interfaces for GCP
-type GCPNetworkInterface struct {
- DisableExternalIP bool `json:"disableExternalIP,omitempty"`
- Network string `json:"network,omitempty"`
- Subnetwork string `json:"subnetwork,omitempty"`
-}
-
-// GCPScheduling describes scheduling configuration for GCP.
-type GCPScheduling struct {
- AutomaticRestart bool `json:"automaticRestart"`
- OnHostMaintenance string `json:"onHostMaintenance"`
- Preemptible bool `json:"preemptible"`
-}
-
-// GCPServiceAccount describes service accounts for GCP.
-type GCPServiceAccount struct {
- Email string `json:"email"`
- Scopes []string `json:"scopes"`
-}
diff --git a/pkg/apis/machine/v1alpha1/openstack_machineclass_types.go b/pkg/apis/machine/v1alpha1/openstack_machineclass_types.go
deleted file mode 100644
index 97e729e5c..000000000
--- a/pkg/apis/machine/v1alpha1/openstack_machineclass_types.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// WARNING!
-// IF YOU MODIFY ANY OF THE TYPES HERE COPY THEM TO ../types.go
-// AND RUN `make generate`
-
-package v1alpha1
-
-import (
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-const (
- // OpenStackAuthURL is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackAuthURL string = "authURL"
- // OpenStackCACert is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackCACert string = "caCert"
- // OpenStackInsecure is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackInsecure string = "insecure"
- // OpenStackDomainName is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackDomainName string = "domainName"
- // OpenStackDomainID is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackDomainID string = "domainID"
- // OpenStackTenantName is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackTenantName string = "tenantName"
- // OpenStackTenantID is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackTenantID string = "tenantID"
- // OpenStackUserDomainName is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackUserDomainName string = "userDomainName"
- // OpenStackUserDomainID is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackUserDomainID string = "userDomainID"
- // OpenStackUsername is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackUsername string = "username"
- // OpenStackPassword is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackPassword string = "password"
- // OpenStackClientCert is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackClientCert string = "clientCert"
- // OpenStackClientKey is a constant for a key name that is part of the OpenStack cloud credentials.
- OpenStackClientKey string = "clientKey"
-)
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-// +kubebuilder:printcolumn:name="Flavor",type=string,JSONPath=`.spec.flavorName`
-// +kubebuilder:printcolumn:name="Image",type=string,JSONPath=`.spec.imageName`
-// +kubebuilder:printcolumn:name="Region",type=string,JSONPath=`.spec.region`,priority=1
-// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
-// OpenStackMachineClass TODO
-type OpenStackMachineClass struct {
- // +optional
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- Spec OpenStackMachineClassSpec `json:"spec,omitempty"`
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-
-// OpenStackMachineClassList is a collection of OpenStackMachineClasses.
-type OpenStackMachineClassList struct {
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- metav1.ListMeta `json:"metadata,omitempty"`
-
- // +optional
- Items []OpenStackMachineClass `json:"items"`
-}
-
-// OpenStackMachineClassSpec is the specification of a OpenStackMachineClass.
-type OpenStackMachineClassSpec struct {
- ImageID string `json:"imageID"`
- ImageName string `json:"imageName"`
- Region string `json:"region"`
- AvailabilityZone string `json:"availabilityZone"`
- FlavorName string `json:"flavorName"`
- KeyName string `json:"keyName"`
- SecurityGroups []string `json:"securityGroups"`
- Tags map[string]string `json:"tags,omitempty"`
- NetworkID string `json:"networkID"`
- Networks []OpenStackNetwork `json:"networks,omitempty"`
- SubnetID *string `json:"subnetID,omitempty"`
- SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
- CredentialsSecretRef *corev1.SecretReference `json:"credentialsSecretRef,omitempty"`
- PodNetworkCidr string `json:"podNetworkCidr"`
- RootDiskSize int `json:"rootDiskSize,omitempty"` // in GB
- UseConfigDrive *bool `json:"useConfigDrive,omitempty"`
- ServerGroupID *string `json:"serverGroupID,omitempty"`
-}
-
-type OpenStackNetwork struct {
- Id string `json:"id,omitempty"` // takes priority before name
- Name string `json:"name,omitempty"`
- PodNetwork bool `json:"podNetwork,omitempty"`
-}
diff --git a/pkg/apis/machine/v1alpha1/packet_machineclass_types.go b/pkg/apis/machine/v1alpha1/packet_machineclass_types.go
deleted file mode 100644
index 82d1aad2f..000000000
--- a/pkg/apis/machine/v1alpha1/packet_machineclass_types.go
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// WARNING!
-// IF YOU MODIFY ANY OF THE TYPES HERE COPY THEM TO ../types.go
-// AND RUN `make generate`
-
-package v1alpha1
-
-import (
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-)
-
-const (
- // PacketAPIKey is a constant for a key name that is part of the Packet cloud credentials
- PacketAPIKey string = "apiToken"
-)
-
-// +genclient
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`,description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC.\nPopulated by the system. Read-only. Null for lists. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata"
-
-// PacketMachineClass TODO
-type PacketMachineClass struct {
- // +optional
- metav1.ObjectMeta `json:"metadata,omitempty"`
-
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- Spec PacketMachineClassSpec `json:"spec,omitempty"`
-}
-
-// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
-// +kubebuilder:object:root=true
-
-// PacketMachineClassList is a collection of PacketMachineClasses.
-type PacketMachineClassList struct {
- // +optional
- metav1.TypeMeta `json:",inline"`
-
- // +optional
- metav1.ListMeta `json:"metadata,omitempty"`
-
- // +optional
- Items []PacketMachineClass `json:"items"`
-}
-
-// PacketMachineClassSpec is the specification of a PacketMachineClass.
-type PacketMachineClassSpec struct {
- Facility []string `json:"facility"`
- MachineType string `json:"machineType"`
- BillingCycle string `json:"billingCycle"`
- OS string `json:"OS"`
- ProjectID string `json:"projectID"`
- Tags []string `json:"tags,omitempty"`
- SSHKeys []string `json:"sshKeys,omitempty"`
- UserData string `json:"userdata,omitempty"`
-
- SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
- CredentialsSecretRef *corev1.SecretReference `json:"credentialsSecretRef,omitempty"`
-}
diff --git a/pkg/apis/machine/v1alpha1/register.go b/pkg/apis/machine/v1alpha1/register.go
index d6c85928d..46e47df2e 100644
--- a/pkg/apis/machine/v1alpha1/register.go
+++ b/pkg/apis/machine/v1alpha1/register.go
@@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@@ -52,24 +52,6 @@ func Resource(resource string) schema.GroupResource {
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
- &OpenStackMachineClass{},
- &OpenStackMachineClassList{},
-
- &AWSMachineClass{},
- &AWSMachineClassList{},
-
- &AzureMachineClass{},
- &AzureMachineClassList{},
-
- &GCPMachineClass{},
- &GCPMachineClassList{},
-
- &AlicloudMachineClass{},
- &AlicloudMachineClassList{},
-
- &PacketMachineClass{},
- &PacketMachineClassList{},
-
&MachineClass{},
&MachineClassList{},
diff --git a/pkg/apis/machine/v1alpha1/zz_generated.conversion.go b/pkg/apis/machine/v1alpha1/zz_generated.conversion.go
index c1d4a9a8a..5b027828d 100644
--- a/pkg/apis/machine/v1alpha1/zz_generated.conversion.go
+++ b/pkg/apis/machine/v1alpha1/zz_generated.conversion.go
@@ -39,326 +39,6 @@ func init() {
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(s *runtime.Scheme) error {
- if err := s.AddGeneratedConversionFunc((*AWSBlockDeviceMappingSpec)(nil), (*machine.AWSBlockDeviceMappingSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec(a.(*AWSBlockDeviceMappingSpec), b.(*machine.AWSBlockDeviceMappingSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AWSBlockDeviceMappingSpec)(nil), (*AWSBlockDeviceMappingSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(a.(*machine.AWSBlockDeviceMappingSpec), b.(*AWSBlockDeviceMappingSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AWSEbsBlockDeviceSpec)(nil), (*machine.AWSEbsBlockDeviceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(a.(*AWSEbsBlockDeviceSpec), b.(*machine.AWSEbsBlockDeviceSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AWSEbsBlockDeviceSpec)(nil), (*AWSEbsBlockDeviceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(a.(*machine.AWSEbsBlockDeviceSpec), b.(*AWSEbsBlockDeviceSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AWSIAMProfileSpec)(nil), (*machine.AWSIAMProfileSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(a.(*AWSIAMProfileSpec), b.(*machine.AWSIAMProfileSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AWSIAMProfileSpec)(nil), (*AWSIAMProfileSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(a.(*machine.AWSIAMProfileSpec), b.(*AWSIAMProfileSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AWSMachineClass)(nil), (*machine.AWSMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass(a.(*AWSMachineClass), b.(*machine.AWSMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AWSMachineClass)(nil), (*AWSMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass(a.(*machine.AWSMachineClass), b.(*AWSMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AWSMachineClassList)(nil), (*machine.AWSMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList(a.(*AWSMachineClassList), b.(*machine.AWSMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AWSMachineClassList)(nil), (*AWSMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList(a.(*machine.AWSMachineClassList), b.(*AWSMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AWSMachineClassSpec)(nil), (*machine.AWSMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(a.(*AWSMachineClassSpec), b.(*machine.AWSMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AWSMachineClassSpec)(nil), (*AWSMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(a.(*machine.AWSMachineClassSpec), b.(*AWSMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AWSNetworkInterfaceSpec)(nil), (*machine.AWSNetworkInterfaceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec(a.(*AWSNetworkInterfaceSpec), b.(*machine.AWSNetworkInterfaceSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AWSNetworkInterfaceSpec)(nil), (*AWSNetworkInterfaceSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(a.(*machine.AWSNetworkInterfaceSpec), b.(*AWSNetworkInterfaceSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AlicloudDataDisk)(nil), (*machine.AlicloudDataDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AlicloudDataDisk_To_machine_AlicloudDataDisk(a.(*AlicloudDataDisk), b.(*machine.AlicloudDataDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AlicloudDataDisk)(nil), (*AlicloudDataDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AlicloudDataDisk_To_v1alpha1_AlicloudDataDisk(a.(*machine.AlicloudDataDisk), b.(*AlicloudDataDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AlicloudMachineClass)(nil), (*machine.AlicloudMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AlicloudMachineClass_To_machine_AlicloudMachineClass(a.(*AlicloudMachineClass), b.(*machine.AlicloudMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AlicloudMachineClass)(nil), (*AlicloudMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AlicloudMachineClass_To_v1alpha1_AlicloudMachineClass(a.(*machine.AlicloudMachineClass), b.(*AlicloudMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AlicloudMachineClassList)(nil), (*machine.AlicloudMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AlicloudMachineClassList_To_machine_AlicloudMachineClassList(a.(*AlicloudMachineClassList), b.(*machine.AlicloudMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AlicloudMachineClassList)(nil), (*AlicloudMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AlicloudMachineClassList_To_v1alpha1_AlicloudMachineClassList(a.(*machine.AlicloudMachineClassList), b.(*AlicloudMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AlicloudMachineClassSpec)(nil), (*machine.AlicloudMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AlicloudMachineClassSpec_To_machine_AlicloudMachineClassSpec(a.(*AlicloudMachineClassSpec), b.(*machine.AlicloudMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AlicloudMachineClassSpec)(nil), (*AlicloudMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AlicloudMachineClassSpec_To_v1alpha1_AlicloudMachineClassSpec(a.(*machine.AlicloudMachineClassSpec), b.(*AlicloudMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AlicloudSystemDisk)(nil), (*machine.AlicloudSystemDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AlicloudSystemDisk_To_machine_AlicloudSystemDisk(a.(*AlicloudSystemDisk), b.(*machine.AlicloudSystemDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AlicloudSystemDisk)(nil), (*AlicloudSystemDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AlicloudSystemDisk_To_v1alpha1_AlicloudSystemDisk(a.(*machine.AlicloudSystemDisk), b.(*AlicloudSystemDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureDataDisk)(nil), (*machine.AzureDataDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureDataDisk_To_machine_AzureDataDisk(a.(*AzureDataDisk), b.(*machine.AzureDataDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureDataDisk)(nil), (*AzureDataDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureDataDisk_To_v1alpha1_AzureDataDisk(a.(*machine.AzureDataDisk), b.(*AzureDataDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureHardwareProfile)(nil), (*machine.AzureHardwareProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureHardwareProfile_To_machine_AzureHardwareProfile(a.(*AzureHardwareProfile), b.(*machine.AzureHardwareProfile), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureHardwareProfile)(nil), (*AzureHardwareProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureHardwareProfile_To_v1alpha1_AzureHardwareProfile(a.(*machine.AzureHardwareProfile), b.(*AzureHardwareProfile), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureImageReference)(nil), (*machine.AzureImageReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureImageReference_To_machine_AzureImageReference(a.(*AzureImageReference), b.(*machine.AzureImageReference), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureImageReference)(nil), (*AzureImageReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureImageReference_To_v1alpha1_AzureImageReference(a.(*machine.AzureImageReference), b.(*AzureImageReference), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureLinuxConfiguration)(nil), (*machine.AzureLinuxConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureLinuxConfiguration_To_machine_AzureLinuxConfiguration(a.(*AzureLinuxConfiguration), b.(*machine.AzureLinuxConfiguration), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureLinuxConfiguration)(nil), (*AzureLinuxConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureLinuxConfiguration_To_v1alpha1_AzureLinuxConfiguration(a.(*machine.AzureLinuxConfiguration), b.(*AzureLinuxConfiguration), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureMachineClass)(nil), (*machine.AzureMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureMachineClass_To_machine_AzureMachineClass(a.(*AzureMachineClass), b.(*machine.AzureMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureMachineClass)(nil), (*AzureMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureMachineClass_To_v1alpha1_AzureMachineClass(a.(*machine.AzureMachineClass), b.(*AzureMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureMachineClassList)(nil), (*machine.AzureMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureMachineClassList_To_machine_AzureMachineClassList(a.(*AzureMachineClassList), b.(*machine.AzureMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureMachineClassList)(nil), (*AzureMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureMachineClassList_To_v1alpha1_AzureMachineClassList(a.(*machine.AzureMachineClassList), b.(*AzureMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureMachineClassSpec)(nil), (*machine.AzureMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureMachineClassSpec_To_machine_AzureMachineClassSpec(a.(*AzureMachineClassSpec), b.(*machine.AzureMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureMachineClassSpec)(nil), (*AzureMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureMachineClassSpec_To_v1alpha1_AzureMachineClassSpec(a.(*machine.AzureMachineClassSpec), b.(*AzureMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureMachineSetConfig)(nil), (*machine.AzureMachineSetConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureMachineSetConfig_To_machine_AzureMachineSetConfig(a.(*AzureMachineSetConfig), b.(*machine.AzureMachineSetConfig), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureMachineSetConfig)(nil), (*AzureMachineSetConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureMachineSetConfig_To_v1alpha1_AzureMachineSetConfig(a.(*machine.AzureMachineSetConfig), b.(*AzureMachineSetConfig), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureManagedDiskParameters)(nil), (*machine.AzureManagedDiskParameters)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureManagedDiskParameters_To_machine_AzureManagedDiskParameters(a.(*AzureManagedDiskParameters), b.(*machine.AzureManagedDiskParameters), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureManagedDiskParameters)(nil), (*AzureManagedDiskParameters)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureManagedDiskParameters_To_v1alpha1_AzureManagedDiskParameters(a.(*machine.AzureManagedDiskParameters), b.(*AzureManagedDiskParameters), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureNetworkInterfaceReference)(nil), (*machine.AzureNetworkInterfaceReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureNetworkInterfaceReference_To_machine_AzureNetworkInterfaceReference(a.(*AzureNetworkInterfaceReference), b.(*machine.AzureNetworkInterfaceReference), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureNetworkInterfaceReference)(nil), (*AzureNetworkInterfaceReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureNetworkInterfaceReference_To_v1alpha1_AzureNetworkInterfaceReference(a.(*machine.AzureNetworkInterfaceReference), b.(*AzureNetworkInterfaceReference), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureNetworkInterfaceReferenceProperties)(nil), (*machine.AzureNetworkInterfaceReferenceProperties)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureNetworkInterfaceReferenceProperties_To_machine_AzureNetworkInterfaceReferenceProperties(a.(*AzureNetworkInterfaceReferenceProperties), b.(*machine.AzureNetworkInterfaceReferenceProperties), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureNetworkInterfaceReferenceProperties)(nil), (*AzureNetworkInterfaceReferenceProperties)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureNetworkInterfaceReferenceProperties_To_v1alpha1_AzureNetworkInterfaceReferenceProperties(a.(*machine.AzureNetworkInterfaceReferenceProperties), b.(*AzureNetworkInterfaceReferenceProperties), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureNetworkProfile)(nil), (*machine.AzureNetworkProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureNetworkProfile_To_machine_AzureNetworkProfile(a.(*AzureNetworkProfile), b.(*machine.AzureNetworkProfile), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureNetworkProfile)(nil), (*AzureNetworkProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureNetworkProfile_To_v1alpha1_AzureNetworkProfile(a.(*machine.AzureNetworkProfile), b.(*AzureNetworkProfile), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureOSDisk)(nil), (*machine.AzureOSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureOSDisk_To_machine_AzureOSDisk(a.(*AzureOSDisk), b.(*machine.AzureOSDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureOSDisk)(nil), (*AzureOSDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureOSDisk_To_v1alpha1_AzureOSDisk(a.(*machine.AzureOSDisk), b.(*AzureOSDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureOSProfile)(nil), (*machine.AzureOSProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureOSProfile_To_machine_AzureOSProfile(a.(*AzureOSProfile), b.(*machine.AzureOSProfile), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureOSProfile)(nil), (*AzureOSProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureOSProfile_To_v1alpha1_AzureOSProfile(a.(*machine.AzureOSProfile), b.(*AzureOSProfile), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureSSHConfiguration)(nil), (*machine.AzureSSHConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureSSHConfiguration_To_machine_AzureSSHConfiguration(a.(*AzureSSHConfiguration), b.(*machine.AzureSSHConfiguration), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureSSHConfiguration)(nil), (*AzureSSHConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureSSHConfiguration_To_v1alpha1_AzureSSHConfiguration(a.(*machine.AzureSSHConfiguration), b.(*AzureSSHConfiguration), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureSSHPublicKey)(nil), (*machine.AzureSSHPublicKey)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureSSHPublicKey_To_machine_AzureSSHPublicKey(a.(*AzureSSHPublicKey), b.(*machine.AzureSSHPublicKey), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureSSHPublicKey)(nil), (*AzureSSHPublicKey)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureSSHPublicKey_To_v1alpha1_AzureSSHPublicKey(a.(*machine.AzureSSHPublicKey), b.(*AzureSSHPublicKey), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureStorageProfile)(nil), (*machine.AzureStorageProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureStorageProfile_To_machine_AzureStorageProfile(a.(*AzureStorageProfile), b.(*machine.AzureStorageProfile), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureStorageProfile)(nil), (*AzureStorageProfile)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureStorageProfile_To_v1alpha1_AzureStorageProfile(a.(*machine.AzureStorageProfile), b.(*AzureStorageProfile), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureSubResource)(nil), (*machine.AzureSubResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureSubResource_To_machine_AzureSubResource(a.(*AzureSubResource), b.(*machine.AzureSubResource), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureSubResource)(nil), (*AzureSubResource)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureSubResource_To_v1alpha1_AzureSubResource(a.(*machine.AzureSubResource), b.(*AzureSubResource), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureSubnetInfo)(nil), (*machine.AzureSubnetInfo)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureSubnetInfo_To_machine_AzureSubnetInfo(a.(*AzureSubnetInfo), b.(*machine.AzureSubnetInfo), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureSubnetInfo)(nil), (*AzureSubnetInfo)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureSubnetInfo_To_v1alpha1_AzureSubnetInfo(a.(*machine.AzureSubnetInfo), b.(*AzureSubnetInfo), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*AzureVirtualMachineProperties)(nil), (*machine.AzureVirtualMachineProperties)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_AzureVirtualMachineProperties_To_machine_AzureVirtualMachineProperties(a.(*AzureVirtualMachineProperties), b.(*machine.AzureVirtualMachineProperties), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.AzureVirtualMachineProperties)(nil), (*AzureVirtualMachineProperties)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_AzureVirtualMachineProperties_To_v1alpha1_AzureVirtualMachineProperties(a.(*machine.AzureVirtualMachineProperties), b.(*AzureVirtualMachineProperties), scope)
- }); err != nil {
- return err
- }
if err := s.AddGeneratedConversionFunc((*ClassSpec)(nil), (*machine.ClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_ClassSpec_To_machine_ClassSpec(a.(*ClassSpec), b.(*machine.ClassSpec), scope)
}); err != nil {
@@ -379,86 +59,6 @@ func RegisterConversions(s *runtime.Scheme) error {
}); err != nil {
return err
}
- if err := s.AddGeneratedConversionFunc((*GCPDisk)(nil), (*machine.GCPDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_GCPDisk_To_machine_GCPDisk(a.(*GCPDisk), b.(*machine.GCPDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.GCPDisk)(nil), (*GCPDisk)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_GCPDisk_To_v1alpha1_GCPDisk(a.(*machine.GCPDisk), b.(*GCPDisk), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*GCPMachineClass)(nil), (*machine.GCPMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_GCPMachineClass_To_machine_GCPMachineClass(a.(*GCPMachineClass), b.(*machine.GCPMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.GCPMachineClass)(nil), (*GCPMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_GCPMachineClass_To_v1alpha1_GCPMachineClass(a.(*machine.GCPMachineClass), b.(*GCPMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*GCPMachineClassList)(nil), (*machine.GCPMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_GCPMachineClassList_To_machine_GCPMachineClassList(a.(*GCPMachineClassList), b.(*machine.GCPMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.GCPMachineClassList)(nil), (*GCPMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_GCPMachineClassList_To_v1alpha1_GCPMachineClassList(a.(*machine.GCPMachineClassList), b.(*GCPMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*GCPMachineClassSpec)(nil), (*machine.GCPMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_GCPMachineClassSpec_To_machine_GCPMachineClassSpec(a.(*GCPMachineClassSpec), b.(*machine.GCPMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.GCPMachineClassSpec)(nil), (*GCPMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_GCPMachineClassSpec_To_v1alpha1_GCPMachineClassSpec(a.(*machine.GCPMachineClassSpec), b.(*GCPMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*GCPMetadata)(nil), (*machine.GCPMetadata)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_GCPMetadata_To_machine_GCPMetadata(a.(*GCPMetadata), b.(*machine.GCPMetadata), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.GCPMetadata)(nil), (*GCPMetadata)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_GCPMetadata_To_v1alpha1_GCPMetadata(a.(*machine.GCPMetadata), b.(*GCPMetadata), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*GCPNetworkInterface)(nil), (*machine.GCPNetworkInterface)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_GCPNetworkInterface_To_machine_GCPNetworkInterface(a.(*GCPNetworkInterface), b.(*machine.GCPNetworkInterface), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.GCPNetworkInterface)(nil), (*GCPNetworkInterface)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_GCPNetworkInterface_To_v1alpha1_GCPNetworkInterface(a.(*machine.GCPNetworkInterface), b.(*GCPNetworkInterface), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*GCPScheduling)(nil), (*machine.GCPScheduling)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_GCPScheduling_To_machine_GCPScheduling(a.(*GCPScheduling), b.(*machine.GCPScheduling), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.GCPScheduling)(nil), (*GCPScheduling)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_GCPScheduling_To_v1alpha1_GCPScheduling(a.(*machine.GCPScheduling), b.(*GCPScheduling), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*GCPServiceAccount)(nil), (*machine.GCPServiceAccount)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_GCPServiceAccount_To_machine_GCPServiceAccount(a.(*GCPServiceAccount), b.(*machine.GCPServiceAccount), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.GCPServiceAccount)(nil), (*GCPServiceAccount)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_GCPServiceAccount_To_v1alpha1_GCPServiceAccount(a.(*machine.GCPServiceAccount), b.(*GCPServiceAccount), scope)
- }); err != nil {
- return err
- }
if err := s.AddGeneratedConversionFunc((*LastOperation)(nil), (*machine.LastOperation)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1alpha1_LastOperation_To_machine_LastOperation(a.(*LastOperation), b.(*machine.LastOperation), scope)
}); err != nil {
@@ -665,1059 +265,53 @@ func RegisterConversions(s *runtime.Scheme) error {
return err
}
if err := s.AddGeneratedConversionFunc((*machine.MachineTemplateSpec)(nil), (*MachineTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec(a.(*machine.MachineTemplateSpec), b.(*MachineTemplateSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*NodeTemplate)(nil), (*machine.NodeTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_NodeTemplate_To_machine_NodeTemplate(a.(*NodeTemplate), b.(*machine.NodeTemplate), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.NodeTemplate)(nil), (*NodeTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_NodeTemplate_To_v1alpha1_NodeTemplate(a.(*machine.NodeTemplate), b.(*NodeTemplate), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*NodeTemplateSpec)(nil), (*machine.NodeTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_NodeTemplateSpec_To_machine_NodeTemplateSpec(a.(*NodeTemplateSpec), b.(*machine.NodeTemplateSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.NodeTemplateSpec)(nil), (*NodeTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_NodeTemplateSpec_To_v1alpha1_NodeTemplateSpec(a.(*machine.NodeTemplateSpec), b.(*NodeTemplateSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*OpenStackMachineClass)(nil), (*machine.OpenStackMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_OpenStackMachineClass_To_machine_OpenStackMachineClass(a.(*OpenStackMachineClass), b.(*machine.OpenStackMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.OpenStackMachineClass)(nil), (*OpenStackMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_OpenStackMachineClass_To_v1alpha1_OpenStackMachineClass(a.(*machine.OpenStackMachineClass), b.(*OpenStackMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*OpenStackMachineClassList)(nil), (*machine.OpenStackMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_OpenStackMachineClassList_To_machine_OpenStackMachineClassList(a.(*OpenStackMachineClassList), b.(*machine.OpenStackMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.OpenStackMachineClassList)(nil), (*OpenStackMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_OpenStackMachineClassList_To_v1alpha1_OpenStackMachineClassList(a.(*machine.OpenStackMachineClassList), b.(*OpenStackMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*OpenStackMachineClassSpec)(nil), (*machine.OpenStackMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_OpenStackMachineClassSpec_To_machine_OpenStackMachineClassSpec(a.(*OpenStackMachineClassSpec), b.(*machine.OpenStackMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.OpenStackMachineClassSpec)(nil), (*OpenStackMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_OpenStackMachineClassSpec_To_v1alpha1_OpenStackMachineClassSpec(a.(*machine.OpenStackMachineClassSpec), b.(*OpenStackMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*OpenStackNetwork)(nil), (*machine.OpenStackNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_OpenStackNetwork_To_machine_OpenStackNetwork(a.(*OpenStackNetwork), b.(*machine.OpenStackNetwork), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.OpenStackNetwork)(nil), (*OpenStackNetwork)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_OpenStackNetwork_To_v1alpha1_OpenStackNetwork(a.(*machine.OpenStackNetwork), b.(*OpenStackNetwork), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*PacketMachineClass)(nil), (*machine.PacketMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_PacketMachineClass_To_machine_PacketMachineClass(a.(*PacketMachineClass), b.(*machine.PacketMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.PacketMachineClass)(nil), (*PacketMachineClass)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_PacketMachineClass_To_v1alpha1_PacketMachineClass(a.(*machine.PacketMachineClass), b.(*PacketMachineClass), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*PacketMachineClassList)(nil), (*machine.PacketMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_PacketMachineClassList_To_machine_PacketMachineClassList(a.(*PacketMachineClassList), b.(*machine.PacketMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.PacketMachineClassList)(nil), (*PacketMachineClassList)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_PacketMachineClassList_To_v1alpha1_PacketMachineClassList(a.(*machine.PacketMachineClassList), b.(*PacketMachineClassList), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*PacketMachineClassSpec)(nil), (*machine.PacketMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_PacketMachineClassSpec_To_machine_PacketMachineClassSpec(a.(*PacketMachineClassSpec), b.(*machine.PacketMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.PacketMachineClassSpec)(nil), (*PacketMachineClassSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_PacketMachineClassSpec_To_v1alpha1_PacketMachineClassSpec(a.(*machine.PacketMachineClassSpec), b.(*PacketMachineClassSpec), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*RollbackConfig)(nil), (*machine.RollbackConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_RollbackConfig_To_machine_RollbackConfig(a.(*RollbackConfig), b.(*machine.RollbackConfig), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.RollbackConfig)(nil), (*RollbackConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_RollbackConfig_To_v1alpha1_RollbackConfig(a.(*machine.RollbackConfig), b.(*RollbackConfig), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*RollingUpdateMachineDeployment)(nil), (*machine.RollingUpdateMachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_v1alpha1_RollingUpdateMachineDeployment_To_machine_RollingUpdateMachineDeployment(a.(*RollingUpdateMachineDeployment), b.(*machine.RollingUpdateMachineDeployment), scope)
- }); err != nil {
- return err
- }
- if err := s.AddGeneratedConversionFunc((*machine.RollingUpdateMachineDeployment)(nil), (*RollingUpdateMachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error {
- return Convert_machine_RollingUpdateMachineDeployment_To_v1alpha1_RollingUpdateMachineDeployment(a.(*machine.RollingUpdateMachineDeployment), b.(*RollingUpdateMachineDeployment), scope)
- }); err != nil {
- return err
- }
- return nil
-}
-
-func autoConvert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec(in *AWSBlockDeviceMappingSpec, out *machine.AWSBlockDeviceMappingSpec, s conversion.Scope) error {
- out.DeviceName = in.DeviceName
- if err := Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(&in.Ebs, &out.Ebs, s); err != nil {
- return err
- }
- out.NoDevice = in.NoDevice
- out.VirtualName = in.VirtualName
- return nil
-}
-
-// Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec is an autogenerated conversion function.
-func Convert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec(in *AWSBlockDeviceMappingSpec, out *machine.AWSBlockDeviceMappingSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_AWSBlockDeviceMappingSpec_To_machine_AWSBlockDeviceMappingSpec(in, out, s)
-}
-
-func autoConvert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in *machine.AWSBlockDeviceMappingSpec, out *AWSBlockDeviceMappingSpec, s conversion.Scope) error {
- out.DeviceName = in.DeviceName
- if err := Convert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(&in.Ebs, &out.Ebs, s); err != nil {
- return err
- }
- out.NoDevice = in.NoDevice
- out.VirtualName = in.VirtualName
- return nil
-}
-
-// Convert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec is an autogenerated conversion function.
-func Convert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in *machine.AWSBlockDeviceMappingSpec, out *AWSBlockDeviceMappingSpec, s conversion.Scope) error {
- return autoConvert_machine_AWSBlockDeviceMappingSpec_To_v1alpha1_AWSBlockDeviceMappingSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(in *AWSEbsBlockDeviceSpec, out *machine.AWSEbsBlockDeviceSpec, s conversion.Scope) error {
- out.DeleteOnTermination = (*bool)(unsafe.Pointer(in.DeleteOnTermination))
- out.Encrypted = in.Encrypted
- out.Iops = in.Iops
- out.KmsKeyID = (*string)(unsafe.Pointer(in.KmsKeyID))
- out.SnapshotID = (*string)(unsafe.Pointer(in.SnapshotID))
- out.VolumeSize = in.VolumeSize
- out.VolumeType = in.VolumeType
- return nil
-}
-
-// Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec is an autogenerated conversion function.
-func Convert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(in *AWSEbsBlockDeviceSpec, out *machine.AWSEbsBlockDeviceSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_AWSEbsBlockDeviceSpec_To_machine_AWSEbsBlockDeviceSpec(in, out, s)
-}
-
-func autoConvert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in *machine.AWSEbsBlockDeviceSpec, out *AWSEbsBlockDeviceSpec, s conversion.Scope) error {
- out.DeleteOnTermination = (*bool)(unsafe.Pointer(in.DeleteOnTermination))
- out.Encrypted = in.Encrypted
- out.Iops = in.Iops
- out.KmsKeyID = (*string)(unsafe.Pointer(in.KmsKeyID))
- out.SnapshotID = (*string)(unsafe.Pointer(in.SnapshotID))
- out.VolumeSize = in.VolumeSize
- out.VolumeType = in.VolumeType
- return nil
-}
-
-// Convert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec is an autogenerated conversion function.
-func Convert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in *machine.AWSEbsBlockDeviceSpec, out *AWSEbsBlockDeviceSpec, s conversion.Scope) error {
- return autoConvert_machine_AWSEbsBlockDeviceSpec_To_v1alpha1_AWSEbsBlockDeviceSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(in *AWSIAMProfileSpec, out *machine.AWSIAMProfileSpec, s conversion.Scope) error {
- out.ARN = in.ARN
- out.Name = in.Name
- return nil
-}
-
-// Convert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec is an autogenerated conversion function.
-func Convert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(in *AWSIAMProfileSpec, out *machine.AWSIAMProfileSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(in, out, s)
-}
-
-func autoConvert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in *machine.AWSIAMProfileSpec, out *AWSIAMProfileSpec, s conversion.Scope) error {
- out.ARN = in.ARN
- out.Name = in.Name
- return nil
-}
-
-// Convert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec is an autogenerated conversion function.
-func Convert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in *machine.AWSIAMProfileSpec, out *AWSIAMProfileSpec, s conversion.Scope) error {
- return autoConvert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass(in *AWSMachineClass, out *machine.AWSMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass is an autogenerated conversion function.
-func Convert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass(in *AWSMachineClass, out *machine.AWSMachineClass, s conversion.Scope) error {
- return autoConvert_v1alpha1_AWSMachineClass_To_machine_AWSMachineClass(in, out, s)
-}
-
-func autoConvert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass(in *machine.AWSMachineClass, out *AWSMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass is an autogenerated conversion function.
-func Convert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass(in *machine.AWSMachineClass, out *AWSMachineClass, s conversion.Scope) error {
- return autoConvert_machine_AWSMachineClass_To_v1alpha1_AWSMachineClass(in, out, s)
-}
-
-func autoConvert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList(in *AWSMachineClassList, out *machine.AWSMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]machine.AWSMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList is an autogenerated conversion function.
-func Convert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList(in *AWSMachineClassList, out *machine.AWSMachineClassList, s conversion.Scope) error {
- return autoConvert_v1alpha1_AWSMachineClassList_To_machine_AWSMachineClassList(in, out, s)
-}
-
-func autoConvert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList(in *machine.AWSMachineClassList, out *AWSMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]AWSMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList is an autogenerated conversion function.
-func Convert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList(in *machine.AWSMachineClassList, out *AWSMachineClassList, s conversion.Scope) error {
- return autoConvert_machine_AWSMachineClassList_To_v1alpha1_AWSMachineClassList(in, out, s)
-}
-
-func autoConvert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(in *AWSMachineClassSpec, out *machine.AWSMachineClassSpec, s conversion.Scope) error {
- out.AMI = in.AMI
- out.Region = in.Region
- out.BlockDevices = *(*[]machine.AWSBlockDeviceMappingSpec)(unsafe.Pointer(&in.BlockDevices))
- out.EbsOptimized = in.EbsOptimized
- if err := Convert_v1alpha1_AWSIAMProfileSpec_To_machine_AWSIAMProfileSpec(&in.IAM, &out.IAM, s); err != nil {
- return err
- }
- out.MachineType = in.MachineType
- out.KeyName = in.KeyName
- out.Monitoring = in.Monitoring
- out.NetworkInterfaces = *(*[]machine.AWSNetworkInterfaceSpec)(unsafe.Pointer(&in.NetworkInterfaces))
- out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags))
- out.SpotPrice = (*string)(unsafe.Pointer(in.SpotPrice))
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- return nil
-}
-
-// Convert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec is an autogenerated conversion function.
-func Convert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(in *AWSMachineClassSpec, out *machine.AWSMachineClassSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_AWSMachineClassSpec_To_machine_AWSMachineClassSpec(in, out, s)
-}
-
-func autoConvert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(in *machine.AWSMachineClassSpec, out *AWSMachineClassSpec, s conversion.Scope) error {
- out.AMI = in.AMI
- out.Region = in.Region
- out.BlockDevices = *(*[]AWSBlockDeviceMappingSpec)(unsafe.Pointer(&in.BlockDevices))
- out.EbsOptimized = in.EbsOptimized
- if err := Convert_machine_AWSIAMProfileSpec_To_v1alpha1_AWSIAMProfileSpec(&in.IAM, &out.IAM, s); err != nil {
- return err
- }
- out.MachineType = in.MachineType
- out.KeyName = in.KeyName
- out.Monitoring = in.Monitoring
- out.NetworkInterfaces = *(*[]AWSNetworkInterfaceSpec)(unsafe.Pointer(&in.NetworkInterfaces))
- out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags))
- out.SpotPrice = (*string)(unsafe.Pointer(in.SpotPrice))
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- return nil
-}
-
-// Convert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec is an autogenerated conversion function.
-func Convert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(in *machine.AWSMachineClassSpec, out *AWSMachineClassSpec, s conversion.Scope) error {
- return autoConvert_machine_AWSMachineClassSpec_To_v1alpha1_AWSMachineClassSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec(in *AWSNetworkInterfaceSpec, out *machine.AWSNetworkInterfaceSpec, s conversion.Scope) error {
- out.AssociatePublicIPAddress = (*bool)(unsafe.Pointer(in.AssociatePublicIPAddress))
- out.DeleteOnTermination = (*bool)(unsafe.Pointer(in.DeleteOnTermination))
- out.Description = (*string)(unsafe.Pointer(in.Description))
- out.SecurityGroupIDs = *(*[]string)(unsafe.Pointer(&in.SecurityGroupIDs))
- out.SubnetID = in.SubnetID
- return nil
-}
-
-// Convert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec is an autogenerated conversion function.
-func Convert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec(in *AWSNetworkInterfaceSpec, out *machine.AWSNetworkInterfaceSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_AWSNetworkInterfaceSpec_To_machine_AWSNetworkInterfaceSpec(in, out, s)
-}
-
-func autoConvert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in *machine.AWSNetworkInterfaceSpec, out *AWSNetworkInterfaceSpec, s conversion.Scope) error {
- out.AssociatePublicIPAddress = (*bool)(unsafe.Pointer(in.AssociatePublicIPAddress))
- out.DeleteOnTermination = (*bool)(unsafe.Pointer(in.DeleteOnTermination))
- out.Description = (*string)(unsafe.Pointer(in.Description))
- out.SecurityGroupIDs = *(*[]string)(unsafe.Pointer(&in.SecurityGroupIDs))
- out.SubnetID = in.SubnetID
- return nil
-}
-
-// Convert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec is an autogenerated conversion function.
-func Convert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in *machine.AWSNetworkInterfaceSpec, out *AWSNetworkInterfaceSpec, s conversion.Scope) error {
- return autoConvert_machine_AWSNetworkInterfaceSpec_To_v1alpha1_AWSNetworkInterfaceSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_AlicloudDataDisk_To_machine_AlicloudDataDisk(in *AlicloudDataDisk, out *machine.AlicloudDataDisk, s conversion.Scope) error {
- out.Name = in.Name
- out.Category = in.Category
- out.Description = in.Description
- out.Encrypted = in.Encrypted
- out.DeleteWithInstance = (*bool)(unsafe.Pointer(in.DeleteWithInstance))
- out.Size = in.Size
- return nil
-}
-
-// Convert_v1alpha1_AlicloudDataDisk_To_machine_AlicloudDataDisk is an autogenerated conversion function.
-func Convert_v1alpha1_AlicloudDataDisk_To_machine_AlicloudDataDisk(in *AlicloudDataDisk, out *machine.AlicloudDataDisk, s conversion.Scope) error {
- return autoConvert_v1alpha1_AlicloudDataDisk_To_machine_AlicloudDataDisk(in, out, s)
-}
-
-func autoConvert_machine_AlicloudDataDisk_To_v1alpha1_AlicloudDataDisk(in *machine.AlicloudDataDisk, out *AlicloudDataDisk, s conversion.Scope) error {
- out.Name = in.Name
- out.Category = in.Category
- out.Description = in.Description
- out.Encrypted = in.Encrypted
- out.Size = in.Size
- out.DeleteWithInstance = (*bool)(unsafe.Pointer(in.DeleteWithInstance))
- return nil
-}
-
-// Convert_machine_AlicloudDataDisk_To_v1alpha1_AlicloudDataDisk is an autogenerated conversion function.
-func Convert_machine_AlicloudDataDisk_To_v1alpha1_AlicloudDataDisk(in *machine.AlicloudDataDisk, out *AlicloudDataDisk, s conversion.Scope) error {
- return autoConvert_machine_AlicloudDataDisk_To_v1alpha1_AlicloudDataDisk(in, out, s)
-}
-
-func autoConvert_v1alpha1_AlicloudMachineClass_To_machine_AlicloudMachineClass(in *AlicloudMachineClass, out *machine.AlicloudMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_v1alpha1_AlicloudMachineClassSpec_To_machine_AlicloudMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_AlicloudMachineClass_To_machine_AlicloudMachineClass is an autogenerated conversion function.
-func Convert_v1alpha1_AlicloudMachineClass_To_machine_AlicloudMachineClass(in *AlicloudMachineClass, out *machine.AlicloudMachineClass, s conversion.Scope) error {
- return autoConvert_v1alpha1_AlicloudMachineClass_To_machine_AlicloudMachineClass(in, out, s)
-}
-
-func autoConvert_machine_AlicloudMachineClass_To_v1alpha1_AlicloudMachineClass(in *machine.AlicloudMachineClass, out *AlicloudMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_machine_AlicloudMachineClassSpec_To_v1alpha1_AlicloudMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_AlicloudMachineClass_To_v1alpha1_AlicloudMachineClass is an autogenerated conversion function.
-func Convert_machine_AlicloudMachineClass_To_v1alpha1_AlicloudMachineClass(in *machine.AlicloudMachineClass, out *AlicloudMachineClass, s conversion.Scope) error {
- return autoConvert_machine_AlicloudMachineClass_To_v1alpha1_AlicloudMachineClass(in, out, s)
-}
-
-func autoConvert_v1alpha1_AlicloudMachineClassList_To_machine_AlicloudMachineClassList(in *AlicloudMachineClassList, out *machine.AlicloudMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]machine.AlicloudMachineClass, len(*in))
- for i := range *in {
- if err := Convert_v1alpha1_AlicloudMachineClass_To_machine_AlicloudMachineClass(&(*in)[i], &(*out)[i], s); err != nil {
- return err
- }
- }
- } else {
- out.Items = nil
- }
- return nil
-}
-
-// Convert_v1alpha1_AlicloudMachineClassList_To_machine_AlicloudMachineClassList is an autogenerated conversion function.
-func Convert_v1alpha1_AlicloudMachineClassList_To_machine_AlicloudMachineClassList(in *AlicloudMachineClassList, out *machine.AlicloudMachineClassList, s conversion.Scope) error {
- return autoConvert_v1alpha1_AlicloudMachineClassList_To_machine_AlicloudMachineClassList(in, out, s)
-}
-
-func autoConvert_machine_AlicloudMachineClassList_To_v1alpha1_AlicloudMachineClassList(in *machine.AlicloudMachineClassList, out *AlicloudMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]AlicloudMachineClass, len(*in))
- for i := range *in {
- if err := Convert_machine_AlicloudMachineClass_To_v1alpha1_AlicloudMachineClass(&(*in)[i], &(*out)[i], s); err != nil {
- return err
- }
- }
- } else {
- out.Items = nil
- }
- return nil
-}
-
-// Convert_machine_AlicloudMachineClassList_To_v1alpha1_AlicloudMachineClassList is an autogenerated conversion function.
-func Convert_machine_AlicloudMachineClassList_To_v1alpha1_AlicloudMachineClassList(in *machine.AlicloudMachineClassList, out *AlicloudMachineClassList, s conversion.Scope) error {
- return autoConvert_machine_AlicloudMachineClassList_To_v1alpha1_AlicloudMachineClassList(in, out, s)
-}
-
-func autoConvert_v1alpha1_AlicloudMachineClassSpec_To_machine_AlicloudMachineClassSpec(in *AlicloudMachineClassSpec, out *machine.AlicloudMachineClassSpec, s conversion.Scope) error {
- out.ImageID = in.ImageID
- out.InstanceType = in.InstanceType
- out.Region = in.Region
- out.ZoneID = in.ZoneID
- out.SecurityGroupID = in.SecurityGroupID
- out.VSwitchID = in.VSwitchID
- out.PrivateIPAddress = in.PrivateIPAddress
- out.SystemDisk = (*machine.AlicloudSystemDisk)(unsafe.Pointer(in.SystemDisk))
- if in.DataDisks != nil {
- in, out := &in.DataDisks, &out.DataDisks
- *out = make([]machine.AlicloudDataDisk, len(*in))
- for i := range *in {
- if err := Convert_v1alpha1_AlicloudDataDisk_To_machine_AlicloudDataDisk(&(*in)[i], &(*out)[i], s); err != nil {
- return err
- }
- }
- } else {
- out.DataDisks = nil
- }
- out.InstanceChargeType = in.InstanceChargeType
- out.InternetChargeType = in.InternetChargeType
- out.InternetMaxBandwidthIn = (*int)(unsafe.Pointer(in.InternetMaxBandwidthIn))
- out.InternetMaxBandwidthOut = (*int)(unsafe.Pointer(in.InternetMaxBandwidthOut))
- out.SpotStrategy = in.SpotStrategy
- out.IoOptimized = in.IoOptimized
- out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags))
- out.KeyPairName = in.KeyPairName
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- return nil
-}
-
-// Convert_v1alpha1_AlicloudMachineClassSpec_To_machine_AlicloudMachineClassSpec is an autogenerated conversion function.
-func Convert_v1alpha1_AlicloudMachineClassSpec_To_machine_AlicloudMachineClassSpec(in *AlicloudMachineClassSpec, out *machine.AlicloudMachineClassSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_AlicloudMachineClassSpec_To_machine_AlicloudMachineClassSpec(in, out, s)
-}
-
-func autoConvert_machine_AlicloudMachineClassSpec_To_v1alpha1_AlicloudMachineClassSpec(in *machine.AlicloudMachineClassSpec, out *AlicloudMachineClassSpec, s conversion.Scope) error {
- out.ImageID = in.ImageID
- out.InstanceType = in.InstanceType
- out.Region = in.Region
- out.ZoneID = in.ZoneID
- out.SecurityGroupID = in.SecurityGroupID
- out.VSwitchID = in.VSwitchID
- out.PrivateIPAddress = in.PrivateIPAddress
- out.SystemDisk = (*AlicloudSystemDisk)(unsafe.Pointer(in.SystemDisk))
- if in.DataDisks != nil {
- in, out := &in.DataDisks, &out.DataDisks
- *out = make([]AlicloudDataDisk, len(*in))
- for i := range *in {
- if err := Convert_machine_AlicloudDataDisk_To_v1alpha1_AlicloudDataDisk(&(*in)[i], &(*out)[i], s); err != nil {
- return err
- }
- }
- } else {
- out.DataDisks = nil
- }
- out.InstanceChargeType = in.InstanceChargeType
- out.InternetChargeType = in.InternetChargeType
- out.InternetMaxBandwidthIn = (*int)(unsafe.Pointer(in.InternetMaxBandwidthIn))
- out.InternetMaxBandwidthOut = (*int)(unsafe.Pointer(in.InternetMaxBandwidthOut))
- out.SpotStrategy = in.SpotStrategy
- out.IoOptimized = in.IoOptimized
- out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags))
- out.KeyPairName = in.KeyPairName
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- return nil
-}
-
-// Convert_machine_AlicloudMachineClassSpec_To_v1alpha1_AlicloudMachineClassSpec is an autogenerated conversion function.
-func Convert_machine_AlicloudMachineClassSpec_To_v1alpha1_AlicloudMachineClassSpec(in *machine.AlicloudMachineClassSpec, out *AlicloudMachineClassSpec, s conversion.Scope) error {
- return autoConvert_machine_AlicloudMachineClassSpec_To_v1alpha1_AlicloudMachineClassSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_AlicloudSystemDisk_To_machine_AlicloudSystemDisk(in *AlicloudSystemDisk, out *machine.AlicloudSystemDisk, s conversion.Scope) error {
- out.Category = in.Category
- out.Size = in.Size
- return nil
-}
-
-// Convert_v1alpha1_AlicloudSystemDisk_To_machine_AlicloudSystemDisk is an autogenerated conversion function.
-func Convert_v1alpha1_AlicloudSystemDisk_To_machine_AlicloudSystemDisk(in *AlicloudSystemDisk, out *machine.AlicloudSystemDisk, s conversion.Scope) error {
- return autoConvert_v1alpha1_AlicloudSystemDisk_To_machine_AlicloudSystemDisk(in, out, s)
-}
-
-func autoConvert_machine_AlicloudSystemDisk_To_v1alpha1_AlicloudSystemDisk(in *machine.AlicloudSystemDisk, out *AlicloudSystemDisk, s conversion.Scope) error {
- out.Category = in.Category
- out.Size = in.Size
- return nil
-}
-
-// Convert_machine_AlicloudSystemDisk_To_v1alpha1_AlicloudSystemDisk is an autogenerated conversion function.
-func Convert_machine_AlicloudSystemDisk_To_v1alpha1_AlicloudSystemDisk(in *machine.AlicloudSystemDisk, out *AlicloudSystemDisk, s conversion.Scope) error {
- return autoConvert_machine_AlicloudSystemDisk_To_v1alpha1_AlicloudSystemDisk(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureDataDisk_To_machine_AzureDataDisk(in *AzureDataDisk, out *machine.AzureDataDisk, s conversion.Scope) error {
- out.Name = in.Name
- out.Lun = (*int32)(unsafe.Pointer(in.Lun))
- out.Caching = in.Caching
- out.StorageAccountType = in.StorageAccountType
- out.DiskSizeGB = in.DiskSizeGB
- return nil
-}
-
-// Convert_v1alpha1_AzureDataDisk_To_machine_AzureDataDisk is an autogenerated conversion function.
-func Convert_v1alpha1_AzureDataDisk_To_machine_AzureDataDisk(in *AzureDataDisk, out *machine.AzureDataDisk, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureDataDisk_To_machine_AzureDataDisk(in, out, s)
-}
-
-func autoConvert_machine_AzureDataDisk_To_v1alpha1_AzureDataDisk(in *machine.AzureDataDisk, out *AzureDataDisk, s conversion.Scope) error {
- out.Name = in.Name
- out.Lun = (*int32)(unsafe.Pointer(in.Lun))
- out.Caching = in.Caching
- out.StorageAccountType = in.StorageAccountType
- out.DiskSizeGB = in.DiskSizeGB
- return nil
-}
-
-// Convert_machine_AzureDataDisk_To_v1alpha1_AzureDataDisk is an autogenerated conversion function.
-func Convert_machine_AzureDataDisk_To_v1alpha1_AzureDataDisk(in *machine.AzureDataDisk, out *AzureDataDisk, s conversion.Scope) error {
- return autoConvert_machine_AzureDataDisk_To_v1alpha1_AzureDataDisk(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureHardwareProfile_To_machine_AzureHardwareProfile(in *AzureHardwareProfile, out *machine.AzureHardwareProfile, s conversion.Scope) error {
- out.VMSize = in.VMSize
- return nil
-}
-
-// Convert_v1alpha1_AzureHardwareProfile_To_machine_AzureHardwareProfile is an autogenerated conversion function.
-func Convert_v1alpha1_AzureHardwareProfile_To_machine_AzureHardwareProfile(in *AzureHardwareProfile, out *machine.AzureHardwareProfile, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureHardwareProfile_To_machine_AzureHardwareProfile(in, out, s)
-}
-
-func autoConvert_machine_AzureHardwareProfile_To_v1alpha1_AzureHardwareProfile(in *machine.AzureHardwareProfile, out *AzureHardwareProfile, s conversion.Scope) error {
- out.VMSize = in.VMSize
- return nil
-}
-
-// Convert_machine_AzureHardwareProfile_To_v1alpha1_AzureHardwareProfile is an autogenerated conversion function.
-func Convert_machine_AzureHardwareProfile_To_v1alpha1_AzureHardwareProfile(in *machine.AzureHardwareProfile, out *AzureHardwareProfile, s conversion.Scope) error {
- return autoConvert_machine_AzureHardwareProfile_To_v1alpha1_AzureHardwareProfile(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureImageReference_To_machine_AzureImageReference(in *AzureImageReference, out *machine.AzureImageReference, s conversion.Scope) error {
- out.ID = in.ID
- out.URN = (*string)(unsafe.Pointer(in.URN))
- return nil
-}
-
-// Convert_v1alpha1_AzureImageReference_To_machine_AzureImageReference is an autogenerated conversion function.
-func Convert_v1alpha1_AzureImageReference_To_machine_AzureImageReference(in *AzureImageReference, out *machine.AzureImageReference, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureImageReference_To_machine_AzureImageReference(in, out, s)
-}
-
-func autoConvert_machine_AzureImageReference_To_v1alpha1_AzureImageReference(in *machine.AzureImageReference, out *AzureImageReference, s conversion.Scope) error {
- out.ID = in.ID
- out.URN = (*string)(unsafe.Pointer(in.URN))
- return nil
-}
-
-// Convert_machine_AzureImageReference_To_v1alpha1_AzureImageReference is an autogenerated conversion function.
-func Convert_machine_AzureImageReference_To_v1alpha1_AzureImageReference(in *machine.AzureImageReference, out *AzureImageReference, s conversion.Scope) error {
- return autoConvert_machine_AzureImageReference_To_v1alpha1_AzureImageReference(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureLinuxConfiguration_To_machine_AzureLinuxConfiguration(in *AzureLinuxConfiguration, out *machine.AzureLinuxConfiguration, s conversion.Scope) error {
- out.DisablePasswordAuthentication = in.DisablePasswordAuthentication
- if err := Convert_v1alpha1_AzureSSHConfiguration_To_machine_AzureSSHConfiguration(&in.SSH, &out.SSH, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_AzureLinuxConfiguration_To_machine_AzureLinuxConfiguration is an autogenerated conversion function.
-func Convert_v1alpha1_AzureLinuxConfiguration_To_machine_AzureLinuxConfiguration(in *AzureLinuxConfiguration, out *machine.AzureLinuxConfiguration, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureLinuxConfiguration_To_machine_AzureLinuxConfiguration(in, out, s)
-}
-
-func autoConvert_machine_AzureLinuxConfiguration_To_v1alpha1_AzureLinuxConfiguration(in *machine.AzureLinuxConfiguration, out *AzureLinuxConfiguration, s conversion.Scope) error {
- out.DisablePasswordAuthentication = in.DisablePasswordAuthentication
- if err := Convert_machine_AzureSSHConfiguration_To_v1alpha1_AzureSSHConfiguration(&in.SSH, &out.SSH, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_AzureLinuxConfiguration_To_v1alpha1_AzureLinuxConfiguration is an autogenerated conversion function.
-func Convert_machine_AzureLinuxConfiguration_To_v1alpha1_AzureLinuxConfiguration(in *machine.AzureLinuxConfiguration, out *AzureLinuxConfiguration, s conversion.Scope) error {
- return autoConvert_machine_AzureLinuxConfiguration_To_v1alpha1_AzureLinuxConfiguration(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureMachineClass_To_machine_AzureMachineClass(in *AzureMachineClass, out *machine.AzureMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_v1alpha1_AzureMachineClassSpec_To_machine_AzureMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_AzureMachineClass_To_machine_AzureMachineClass is an autogenerated conversion function.
-func Convert_v1alpha1_AzureMachineClass_To_machine_AzureMachineClass(in *AzureMachineClass, out *machine.AzureMachineClass, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureMachineClass_To_machine_AzureMachineClass(in, out, s)
-}
-
-func autoConvert_machine_AzureMachineClass_To_v1alpha1_AzureMachineClass(in *machine.AzureMachineClass, out *AzureMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_machine_AzureMachineClassSpec_To_v1alpha1_AzureMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_AzureMachineClass_To_v1alpha1_AzureMachineClass is an autogenerated conversion function.
-func Convert_machine_AzureMachineClass_To_v1alpha1_AzureMachineClass(in *machine.AzureMachineClass, out *AzureMachineClass, s conversion.Scope) error {
- return autoConvert_machine_AzureMachineClass_To_v1alpha1_AzureMachineClass(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureMachineClassList_To_machine_AzureMachineClassList(in *AzureMachineClassList, out *machine.AzureMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]machine.AzureMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1alpha1_AzureMachineClassList_To_machine_AzureMachineClassList is an autogenerated conversion function.
-func Convert_v1alpha1_AzureMachineClassList_To_machine_AzureMachineClassList(in *AzureMachineClassList, out *machine.AzureMachineClassList, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureMachineClassList_To_machine_AzureMachineClassList(in, out, s)
-}
-
-func autoConvert_machine_AzureMachineClassList_To_v1alpha1_AzureMachineClassList(in *machine.AzureMachineClassList, out *AzureMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]AzureMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_machine_AzureMachineClassList_To_v1alpha1_AzureMachineClassList is an autogenerated conversion function.
-func Convert_machine_AzureMachineClassList_To_v1alpha1_AzureMachineClassList(in *machine.AzureMachineClassList, out *AzureMachineClassList, s conversion.Scope) error {
- return autoConvert_machine_AzureMachineClassList_To_v1alpha1_AzureMachineClassList(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureMachineClassSpec_To_machine_AzureMachineClassSpec(in *AzureMachineClassSpec, out *machine.AzureMachineClassSpec, s conversion.Scope) error {
- out.Location = in.Location
- out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags))
- if err := Convert_v1alpha1_AzureVirtualMachineProperties_To_machine_AzureVirtualMachineProperties(&in.Properties, &out.Properties, s); err != nil {
- return err
- }
- out.ResourceGroup = in.ResourceGroup
- if err := Convert_v1alpha1_AzureSubnetInfo_To_machine_AzureSubnetInfo(&in.SubnetInfo, &out.SubnetInfo, s); err != nil {
- return err
- }
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- return nil
-}
-
-// Convert_v1alpha1_AzureMachineClassSpec_To_machine_AzureMachineClassSpec is an autogenerated conversion function.
-func Convert_v1alpha1_AzureMachineClassSpec_To_machine_AzureMachineClassSpec(in *AzureMachineClassSpec, out *machine.AzureMachineClassSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureMachineClassSpec_To_machine_AzureMachineClassSpec(in, out, s)
-}
-
-func autoConvert_machine_AzureMachineClassSpec_To_v1alpha1_AzureMachineClassSpec(in *machine.AzureMachineClassSpec, out *AzureMachineClassSpec, s conversion.Scope) error {
- out.Location = in.Location
- out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags))
- if err := Convert_machine_AzureVirtualMachineProperties_To_v1alpha1_AzureVirtualMachineProperties(&in.Properties, &out.Properties, s); err != nil {
- return err
- }
- out.ResourceGroup = in.ResourceGroup
- if err := Convert_machine_AzureSubnetInfo_To_v1alpha1_AzureSubnetInfo(&in.SubnetInfo, &out.SubnetInfo, s); err != nil {
- return err
- }
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- return nil
-}
-
-// Convert_machine_AzureMachineClassSpec_To_v1alpha1_AzureMachineClassSpec is an autogenerated conversion function.
-func Convert_machine_AzureMachineClassSpec_To_v1alpha1_AzureMachineClassSpec(in *machine.AzureMachineClassSpec, out *AzureMachineClassSpec, s conversion.Scope) error {
- return autoConvert_machine_AzureMachineClassSpec_To_v1alpha1_AzureMachineClassSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureMachineSetConfig_To_machine_AzureMachineSetConfig(in *AzureMachineSetConfig, out *machine.AzureMachineSetConfig, s conversion.Scope) error {
- out.ID = in.ID
- out.Kind = in.Kind
- return nil
-}
-
-// Convert_v1alpha1_AzureMachineSetConfig_To_machine_AzureMachineSetConfig is an autogenerated conversion function.
-func Convert_v1alpha1_AzureMachineSetConfig_To_machine_AzureMachineSetConfig(in *AzureMachineSetConfig, out *machine.AzureMachineSetConfig, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureMachineSetConfig_To_machine_AzureMachineSetConfig(in, out, s)
-}
-
-func autoConvert_machine_AzureMachineSetConfig_To_v1alpha1_AzureMachineSetConfig(in *machine.AzureMachineSetConfig, out *AzureMachineSetConfig, s conversion.Scope) error {
- out.ID = in.ID
- out.Kind = in.Kind
- return nil
-}
-
-// Convert_machine_AzureMachineSetConfig_To_v1alpha1_AzureMachineSetConfig is an autogenerated conversion function.
-func Convert_machine_AzureMachineSetConfig_To_v1alpha1_AzureMachineSetConfig(in *machine.AzureMachineSetConfig, out *AzureMachineSetConfig, s conversion.Scope) error {
- return autoConvert_machine_AzureMachineSetConfig_To_v1alpha1_AzureMachineSetConfig(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureManagedDiskParameters_To_machine_AzureManagedDiskParameters(in *AzureManagedDiskParameters, out *machine.AzureManagedDiskParameters, s conversion.Scope) error {
- out.ID = in.ID
- out.StorageAccountType = in.StorageAccountType
- return nil
-}
-
-// Convert_v1alpha1_AzureManagedDiskParameters_To_machine_AzureManagedDiskParameters is an autogenerated conversion function.
-func Convert_v1alpha1_AzureManagedDiskParameters_To_machine_AzureManagedDiskParameters(in *AzureManagedDiskParameters, out *machine.AzureManagedDiskParameters, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureManagedDiskParameters_To_machine_AzureManagedDiskParameters(in, out, s)
-}
-
-func autoConvert_machine_AzureManagedDiskParameters_To_v1alpha1_AzureManagedDiskParameters(in *machine.AzureManagedDiskParameters, out *AzureManagedDiskParameters, s conversion.Scope) error {
- out.ID = in.ID
- out.StorageAccountType = in.StorageAccountType
- return nil
-}
-
-// Convert_machine_AzureManagedDiskParameters_To_v1alpha1_AzureManagedDiskParameters is an autogenerated conversion function.
-func Convert_machine_AzureManagedDiskParameters_To_v1alpha1_AzureManagedDiskParameters(in *machine.AzureManagedDiskParameters, out *AzureManagedDiskParameters, s conversion.Scope) error {
- return autoConvert_machine_AzureManagedDiskParameters_To_v1alpha1_AzureManagedDiskParameters(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureNetworkInterfaceReference_To_machine_AzureNetworkInterfaceReference(in *AzureNetworkInterfaceReference, out *machine.AzureNetworkInterfaceReference, s conversion.Scope) error {
- out.ID = in.ID
- out.AzureNetworkInterfaceReferenceProperties = (*machine.AzureNetworkInterfaceReferenceProperties)(unsafe.Pointer(in.AzureNetworkInterfaceReferenceProperties))
- return nil
-}
-
-// Convert_v1alpha1_AzureNetworkInterfaceReference_To_machine_AzureNetworkInterfaceReference is an autogenerated conversion function.
-func Convert_v1alpha1_AzureNetworkInterfaceReference_To_machine_AzureNetworkInterfaceReference(in *AzureNetworkInterfaceReference, out *machine.AzureNetworkInterfaceReference, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureNetworkInterfaceReference_To_machine_AzureNetworkInterfaceReference(in, out, s)
-}
-
-func autoConvert_machine_AzureNetworkInterfaceReference_To_v1alpha1_AzureNetworkInterfaceReference(in *machine.AzureNetworkInterfaceReference, out *AzureNetworkInterfaceReference, s conversion.Scope) error {
- out.ID = in.ID
- out.AzureNetworkInterfaceReferenceProperties = (*AzureNetworkInterfaceReferenceProperties)(unsafe.Pointer(in.AzureNetworkInterfaceReferenceProperties))
- return nil
-}
-
-// Convert_machine_AzureNetworkInterfaceReference_To_v1alpha1_AzureNetworkInterfaceReference is an autogenerated conversion function.
-func Convert_machine_AzureNetworkInterfaceReference_To_v1alpha1_AzureNetworkInterfaceReference(in *machine.AzureNetworkInterfaceReference, out *AzureNetworkInterfaceReference, s conversion.Scope) error {
- return autoConvert_machine_AzureNetworkInterfaceReference_To_v1alpha1_AzureNetworkInterfaceReference(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureNetworkInterfaceReferenceProperties_To_machine_AzureNetworkInterfaceReferenceProperties(in *AzureNetworkInterfaceReferenceProperties, out *machine.AzureNetworkInterfaceReferenceProperties, s conversion.Scope) error {
- out.Primary = in.Primary
- return nil
-}
-
-// Convert_v1alpha1_AzureNetworkInterfaceReferenceProperties_To_machine_AzureNetworkInterfaceReferenceProperties is an autogenerated conversion function.
-func Convert_v1alpha1_AzureNetworkInterfaceReferenceProperties_To_machine_AzureNetworkInterfaceReferenceProperties(in *AzureNetworkInterfaceReferenceProperties, out *machine.AzureNetworkInterfaceReferenceProperties, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureNetworkInterfaceReferenceProperties_To_machine_AzureNetworkInterfaceReferenceProperties(in, out, s)
-}
-
-func autoConvert_machine_AzureNetworkInterfaceReferenceProperties_To_v1alpha1_AzureNetworkInterfaceReferenceProperties(in *machine.AzureNetworkInterfaceReferenceProperties, out *AzureNetworkInterfaceReferenceProperties, s conversion.Scope) error {
- out.Primary = in.Primary
- return nil
-}
-
-// Convert_machine_AzureNetworkInterfaceReferenceProperties_To_v1alpha1_AzureNetworkInterfaceReferenceProperties is an autogenerated conversion function.
-func Convert_machine_AzureNetworkInterfaceReferenceProperties_To_v1alpha1_AzureNetworkInterfaceReferenceProperties(in *machine.AzureNetworkInterfaceReferenceProperties, out *AzureNetworkInterfaceReferenceProperties, s conversion.Scope) error {
- return autoConvert_machine_AzureNetworkInterfaceReferenceProperties_To_v1alpha1_AzureNetworkInterfaceReferenceProperties(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureNetworkProfile_To_machine_AzureNetworkProfile(in *AzureNetworkProfile, out *machine.AzureNetworkProfile, s conversion.Scope) error {
- if err := Convert_v1alpha1_AzureNetworkInterfaceReference_To_machine_AzureNetworkInterfaceReference(&in.NetworkInterfaces, &out.NetworkInterfaces, s); err != nil {
- return err
- }
- out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking))
- return nil
-}
-
-// Convert_v1alpha1_AzureNetworkProfile_To_machine_AzureNetworkProfile is an autogenerated conversion function.
-func Convert_v1alpha1_AzureNetworkProfile_To_machine_AzureNetworkProfile(in *AzureNetworkProfile, out *machine.AzureNetworkProfile, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureNetworkProfile_To_machine_AzureNetworkProfile(in, out, s)
-}
-
-func autoConvert_machine_AzureNetworkProfile_To_v1alpha1_AzureNetworkProfile(in *machine.AzureNetworkProfile, out *AzureNetworkProfile, s conversion.Scope) error {
- if err := Convert_machine_AzureNetworkInterfaceReference_To_v1alpha1_AzureNetworkInterfaceReference(&in.NetworkInterfaces, &out.NetworkInterfaces, s); err != nil {
- return err
- }
- out.AcceleratedNetworking = (*bool)(unsafe.Pointer(in.AcceleratedNetworking))
- return nil
-}
-
-// Convert_machine_AzureNetworkProfile_To_v1alpha1_AzureNetworkProfile is an autogenerated conversion function.
-func Convert_machine_AzureNetworkProfile_To_v1alpha1_AzureNetworkProfile(in *machine.AzureNetworkProfile, out *AzureNetworkProfile, s conversion.Scope) error {
- return autoConvert_machine_AzureNetworkProfile_To_v1alpha1_AzureNetworkProfile(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureOSDisk_To_machine_AzureOSDisk(in *AzureOSDisk, out *machine.AzureOSDisk, s conversion.Scope) error {
- out.Name = in.Name
- out.Caching = in.Caching
- if err := Convert_v1alpha1_AzureManagedDiskParameters_To_machine_AzureManagedDiskParameters(&in.ManagedDisk, &out.ManagedDisk, s); err != nil {
- return err
- }
- out.DiskSizeGB = in.DiskSizeGB
- out.CreateOption = in.CreateOption
- return nil
-}
-
-// Convert_v1alpha1_AzureOSDisk_To_machine_AzureOSDisk is an autogenerated conversion function.
-func Convert_v1alpha1_AzureOSDisk_To_machine_AzureOSDisk(in *AzureOSDisk, out *machine.AzureOSDisk, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureOSDisk_To_machine_AzureOSDisk(in, out, s)
-}
-
-func autoConvert_machine_AzureOSDisk_To_v1alpha1_AzureOSDisk(in *machine.AzureOSDisk, out *AzureOSDisk, s conversion.Scope) error {
- out.Name = in.Name
- out.Caching = in.Caching
- if err := Convert_machine_AzureManagedDiskParameters_To_v1alpha1_AzureManagedDiskParameters(&in.ManagedDisk, &out.ManagedDisk, s); err != nil {
- return err
- }
- out.DiskSizeGB = in.DiskSizeGB
- out.CreateOption = in.CreateOption
- return nil
-}
-
-// Convert_machine_AzureOSDisk_To_v1alpha1_AzureOSDisk is an autogenerated conversion function.
-func Convert_machine_AzureOSDisk_To_v1alpha1_AzureOSDisk(in *machine.AzureOSDisk, out *AzureOSDisk, s conversion.Scope) error {
- return autoConvert_machine_AzureOSDisk_To_v1alpha1_AzureOSDisk(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureOSProfile_To_machine_AzureOSProfile(in *AzureOSProfile, out *machine.AzureOSProfile, s conversion.Scope) error {
- out.ComputerName = in.ComputerName
- out.AdminUsername = in.AdminUsername
- out.AdminPassword = in.AdminPassword
- out.CustomData = in.CustomData
- if err := Convert_v1alpha1_AzureLinuxConfiguration_To_machine_AzureLinuxConfiguration(&in.LinuxConfiguration, &out.LinuxConfiguration, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_AzureOSProfile_To_machine_AzureOSProfile is an autogenerated conversion function.
-func Convert_v1alpha1_AzureOSProfile_To_machine_AzureOSProfile(in *AzureOSProfile, out *machine.AzureOSProfile, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureOSProfile_To_machine_AzureOSProfile(in, out, s)
-}
-
-func autoConvert_machine_AzureOSProfile_To_v1alpha1_AzureOSProfile(in *machine.AzureOSProfile, out *AzureOSProfile, s conversion.Scope) error {
- out.ComputerName = in.ComputerName
- out.AdminUsername = in.AdminUsername
- out.AdminPassword = in.AdminPassword
- out.CustomData = in.CustomData
- if err := Convert_machine_AzureLinuxConfiguration_To_v1alpha1_AzureLinuxConfiguration(&in.LinuxConfiguration, &out.LinuxConfiguration, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_AzureOSProfile_To_v1alpha1_AzureOSProfile is an autogenerated conversion function.
-func Convert_machine_AzureOSProfile_To_v1alpha1_AzureOSProfile(in *machine.AzureOSProfile, out *AzureOSProfile, s conversion.Scope) error {
- return autoConvert_machine_AzureOSProfile_To_v1alpha1_AzureOSProfile(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureSSHConfiguration_To_machine_AzureSSHConfiguration(in *AzureSSHConfiguration, out *machine.AzureSSHConfiguration, s conversion.Scope) error {
- if err := Convert_v1alpha1_AzureSSHPublicKey_To_machine_AzureSSHPublicKey(&in.PublicKeys, &out.PublicKeys, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_AzureSSHConfiguration_To_machine_AzureSSHConfiguration is an autogenerated conversion function.
-func Convert_v1alpha1_AzureSSHConfiguration_To_machine_AzureSSHConfiguration(in *AzureSSHConfiguration, out *machine.AzureSSHConfiguration, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureSSHConfiguration_To_machine_AzureSSHConfiguration(in, out, s)
-}
-
-func autoConvert_machine_AzureSSHConfiguration_To_v1alpha1_AzureSSHConfiguration(in *machine.AzureSSHConfiguration, out *AzureSSHConfiguration, s conversion.Scope) error {
- if err := Convert_machine_AzureSSHPublicKey_To_v1alpha1_AzureSSHPublicKey(&in.PublicKeys, &out.PublicKeys, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_AzureSSHConfiguration_To_v1alpha1_AzureSSHConfiguration is an autogenerated conversion function.
-func Convert_machine_AzureSSHConfiguration_To_v1alpha1_AzureSSHConfiguration(in *machine.AzureSSHConfiguration, out *AzureSSHConfiguration, s conversion.Scope) error {
- return autoConvert_machine_AzureSSHConfiguration_To_v1alpha1_AzureSSHConfiguration(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureSSHPublicKey_To_machine_AzureSSHPublicKey(in *AzureSSHPublicKey, out *machine.AzureSSHPublicKey, s conversion.Scope) error {
- out.Path = in.Path
- out.KeyData = in.KeyData
- return nil
-}
-
-// Convert_v1alpha1_AzureSSHPublicKey_To_machine_AzureSSHPublicKey is an autogenerated conversion function.
-func Convert_v1alpha1_AzureSSHPublicKey_To_machine_AzureSSHPublicKey(in *AzureSSHPublicKey, out *machine.AzureSSHPublicKey, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureSSHPublicKey_To_machine_AzureSSHPublicKey(in, out, s)
-}
-
-func autoConvert_machine_AzureSSHPublicKey_To_v1alpha1_AzureSSHPublicKey(in *machine.AzureSSHPublicKey, out *AzureSSHPublicKey, s conversion.Scope) error {
- out.Path = in.Path
- out.KeyData = in.KeyData
- return nil
-}
-
-// Convert_machine_AzureSSHPublicKey_To_v1alpha1_AzureSSHPublicKey is an autogenerated conversion function.
-func Convert_machine_AzureSSHPublicKey_To_v1alpha1_AzureSSHPublicKey(in *machine.AzureSSHPublicKey, out *AzureSSHPublicKey, s conversion.Scope) error {
- return autoConvert_machine_AzureSSHPublicKey_To_v1alpha1_AzureSSHPublicKey(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureStorageProfile_To_machine_AzureStorageProfile(in *AzureStorageProfile, out *machine.AzureStorageProfile, s conversion.Scope) error {
- if err := Convert_v1alpha1_AzureImageReference_To_machine_AzureImageReference(&in.ImageReference, &out.ImageReference, s); err != nil {
- return err
- }
- if err := Convert_v1alpha1_AzureOSDisk_To_machine_AzureOSDisk(&in.OsDisk, &out.OsDisk, s); err != nil {
- return err
- }
- out.DataDisks = *(*[]machine.AzureDataDisk)(unsafe.Pointer(&in.DataDisks))
- return nil
-}
-
-// Convert_v1alpha1_AzureStorageProfile_To_machine_AzureStorageProfile is an autogenerated conversion function.
-func Convert_v1alpha1_AzureStorageProfile_To_machine_AzureStorageProfile(in *AzureStorageProfile, out *machine.AzureStorageProfile, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureStorageProfile_To_machine_AzureStorageProfile(in, out, s)
-}
-
-func autoConvert_machine_AzureStorageProfile_To_v1alpha1_AzureStorageProfile(in *machine.AzureStorageProfile, out *AzureStorageProfile, s conversion.Scope) error {
- if err := Convert_machine_AzureImageReference_To_v1alpha1_AzureImageReference(&in.ImageReference, &out.ImageReference, s); err != nil {
- return err
- }
- if err := Convert_machine_AzureOSDisk_To_v1alpha1_AzureOSDisk(&in.OsDisk, &out.OsDisk, s); err != nil {
+ return Convert_machine_MachineTemplateSpec_To_v1alpha1_MachineTemplateSpec(a.(*machine.MachineTemplateSpec), b.(*MachineTemplateSpec), scope)
+ }); err != nil {
return err
}
- out.DataDisks = *(*[]AzureDataDisk)(unsafe.Pointer(&in.DataDisks))
- return nil
-}
-
-// Convert_machine_AzureStorageProfile_To_v1alpha1_AzureStorageProfile is an autogenerated conversion function.
-func Convert_machine_AzureStorageProfile_To_v1alpha1_AzureStorageProfile(in *machine.AzureStorageProfile, out *AzureStorageProfile, s conversion.Scope) error {
- return autoConvert_machine_AzureStorageProfile_To_v1alpha1_AzureStorageProfile(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureSubResource_To_machine_AzureSubResource(in *AzureSubResource, out *machine.AzureSubResource, s conversion.Scope) error {
- out.ID = in.ID
- return nil
-}
-
-// Convert_v1alpha1_AzureSubResource_To_machine_AzureSubResource is an autogenerated conversion function.
-func Convert_v1alpha1_AzureSubResource_To_machine_AzureSubResource(in *AzureSubResource, out *machine.AzureSubResource, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureSubResource_To_machine_AzureSubResource(in, out, s)
-}
-
-func autoConvert_machine_AzureSubResource_To_v1alpha1_AzureSubResource(in *machine.AzureSubResource, out *AzureSubResource, s conversion.Scope) error {
- out.ID = in.ID
- return nil
-}
-
-// Convert_machine_AzureSubResource_To_v1alpha1_AzureSubResource is an autogenerated conversion function.
-func Convert_machine_AzureSubResource_To_v1alpha1_AzureSubResource(in *machine.AzureSubResource, out *AzureSubResource, s conversion.Scope) error {
- return autoConvert_machine_AzureSubResource_To_v1alpha1_AzureSubResource(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureSubnetInfo_To_machine_AzureSubnetInfo(in *AzureSubnetInfo, out *machine.AzureSubnetInfo, s conversion.Scope) error {
- out.VnetName = in.VnetName
- out.VnetResourceGroup = (*string)(unsafe.Pointer(in.VnetResourceGroup))
- out.SubnetName = in.SubnetName
- return nil
-}
-
-// Convert_v1alpha1_AzureSubnetInfo_To_machine_AzureSubnetInfo is an autogenerated conversion function.
-func Convert_v1alpha1_AzureSubnetInfo_To_machine_AzureSubnetInfo(in *AzureSubnetInfo, out *machine.AzureSubnetInfo, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureSubnetInfo_To_machine_AzureSubnetInfo(in, out, s)
-}
-
-func autoConvert_machine_AzureSubnetInfo_To_v1alpha1_AzureSubnetInfo(in *machine.AzureSubnetInfo, out *AzureSubnetInfo, s conversion.Scope) error {
- out.VnetName = in.VnetName
- out.VnetResourceGroup = (*string)(unsafe.Pointer(in.VnetResourceGroup))
- out.SubnetName = in.SubnetName
- return nil
-}
-
-// Convert_machine_AzureSubnetInfo_To_v1alpha1_AzureSubnetInfo is an autogenerated conversion function.
-func Convert_machine_AzureSubnetInfo_To_v1alpha1_AzureSubnetInfo(in *machine.AzureSubnetInfo, out *AzureSubnetInfo, s conversion.Scope) error {
- return autoConvert_machine_AzureSubnetInfo_To_v1alpha1_AzureSubnetInfo(in, out, s)
-}
-
-func autoConvert_v1alpha1_AzureVirtualMachineProperties_To_machine_AzureVirtualMachineProperties(in *AzureVirtualMachineProperties, out *machine.AzureVirtualMachineProperties, s conversion.Scope) error {
- if err := Convert_v1alpha1_AzureHardwareProfile_To_machine_AzureHardwareProfile(&in.HardwareProfile, &out.HardwareProfile, s); err != nil {
+ if err := s.AddGeneratedConversionFunc((*NodeTemplate)(nil), (*machine.NodeTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error {
+ return Convert_v1alpha1_NodeTemplate_To_machine_NodeTemplate(a.(*NodeTemplate), b.(*machine.NodeTemplate), scope)
+ }); err != nil {
return err
}
- if err := Convert_v1alpha1_AzureStorageProfile_To_machine_AzureStorageProfile(&in.StorageProfile, &out.StorageProfile, s); err != nil {
+ if err := s.AddGeneratedConversionFunc((*machine.NodeTemplate)(nil), (*NodeTemplate)(nil), func(a, b interface{}, scope conversion.Scope) error {
+ return Convert_machine_NodeTemplate_To_v1alpha1_NodeTemplate(a.(*machine.NodeTemplate), b.(*NodeTemplate), scope)
+ }); err != nil {
return err
}
- if err := Convert_v1alpha1_AzureOSProfile_To_machine_AzureOSProfile(&in.OsProfile, &out.OsProfile, s); err != nil {
+ if err := s.AddGeneratedConversionFunc((*NodeTemplateSpec)(nil), (*machine.NodeTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
+ return Convert_v1alpha1_NodeTemplateSpec_To_machine_NodeTemplateSpec(a.(*NodeTemplateSpec), b.(*machine.NodeTemplateSpec), scope)
+ }); err != nil {
return err
}
- if err := Convert_v1alpha1_AzureNetworkProfile_To_machine_AzureNetworkProfile(&in.NetworkProfile, &out.NetworkProfile, s); err != nil {
+ if err := s.AddGeneratedConversionFunc((*machine.NodeTemplateSpec)(nil), (*NodeTemplateSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
+ return Convert_machine_NodeTemplateSpec_To_v1alpha1_NodeTemplateSpec(a.(*machine.NodeTemplateSpec), b.(*NodeTemplateSpec), scope)
+ }); err != nil {
return err
}
- out.AvailabilitySet = (*machine.AzureSubResource)(unsafe.Pointer(in.AvailabilitySet))
- out.IdentityID = (*string)(unsafe.Pointer(in.IdentityID))
- out.Zone = (*int)(unsafe.Pointer(in.Zone))
- out.MachineSet = (*machine.AzureMachineSetConfig)(unsafe.Pointer(in.MachineSet))
- return nil
-}
-
-// Convert_v1alpha1_AzureVirtualMachineProperties_To_machine_AzureVirtualMachineProperties is an autogenerated conversion function.
-func Convert_v1alpha1_AzureVirtualMachineProperties_To_machine_AzureVirtualMachineProperties(in *AzureVirtualMachineProperties, out *machine.AzureVirtualMachineProperties, s conversion.Scope) error {
- return autoConvert_v1alpha1_AzureVirtualMachineProperties_To_machine_AzureVirtualMachineProperties(in, out, s)
-}
-
-func autoConvert_machine_AzureVirtualMachineProperties_To_v1alpha1_AzureVirtualMachineProperties(in *machine.AzureVirtualMachineProperties, out *AzureVirtualMachineProperties, s conversion.Scope) error {
- if err := Convert_machine_AzureHardwareProfile_To_v1alpha1_AzureHardwareProfile(&in.HardwareProfile, &out.HardwareProfile, s); err != nil {
+ if err := s.AddGeneratedConversionFunc((*RollbackConfig)(nil), (*machine.RollbackConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
+ return Convert_v1alpha1_RollbackConfig_To_machine_RollbackConfig(a.(*RollbackConfig), b.(*machine.RollbackConfig), scope)
+ }); err != nil {
return err
}
- if err := Convert_machine_AzureStorageProfile_To_v1alpha1_AzureStorageProfile(&in.StorageProfile, &out.StorageProfile, s); err != nil {
+ if err := s.AddGeneratedConversionFunc((*machine.RollbackConfig)(nil), (*RollbackConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
+ return Convert_machine_RollbackConfig_To_v1alpha1_RollbackConfig(a.(*machine.RollbackConfig), b.(*RollbackConfig), scope)
+ }); err != nil {
return err
}
- if err := Convert_machine_AzureOSProfile_To_v1alpha1_AzureOSProfile(&in.OsProfile, &out.OsProfile, s); err != nil {
+ if err := s.AddGeneratedConversionFunc((*RollingUpdateMachineDeployment)(nil), (*machine.RollingUpdateMachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error {
+ return Convert_v1alpha1_RollingUpdateMachineDeployment_To_machine_RollingUpdateMachineDeployment(a.(*RollingUpdateMachineDeployment), b.(*machine.RollingUpdateMachineDeployment), scope)
+ }); err != nil {
return err
}
- if err := Convert_machine_AzureNetworkProfile_To_v1alpha1_AzureNetworkProfile(&in.NetworkProfile, &out.NetworkProfile, s); err != nil {
+ if err := s.AddGeneratedConversionFunc((*machine.RollingUpdateMachineDeployment)(nil), (*RollingUpdateMachineDeployment)(nil), func(a, b interface{}, scope conversion.Scope) error {
+ return Convert_machine_RollingUpdateMachineDeployment_To_v1alpha1_RollingUpdateMachineDeployment(a.(*machine.RollingUpdateMachineDeployment), b.(*RollingUpdateMachineDeployment), scope)
+ }); err != nil {
return err
}
- out.AvailabilitySet = (*AzureSubResource)(unsafe.Pointer(in.AvailabilitySet))
- out.IdentityID = (*string)(unsafe.Pointer(in.IdentityID))
- out.Zone = (*int)(unsafe.Pointer(in.Zone))
- out.MachineSet = (*AzureMachineSetConfig)(unsafe.Pointer(in.MachineSet))
return nil
}
-// Convert_machine_AzureVirtualMachineProperties_To_v1alpha1_AzureVirtualMachineProperties is an autogenerated conversion function.
-func Convert_machine_AzureVirtualMachineProperties_To_v1alpha1_AzureVirtualMachineProperties(in *machine.AzureVirtualMachineProperties, out *AzureVirtualMachineProperties, s conversion.Scope) error {
- return autoConvert_machine_AzureVirtualMachineProperties_To_v1alpha1_AzureVirtualMachineProperties(in, out, s)
-}
-
func autoConvert_v1alpha1_ClassSpec_To_machine_ClassSpec(in *ClassSpec, out *machine.ClassSpec, s conversion.Scope) error {
out.APIGroup = in.APIGroup
out.Kind = in.Kind
@@ -1766,230 +360,6 @@ func Convert_machine_CurrentStatus_To_v1alpha1_CurrentStatus(in *machine.Current
return autoConvert_machine_CurrentStatus_To_v1alpha1_CurrentStatus(in, out, s)
}
-func autoConvert_v1alpha1_GCPDisk_To_machine_GCPDisk(in *GCPDisk, out *machine.GCPDisk, s conversion.Scope) error {
- out.AutoDelete = (*bool)(unsafe.Pointer(in.AutoDelete))
- out.Boot = in.Boot
- out.SizeGb = in.SizeGb
- out.Type = in.Type
- out.Interface = in.Interface
- out.Image = in.Image
- out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
- return nil
-}
-
-// Convert_v1alpha1_GCPDisk_To_machine_GCPDisk is an autogenerated conversion function.
-func Convert_v1alpha1_GCPDisk_To_machine_GCPDisk(in *GCPDisk, out *machine.GCPDisk, s conversion.Scope) error {
- return autoConvert_v1alpha1_GCPDisk_To_machine_GCPDisk(in, out, s)
-}
-
-func autoConvert_machine_GCPDisk_To_v1alpha1_GCPDisk(in *machine.GCPDisk, out *GCPDisk, s conversion.Scope) error {
- out.AutoDelete = (*bool)(unsafe.Pointer(in.AutoDelete))
- out.Boot = in.Boot
- out.SizeGb = in.SizeGb
- out.Type = in.Type
- out.Interface = in.Interface
- out.Image = in.Image
- out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
- return nil
-}
-
-// Convert_machine_GCPDisk_To_v1alpha1_GCPDisk is an autogenerated conversion function.
-func Convert_machine_GCPDisk_To_v1alpha1_GCPDisk(in *machine.GCPDisk, out *GCPDisk, s conversion.Scope) error {
- return autoConvert_machine_GCPDisk_To_v1alpha1_GCPDisk(in, out, s)
-}
-
-func autoConvert_v1alpha1_GCPMachineClass_To_machine_GCPMachineClass(in *GCPMachineClass, out *machine.GCPMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_v1alpha1_GCPMachineClassSpec_To_machine_GCPMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_GCPMachineClass_To_machine_GCPMachineClass is an autogenerated conversion function.
-func Convert_v1alpha1_GCPMachineClass_To_machine_GCPMachineClass(in *GCPMachineClass, out *machine.GCPMachineClass, s conversion.Scope) error {
- return autoConvert_v1alpha1_GCPMachineClass_To_machine_GCPMachineClass(in, out, s)
-}
-
-func autoConvert_machine_GCPMachineClass_To_v1alpha1_GCPMachineClass(in *machine.GCPMachineClass, out *GCPMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_machine_GCPMachineClassSpec_To_v1alpha1_GCPMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_GCPMachineClass_To_v1alpha1_GCPMachineClass is an autogenerated conversion function.
-func Convert_machine_GCPMachineClass_To_v1alpha1_GCPMachineClass(in *machine.GCPMachineClass, out *GCPMachineClass, s conversion.Scope) error {
- return autoConvert_machine_GCPMachineClass_To_v1alpha1_GCPMachineClass(in, out, s)
-}
-
-func autoConvert_v1alpha1_GCPMachineClassList_To_machine_GCPMachineClassList(in *GCPMachineClassList, out *machine.GCPMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]machine.GCPMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1alpha1_GCPMachineClassList_To_machine_GCPMachineClassList is an autogenerated conversion function.
-func Convert_v1alpha1_GCPMachineClassList_To_machine_GCPMachineClassList(in *GCPMachineClassList, out *machine.GCPMachineClassList, s conversion.Scope) error {
- return autoConvert_v1alpha1_GCPMachineClassList_To_machine_GCPMachineClassList(in, out, s)
-}
-
-func autoConvert_machine_GCPMachineClassList_To_v1alpha1_GCPMachineClassList(in *machine.GCPMachineClassList, out *GCPMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]GCPMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_machine_GCPMachineClassList_To_v1alpha1_GCPMachineClassList is an autogenerated conversion function.
-func Convert_machine_GCPMachineClassList_To_v1alpha1_GCPMachineClassList(in *machine.GCPMachineClassList, out *GCPMachineClassList, s conversion.Scope) error {
- return autoConvert_machine_GCPMachineClassList_To_v1alpha1_GCPMachineClassList(in, out, s)
-}
-
-func autoConvert_v1alpha1_GCPMachineClassSpec_To_machine_GCPMachineClassSpec(in *GCPMachineClassSpec, out *machine.GCPMachineClassSpec, s conversion.Scope) error {
- out.CanIpForward = in.CanIpForward
- out.DeletionProtection = in.DeletionProtection
- out.Description = (*string)(unsafe.Pointer(in.Description))
- out.Disks = *(*[]*machine.GCPDisk)(unsafe.Pointer(&in.Disks))
- out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
- out.MachineType = in.MachineType
- out.Metadata = *(*[]*machine.GCPMetadata)(unsafe.Pointer(&in.Metadata))
- out.NetworkInterfaces = *(*[]*machine.GCPNetworkInterface)(unsafe.Pointer(&in.NetworkInterfaces))
- if err := Convert_v1alpha1_GCPScheduling_To_machine_GCPScheduling(&in.Scheduling, &out.Scheduling, s); err != nil {
- return err
- }
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- out.ServiceAccounts = *(*[]machine.GCPServiceAccount)(unsafe.Pointer(&in.ServiceAccounts))
- out.Tags = *(*[]string)(unsafe.Pointer(&in.Tags))
- out.Region = in.Region
- out.Zone = in.Zone
- return nil
-}
-
-// Convert_v1alpha1_GCPMachineClassSpec_To_machine_GCPMachineClassSpec is an autogenerated conversion function.
-func Convert_v1alpha1_GCPMachineClassSpec_To_machine_GCPMachineClassSpec(in *GCPMachineClassSpec, out *machine.GCPMachineClassSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_GCPMachineClassSpec_To_machine_GCPMachineClassSpec(in, out, s)
-}
-
-func autoConvert_machine_GCPMachineClassSpec_To_v1alpha1_GCPMachineClassSpec(in *machine.GCPMachineClassSpec, out *GCPMachineClassSpec, s conversion.Scope) error {
- out.CanIpForward = in.CanIpForward
- out.DeletionProtection = in.DeletionProtection
- out.Description = (*string)(unsafe.Pointer(in.Description))
- out.Disks = *(*[]*GCPDisk)(unsafe.Pointer(&in.Disks))
- out.Labels = *(*map[string]string)(unsafe.Pointer(&in.Labels))
- out.MachineType = in.MachineType
- out.Metadata = *(*[]*GCPMetadata)(unsafe.Pointer(&in.Metadata))
- out.NetworkInterfaces = *(*[]*GCPNetworkInterface)(unsafe.Pointer(&in.NetworkInterfaces))
- if err := Convert_machine_GCPScheduling_To_v1alpha1_GCPScheduling(&in.Scheduling, &out.Scheduling, s); err != nil {
- return err
- }
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- out.ServiceAccounts = *(*[]GCPServiceAccount)(unsafe.Pointer(&in.ServiceAccounts))
- out.Tags = *(*[]string)(unsafe.Pointer(&in.Tags))
- out.Region = in.Region
- out.Zone = in.Zone
- return nil
-}
-
-// Convert_machine_GCPMachineClassSpec_To_v1alpha1_GCPMachineClassSpec is an autogenerated conversion function.
-func Convert_machine_GCPMachineClassSpec_To_v1alpha1_GCPMachineClassSpec(in *machine.GCPMachineClassSpec, out *GCPMachineClassSpec, s conversion.Scope) error {
- return autoConvert_machine_GCPMachineClassSpec_To_v1alpha1_GCPMachineClassSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_GCPMetadata_To_machine_GCPMetadata(in *GCPMetadata, out *machine.GCPMetadata, s conversion.Scope) error {
- out.Key = in.Key
- out.Value = (*string)(unsafe.Pointer(in.Value))
- return nil
-}
-
-// Convert_v1alpha1_GCPMetadata_To_machine_GCPMetadata is an autogenerated conversion function.
-func Convert_v1alpha1_GCPMetadata_To_machine_GCPMetadata(in *GCPMetadata, out *machine.GCPMetadata, s conversion.Scope) error {
- return autoConvert_v1alpha1_GCPMetadata_To_machine_GCPMetadata(in, out, s)
-}
-
-func autoConvert_machine_GCPMetadata_To_v1alpha1_GCPMetadata(in *machine.GCPMetadata, out *GCPMetadata, s conversion.Scope) error {
- out.Key = in.Key
- out.Value = (*string)(unsafe.Pointer(in.Value))
- return nil
-}
-
-// Convert_machine_GCPMetadata_To_v1alpha1_GCPMetadata is an autogenerated conversion function.
-func Convert_machine_GCPMetadata_To_v1alpha1_GCPMetadata(in *machine.GCPMetadata, out *GCPMetadata, s conversion.Scope) error {
- return autoConvert_machine_GCPMetadata_To_v1alpha1_GCPMetadata(in, out, s)
-}
-
-func autoConvert_v1alpha1_GCPNetworkInterface_To_machine_GCPNetworkInterface(in *GCPNetworkInterface, out *machine.GCPNetworkInterface, s conversion.Scope) error {
- out.DisableExternalIP = in.DisableExternalIP
- out.Network = in.Network
- out.Subnetwork = in.Subnetwork
- return nil
-}
-
-// Convert_v1alpha1_GCPNetworkInterface_To_machine_GCPNetworkInterface is an autogenerated conversion function.
-func Convert_v1alpha1_GCPNetworkInterface_To_machine_GCPNetworkInterface(in *GCPNetworkInterface, out *machine.GCPNetworkInterface, s conversion.Scope) error {
- return autoConvert_v1alpha1_GCPNetworkInterface_To_machine_GCPNetworkInterface(in, out, s)
-}
-
-func autoConvert_machine_GCPNetworkInterface_To_v1alpha1_GCPNetworkInterface(in *machine.GCPNetworkInterface, out *GCPNetworkInterface, s conversion.Scope) error {
- out.DisableExternalIP = in.DisableExternalIP
- out.Network = in.Network
- out.Subnetwork = in.Subnetwork
- return nil
-}
-
-// Convert_machine_GCPNetworkInterface_To_v1alpha1_GCPNetworkInterface is an autogenerated conversion function.
-func Convert_machine_GCPNetworkInterface_To_v1alpha1_GCPNetworkInterface(in *machine.GCPNetworkInterface, out *GCPNetworkInterface, s conversion.Scope) error {
- return autoConvert_machine_GCPNetworkInterface_To_v1alpha1_GCPNetworkInterface(in, out, s)
-}
-
-func autoConvert_v1alpha1_GCPScheduling_To_machine_GCPScheduling(in *GCPScheduling, out *machine.GCPScheduling, s conversion.Scope) error {
- out.AutomaticRestart = in.AutomaticRestart
- out.OnHostMaintenance = in.OnHostMaintenance
- out.Preemptible = in.Preemptible
- return nil
-}
-
-// Convert_v1alpha1_GCPScheduling_To_machine_GCPScheduling is an autogenerated conversion function.
-func Convert_v1alpha1_GCPScheduling_To_machine_GCPScheduling(in *GCPScheduling, out *machine.GCPScheduling, s conversion.Scope) error {
- return autoConvert_v1alpha1_GCPScheduling_To_machine_GCPScheduling(in, out, s)
-}
-
-func autoConvert_machine_GCPScheduling_To_v1alpha1_GCPScheduling(in *machine.GCPScheduling, out *GCPScheduling, s conversion.Scope) error {
- out.AutomaticRestart = in.AutomaticRestart
- out.OnHostMaintenance = in.OnHostMaintenance
- out.Preemptible = in.Preemptible
- return nil
-}
-
-// Convert_machine_GCPScheduling_To_v1alpha1_GCPScheduling is an autogenerated conversion function.
-func Convert_machine_GCPScheduling_To_v1alpha1_GCPScheduling(in *machine.GCPScheduling, out *GCPScheduling, s conversion.Scope) error {
- return autoConvert_machine_GCPScheduling_To_v1alpha1_GCPScheduling(in, out, s)
-}
-
-func autoConvert_v1alpha1_GCPServiceAccount_To_machine_GCPServiceAccount(in *GCPServiceAccount, out *machine.GCPServiceAccount, s conversion.Scope) error {
- out.Email = in.Email
- out.Scopes = *(*[]string)(unsafe.Pointer(&in.Scopes))
- return nil
-}
-
-// Convert_v1alpha1_GCPServiceAccount_To_machine_GCPServiceAccount is an autogenerated conversion function.
-func Convert_v1alpha1_GCPServiceAccount_To_machine_GCPServiceAccount(in *GCPServiceAccount, out *machine.GCPServiceAccount, s conversion.Scope) error {
- return autoConvert_v1alpha1_GCPServiceAccount_To_machine_GCPServiceAccount(in, out, s)
-}
-
-func autoConvert_machine_GCPServiceAccount_To_v1alpha1_GCPServiceAccount(in *machine.GCPServiceAccount, out *GCPServiceAccount, s conversion.Scope) error {
- out.Email = in.Email
- out.Scopes = *(*[]string)(unsafe.Pointer(&in.Scopes))
- return nil
-}
-
-// Convert_machine_GCPServiceAccount_To_v1alpha1_GCPServiceAccount is an autogenerated conversion function.
-func Convert_machine_GCPServiceAccount_To_v1alpha1_GCPServiceAccount(in *machine.GCPServiceAccount, out *GCPServiceAccount, s conversion.Scope) error {
- return autoConvert_machine_GCPServiceAccount_To_v1alpha1_GCPServiceAccount(in, out, s)
-}
-
func autoConvert_v1alpha1_LastOperation_To_machine_LastOperation(in *LastOperation, out *machine.LastOperation, s conversion.Scope) error {
out.Description = in.Description
out.LastUpdateTime = in.LastUpdateTime
@@ -2684,216 +1054,6 @@ func Convert_machine_NodeTemplateSpec_To_v1alpha1_NodeTemplateSpec(in *machine.N
return autoConvert_machine_NodeTemplateSpec_To_v1alpha1_NodeTemplateSpec(in, out, s)
}
-func autoConvert_v1alpha1_OpenStackMachineClass_To_machine_OpenStackMachineClass(in *OpenStackMachineClass, out *machine.OpenStackMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_v1alpha1_OpenStackMachineClassSpec_To_machine_OpenStackMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_OpenStackMachineClass_To_machine_OpenStackMachineClass is an autogenerated conversion function.
-func Convert_v1alpha1_OpenStackMachineClass_To_machine_OpenStackMachineClass(in *OpenStackMachineClass, out *machine.OpenStackMachineClass, s conversion.Scope) error {
- return autoConvert_v1alpha1_OpenStackMachineClass_To_machine_OpenStackMachineClass(in, out, s)
-}
-
-func autoConvert_machine_OpenStackMachineClass_To_v1alpha1_OpenStackMachineClass(in *machine.OpenStackMachineClass, out *OpenStackMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_machine_OpenStackMachineClassSpec_To_v1alpha1_OpenStackMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_OpenStackMachineClass_To_v1alpha1_OpenStackMachineClass is an autogenerated conversion function.
-func Convert_machine_OpenStackMachineClass_To_v1alpha1_OpenStackMachineClass(in *machine.OpenStackMachineClass, out *OpenStackMachineClass, s conversion.Scope) error {
- return autoConvert_machine_OpenStackMachineClass_To_v1alpha1_OpenStackMachineClass(in, out, s)
-}
-
-func autoConvert_v1alpha1_OpenStackMachineClassList_To_machine_OpenStackMachineClassList(in *OpenStackMachineClassList, out *machine.OpenStackMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]machine.OpenStackMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1alpha1_OpenStackMachineClassList_To_machine_OpenStackMachineClassList is an autogenerated conversion function.
-func Convert_v1alpha1_OpenStackMachineClassList_To_machine_OpenStackMachineClassList(in *OpenStackMachineClassList, out *machine.OpenStackMachineClassList, s conversion.Scope) error {
- return autoConvert_v1alpha1_OpenStackMachineClassList_To_machine_OpenStackMachineClassList(in, out, s)
-}
-
-func autoConvert_machine_OpenStackMachineClassList_To_v1alpha1_OpenStackMachineClassList(in *machine.OpenStackMachineClassList, out *OpenStackMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]OpenStackMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_machine_OpenStackMachineClassList_To_v1alpha1_OpenStackMachineClassList is an autogenerated conversion function.
-func Convert_machine_OpenStackMachineClassList_To_v1alpha1_OpenStackMachineClassList(in *machine.OpenStackMachineClassList, out *OpenStackMachineClassList, s conversion.Scope) error {
- return autoConvert_machine_OpenStackMachineClassList_To_v1alpha1_OpenStackMachineClassList(in, out, s)
-}
-
-func autoConvert_v1alpha1_OpenStackMachineClassSpec_To_machine_OpenStackMachineClassSpec(in *OpenStackMachineClassSpec, out *machine.OpenStackMachineClassSpec, s conversion.Scope) error {
- out.ImageID = in.ImageID
- out.ImageName = in.ImageName
- out.Region = in.Region
- out.AvailabilityZone = in.AvailabilityZone
- out.FlavorName = in.FlavorName
- out.KeyName = in.KeyName
- out.SecurityGroups = *(*[]string)(unsafe.Pointer(&in.SecurityGroups))
- out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags))
- out.NetworkID = in.NetworkID
- out.Networks = *(*[]machine.OpenStackNetwork)(unsafe.Pointer(&in.Networks))
- out.SubnetID = (*string)(unsafe.Pointer(in.SubnetID))
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- out.PodNetworkCidr = in.PodNetworkCidr
- out.RootDiskSize = in.RootDiskSize
- out.UseConfigDrive = (*bool)(unsafe.Pointer(in.UseConfigDrive))
- out.ServerGroupID = (*string)(unsafe.Pointer(in.ServerGroupID))
- return nil
-}
-
-// Convert_v1alpha1_OpenStackMachineClassSpec_To_machine_OpenStackMachineClassSpec is an autogenerated conversion function.
-func Convert_v1alpha1_OpenStackMachineClassSpec_To_machine_OpenStackMachineClassSpec(in *OpenStackMachineClassSpec, out *machine.OpenStackMachineClassSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_OpenStackMachineClassSpec_To_machine_OpenStackMachineClassSpec(in, out, s)
-}
-
-func autoConvert_machine_OpenStackMachineClassSpec_To_v1alpha1_OpenStackMachineClassSpec(in *machine.OpenStackMachineClassSpec, out *OpenStackMachineClassSpec, s conversion.Scope) error {
- out.ImageID = in.ImageID
- out.ImageName = in.ImageName
- out.Region = in.Region
- out.AvailabilityZone = in.AvailabilityZone
- out.FlavorName = in.FlavorName
- out.KeyName = in.KeyName
- out.SecurityGroups = *(*[]string)(unsafe.Pointer(&in.SecurityGroups))
- out.Tags = *(*map[string]string)(unsafe.Pointer(&in.Tags))
- out.NetworkID = in.NetworkID
- out.Networks = *(*[]OpenStackNetwork)(unsafe.Pointer(&in.Networks))
- out.SubnetID = (*string)(unsafe.Pointer(in.SubnetID))
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- out.PodNetworkCidr = in.PodNetworkCidr
- out.RootDiskSize = in.RootDiskSize
- out.UseConfigDrive = (*bool)(unsafe.Pointer(in.UseConfigDrive))
- out.ServerGroupID = (*string)(unsafe.Pointer(in.ServerGroupID))
- return nil
-}
-
-// Convert_machine_OpenStackMachineClassSpec_To_v1alpha1_OpenStackMachineClassSpec is an autogenerated conversion function.
-func Convert_machine_OpenStackMachineClassSpec_To_v1alpha1_OpenStackMachineClassSpec(in *machine.OpenStackMachineClassSpec, out *OpenStackMachineClassSpec, s conversion.Scope) error {
- return autoConvert_machine_OpenStackMachineClassSpec_To_v1alpha1_OpenStackMachineClassSpec(in, out, s)
-}
-
-func autoConvert_v1alpha1_OpenStackNetwork_To_machine_OpenStackNetwork(in *OpenStackNetwork, out *machine.OpenStackNetwork, s conversion.Scope) error {
- out.Id = in.Id
- out.Name = in.Name
- out.PodNetwork = in.PodNetwork
- return nil
-}
-
-// Convert_v1alpha1_OpenStackNetwork_To_machine_OpenStackNetwork is an autogenerated conversion function.
-func Convert_v1alpha1_OpenStackNetwork_To_machine_OpenStackNetwork(in *OpenStackNetwork, out *machine.OpenStackNetwork, s conversion.Scope) error {
- return autoConvert_v1alpha1_OpenStackNetwork_To_machine_OpenStackNetwork(in, out, s)
-}
-
-func autoConvert_machine_OpenStackNetwork_To_v1alpha1_OpenStackNetwork(in *machine.OpenStackNetwork, out *OpenStackNetwork, s conversion.Scope) error {
- out.Id = in.Id
- out.Name = in.Name
- out.PodNetwork = in.PodNetwork
- return nil
-}
-
-// Convert_machine_OpenStackNetwork_To_v1alpha1_OpenStackNetwork is an autogenerated conversion function.
-func Convert_machine_OpenStackNetwork_To_v1alpha1_OpenStackNetwork(in *machine.OpenStackNetwork, out *OpenStackNetwork, s conversion.Scope) error {
- return autoConvert_machine_OpenStackNetwork_To_v1alpha1_OpenStackNetwork(in, out, s)
-}
-
-func autoConvert_v1alpha1_PacketMachineClass_To_machine_PacketMachineClass(in *PacketMachineClass, out *machine.PacketMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_v1alpha1_PacketMachineClassSpec_To_machine_PacketMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_v1alpha1_PacketMachineClass_To_machine_PacketMachineClass is an autogenerated conversion function.
-func Convert_v1alpha1_PacketMachineClass_To_machine_PacketMachineClass(in *PacketMachineClass, out *machine.PacketMachineClass, s conversion.Scope) error {
- return autoConvert_v1alpha1_PacketMachineClass_To_machine_PacketMachineClass(in, out, s)
-}
-
-func autoConvert_machine_PacketMachineClass_To_v1alpha1_PacketMachineClass(in *machine.PacketMachineClass, out *PacketMachineClass, s conversion.Scope) error {
- out.ObjectMeta = in.ObjectMeta
- if err := Convert_machine_PacketMachineClassSpec_To_v1alpha1_PacketMachineClassSpec(&in.Spec, &out.Spec, s); err != nil {
- return err
- }
- return nil
-}
-
-// Convert_machine_PacketMachineClass_To_v1alpha1_PacketMachineClass is an autogenerated conversion function.
-func Convert_machine_PacketMachineClass_To_v1alpha1_PacketMachineClass(in *machine.PacketMachineClass, out *PacketMachineClass, s conversion.Scope) error {
- return autoConvert_machine_PacketMachineClass_To_v1alpha1_PacketMachineClass(in, out, s)
-}
-
-func autoConvert_v1alpha1_PacketMachineClassList_To_machine_PacketMachineClassList(in *PacketMachineClassList, out *machine.PacketMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]machine.PacketMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_v1alpha1_PacketMachineClassList_To_machine_PacketMachineClassList is an autogenerated conversion function.
-func Convert_v1alpha1_PacketMachineClassList_To_machine_PacketMachineClassList(in *PacketMachineClassList, out *machine.PacketMachineClassList, s conversion.Scope) error {
- return autoConvert_v1alpha1_PacketMachineClassList_To_machine_PacketMachineClassList(in, out, s)
-}
-
-func autoConvert_machine_PacketMachineClassList_To_v1alpha1_PacketMachineClassList(in *machine.PacketMachineClassList, out *PacketMachineClassList, s conversion.Scope) error {
- out.ListMeta = in.ListMeta
- out.Items = *(*[]PacketMachineClass)(unsafe.Pointer(&in.Items))
- return nil
-}
-
-// Convert_machine_PacketMachineClassList_To_v1alpha1_PacketMachineClassList is an autogenerated conversion function.
-func Convert_machine_PacketMachineClassList_To_v1alpha1_PacketMachineClassList(in *machine.PacketMachineClassList, out *PacketMachineClassList, s conversion.Scope) error {
- return autoConvert_machine_PacketMachineClassList_To_v1alpha1_PacketMachineClassList(in, out, s)
-}
-
-func autoConvert_v1alpha1_PacketMachineClassSpec_To_machine_PacketMachineClassSpec(in *PacketMachineClassSpec, out *machine.PacketMachineClassSpec, s conversion.Scope) error {
- out.Facility = *(*[]string)(unsafe.Pointer(&in.Facility))
- out.MachineType = in.MachineType
- out.BillingCycle = in.BillingCycle
- out.OS = in.OS
- out.ProjectID = in.ProjectID
- out.Tags = *(*[]string)(unsafe.Pointer(&in.Tags))
- out.SSHKeys = *(*[]string)(unsafe.Pointer(&in.SSHKeys))
- out.UserData = in.UserData
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- return nil
-}
-
-// Convert_v1alpha1_PacketMachineClassSpec_To_machine_PacketMachineClassSpec is an autogenerated conversion function.
-func Convert_v1alpha1_PacketMachineClassSpec_To_machine_PacketMachineClassSpec(in *PacketMachineClassSpec, out *machine.PacketMachineClassSpec, s conversion.Scope) error {
- return autoConvert_v1alpha1_PacketMachineClassSpec_To_machine_PacketMachineClassSpec(in, out, s)
-}
-
-func autoConvert_machine_PacketMachineClassSpec_To_v1alpha1_PacketMachineClassSpec(in *machine.PacketMachineClassSpec, out *PacketMachineClassSpec, s conversion.Scope) error {
- out.Facility = *(*[]string)(unsafe.Pointer(&in.Facility))
- out.MachineType = in.MachineType
- out.OS = in.OS
- out.ProjectID = in.ProjectID
- out.BillingCycle = in.BillingCycle
- out.Tags = *(*[]string)(unsafe.Pointer(&in.Tags))
- out.SSHKeys = *(*[]string)(unsafe.Pointer(&in.SSHKeys))
- out.UserData = in.UserData
- out.SecretRef = (*v1.SecretReference)(unsafe.Pointer(in.SecretRef))
- out.CredentialsSecretRef = (*v1.SecretReference)(unsafe.Pointer(in.CredentialsSecretRef))
- return nil
-}
-
-// Convert_machine_PacketMachineClassSpec_To_v1alpha1_PacketMachineClassSpec is an autogenerated conversion function.
-func Convert_machine_PacketMachineClassSpec_To_v1alpha1_PacketMachineClassSpec(in *machine.PacketMachineClassSpec, out *PacketMachineClassSpec, s conversion.Scope) error {
- return autoConvert_machine_PacketMachineClassSpec_To_v1alpha1_PacketMachineClassSpec(in, out, s)
-}
-
func autoConvert_v1alpha1_RollbackConfig_To_machine_RollbackConfig(in *RollbackConfig, out *machine.RollbackConfig, s conversion.Scope) error {
out.Revision = in.Revision
return nil
diff --git a/pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go
index b55e3928a..35b368e1a 100644
--- a/pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/machine/v1alpha1/zz_generated.deepcopy.go
@@ -29,1075 +29,34 @@ import (
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSBlockDeviceMappingSpec) DeepCopyInto(out *AWSBlockDeviceMappingSpec) {
- *out = *in
- in.Ebs.DeepCopyInto(&out.Ebs)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSBlockDeviceMappingSpec.
-func (in *AWSBlockDeviceMappingSpec) DeepCopy() *AWSBlockDeviceMappingSpec {
- if in == nil {
- return nil
- }
- out := new(AWSBlockDeviceMappingSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSEbsBlockDeviceSpec) DeepCopyInto(out *AWSEbsBlockDeviceSpec) {
- *out = *in
- if in.DeleteOnTermination != nil {
- in, out := &in.DeleteOnTermination, &out.DeleteOnTermination
- *out = new(bool)
- **out = **in
- }
- if in.KmsKeyID != nil {
- in, out := &in.KmsKeyID, &out.KmsKeyID
- *out = new(string)
- **out = **in
- }
- if in.SnapshotID != nil {
- in, out := &in.SnapshotID, &out.SnapshotID
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSEbsBlockDeviceSpec.
-func (in *AWSEbsBlockDeviceSpec) DeepCopy() *AWSEbsBlockDeviceSpec {
- if in == nil {
- return nil
- }
- out := new(AWSEbsBlockDeviceSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSIAMProfileSpec) DeepCopyInto(out *AWSIAMProfileSpec) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSIAMProfileSpec.
-func (in *AWSIAMProfileSpec) DeepCopy() *AWSIAMProfileSpec {
- if in == nil {
- return nil
- }
- out := new(AWSIAMProfileSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSMachineClass) DeepCopyInto(out *AWSMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClass.
-func (in *AWSMachineClass) DeepCopy() *AWSMachineClass {
- if in == nil {
- return nil
- }
- out := new(AWSMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AWSMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSMachineClassList) DeepCopyInto(out *AWSMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]AWSMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClassList.
-func (in *AWSMachineClassList) DeepCopy() *AWSMachineClassList {
- if in == nil {
- return nil
- }
- out := new(AWSMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AWSMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSMachineClassSpec) DeepCopyInto(out *AWSMachineClassSpec) {
- *out = *in
- if in.BlockDevices != nil {
- in, out := &in.BlockDevices, &out.BlockDevices
- *out = make([]AWSBlockDeviceMappingSpec, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- out.IAM = in.IAM
- if in.NetworkInterfaces != nil {
- in, out := &in.NetworkInterfaces, &out.NetworkInterfaces
- *out = make([]AWSNetworkInterfaceSpec, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.SpotPrice != nil {
- in, out := &in.SpotPrice, &out.SpotPrice
- *out = new(string)
- **out = **in
- }
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClassSpec.
-func (in *AWSMachineClassSpec) DeepCopy() *AWSMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(AWSMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSNetworkInterfaceSpec) DeepCopyInto(out *AWSNetworkInterfaceSpec) {
- *out = *in
- if in.AssociatePublicIPAddress != nil {
- in, out := &in.AssociatePublicIPAddress, &out.AssociatePublicIPAddress
- *out = new(bool)
- **out = **in
- }
- if in.DeleteOnTermination != nil {
- in, out := &in.DeleteOnTermination, &out.DeleteOnTermination
- *out = new(bool)
- **out = **in
- }
- if in.Description != nil {
- in, out := &in.Description, &out.Description
- *out = new(string)
- **out = **in
- }
- if in.SecurityGroupIDs != nil {
- in, out := &in.SecurityGroupIDs, &out.SecurityGroupIDs
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSNetworkInterfaceSpec.
-func (in *AWSNetworkInterfaceSpec) DeepCopy() *AWSNetworkInterfaceSpec {
- if in == nil {
- return nil
- }
- out := new(AWSNetworkInterfaceSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudDataDisk) DeepCopyInto(out *AlicloudDataDisk) {
- *out = *in
- if in.DeleteWithInstance != nil {
- in, out := &in.DeleteWithInstance, &out.DeleteWithInstance
- *out = new(bool)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudDataDisk.
-func (in *AlicloudDataDisk) DeepCopy() *AlicloudDataDisk {
- if in == nil {
- return nil
- }
- out := new(AlicloudDataDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudMachineClass) DeepCopyInto(out *AlicloudMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudMachineClass.
-func (in *AlicloudMachineClass) DeepCopy() *AlicloudMachineClass {
- if in == nil {
- return nil
- }
- out := new(AlicloudMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AlicloudMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudMachineClassList) DeepCopyInto(out *AlicloudMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]AlicloudMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudMachineClassList.
-func (in *AlicloudMachineClassList) DeepCopy() *AlicloudMachineClassList {
- if in == nil {
- return nil
- }
- out := new(AlicloudMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AlicloudMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudMachineClassSpec) DeepCopyInto(out *AlicloudMachineClassSpec) {
- *out = *in
- if in.SystemDisk != nil {
- in, out := &in.SystemDisk, &out.SystemDisk
- *out = new(AlicloudSystemDisk)
- **out = **in
- }
- if in.DataDisks != nil {
- in, out := &in.DataDisks, &out.DataDisks
- *out = make([]AlicloudDataDisk, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- if in.InternetMaxBandwidthIn != nil {
- in, out := &in.InternetMaxBandwidthIn, &out.InternetMaxBandwidthIn
- *out = new(int)
- **out = **in
- }
- if in.InternetMaxBandwidthOut != nil {
- in, out := &in.InternetMaxBandwidthOut, &out.InternetMaxBandwidthOut
- *out = new(int)
- **out = **in
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudMachineClassSpec.
-func (in *AlicloudMachineClassSpec) DeepCopy() *AlicloudMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(AlicloudMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudSystemDisk) DeepCopyInto(out *AlicloudSystemDisk) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudSystemDisk.
-func (in *AlicloudSystemDisk) DeepCopy() *AlicloudSystemDisk {
- if in == nil {
- return nil
- }
- out := new(AlicloudSystemDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureDataDisk) DeepCopyInto(out *AzureDataDisk) {
- *out = *in
- if in.Lun != nil {
- in, out := &in.Lun, &out.Lun
- *out = new(int32)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureDataDisk.
-func (in *AzureDataDisk) DeepCopy() *AzureDataDisk {
- if in == nil {
- return nil
- }
- out := new(AzureDataDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureHardwareProfile) DeepCopyInto(out *AzureHardwareProfile) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureHardwareProfile.
-func (in *AzureHardwareProfile) DeepCopy() *AzureHardwareProfile {
- if in == nil {
- return nil
- }
- out := new(AzureHardwareProfile)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureImageReference) DeepCopyInto(out *AzureImageReference) {
- *out = *in
- if in.URN != nil {
- in, out := &in.URN, &out.URN
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureImageReference.
-func (in *AzureImageReference) DeepCopy() *AzureImageReference {
- if in == nil {
- return nil
- }
- out := new(AzureImageReference)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureLinuxConfiguration) DeepCopyInto(out *AzureLinuxConfiguration) {
- *out = *in
- out.SSH = in.SSH
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureLinuxConfiguration.
-func (in *AzureLinuxConfiguration) DeepCopy() *AzureLinuxConfiguration {
- if in == nil {
- return nil
- }
- out := new(AzureLinuxConfiguration)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureMachineClass) DeepCopyInto(out *AzureMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineClass.
-func (in *AzureMachineClass) DeepCopy() *AzureMachineClass {
- if in == nil {
- return nil
- }
- out := new(AzureMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AzureMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureMachineClassList) DeepCopyInto(out *AzureMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]AzureMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineClassList.
-func (in *AzureMachineClassList) DeepCopy() *AzureMachineClassList {
- if in == nil {
- return nil
- }
- out := new(AzureMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AzureMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureMachineClassSpec) DeepCopyInto(out *AzureMachineClassSpec) {
- *out = *in
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- in.Properties.DeepCopyInto(&out.Properties)
- in.SubnetInfo.DeepCopyInto(&out.SubnetInfo)
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineClassSpec.
-func (in *AzureMachineClassSpec) DeepCopy() *AzureMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(AzureMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureMachineSetConfig) DeepCopyInto(out *AzureMachineSetConfig) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineSetConfig.
-func (in *AzureMachineSetConfig) DeepCopy() *AzureMachineSetConfig {
- if in == nil {
- return nil
- }
- out := new(AzureMachineSetConfig)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureManagedDiskParameters) DeepCopyInto(out *AzureManagedDiskParameters) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedDiskParameters.
-func (in *AzureManagedDiskParameters) DeepCopy() *AzureManagedDiskParameters {
- if in == nil {
- return nil
- }
- out := new(AzureManagedDiskParameters)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureNetworkInterfaceReference) DeepCopyInto(out *AzureNetworkInterfaceReference) {
- *out = *in
- if in.AzureNetworkInterfaceReferenceProperties != nil {
- in, out := &in.AzureNetworkInterfaceReferenceProperties, &out.AzureNetworkInterfaceReferenceProperties
- *out = new(AzureNetworkInterfaceReferenceProperties)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureNetworkInterfaceReference.
-func (in *AzureNetworkInterfaceReference) DeepCopy() *AzureNetworkInterfaceReference {
- if in == nil {
- return nil
- }
- out := new(AzureNetworkInterfaceReference)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureNetworkInterfaceReferenceProperties) DeepCopyInto(out *AzureNetworkInterfaceReferenceProperties) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureNetworkInterfaceReferenceProperties.
-func (in *AzureNetworkInterfaceReferenceProperties) DeepCopy() *AzureNetworkInterfaceReferenceProperties {
- if in == nil {
- return nil
- }
- out := new(AzureNetworkInterfaceReferenceProperties)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureNetworkProfile) DeepCopyInto(out *AzureNetworkProfile) {
- *out = *in
- in.NetworkInterfaces.DeepCopyInto(&out.NetworkInterfaces)
- if in.AcceleratedNetworking != nil {
- in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking
- *out = new(bool)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureNetworkProfile.
-func (in *AzureNetworkProfile) DeepCopy() *AzureNetworkProfile {
- if in == nil {
- return nil
- }
- out := new(AzureNetworkProfile)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureOSDisk) DeepCopyInto(out *AzureOSDisk) {
- *out = *in
- out.ManagedDisk = in.ManagedDisk
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureOSDisk.
-func (in *AzureOSDisk) DeepCopy() *AzureOSDisk {
- if in == nil {
- return nil
- }
- out := new(AzureOSDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureOSProfile) DeepCopyInto(out *AzureOSProfile) {
- *out = *in
- out.LinuxConfiguration = in.LinuxConfiguration
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureOSProfile.
-func (in *AzureOSProfile) DeepCopy() *AzureOSProfile {
- if in == nil {
- return nil
- }
- out := new(AzureOSProfile)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureSSHConfiguration) DeepCopyInto(out *AzureSSHConfiguration) {
- *out = *in
- out.PublicKeys = in.PublicKeys
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSSHConfiguration.
-func (in *AzureSSHConfiguration) DeepCopy() *AzureSSHConfiguration {
- if in == nil {
- return nil
- }
- out := new(AzureSSHConfiguration)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureSSHPublicKey) DeepCopyInto(out *AzureSSHPublicKey) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSSHPublicKey.
-func (in *AzureSSHPublicKey) DeepCopy() *AzureSSHPublicKey {
- if in == nil {
- return nil
- }
- out := new(AzureSSHPublicKey)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureStorageProfile) DeepCopyInto(out *AzureStorageProfile) {
- *out = *in
- in.ImageReference.DeepCopyInto(&out.ImageReference)
- out.OsDisk = in.OsDisk
- if in.DataDisks != nil {
- in, out := &in.DataDisks, &out.DataDisks
- *out = make([]AzureDataDisk, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStorageProfile.
-func (in *AzureStorageProfile) DeepCopy() *AzureStorageProfile {
- if in == nil {
- return nil
- }
- out := new(AzureStorageProfile)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureSubResource) DeepCopyInto(out *AzureSubResource) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSubResource.
-func (in *AzureSubResource) DeepCopy() *AzureSubResource {
- if in == nil {
- return nil
- }
- out := new(AzureSubResource)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureSubnetInfo) DeepCopyInto(out *AzureSubnetInfo) {
- *out = *in
- if in.VnetResourceGroup != nil {
- in, out := &in.VnetResourceGroup, &out.VnetResourceGroup
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSubnetInfo.
-func (in *AzureSubnetInfo) DeepCopy() *AzureSubnetInfo {
- if in == nil {
- return nil
- }
- out := new(AzureSubnetInfo)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureVirtualMachineProperties) DeepCopyInto(out *AzureVirtualMachineProperties) {
- *out = *in
- out.HardwareProfile = in.HardwareProfile
- in.StorageProfile.DeepCopyInto(&out.StorageProfile)
- out.OsProfile = in.OsProfile
- in.NetworkProfile.DeepCopyInto(&out.NetworkProfile)
- if in.AvailabilitySet != nil {
- in, out := &in.AvailabilitySet, &out.AvailabilitySet
- *out = new(AzureSubResource)
- **out = **in
- }
- if in.IdentityID != nil {
- in, out := &in.IdentityID, &out.IdentityID
- *out = new(string)
- **out = **in
- }
- if in.Zone != nil {
- in, out := &in.Zone, &out.Zone
- *out = new(int)
- **out = **in
- }
- if in.MachineSet != nil {
- in, out := &in.MachineSet, &out.MachineSet
- *out = new(AzureMachineSetConfig)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureVirtualMachineProperties.
-func (in *AzureVirtualMachineProperties) DeepCopy() *AzureVirtualMachineProperties {
- if in == nil {
- return nil
- }
- out := new(AzureVirtualMachineProperties)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ClassSpec) DeepCopyInto(out *ClassSpec) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassSpec.
-func (in *ClassSpec) DeepCopy() *ClassSpec {
- if in == nil {
- return nil
- }
- out := new(ClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *CurrentStatus) DeepCopyInto(out *CurrentStatus) {
- *out = *in
- in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CurrentStatus.
-func (in *CurrentStatus) DeepCopy() *CurrentStatus {
- if in == nil {
- return nil
- }
- out := new(CurrentStatus)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPDisk) DeepCopyInto(out *GCPDisk) {
- *out = *in
- if in.AutoDelete != nil {
- in, out := &in.AutoDelete, &out.AutoDelete
- *out = new(bool)
- **out = **in
- }
- if in.Labels != nil {
- in, out := &in.Labels, &out.Labels
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPDisk.
-func (in *GCPDisk) DeepCopy() *GCPDisk {
- if in == nil {
- return nil
- }
- out := new(GCPDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPMachineClass) DeepCopyInto(out *GCPMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPMachineClass.
-func (in *GCPMachineClass) DeepCopy() *GCPMachineClass {
- if in == nil {
- return nil
- }
- out := new(GCPMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *GCPMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPMachineClassList) DeepCopyInto(out *GCPMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]GCPMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPMachineClassList.
-func (in *GCPMachineClassList) DeepCopy() *GCPMachineClassList {
- if in == nil {
- return nil
- }
- out := new(GCPMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *GCPMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPMachineClassSpec) DeepCopyInto(out *GCPMachineClassSpec) {
- *out = *in
- if in.Description != nil {
- in, out := &in.Description, &out.Description
- *out = new(string)
- **out = **in
- }
- if in.Disks != nil {
- in, out := &in.Disks, &out.Disks
- *out = make([]*GCPDisk, len(*in))
- for i := range *in {
- if (*in)[i] != nil {
- in, out := &(*in)[i], &(*out)[i]
- *out = new(GCPDisk)
- (*in).DeepCopyInto(*out)
- }
- }
- }
- if in.Labels != nil {
- in, out := &in.Labels, &out.Labels
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.Metadata != nil {
- in, out := &in.Metadata, &out.Metadata
- *out = make([]*GCPMetadata, len(*in))
- for i := range *in {
- if (*in)[i] != nil {
- in, out := &(*in)[i], &(*out)[i]
- *out = new(GCPMetadata)
- (*in).DeepCopyInto(*out)
- }
- }
- }
- if in.NetworkInterfaces != nil {
- in, out := &in.NetworkInterfaces, &out.NetworkInterfaces
- *out = make([]*GCPNetworkInterface, len(*in))
- for i := range *in {
- if (*in)[i] != nil {
- in, out := &(*in)[i], &(*out)[i]
- *out = new(GCPNetworkInterface)
- **out = **in
- }
- }
- }
- out.Scheduling = in.Scheduling
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.ServiceAccounts != nil {
- in, out := &in.ServiceAccounts, &out.ServiceAccounts
- *out = make([]GCPServiceAccount, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPMachineClassSpec.
-func (in *GCPMachineClassSpec) DeepCopy() *GCPMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(GCPMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPMetadata) DeepCopyInto(out *GCPMetadata) {
- *out = *in
- if in.Value != nil {
- in, out := &in.Value, &out.Value
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPMetadata.
-func (in *GCPMetadata) DeepCopy() *GCPMetadata {
- if in == nil {
- return nil
- }
- out := new(GCPMetadata)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPNetworkInterface) DeepCopyInto(out *GCPNetworkInterface) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPNetworkInterface.
-func (in *GCPNetworkInterface) DeepCopy() *GCPNetworkInterface {
- if in == nil {
- return nil
- }
- out := new(GCPNetworkInterface)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPScheduling) DeepCopyInto(out *GCPScheduling) {
+func (in *ClassSpec) DeepCopyInto(out *ClassSpec) {
*out = *in
return
}
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPScheduling.
-func (in *GCPScheduling) DeepCopy() *GCPScheduling {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassSpec.
+func (in *ClassSpec) DeepCopy() *ClassSpec {
if in == nil {
return nil
}
- out := new(GCPScheduling)
+ out := new(ClassSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPServiceAccount) DeepCopyInto(out *GCPServiceAccount) {
+func (in *CurrentStatus) DeepCopyInto(out *CurrentStatus) {
*out = *in
- if in.Scopes != nil {
- in, out := &in.Scopes, &out.Scopes
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
+ in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
return
}
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPServiceAccount.
-func (in *GCPServiceAccount) DeepCopy() *GCPServiceAccount {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CurrentStatus.
+func (in *CurrentStatus) DeepCopy() *CurrentStatus {
if in == nil {
return nil
}
- out := new(GCPServiceAccount)
+ out := new(CurrentStatus)
in.DeepCopyInto(out)
return out
}
@@ -1733,241 +692,6 @@ func (in *NodeTemplateSpec) DeepCopy() *NodeTemplateSpec {
return out
}
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OpenStackMachineClass) DeepCopyInto(out *OpenStackMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackMachineClass.
-func (in *OpenStackMachineClass) DeepCopy() *OpenStackMachineClass {
- if in == nil {
- return nil
- }
- out := new(OpenStackMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *OpenStackMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OpenStackMachineClassList) DeepCopyInto(out *OpenStackMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]OpenStackMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackMachineClassList.
-func (in *OpenStackMachineClassList) DeepCopy() *OpenStackMachineClassList {
- if in == nil {
- return nil
- }
- out := new(OpenStackMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *OpenStackMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OpenStackMachineClassSpec) DeepCopyInto(out *OpenStackMachineClassSpec) {
- *out = *in
- if in.SecurityGroups != nil {
- in, out := &in.SecurityGroups, &out.SecurityGroups
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.Networks != nil {
- in, out := &in.Networks, &out.Networks
- *out = make([]OpenStackNetwork, len(*in))
- copy(*out, *in)
- }
- if in.SubnetID != nil {
- in, out := &in.SubnetID, &out.SubnetID
- *out = new(string)
- **out = **in
- }
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.UseConfigDrive != nil {
- in, out := &in.UseConfigDrive, &out.UseConfigDrive
- *out = new(bool)
- **out = **in
- }
- if in.ServerGroupID != nil {
- in, out := &in.ServerGroupID, &out.ServerGroupID
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackMachineClassSpec.
-func (in *OpenStackMachineClassSpec) DeepCopy() *OpenStackMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(OpenStackMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OpenStackNetwork) DeepCopyInto(out *OpenStackNetwork) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackNetwork.
-func (in *OpenStackNetwork) DeepCopy() *OpenStackNetwork {
- if in == nil {
- return nil
- }
- out := new(OpenStackNetwork)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *PacketMachineClass) DeepCopyInto(out *PacketMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PacketMachineClass.
-func (in *PacketMachineClass) DeepCopy() *PacketMachineClass {
- if in == nil {
- return nil
- }
- out := new(PacketMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *PacketMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *PacketMachineClassList) DeepCopyInto(out *PacketMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]PacketMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PacketMachineClassList.
-func (in *PacketMachineClassList) DeepCopy() *PacketMachineClassList {
- if in == nil {
- return nil
- }
- out := new(PacketMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *PacketMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *PacketMachineClassSpec) DeepCopyInto(out *PacketMachineClassSpec) {
- *out = *in
- if in.Facility != nil {
- in, out := &in.Facility, &out.Facility
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.SSHKeys != nil {
- in, out := &in.SSHKeys, &out.SSHKeys
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PacketMachineClassSpec.
-func (in *PacketMachineClassSpec) DeepCopy() *PacketMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(PacketMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RollbackConfig) DeepCopyInto(out *RollbackConfig) {
*out = *in
diff --git a/pkg/apis/machine/validation/alicloudmachineclass.go b/pkg/apis/machine/validation/alicloudmachineclass.go
deleted file mode 100644
index 1380c3c4e..000000000
--- a/pkg/apis/machine/validation/alicloudmachineclass.go
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package validation is used to validate all the machine CRD objects
-package validation
-
-import (
- "fmt"
- utilvalidation "k8s.io/apimachinery/pkg/util/validation"
- "regexp"
- "strings"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- apivalidation "k8s.io/apimachinery/pkg/api/validation"
- "k8s.io/apimachinery/pkg/util/validation/field"
-)
-
-// ValidateAlicloudMachineClass is to validate Alicoud machine class
-func ValidateAlicloudMachineClass(AlicloudMachineClass *machine.AlicloudMachineClass) field.ErrorList {
- return internalValidateAlicloudMachineClass(AlicloudMachineClass)
-}
-
-func internalValidateAlicloudMachineClass(AlicloudMachineClass *machine.AlicloudMachineClass) field.ErrorList {
- allErrs := field.ErrorList{}
-
- allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&AlicloudMachineClass.ObjectMeta, true,
- validateName,
- field.NewPath("metadata"))...)
-
- allErrs = append(allErrs, validateAlicloudMachineClassSpec(&AlicloudMachineClass.Spec, field.NewPath("spec"))...)
- return allErrs
-}
-
-func validateAlicloudMachineClassSpec(spec *machine.AlicloudMachineClassSpec, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if "" == spec.ImageID {
- allErrs = append(allErrs, field.Required(fldPath.Child("imageID"), "ImageID is required"))
- }
- if "" == spec.Region {
- allErrs = append(allErrs, field.Required(fldPath.Child("region"), "Region is required"))
- }
- if "" == spec.ZoneID {
- allErrs = append(allErrs, field.Required(fldPath.Child("zoneID"), "ZoneID is required"))
- }
- if "" == spec.InstanceType {
- allErrs = append(allErrs, field.Required(fldPath.Child("instanceType"), "InstanceType is required"))
- }
- if "" == spec.VSwitchID {
- allErrs = append(allErrs, field.Required(fldPath.Child("vSwitchID"), "VSwitchID is required"))
- }
- if "" == spec.KeyPairName {
- allErrs = append(allErrs, field.Required(fldPath.Child("keyPairName"), "KeyPairName is required"))
- }
-
- const dataDiskNameFmt string = `[a-zA-Z][a-zA-Z0-9\.\-_:]+`
- var dataDiskNameRegexp = regexp.MustCompile("^" + dataDiskNameFmt + "$")
-
-
- if spec.DataDisks != nil {
- names := map[string]int{}
- for i, dataDisk := range spec.DataDisks {
- idxPath := fldPath.Child("dataDisks").Index(i)
-
- if dataDisk.Name == "" {
- allErrs = append(allErrs, field.Required(idxPath.Child("name"), "Data Disk name is required"))
- } else if !dataDiskNameRegexp.MatchString(dataDisk.Name) {
- allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), dataDisk.Name, utilvalidation.RegexError(fmt.Sprintf("Disk name given: %s does not match the expected pattern", dataDisk.Name), dataDiskNameFmt)))
- } else if len(dataDisk.Name) > 64 {
- allErrs = append(allErrs, field.Invalid(idxPath.Child("name"), dataDisk.Name, "Data Disk Name length must be between 1 and 64"))
- } else {
- if _, keyExist := names[dataDisk.Name]; keyExist {
- names[dataDisk.Name]++
- } else {
- names[dataDisk.Name] = 1
- }
- }
- if dataDisk.Size < 20 || dataDisk.Size > 32768 {
- allErrs = append(allErrs, field.Invalid(idxPath.Child("size"), dataDisk.Size, utilvalidation.InclusiveRangeError(20, 32768)))
- }
- if dataDisk.Category == "" {
- allErrs = append(allErrs, field.Required(idxPath.Child("category"), "Data Disk category is required"))
- }
- }
-
- for name, number := range names {
- if number > 1 {
- allErrs = append(allErrs, field.Invalid(fldPath.Child("dataDisks"), name, fmt.Sprintf("Data Disk Name '%s' duplicated %d times, Name must be unique", name, number)))
- }
- }
- }
-
- allErrs = append(allErrs, validateSecretRef(spec.SecretRef, field.NewPath("spec.secretRef"))...)
- allErrs = append(allErrs, validateAlicloudClassSpecTags(spec.Tags, field.NewPath("spec.tags"))...)
-
- return allErrs
-}
-
-func validateAlicloudClassSpecTags(tags map[string]string, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
- clusterName := ""
- nodeRole := ""
-
- if tags == nil {
- allErrs = append(allErrs, field.Required(fldPath.Child("tags"), "Tags required for Alicloud machines"))
- }
-
- for key := range tags {
- if strings.Contains(key, "kubernetes.io/cluster/") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes.io/role/") {
- nodeRole = key
- }
- }
-
- if clusterName == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io/cluster/"), "Tag required of the form kubernetes.io/cluster/****"))
- }
- if nodeRole == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io/role/"), "Tag required of the form kubernetes.io/role/****"))
- }
-
- return allErrs
-}
diff --git a/pkg/apis/machine/validation/alicloudmachineclass_test.go b/pkg/apis/machine/validation/alicloudmachineclass_test.go
deleted file mode 100644
index 5b534f5d2..000000000
--- a/pkg/apis/machine/validation/alicloudmachineclass_test.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package validation
-
-import (
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/validation/field"
- "strings"
-)
-
-func getAliCloudMachineSpec() *machine.AlicloudMachineClassSpec {
- bandwidth := 5
- deleteVol1 := true
- deleteVol2 := false
- return &machine.AlicloudMachineClassSpec{
- ImageID: "coreos_1745_7_0_64_30G_alibase_20180705.vhd",
- InstanceType: "ecs.n1.medium",
- Region: "cn-hangzhou",
- ZoneID: "cn-hangzhou-e",
- SecurityGroupID: "sg-1234567890",
- VSwitchID: "vsw-1234567890",
- SystemDisk: &machine.AlicloudSystemDisk{
- Category: "cloud_efficiency",
- Size: 75,
- },
- DataDisks: []machine.AlicloudDataDisk{
- {
- Name: "dd1",
- Category: "cloud_efficiency",
- Size: 75,
- Encrypted: true,
- DeleteWithInstance: &deleteVol1,
- },
- {
- Name: "dd2",
- Category: "cloud_efficiency",
- Size: 75,
- Encrypted: true,
- DeleteWithInstance: &deleteVol2,
- },
- },
- InstanceChargeType: "PostPaid",
- InternetChargeType: "PayByTraffic",
- InternetMaxBandwidthIn: &bandwidth,
- InternetMaxBandwidthOut: &bandwidth,
- SpotStrategy: "NoSpot",
- KeyPairName: "my-ssh-key",
- Tags: map[string]string{
- "kubernetes.io/cluster/shoot": "1",
- "kubernetes.io/role/role": "1",
- },
- SecretRef: &corev1.SecretReference{
- Name: "test-secret",
- Namespace: "test-namespace",
- },
- }
-}
-
-var _ = Describe("AliCloudMachineClass Validation", func() {
-
- Context("Validate AliCloudMachineClass Spec", func() {
-
- It("should validate an object successfully", func() {
-
- spec := getAliCloudMachineSpec()
- err := validateAlicloudMachineClassSpec(spec, field.NewPath("spec"))
-
- Expect(err).To(Equal(field.ErrorList{}))
- })
-
- It("should get an error on DataDisks validation", func() {
- spec := getAliCloudMachineSpec()
- longname := strings.Repeat("longname", 10)
- spec.DataDisks = []machine.AlicloudDataDisk{
- {
- Name: "",
- Category: "",
- Size: 10,
- Encrypted: true,
- },
- {
- Name: "dd1",
- Category: "cloud_efficiency",
- Size: 32769,
- Encrypted: true,
- },
- {
- Name: "dd1",
- Category: "cloud_efficiency",
- Size: 75,
- Encrypted: true,
- },
- {
- Name: "bad$#%name",
- Category: "cloud_efficiency",
- Size: 75,
- Encrypted: true,
- },
- {
- Name: longname,
- Category: "cloud_efficiency",
- Size: 75,
- Encrypted: true,
- },
- }
-
- errList := validateAlicloudMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: field.ErrorTypeRequired,
- Field: "spec.dataDisks[0].name",
- BadValue: "",
- Detail: "Data Disk name is required",
- },
- {
- Type: field.ErrorTypeInvalid,
- Field: "spec.dataDisks[0].size",
- BadValue: 10,
- Detail: "must be between 20 and 32768, inclusive",
- },
- {
- Type: field.ErrorTypeRequired,
- Field: "spec.dataDisks[0].category",
- BadValue: "",
- Detail: "Data Disk category is required",
- },
- {
- Type: field.ErrorTypeInvalid,
- Field: "spec.dataDisks[1].size",
- BadValue: 32769,
- Detail: "must be between 20 and 32768, inclusive",
- },
- {
- Type: field.ErrorTypeInvalid,
- Field: "spec.dataDisks",
- BadValue: "dd1",
- Detail: "Data Disk Name 'dd1' duplicated 2 times, Name must be unique",
- },
- {
- Type: field.ErrorTypeInvalid,
- Field: "spec.dataDisks[3].name",
- BadValue: "bad$#%name",
- Detail: "Disk name given: bad$#%name does not match the expected pattern (regex used for validation is '[a-zA-Z][a-zA-Z0-9\\.\\-_:]+')",
- },
- {
- Type: field.ErrorTypeInvalid,
- Field: "spec.dataDisks[4].name",
- BadValue: longname,
- Detail: "Data Disk Name length must be between 1 and 64",
- },
- }
- Expect(errList).To(ConsistOf(errExpected))
- })
- })
-})
diff --git a/pkg/apis/machine/validation/awsmachineclass.go b/pkg/apis/machine/validation/awsmachineclass.go
deleted file mode 100644
index 8fee9385d..000000000
--- a/pkg/apis/machine/validation/awsmachineclass.go
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package validation is used to validate all the machine CRD objects
-package validation
-
-import (
- "fmt"
- "regexp"
- "strconv"
- "strings"
-
- corev1 "k8s.io/api/core/v1"
- apivalidation "k8s.io/apimachinery/pkg/api/validation"
- utilvalidation "k8s.io/apimachinery/pkg/util/validation"
- "k8s.io/apimachinery/pkg/util/validation/field"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
-)
-
-const nameFmt string = `[-a-z0-9]+`
-const nameMaxLength int = 63
-
-var nameRegexp = regexp.MustCompile("^" + nameFmt + "$")
-
-func contains(arr []string, checkValue string) bool {
- for _, value := range arr {
- if value == checkValue {
- return true
- }
- }
- return false
-}
-
-// validateName is the validation function for object names.
-func validateName(value string, prefix bool) []string {
- var errs []string
- if len(value) > nameMaxLength {
- errs = append(errs, utilvalidation.MaxLenError(nameMaxLength))
- }
- if !nameRegexp.MatchString(value) {
- errs = append(errs, utilvalidation.RegexError(nameFmt, "name-40d-0983-1b89"))
- }
-
- return errs
-}
-
-// ValidateAWSMachineClass validates a AWSMachineClass and returns a list of errors.
-func ValidateAWSMachineClass(AWSMachineClass *machine.AWSMachineClass) field.ErrorList {
- return internalValidateAWSMachineClass(AWSMachineClass)
-}
-
-func internalValidateAWSMachineClass(AWSMachineClass *machine.AWSMachineClass) field.ErrorList {
- allErrs := field.ErrorList{}
-
- allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&AWSMachineClass.ObjectMeta, true, /*namespace*/
- validateName,
- field.NewPath("metadata"))...)
-
- allErrs = append(allErrs, validateAWSMachineClassSpec(&AWSMachineClass.Spec, field.NewPath("spec"))...)
- return allErrs
-}
-
-func validateAWSMachineClassSpec(spec *machine.AWSMachineClassSpec, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if "" == spec.AMI {
- allErrs = append(allErrs, field.Required(fldPath.Child("ami"), "AMI is required"))
- }
- if "" == spec.Region {
- allErrs = append(allErrs, field.Required(fldPath.Child("region"), "Region is required"))
- }
- if "" == spec.MachineType {
- allErrs = append(allErrs, field.Required(fldPath.Child("machineType"), "MachineType is required"))
- }
- if "" == spec.IAM.Name {
- allErrs = append(allErrs, field.Required(fldPath.Child("iam.name"), "IAM Name is required"))
- }
- if "" == spec.KeyName {
- allErrs = append(allErrs, field.Required(fldPath.Child("keyName"), "KeyName is required"))
- }
-
- allErrs = append(allErrs, validateBlockDevices(spec.BlockDevices, field.NewPath("spec.blockDevices"))...)
- allErrs = append(allErrs, validateNetworkInterfaces(spec.NetworkInterfaces, field.NewPath("spec.networkInterfaces"))...)
- allErrs = append(allErrs, validateSecretRef(spec.SecretRef, field.NewPath("spec.secretRef"))...)
- allErrs = append(allErrs, validateAWSClassSpecTags(spec.Tags, field.NewPath("spec.tags"))...)
-
- return allErrs
-}
-
-func validateAWSClassSpecTags(tags map[string]string, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
- clusterName := ""
- nodeRole := ""
-
- for key := range tags {
- if strings.Contains(key, "kubernetes.io/cluster/") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes.io/role/") {
- nodeRole = key
- }
- }
-
- if clusterName == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io/cluster/"), "Tag required of the form kubernetes.io/cluster/****"))
- }
- if nodeRole == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io/role/"), "Tag required of the form kubernetes.io/role/****"))
- }
-
- return allErrs
-}
-
-func validateBlockDevices(blockDevices []machine.AWSBlockDeviceMappingSpec, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- rootPartitionCount := 0
- var deviceNames = make(map[string]int)
-
- validVolumeTypes := []string{"gp2", "io1", "st1", "sc1", "standard"}
-
- // https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html
- const dataDeviceNameFmt string = `/dev/(sd[a-z]|xvd[a-c][a-z]?)`
- var dataDeviceNameRegexp = regexp.MustCompile("^" + dataDeviceNameFmt + "$")
-
- // if blockDevices is empty, AWS will automatically create a root partition
- for i, disk := range blockDevices {
- idxPath := fldPath.Index(i)
-
- if disk.DeviceName == "/root" {
- rootPartitionCount++
- } else if len(blockDevices) > 1 && !dataDeviceNameRegexp.MatchString(disk.DeviceName) {
- // if there are multiple devices, non-root devices are expected to adhere to AWS naming conventions
- allErrs = append(allErrs, field.Invalid(idxPath.Child("deviceName"), disk.DeviceName, utilvalidation.RegexError(fmt.Sprintf("Device name given: %s does not match the expected pattern", disk.DeviceName), dataDeviceNameFmt)))
- }
-
- if _, keyExist := deviceNames[disk.DeviceName]; keyExist {
- deviceNames[disk.DeviceName]++
- } else {
- deviceNames[disk.DeviceName] = 1
- }
-
- if !contains(validVolumeTypes, disk.Ebs.VolumeType) {
- allErrs = append(allErrs, field.Required(idxPath.Child("ebs.volumeType"), "Please mention a valid ebs volume type: gp2, io1, st1, sc1, or standard."))
- }
-
- if disk.Ebs.VolumeSize <= 0 {
- allErrs = append(allErrs, field.Required(idxPath.Child("ebs.volumeSize"), "Please mention a valid ebs volume size"))
- }
- if disk.Ebs.VolumeType == "" {
- allErrs = append(allErrs, field.Required(idxPath.Child("ebs.volumeType"), "Please mention a valid ebs volume type"))
- } else if disk.Ebs.VolumeType == "io1" && disk.Ebs.Iops <= 0 {
- allErrs = append(allErrs, field.Required(idxPath.Child("ebs.iops"), "Please mention a valid ebs volume iops"))
- }
-
- }
-
- if rootPartitionCount > 1 {
- allErrs = append(allErrs, field.Required(fldPath, "Only one '/root' partition can be specified"))
- // len(blockDevices) > 1 allow backward compatibility when a single disk is provided without DeviceName
- } else if rootPartitionCount == 0 && len(blockDevices) > 1 {
- allErrs = append(allErrs, field.Required(fldPath, "Device name with '/root' partition must be specified"))
- }
-
- for device, number := range deviceNames {
- if number > 1 {
- allErrs = append(allErrs, field.Required(fldPath, fmt.Sprintf("Device name '%s' duplicated %d times, DeviceName must be uniq", device, number)))
- }
- }
-
- return allErrs
-}
-
-func validateNetworkInterfaces(networkInterfaces []machine.AWSNetworkInterfaceSpec, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
- if len(networkInterfaces) == 0 {
- allErrs = append(allErrs, field.Required(fldPath.Child(""), "Mention at least one NetworkInterface"))
- } else {
- for i := range networkInterfaces {
- if "" == networkInterfaces[i].SubnetID {
- allErrs = append(allErrs, field.Required(fldPath.Child("subnetID"), "SubnetID is required"))
- }
-
- if 0 == len(networkInterfaces[i].SecurityGroupIDs) {
- allErrs = append(allErrs, field.Required(fldPath.Child("securityGroupIDs"), "Mention at least one securityGroupID"))
- } else {
- for j := range networkInterfaces[i].SecurityGroupIDs {
- if "" == networkInterfaces[i].SecurityGroupIDs[j] {
- output := strings.Join([]string{"securityGroupIDs cannot be blank for networkInterface:", strconv.Itoa(i), " securityGroupID:", strconv.Itoa(j)}, "")
- allErrs = append(allErrs, field.Required(fldPath.Child("securityGroupIDs"), output))
- }
- }
- }
- }
- }
- return allErrs
-}
-
-func validateSecretRef(reference *corev1.SecretReference, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
- if "" == reference.Name {
- allErrs = append(allErrs, field.Required(fldPath.Child("name"), "name is required"))
- }
-
- if "" == reference.Namespace {
- allErrs = append(allErrs, field.Required(fldPath.Child("namespace"), "namespace is required"))
- }
- return allErrs
-}
diff --git a/pkg/apis/machine/validation/awsmachineclass_test.go b/pkg/apis/machine/validation/awsmachineclass_test.go
deleted file mode 100644
index 792a4eaab..000000000
--- a/pkg/apis/machine/validation/awsmachineclass_test.go
+++ /dev/null
@@ -1,427 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package validation is used to validate all the machine CRD objects
-package validation
-
-import (
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/validation/field"
-)
-
-func getSpec() *machine.AWSMachineClassSpec {
- return &machine.AWSMachineClassSpec{
- AMI: "ami-99fn8a892f94e765a",
- Region: "eu-west-1",
- BlockDevices: []machine.AWSBlockDeviceMappingSpec{},
- EbsOptimized: true,
- IAM: machine.AWSIAMProfileSpec{
- Name: "iam-name",
- },
- MachineType: "m5.large",
- KeyName: "keyname",
- Monitoring: true,
- NetworkInterfaces: []machine.AWSNetworkInterfaceSpec{
- {
- SubnetID: "subnet-d660fb99",
- SecurityGroupIDs: []string{"sg-0c3a49f760fe5cbfe", "sg-0c3a49f789898dwwdw", "sg-0c3a49f789898ddsdfe"},
- },
- },
- Tags: map[string]string{
- "kubernetes.io/cluster/env": "shared",
- "kubernetes.io/role/env": "1",
- },
- SecretRef: &corev1.SecretReference{
- Name: "test-secret",
- Namespace: "test-namespace",
- },
- }
-}
-
-var _ = Describe("AWSMachineClass Validation", func() {
-
- Context("Validate AWSMachineClass Spec", func() {
-
- It("should validate an object successfully", func() {
-
- spec := getSpec()
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- Expect(err).To(Equal(field.ErrorList{}))
- })
-
- It("should get an error - fields required", func() {
-
- spec := getSpec()
- spec.AMI = ""
- spec.Region = ""
- spec.MachineType = ""
- spec.NetworkInterfaces = []machine.AWSNetworkInterfaceSpec{}
- spec.IAM = machine.AWSIAMProfileSpec{}
- spec.KeyName = ""
- spec.SecretRef = &corev1.SecretReference{}
- spec.Tags = map[string]string{}
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: "FieldValueRequired",
- Field: "spec.ami",
- BadValue: "",
- Detail: "AMI is required",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.region",
- BadValue: "",
- Detail: "Region is required",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.machineType",
- BadValue: "",
- Detail: "MachineType is required",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.iam.name",
- BadValue: "",
- Detail: "IAM Name is required",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.keyName",
- BadValue: "",
- Detail: "KeyName is required",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.networkInterfaces[]",
- BadValue: "",
- Detail: "Mention at least one NetworkInterface",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.secretRef.name",
- BadValue: "",
- Detail: "name is required",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.secretRef.namespace",
- BadValue: "",
- Detail: "namespace is required",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.tags.kubernetes.io/cluster/",
- BadValue: "",
- Detail: "Tag required of the form kubernetes.io/cluster/****",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.tags.kubernetes.io/role/",
- BadValue: "",
- Detail: "Tag required of the form kubernetes.io/role/****",
- },
- }
-
- Expect(err).To(Equal(errExpected))
- })
-
- It("should get an error on NetworkInterfaces validation", func() {
- spec := getSpec()
- spec.NetworkInterfaces = []machine.AWSNetworkInterfaceSpec{
- {
- SubnetID: "",
- SecurityGroupIDs: []string{"", "sg-0c3a49f789898dwwdw", "sg-0c3a49f789898ddsdfe"},
- },
- }
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: "FieldValueRequired",
- Field: "spec.networkInterfaces.subnetID",
- BadValue: "",
- Detail: "SubnetID is required",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.networkInterfaces.securityGroupIDs",
- BadValue: "",
- Detail: "securityGroupIDs cannot be blank for networkInterface:0 securityGroupID:0",
- },
- }
- Expect(err).To(Equal(errExpected))
- })
-
- It("should get an error on BlockDevices validation - wrong ebs definition", func() {
- spec := getSpec()
- spec.BlockDevices = []machine.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "/test",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 0,
- VolumeType: "",
- },
- },
- }
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices[0].ebs.volumeType",
- BadValue: "",
- Detail: "Please mention a valid ebs volume type: gp2, io1, st1, sc1, or standard.",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices[0].ebs.volumeSize",
- BadValue: "",
- Detail: "Please mention a valid ebs volume size",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices[0].ebs.volumeType",
- BadValue: "",
- Detail: "Please mention a valid ebs volume type",
- },
- }
- Expect(err).To(Equal(errExpected))
- })
-
- It("should get an error on BlockDevices validation - wrong iops ebs definition", func() {
- spec := getSpec()
- spec.BlockDevices = []machine.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "/test",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 0,
- VolumeType: "io1",
- Iops: 0,
- },
- },
- }
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices[0].ebs.volumeSize",
- BadValue: "",
- Detail: "Please mention a valid ebs volume size",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices[0].ebs.iops",
- BadValue: "",
- Detail: "Please mention a valid ebs volume iops",
- },
- }
- Expect(err).To(Equal(errExpected))
- })
-
- It("should get an error on BlockDevices validation - duplicated root device name", func() {
- spec := getSpec()
- spec.BlockDevices = []machine.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "/root",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 10,
- VolumeType: "gp2",
- },
- },
- {
- DeviceName: "/root",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 15,
- VolumeType: "gp2",
- },
- },
- }
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices",
- BadValue: "",
- Detail: "Only one '/root' partition can be specified",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices",
- BadValue: "",
- Detail: "Device name '/root' duplicated 2 times, DeviceName must be uniq",
- },
- }
- Expect(err).To(Equal(errExpected))
- })
-
- It("should get an error on BlockDevices validation - duplicated device name", func() {
- spec := getSpec()
- spec.BlockDevices = []machine.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "/dev/sdf",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 10,
- VolumeType: "gp2",
- },
- },
- {
- DeviceName: "/dev/sdf",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 15,
- VolumeType: "gp2",
- },
- },
- }
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices",
- BadValue: "",
- Detail: "Device name with '/root' partition must be specified",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices",
- BadValue: "",
- Detail: "Device name '/dev/sdf' duplicated 2 times, DeviceName must be uniq",
- },
- }
- Expect(err).To(Equal(errExpected))
- })
-
- It("should get an error on BlockDevices validation - invalid device name", func() {
- spec := getSpec()
- spec.BlockDevices = []machine.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "/dev/vdga",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 10,
- VolumeType: "gp2",
- },
- },
- {
- DeviceName: "/dev/sdf",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 15,
- VolumeType: "gp2",
- },
- },
- }
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: "FieldValueInvalid",
- Field: "spec.blockDevices[0].deviceName",
- BadValue: "/dev/vdga",
- Detail: "Device name given: /dev/vdga does not match the expected pattern (regex used for validation is '/dev/(sd[a-z]|xvd[a-c][a-z]?)')",
- },
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices",
- BadValue: "",
- Detail: "Device name with '/root' partition must be specified",
- },
- }
- Expect(err).To(Equal(errExpected))
- })
-
- It("should get an error on BlockDevices validation - invalid volumeType", func() {
- spec := getSpec()
- spec.BlockDevices = []machine.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "/dev/sdf",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 10,
- VolumeType: "gp2-invalid",
- },
- },
- }
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: "FieldValueRequired",
- Field: "spec.blockDevices[0].ebs.volumeType",
- BadValue: "",
- Detail: "Please mention a valid ebs volume type: gp2, io1, st1, sc1, or standard.",
- },
- }
- Expect(err).To(Equal(errExpected))
- })
-
- It("should validate an object successfully - with one EBS without root device name", func() {
- spec := getSpec()
- spec.BlockDevices = []machine.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 10,
- VolumeType: "gp2",
- },
- },
- }
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- Expect(err).To(Equal(field.ErrorList{}))
- })
-
- It("should validate an object successfully - with multiples EBS", func() {
- spec := getSpec()
- spec.BlockDevices = []machine.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "/root",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 10,
- VolumeType: "gp2",
- },
- },
- {
- DeviceName: "/dev/sdf",
- Ebs: machine.AWSEbsBlockDeviceSpec{
- VolumeSize: 15,
- VolumeType: "gp2",
- },
- },
- }
-
- err := validateAWSMachineClassSpec(spec, field.NewPath("spec"))
-
- Expect(err).To(Equal(field.ErrorList{}))
- })
-
- })
-
-})
diff --git a/pkg/apis/machine/validation/azuremachineclass.go b/pkg/apis/machine/validation/azuremachineclass.go
deleted file mode 100644
index 7bd2c27d7..000000000
--- a/pkg/apis/machine/validation/azuremachineclass.go
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package validation is used to validate all the machine CRD objects
-package validation
-
-import (
- "fmt"
- "strings"
-
- utilvalidation "k8s.io/apimachinery/pkg/util/validation"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
-
- "k8s.io/apimachinery/pkg/util/validation/field"
-)
-
-// ValidateAzureMachineClass validates a AzureMachineClass and returns a list of errors.
-func ValidateAzureMachineClass(AzureMachineClass *machine.AzureMachineClass) field.ErrorList {
- return internalValidateAzureMachineClass(AzureMachineClass)
-}
-
-func internalValidateAzureMachineClass(AzureMachineClass *machine.AzureMachineClass) field.ErrorList {
- allErrs := field.ErrorList{}
- allErrs = append(allErrs, validateAzureMachineClassSpec(&AzureMachineClass.Spec, field.NewPath("spec"))...)
- return allErrs
-}
-
-func validateAzureMachineClassSpec(spec *machine.AzureMachineClassSpec, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if "" == spec.Location {
- allErrs = append(allErrs, field.Required(fldPath.Child("location"), "Location is required"))
- }
- if "" == spec.ResourceGroup {
- allErrs = append(allErrs, field.Required(fldPath.Child("resourceGroup"), "ResourceGroup is required"))
- }
- if "" == spec.SubnetInfo.SubnetName {
- allErrs = append(allErrs, field.Required(fldPath.Child("subnetInfo.subnetName"), "SubnetName is required"))
- }
- if "" == spec.SubnetInfo.VnetName {
- allErrs = append(allErrs, field.Required(fldPath.Child("subnetInfo.vnetName"), "VNetName Name is required"))
- }
-
- allErrs = append(allErrs, validateAzureProperties(spec.Properties, field.NewPath("spec.properties"))...)
- allErrs = append(allErrs, validateSecretRef(spec.SecretRef, field.NewPath("spec.secretRef"))...)
- allErrs = append(allErrs, validateAzureClassSpecTags(spec.Tags, field.NewPath("spec.tags"))...)
-
- return allErrs
-}
-
-func validateAzureClassSpecTags(tags map[string]string, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
- clusterName := ""
- nodeRole := ""
-
- for key := range tags {
- if strings.Contains(key, "kubernetes.io-cluster-") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes.io-role-") {
- nodeRole = key
- }
- }
-
- if clusterName == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io-cluster-"), "Tag required of the form kubernetes.io-cluster-****"))
- }
- if nodeRole == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io-role-"), "Tag required of the form kubernetes.io-role-****"))
- }
-
- return allErrs
-}
-
-func validateAzureProperties(properties machine.AzureVirtualMachineProperties, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if properties.HardwareProfile.VMSize == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("hardwareProfile.vmSize"), "VMSize is required"))
- }
-
- imageRef := properties.StorageProfile.ImageReference
- if ((imageRef.URN == nil || *imageRef.URN == "") && imageRef.ID == "") ||
- (imageRef.URN != nil && *imageRef.URN != "" && imageRef.ID != "") {
- allErrs = append(allErrs, field.Required(fldPath.Child("storageProfile.imageReference"), "must specify either a image id or an urn"))
- } else if imageRef.URN != nil && *imageRef.URN != "" {
- splits := strings.Split(*imageRef.URN, ":")
- if len(splits) != 4 {
- allErrs = append(allErrs, field.Required(fldPath.Child("storageProfile.imageReference.urn"), "Invalid urn format"))
- } else {
- for _, s := range splits {
- if len(s) == 0 {
- allErrs = append(allErrs, field.Required(fldPath.Child("storageProfile.imageReference.urn"), "Invalid urn format, empty field"))
- }
- }
- }
- }
-
- if properties.StorageProfile.OsDisk.DiskSizeGB <= 0 {
- allErrs = append(allErrs, field.Required(fldPath.Child("storageProfile.osDisk.diskSizeGB"), "OSDisk size must be positive"))
- }
- if properties.StorageProfile.OsDisk.CreateOption == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("storageProfile.osDisk.createOption"), "OSDisk create option is required"))
- }
-
- if properties.StorageProfile.DataDisks != nil {
-
- if len(properties.StorageProfile.DataDisks) > 64 {
- allErrs = append(allErrs, field.TooMany(fldPath.Child("storageProfile.dataDisks"), len(properties.StorageProfile.DataDisks), 64))
- }
-
- luns := map[int32]int{}
- for i, dataDisk := range properties.StorageProfile.DataDisks {
- idxPath := fldPath.Child("storageProfile.dataDisks").Index(i)
-
- lun := dataDisk.Lun
-
- if lun == nil {
- allErrs = append(allErrs, field.Required(idxPath.Child("lun"), "DataDisk Lun is required"))
- } else {
- if *lun < 0 || *lun > 63 {
- allErrs = append(allErrs, field.Invalid(idxPath.Child("lun"), *lun, utilvalidation.InclusiveRangeError(0, 63)))
- }
- if _, keyExist := luns[*lun]; keyExist {
- luns[*lun]++
- } else {
- luns[*lun] = 1
- }
- }
-
- if dataDisk.DiskSizeGB <= 0 {
- allErrs = append(allErrs, field.Required(idxPath.Child("diskSizeGB"), "DataDisk size must be positive"))
- }
- if dataDisk.StorageAccountType == "" {
- allErrs = append(allErrs, field.Required(idxPath.Child("storageAccountType"), "DataDisk storage account type is required"))
- }
- }
-
- for lun, number := range luns {
- if number > 1 {
- allErrs = append(allErrs, field.Invalid(fldPath.Child("storageProfile.dataDisks"), lun, fmt.Sprintf("Data Disk Lun '%d' duplicated %d times, Lun must be unique", lun, number)))
- }
- }
- }
- if properties.OsProfile.AdminUsername == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("osProfile.adminUsername"), "AdminUsername is required"))
- }
-
- if properties.Zone == nil && properties.MachineSet == nil && properties.AvailabilitySet == nil {
- allErrs = append(allErrs, field.Forbidden(fldPath.Child("zone|.machineSet|.availabilitySet"), "Machine need to be assigned to a zone, a MachineSet or an AvailabilitySet"))
- }
-
- if properties.Zone != nil && (properties.MachineSet != nil || properties.AvailabilitySet != nil) {
- allErrs = append(allErrs, field.Forbidden(fldPath.Child("zone|.machineSet|.availabilitySet"), "Machine cannot be assigned to a zone, a MachineSet and an AvailabilitySet in parallel"))
- }
-
- if properties.Zone == nil {
- if properties.MachineSet != nil && properties.AvailabilitySet != nil {
- allErrs = append(allErrs, field.Forbidden(fldPath.Child("machineSet|.availabilitySet"), "Machine cannot be assigned a MachineSet and an AvailabilitySet in parallel"))
- }
- if properties.MachineSet != nil && !(properties.MachineSet.Kind == machine.MachineSetKindVMO || properties.MachineSet.Kind == machine.MachineSetKindAvailabilitySet) {
- allErrs = append(allErrs, field.Invalid(fldPath.Child("machineSet"), properties.MachineSet.Kind, fmt.Sprintf("Invalid MachineSet kind. Use either '%s' or '%s'", machine.MachineSetKindVMO, machine.MachineSetKindAvailabilitySet)))
- }
- }
-
- /*
- if properties.OsProfile.LinuxConfiguration.SSH.PublicKeys.Path == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("osProfile.linuxConfiguration.ssh.publicKeys.path"), "PublicKey path is required"))
- }
- if properties.OsProfile.LinuxConfiguration.SSH.PublicKeys.KeyData == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("osProfile.linuxConfiguration.ssh.publicKeys.keyData"), "PublicKey data is required"))
- }*/
-
- return allErrs
-}
diff --git a/pkg/apis/machine/validation/azuremachineclass_test.go b/pkg/apis/machine/validation/azuremachineclass_test.go
deleted file mode 100644
index 07a67e40d..000000000
--- a/pkg/apis/machine/validation/azuremachineclass_test.go
+++ /dev/null
@@ -1,242 +0,0 @@
-package validation
-
-import (
- "fmt"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/validation/field"
-)
-
-func getAzureMachineSpec() *machine.AzureMachineClassSpec {
- urn := "CoreOS:CoreOS:Stable:2303.3.0"
- zone := 1
- lun0 := int32(0)
- lun1 := int32(1)
- return &machine.AzureMachineClassSpec{
- Location: "westeurope",
- Properties: machine.AzureVirtualMachineProperties{
- HardwareProfile: machine.AzureHardwareProfile{
- VMSize: "Standard_A1_v2",
- },
- OsProfile: machine.AzureOSProfile{
- AdminUsername: "core",
- LinuxConfiguration: machine.AzureLinuxConfiguration{
- DisablePasswordAuthentication: true,
- SSH: machine.AzureSSHConfiguration{
- PublicKeys: machine.AzureSSHPublicKey{
- KeyData: "this-is-a-key",
- Path: "/home/core/.ssh/authorized_keys",
- },
- },
- },
- },
- StorageProfile: machine.AzureStorageProfile{
- ImageReference: machine.AzureImageReference{
- URN: &urn,
- },
- OsDisk: machine.AzureOSDisk{
- Caching: "None",
- CreateOption: "FromImage",
- DiskSizeGB: 75,
- ManagedDisk: machine.AzureManagedDiskParameters{
- StorageAccountType: "Standard_LRS",
- },
- },
- DataDisks: []machine.AzureDataDisk{
- {
- Lun: &lun0,
- Caching: "None",
- DiskSizeGB: 75,
- StorageAccountType: "Standard_LRS",
- },
- {
- Lun: &lun1,
- Caching: "None",
- DiskSizeGB: 75,
- StorageAccountType: "Standard_LRS",
- },
- },
- },
- Zone: &zone,
- },
- ResourceGroup: "resourcegroup",
- SubnetInfo: machine.AzureSubnetInfo{
- SubnetName: "subnetnamne", VnetName: "vnetname",
- },
- Tags: map[string]string{
- "kubernetes.io-cluster-shoot": "1",
- "kubernetes.io-role-node": "1",
- },
- SecretRef: &corev1.SecretReference{
- Name: "test-secret",
- Namespace: "test-namespace",
- },
- }
-}
-
-var _ = Describe("AzureMachineClass Validation", func() {
-
- Context("Validate AzureMachineClass Spec", func() {
-
- It("should validate an object successfully", func() {
-
- spec := getAzureMachineSpec()
- err := validateAzureMachineClassSpec(spec, field.NewPath("spec"))
-
- Expect(err).To(Equal(field.ErrorList{}))
- })
-
- It("should get an error on DataDisks validation", func() {
- spec := getAzureMachineSpec()
- spec.Properties.StorageProfile.DataDisks = []machine.AzureDataDisk{
- {
- Name: "sdb",
- },
- }
-
- errList := validateAzureMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: field.ErrorTypeRequired,
- Field: "spec.properties.storageProfile.dataDisks[0].lun",
- BadValue: "",
- Detail: "DataDisk Lun is required",
- },
- {
- Type: field.ErrorTypeRequired,
- Field: "spec.properties.storageProfile.dataDisks[0].diskSizeGB",
- BadValue: "",
- Detail: "DataDisk size must be positive",
- },
- {
- Type: field.ErrorTypeRequired,
- Field: "spec.properties.storageProfile.dataDisks[0].storageAccountType",
- BadValue: "",
- Detail: "DataDisk storage account type is required",
- },
- }
- Expect(errList).To(ConsistOf(errExpected))
-
- })
-
- It("should get an error on duplicated DataDisks lun", func() {
- spec := getAzureMachineSpec()
- lun1 := int32(1)
- spec.Properties.StorageProfile.DataDisks = []machine.AzureDataDisk{
- {
- Lun: &lun1,
- Caching: "None",
- DiskSizeGB: 75,
- StorageAccountType: "Standard_LRS",
- },
- {
- Lun: &lun1,
- Caching: "None",
- DiskSizeGB: 75,
- StorageAccountType: "Standard_LRS",
- },
- }
-
- errList := validateAzureMachineClassSpec(spec, field.NewPath("spec"))
-
- errExpected := field.ErrorList{
- {
- Type: field.ErrorTypeInvalid,
- Field: "spec.properties.storageProfile.dataDisks",
- BadValue: int32(1),
- Detail: "Data Disk Lun '1' duplicated 2 times, Lun must be unique",
- },
- }
- Expect(errList).To(ConsistOf(errExpected))
- })
-
- It("should forbid to use neither a zone, a machineset or an availabilityset", func() {
- spec := getAzureMachineSpec()
- spec.Properties.Zone = nil
- spec.Properties.AvailabilitySet = nil
- spec.Properties.MachineSet = nil
-
- expectedErr := field.ErrorList{
- {
- Type: field.ErrorTypeForbidden,
- Field: "spec.properties.zone|.machineSet|.availabilitySet",
- BadValue: "",
- Detail: "Machine need to be assigned to a zone, a MachineSet or an AvailabilitySet",
- },
- }
-
- err := validateAzureMachineClassSpec(spec, field.NewPath("spec"))
- Expect(err).To(ConsistOf(expectedErr))
- })
-
- It("should forbid to use a zone and a machineset or an availabilityset in parallel", func() {
- spec := getAzureMachineSpec()
- spec.Properties.MachineSet = &machine.AzureMachineSetConfig{
- ID: "test-machineset-id",
- Kind: "vmo",
- }
-
- expectedErr := field.ErrorList{
- {
- Type: field.ErrorTypeForbidden,
- Field: "spec.properties.zone|.machineSet|.availabilitySet",
- BadValue: "",
- Detail: "Machine cannot be assigned to a zone, a MachineSet and an AvailabilitySet in parallel",
- },
- }
-
- err := validateAzureMachineClassSpec(spec, field.NewPath("spec"))
- Expect(err).To(ConsistOf(expectedErr))
- })
-
- It("should forbid to use a machineset and an availabilityset in parallel", func() {
- spec := getAzureMachineSpec()
- spec.Properties.Zone = nil
- spec.Properties.MachineSet = &machine.AzureMachineSetConfig{
- ID: "test-machineset-id",
- Kind: "vmo",
- }
- spec.Properties.AvailabilitySet = &machine.AzureSubResource{
- ID: "test-availabilityset-id",
- }
-
- expectedErr := field.ErrorList{
- {
- Type: field.ErrorTypeForbidden,
- Field: "spec.properties.machineSet|.availabilitySet",
- BadValue: "",
- Detail: "Machine cannot be assigned a MachineSet and an AvailabilitySet in parallel",
- },
- }
-
- err := validateAzureMachineClassSpec(spec, field.NewPath("spec"))
- Expect(err).To(ConsistOf(expectedErr))
- })
-
- It("should return an error if invalid machineset kind is specified", func() {
- spec := getAzureMachineSpec()
- spec.Properties.Zone = nil
- spec.Properties.MachineSet = &machine.AzureMachineSetConfig{
- ID: "test-machineset-id",
- Kind: "foo",
- }
-
- expectedErr := field.ErrorList{
- {
- Type: field.ErrorTypeInvalid,
- Field: "spec.properties.machineSet",
- BadValue: spec.Properties.MachineSet.Kind,
- Detail: fmt.Sprintf("Invalid MachineSet kind. Use either '%s' or '%s'", machine.MachineSetKindVMO, machine.MachineSetKindAvailabilitySet),
- },
- }
-
- err := validateAzureMachineClassSpec(spec, field.NewPath("spec"))
- Expect(err).To(ConsistOf(expectedErr))
- })
-
- })
-})
diff --git a/pkg/apis/machine/validation/gcpmachineclass.go b/pkg/apis/machine/validation/gcpmachineclass.go
deleted file mode 100644
index df5cf88c5..000000000
--- a/pkg/apis/machine/validation/gcpmachineclass.go
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package validation is used to validate all the machine CRD objects
-package validation
-
-import (
- "regexp"
- "strings"
-
- "k8s.io/apimachinery/pkg/util/validation/field"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
-)
-
-// ValidateGCPMachineClass validates a GCPMachineClass and returns a list of errors.
-func ValidateGCPMachineClass(GCPMachineClass *machine.GCPMachineClass) field.ErrorList {
- return internalValidateGCPMachineClass(GCPMachineClass)
-}
-
-func internalValidateGCPMachineClass(GCPMachineClass *machine.GCPMachineClass) field.ErrorList {
- allErrs := field.ErrorList{}
- allErrs = append(allErrs, validateGCPMachineClassSpec(&GCPMachineClass.Spec, field.NewPath("spec"))...)
- return allErrs
-}
-
-func validateGCPMachineClassSpec(spec *machine.GCPMachineClassSpec, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- allErrs = append(allErrs, validateGCPDisks(spec.Disks, fldPath.Child("disks"))...)
-
- if "" == spec.MachineType {
- allErrs = append(allErrs, field.Required(fldPath.Child("machineType"), "machineType is required"))
- }
- if "" == spec.Region {
- allErrs = append(allErrs, field.Required(fldPath.Child("region"), "region is required"))
- }
- if "" == spec.Zone {
- allErrs = append(allErrs, field.Required(fldPath.Child("zone"), "zone is required"))
- }
-
- allErrs = append(allErrs, validateGCPNetworkInterfaces(spec.NetworkInterfaces, fldPath.Child("networkInterfaces"))...)
- allErrs = append(allErrs, validateGCPMetadata(spec.Metadata, fldPath.Child("networkInterfaces"))...)
- allErrs = append(allErrs, validateGCPScheduling(spec.Scheduling, fldPath.Child("scheduling"))...)
- allErrs = append(allErrs, validateSecretRef(spec.SecretRef, fldPath.Child("secretRef"))...)
- allErrs = append(allErrs, validateGCPServiceAccounts(spec.ServiceAccounts, fldPath.Child("serviceAccounts"))...)
- allErrs = append(allErrs, validateGCPClassSpecTags(spec.Tags, field.NewPath("spec.tags"))...)
-
- return allErrs
-}
-
-func validateGCPClassSpecTags(tags []string, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
- clusterName := ""
- nodeRole := ""
-
- for _, key := range tags {
- if strings.Contains(key, "kubernetes-io-cluster-") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes-io-role-") {
- nodeRole = key
- }
- }
-
- if clusterName == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes-io-cluster-"), "Tag required of the form kubernetes-io-cluster-****"))
- }
- if nodeRole == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes-io-role-"), "Tag required of the form kubernetes-io-role-****"))
- }
-
- return allErrs
-}
-
-func validateGCPDisks(disks []*machine.GCPDisk, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if 0 == len(disks) {
- allErrs = append(allErrs, field.Required(fldPath, "at least one disk is required"))
- }
-
- for i, disk := range disks {
- idxPath := fldPath.Index(i)
- if disk.SizeGb < 20 {
- allErrs = append(allErrs, field.Invalid(idxPath.Child("sizeGb"), disk.SizeGb, "disk size must be at least 20 GB"))
- }
- if disk.Type != "pd-standard" && disk.Type != "pd-ssd" && disk.Type != "SCRATCH" {
- allErrs = append(allErrs, field.NotSupported(idxPath.Child("type"), disk.Type, []string{"pd-standard", "pd-ssd", "SCRATCH"}))
- }
- if disk.Type == "SCRATCH" && (disk.Interface != "NVME" && disk.Interface != "SCSI") {
- allErrs = append(allErrs, field.NotSupported(idxPath.Child("interface"), disk.Interface, []string{"NVME", "SCSI"}))
- }
- if disk.Boot && "" == disk.Image {
- allErrs = append(allErrs, field.Required(idxPath.Child("image"), "image is required for boot disk"))
- }
- }
-
- return allErrs
-}
-
-func validateGCPNetworkInterfaces(interfaces []*machine.GCPNetworkInterface, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if 0 == len(interfaces) {
- allErrs = append(allErrs, field.Required(fldPath.Child("networkInterfaces"), "at least one network interface is required"))
- }
-
- for i, nic := range interfaces {
- idxPath := fldPath.Index(i)
- if "" == nic.Network && "" == nic.Subnetwork {
- allErrs = append(allErrs, field.Required(idxPath, "either network or subnetwork or both is required"))
- }
- }
-
- return allErrs
-}
-
-func validateGCPMetadata(metadata []*machine.GCPMetadata, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- for i, item := range metadata {
- idxPath := fldPath.Index(i)
- if item.Key == "user-data" {
- allErrs = append(allErrs, field.Forbidden(idxPath.Child("key"), "user-data key is forbidden in metadata"))
- }
- }
-
- return allErrs
-}
-
-func validateGCPScheduling(scheduling machine.GCPScheduling, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if "MIGRATE" != scheduling.OnHostMaintenance && "TERMINATE" != scheduling.OnHostMaintenance {
- allErrs = append(allErrs, field.NotSupported(fldPath.Child("onHostMaintenance"), scheduling.OnHostMaintenance, []string{"MIGRATE", "TERMINATE"}))
- }
-
- return allErrs
-}
-
-func validateGCPServiceAccounts(serviceAccounts []machine.GCPServiceAccount, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if 0 == len(serviceAccounts) {
- allErrs = append(allErrs, field.Required(fldPath, "at least one service account is required"))
- }
-
- for i, account := range serviceAccounts {
- idxPath := fldPath.Index(i)
- if match, _ := regexp.MatchString(`^[^@]+@(?:[a-zA-Z-0-9]+\.)+[a-zA-Z]{2,}$`, account.Email); !match {
- allErrs = append(allErrs, field.Invalid(idxPath.Child("email"), account.Email, "email address is of invalid format"))
- }
- }
-
- return allErrs
-}
diff --git a/pkg/apis/machine/validation/openstackmachineclass.go b/pkg/apis/machine/validation/openstackmachineclass.go
deleted file mode 100644
index d354ea164..000000000
--- a/pkg/apis/machine/validation/openstackmachineclass.go
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package validation is used to validate all the machine CRD objects
-package validation
-
-import (
- "strings"
-
- "k8s.io/apimachinery/pkg/util/validation/field"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
-)
-
-// ValidateOpenStackMachineClass validates a OpenStackMachineClass and returns a list of errors.
-func ValidateOpenStackMachineClass(OpenStackMachineClass *machine.OpenStackMachineClass) field.ErrorList {
- return internalValidateOpenStackMachineClass(OpenStackMachineClass)
-}
-
-func internalValidateOpenStackMachineClass(OpenStackMachineClass *machine.OpenStackMachineClass) field.ErrorList {
- allErrs := field.ErrorList{}
-
- allErrs = append(allErrs, validateOpenStackMachineClassSpec(&OpenStackMachineClass.Spec, field.NewPath("spec"))...)
- return allErrs
-}
-
-func validateOpenStackMachineClassSpec(spec *machine.OpenStackMachineClassSpec, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if "" == spec.ImageID {
- if "" == spec.ImageName {
- allErrs = append(allErrs, field.Required(fldPath.Child("imageName"), "ImageName is required if no ImageID is given"))
- }
- }
-
- if "" == spec.Region {
- allErrs = append(allErrs, field.Required(fldPath.Child("region"), "Region is required"))
- }
- if "" == spec.FlavorName {
- allErrs = append(allErrs, field.Required(fldPath.Child("flavorName"), "Flavor is required"))
- }
- if "" == spec.AvailabilityZone {
- allErrs = append(allErrs, field.Required(fldPath.Child("availabilityZone"), "AvailabilityZone Name is required"))
- }
- if "" == spec.KeyName {
- allErrs = append(allErrs, field.Required(fldPath.Child("keyName"), "KeyName is required"))
- }
- if "" != spec.NetworkID && len(spec.Networks) > 0 {
- allErrs = append(allErrs, field.Forbidden(fldPath.Child("networks"), "\"networks\" list should not be specified along with \"spec.NetworkID\""))
- }
- if "" == spec.NetworkID && len(spec.Networks) == 0 {
- allErrs = append(allErrs, field.Forbidden(fldPath.Child("networks"), "both \"networks\" and \"networkID\" should not be empty"))
- }
- if "" == spec.PodNetworkCidr {
- allErrs = append(allErrs, field.Required(fldPath.Child("podNetworkCidr"), "PodNetworkCidr is required"))
- }
- if spec.RootDiskSize < 0 {
- allErrs = append(allErrs, field.Required(fldPath.Child("rootDiskSize"), "RootDiskSize can not be negative"))
- }
-
- allErrs = append(allErrs, validateOsNetworks(spec.Networks, spec.PodNetworkCidr, field.NewPath("spec.networks"))...)
- allErrs = append(allErrs, validateSecretRef(spec.SecretRef, field.NewPath("spec.secretRef"))...)
- allErrs = append(allErrs, validateOSClassSpecTags(spec.Tags, field.NewPath("spec.tags"))...)
-
- return allErrs
-}
-
-func validateOsNetworks(networks []machine.OpenStackNetwork, podNetworkCidr string, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- for index, network := range networks {
- fldPath := fldPath.Index(index)
- if "" == network.Id && "" == network.Name {
- allErrs = append(allErrs, field.Required(fldPath, "at least on of network \"id\" or \"name\" is required"))
- }
- if "" != network.Id && "" != network.Name {
- allErrs = append(allErrs, field.Forbidden(fldPath, "simultaneous use of network \"id\" and \"name\" is forbidden"))
- }
- if "" == podNetworkCidr && network.PodNetwork {
- allErrs = append(allErrs, field.Required(fldPath.Child("podNetwork"), "\"podNetwork\" switch should not be used in absence of \"spec.podNetworkCidr\""))
- }
- }
-
- return allErrs
-}
-
-func validateOSClassSpecTags(tags map[string]string, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
- clusterName := ""
- nodeRole := ""
-
- for key := range tags {
- if strings.Contains(key, "kubernetes.io-cluster-") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes.io-role-") {
- nodeRole = key
- }
- }
-
- if clusterName == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io-cluster-"), "Tag required of the form kubernetes.io-cluster-****"))
- }
- if nodeRole == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io-role-"), "Tag required of the form kubernetes.io-role-****"))
- }
-
- return allErrs
-}
diff --git a/pkg/apis/machine/validation/packetmachineclass.go b/pkg/apis/machine/validation/packetmachineclass.go
deleted file mode 100644
index ef5772ae9..000000000
--- a/pkg/apis/machine/validation/packetmachineclass.go
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package validation is used to validate all the machine CRD objects
-package validation
-
-import (
- "regexp"
- "strings"
-
- apivalidation "k8s.io/apimachinery/pkg/api/validation"
- utilvalidation "k8s.io/apimachinery/pkg/util/validation"
- "k8s.io/apimachinery/pkg/util/validation/field"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
-)
-
-const packetNameFmt string = `[-a-z0-9]+`
-const packetNameMaxLength int = 63
-
-var packetNameRegexp = regexp.MustCompile("^" + packetNameFmt + "$")
-
-// packetValidateName is the validation function for object names.
-func packetValidateName(value string, prefix bool) []string {
- var errs []string
- if len(value) > nameMaxLength {
- errs = append(errs, utilvalidation.MaxLenError(packetNameMaxLength))
- }
- if !packetNameRegexp.MatchString(value) {
- errs = append(errs, utilvalidation.RegexError(packetNameFmt, "name-40d-0983-1b89"))
- }
-
- return errs
-}
-
-// ValidatePacketMachineClass validates a PacketMachineClass and returns a list of errors.
-func ValidatePacketMachineClass(PacketMachineClass *machine.PacketMachineClass) field.ErrorList {
- return internalValidatePacketMachineClass(PacketMachineClass)
-}
-
-func internalValidatePacketMachineClass(PacketMachineClass *machine.PacketMachineClass) field.ErrorList {
- allErrs := field.ErrorList{}
-
- allErrs = append(allErrs, apivalidation.ValidateObjectMeta(&PacketMachineClass.ObjectMeta, true, /*namespace*/
- packetValidateName,
- field.NewPath("metadata"))...)
-
- allErrs = append(allErrs, validatePacketMachineClassSpec(&PacketMachineClass.Spec, field.NewPath("spec"))...)
- return allErrs
-}
-
-func validatePacketMachineClassSpec(spec *machine.PacketMachineClassSpec, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
-
- if "" == spec.OS {
- allErrs = append(allErrs, field.Required(fldPath.Child("os"), "OS is required"))
- }
- if "" == spec.MachineType {
- allErrs = append(allErrs, field.Required(fldPath.Child("machineType"), "Machine Type is required"))
- }
- if "" == spec.ProjectID {
- allErrs = append(allErrs, field.Required(fldPath.Child("projectID"), "Project ID is required"))
- }
- if len(spec.Facility) == 0 {
- allErrs = append(allErrs, field.Required(fldPath.Child("facility"), "At least one Facility specification is required"))
- }
-
- allErrs = append(allErrs, validatePacketClassSpecTags(spec.Tags, field.NewPath("spec.tags"))...)
- allErrs = append(allErrs, validateSecretRef(spec.SecretRef, field.NewPath("spec.secretRef"))...)
-
- return allErrs
-}
-
-func validatePacketClassSpecTags(tags []string, fldPath *field.Path) field.ErrorList {
- allErrs := field.ErrorList{}
- clusterName := ""
- nodeRole := ""
-
- for _, key := range tags {
- if strings.Contains(key, "kubernetes.io/cluster/") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes.io/role/") {
- nodeRole = key
- }
- }
-
- if clusterName == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io/cluster/"), "Tag required of the form kubernetes.io/cluster/****"))
- }
- if nodeRole == "" {
- allErrs = append(allErrs, field.Required(fldPath.Child("kubernetes.io/role/"), "Tag required of the form kubernetes.io/role/****"))
- }
-
- return allErrs
-}
diff --git a/pkg/apis/machine/zz_generated.deepcopy.go b/pkg/apis/machine/zz_generated.deepcopy.go
index 72a43a822..e9bb94643 100644
--- a/pkg/apis/machine/zz_generated.deepcopy.go
+++ b/pkg/apis/machine/zz_generated.deepcopy.go
@@ -29,1075 +29,34 @@ import (
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSBlockDeviceMappingSpec) DeepCopyInto(out *AWSBlockDeviceMappingSpec) {
- *out = *in
- in.Ebs.DeepCopyInto(&out.Ebs)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSBlockDeviceMappingSpec.
-func (in *AWSBlockDeviceMappingSpec) DeepCopy() *AWSBlockDeviceMappingSpec {
- if in == nil {
- return nil
- }
- out := new(AWSBlockDeviceMappingSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSEbsBlockDeviceSpec) DeepCopyInto(out *AWSEbsBlockDeviceSpec) {
- *out = *in
- if in.DeleteOnTermination != nil {
- in, out := &in.DeleteOnTermination, &out.DeleteOnTermination
- *out = new(bool)
- **out = **in
- }
- if in.KmsKeyID != nil {
- in, out := &in.KmsKeyID, &out.KmsKeyID
- *out = new(string)
- **out = **in
- }
- if in.SnapshotID != nil {
- in, out := &in.SnapshotID, &out.SnapshotID
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSEbsBlockDeviceSpec.
-func (in *AWSEbsBlockDeviceSpec) DeepCopy() *AWSEbsBlockDeviceSpec {
- if in == nil {
- return nil
- }
- out := new(AWSEbsBlockDeviceSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSIAMProfileSpec) DeepCopyInto(out *AWSIAMProfileSpec) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSIAMProfileSpec.
-func (in *AWSIAMProfileSpec) DeepCopy() *AWSIAMProfileSpec {
- if in == nil {
- return nil
- }
- out := new(AWSIAMProfileSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSMachineClass) DeepCopyInto(out *AWSMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClass.
-func (in *AWSMachineClass) DeepCopy() *AWSMachineClass {
- if in == nil {
- return nil
- }
- out := new(AWSMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AWSMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSMachineClassList) DeepCopyInto(out *AWSMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]AWSMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClassList.
-func (in *AWSMachineClassList) DeepCopy() *AWSMachineClassList {
- if in == nil {
- return nil
- }
- out := new(AWSMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AWSMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSMachineClassSpec) DeepCopyInto(out *AWSMachineClassSpec) {
- *out = *in
- if in.BlockDevices != nil {
- in, out := &in.BlockDevices, &out.BlockDevices
- *out = make([]AWSBlockDeviceMappingSpec, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- out.IAM = in.IAM
- if in.NetworkInterfaces != nil {
- in, out := &in.NetworkInterfaces, &out.NetworkInterfaces
- *out = make([]AWSNetworkInterfaceSpec, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.SpotPrice != nil {
- in, out := &in.SpotPrice, &out.SpotPrice
- *out = new(string)
- **out = **in
- }
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSMachineClassSpec.
-func (in *AWSMachineClassSpec) DeepCopy() *AWSMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(AWSMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AWSNetworkInterfaceSpec) DeepCopyInto(out *AWSNetworkInterfaceSpec) {
- *out = *in
- if in.AssociatePublicIPAddress != nil {
- in, out := &in.AssociatePublicIPAddress, &out.AssociatePublicIPAddress
- *out = new(bool)
- **out = **in
- }
- if in.DeleteOnTermination != nil {
- in, out := &in.DeleteOnTermination, &out.DeleteOnTermination
- *out = new(bool)
- **out = **in
- }
- if in.Description != nil {
- in, out := &in.Description, &out.Description
- *out = new(string)
- **out = **in
- }
- if in.SecurityGroupIDs != nil {
- in, out := &in.SecurityGroupIDs, &out.SecurityGroupIDs
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSNetworkInterfaceSpec.
-func (in *AWSNetworkInterfaceSpec) DeepCopy() *AWSNetworkInterfaceSpec {
- if in == nil {
- return nil
- }
- out := new(AWSNetworkInterfaceSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudDataDisk) DeepCopyInto(out *AlicloudDataDisk) {
- *out = *in
- if in.DeleteWithInstance != nil {
- in, out := &in.DeleteWithInstance, &out.DeleteWithInstance
- *out = new(bool)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudDataDisk.
-func (in *AlicloudDataDisk) DeepCopy() *AlicloudDataDisk {
- if in == nil {
- return nil
- }
- out := new(AlicloudDataDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudMachineClass) DeepCopyInto(out *AlicloudMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudMachineClass.
-func (in *AlicloudMachineClass) DeepCopy() *AlicloudMachineClass {
- if in == nil {
- return nil
- }
- out := new(AlicloudMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AlicloudMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudMachineClassList) DeepCopyInto(out *AlicloudMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]AlicloudMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudMachineClassList.
-func (in *AlicloudMachineClassList) DeepCopy() *AlicloudMachineClassList {
- if in == nil {
- return nil
- }
- out := new(AlicloudMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AlicloudMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudMachineClassSpec) DeepCopyInto(out *AlicloudMachineClassSpec) {
- *out = *in
- if in.SystemDisk != nil {
- in, out := &in.SystemDisk, &out.SystemDisk
- *out = new(AlicloudSystemDisk)
- **out = **in
- }
- if in.DataDisks != nil {
- in, out := &in.DataDisks, &out.DataDisks
- *out = make([]AlicloudDataDisk, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- if in.InternetMaxBandwidthIn != nil {
- in, out := &in.InternetMaxBandwidthIn, &out.InternetMaxBandwidthIn
- *out = new(int)
- **out = **in
- }
- if in.InternetMaxBandwidthOut != nil {
- in, out := &in.InternetMaxBandwidthOut, &out.InternetMaxBandwidthOut
- *out = new(int)
- **out = **in
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudMachineClassSpec.
-func (in *AlicloudMachineClassSpec) DeepCopy() *AlicloudMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(AlicloudMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AlicloudSystemDisk) DeepCopyInto(out *AlicloudSystemDisk) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AlicloudSystemDisk.
-func (in *AlicloudSystemDisk) DeepCopy() *AlicloudSystemDisk {
- if in == nil {
- return nil
- }
- out := new(AlicloudSystemDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureDataDisk) DeepCopyInto(out *AzureDataDisk) {
- *out = *in
- if in.Lun != nil {
- in, out := &in.Lun, &out.Lun
- *out = new(int32)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureDataDisk.
-func (in *AzureDataDisk) DeepCopy() *AzureDataDisk {
- if in == nil {
- return nil
- }
- out := new(AzureDataDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureHardwareProfile) DeepCopyInto(out *AzureHardwareProfile) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureHardwareProfile.
-func (in *AzureHardwareProfile) DeepCopy() *AzureHardwareProfile {
- if in == nil {
- return nil
- }
- out := new(AzureHardwareProfile)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureImageReference) DeepCopyInto(out *AzureImageReference) {
- *out = *in
- if in.URN != nil {
- in, out := &in.URN, &out.URN
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureImageReference.
-func (in *AzureImageReference) DeepCopy() *AzureImageReference {
- if in == nil {
- return nil
- }
- out := new(AzureImageReference)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureLinuxConfiguration) DeepCopyInto(out *AzureLinuxConfiguration) {
- *out = *in
- out.SSH = in.SSH
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureLinuxConfiguration.
-func (in *AzureLinuxConfiguration) DeepCopy() *AzureLinuxConfiguration {
- if in == nil {
- return nil
- }
- out := new(AzureLinuxConfiguration)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureMachineClass) DeepCopyInto(out *AzureMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineClass.
-func (in *AzureMachineClass) DeepCopy() *AzureMachineClass {
- if in == nil {
- return nil
- }
- out := new(AzureMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AzureMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureMachineClassList) DeepCopyInto(out *AzureMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]AzureMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineClassList.
-func (in *AzureMachineClassList) DeepCopy() *AzureMachineClassList {
- if in == nil {
- return nil
- }
- out := new(AzureMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *AzureMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureMachineClassSpec) DeepCopyInto(out *AzureMachineClassSpec) {
- *out = *in
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- in.Properties.DeepCopyInto(&out.Properties)
- in.SubnetInfo.DeepCopyInto(&out.SubnetInfo)
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineClassSpec.
-func (in *AzureMachineClassSpec) DeepCopy() *AzureMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(AzureMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureMachineSetConfig) DeepCopyInto(out *AzureMachineSetConfig) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureMachineSetConfig.
-func (in *AzureMachineSetConfig) DeepCopy() *AzureMachineSetConfig {
- if in == nil {
- return nil
- }
- out := new(AzureMachineSetConfig)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureManagedDiskParameters) DeepCopyInto(out *AzureManagedDiskParameters) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureManagedDiskParameters.
-func (in *AzureManagedDiskParameters) DeepCopy() *AzureManagedDiskParameters {
- if in == nil {
- return nil
- }
- out := new(AzureManagedDiskParameters)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureNetworkInterfaceReference) DeepCopyInto(out *AzureNetworkInterfaceReference) {
- *out = *in
- if in.AzureNetworkInterfaceReferenceProperties != nil {
- in, out := &in.AzureNetworkInterfaceReferenceProperties, &out.AzureNetworkInterfaceReferenceProperties
- *out = new(AzureNetworkInterfaceReferenceProperties)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureNetworkInterfaceReference.
-func (in *AzureNetworkInterfaceReference) DeepCopy() *AzureNetworkInterfaceReference {
- if in == nil {
- return nil
- }
- out := new(AzureNetworkInterfaceReference)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureNetworkInterfaceReferenceProperties) DeepCopyInto(out *AzureNetworkInterfaceReferenceProperties) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureNetworkInterfaceReferenceProperties.
-func (in *AzureNetworkInterfaceReferenceProperties) DeepCopy() *AzureNetworkInterfaceReferenceProperties {
- if in == nil {
- return nil
- }
- out := new(AzureNetworkInterfaceReferenceProperties)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureNetworkProfile) DeepCopyInto(out *AzureNetworkProfile) {
- *out = *in
- in.NetworkInterfaces.DeepCopyInto(&out.NetworkInterfaces)
- if in.AcceleratedNetworking != nil {
- in, out := &in.AcceleratedNetworking, &out.AcceleratedNetworking
- *out = new(bool)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureNetworkProfile.
-func (in *AzureNetworkProfile) DeepCopy() *AzureNetworkProfile {
- if in == nil {
- return nil
- }
- out := new(AzureNetworkProfile)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureOSDisk) DeepCopyInto(out *AzureOSDisk) {
- *out = *in
- out.ManagedDisk = in.ManagedDisk
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureOSDisk.
-func (in *AzureOSDisk) DeepCopy() *AzureOSDisk {
- if in == nil {
- return nil
- }
- out := new(AzureOSDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureOSProfile) DeepCopyInto(out *AzureOSProfile) {
- *out = *in
- out.LinuxConfiguration = in.LinuxConfiguration
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureOSProfile.
-func (in *AzureOSProfile) DeepCopy() *AzureOSProfile {
- if in == nil {
- return nil
- }
- out := new(AzureOSProfile)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureSSHConfiguration) DeepCopyInto(out *AzureSSHConfiguration) {
- *out = *in
- out.PublicKeys = in.PublicKeys
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSSHConfiguration.
-func (in *AzureSSHConfiguration) DeepCopy() *AzureSSHConfiguration {
- if in == nil {
- return nil
- }
- out := new(AzureSSHConfiguration)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureSSHPublicKey) DeepCopyInto(out *AzureSSHPublicKey) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSSHPublicKey.
-func (in *AzureSSHPublicKey) DeepCopy() *AzureSSHPublicKey {
- if in == nil {
- return nil
- }
- out := new(AzureSSHPublicKey)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureStorageProfile) DeepCopyInto(out *AzureStorageProfile) {
- *out = *in
- in.ImageReference.DeepCopyInto(&out.ImageReference)
- out.OsDisk = in.OsDisk
- if in.DataDisks != nil {
- in, out := &in.DataDisks, &out.DataDisks
- *out = make([]AzureDataDisk, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStorageProfile.
-func (in *AzureStorageProfile) DeepCopy() *AzureStorageProfile {
- if in == nil {
- return nil
- }
- out := new(AzureStorageProfile)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureSubResource) DeepCopyInto(out *AzureSubResource) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSubResource.
-func (in *AzureSubResource) DeepCopy() *AzureSubResource {
- if in == nil {
- return nil
- }
- out := new(AzureSubResource)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureSubnetInfo) DeepCopyInto(out *AzureSubnetInfo) {
- *out = *in
- if in.VnetResourceGroup != nil {
- in, out := &in.VnetResourceGroup, &out.VnetResourceGroup
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSubnetInfo.
-func (in *AzureSubnetInfo) DeepCopy() *AzureSubnetInfo {
- if in == nil {
- return nil
- }
- out := new(AzureSubnetInfo)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *AzureVirtualMachineProperties) DeepCopyInto(out *AzureVirtualMachineProperties) {
- *out = *in
- out.HardwareProfile = in.HardwareProfile
- in.StorageProfile.DeepCopyInto(&out.StorageProfile)
- out.OsProfile = in.OsProfile
- in.NetworkProfile.DeepCopyInto(&out.NetworkProfile)
- if in.AvailabilitySet != nil {
- in, out := &in.AvailabilitySet, &out.AvailabilitySet
- *out = new(AzureSubResource)
- **out = **in
- }
- if in.IdentityID != nil {
- in, out := &in.IdentityID, &out.IdentityID
- *out = new(string)
- **out = **in
- }
- if in.Zone != nil {
- in, out := &in.Zone, &out.Zone
- *out = new(int)
- **out = **in
- }
- if in.MachineSet != nil {
- in, out := &in.MachineSet, &out.MachineSet
- *out = new(AzureMachineSetConfig)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureVirtualMachineProperties.
-func (in *AzureVirtualMachineProperties) DeepCopy() *AzureVirtualMachineProperties {
- if in == nil {
- return nil
- }
- out := new(AzureVirtualMachineProperties)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *ClassSpec) DeepCopyInto(out *ClassSpec) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassSpec.
-func (in *ClassSpec) DeepCopy() *ClassSpec {
- if in == nil {
- return nil
- }
- out := new(ClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *CurrentStatus) DeepCopyInto(out *CurrentStatus) {
- *out = *in
- in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CurrentStatus.
-func (in *CurrentStatus) DeepCopy() *CurrentStatus {
- if in == nil {
- return nil
- }
- out := new(CurrentStatus)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPDisk) DeepCopyInto(out *GCPDisk) {
- *out = *in
- if in.AutoDelete != nil {
- in, out := &in.AutoDelete, &out.AutoDelete
- *out = new(bool)
- **out = **in
- }
- if in.Labels != nil {
- in, out := &in.Labels, &out.Labels
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPDisk.
-func (in *GCPDisk) DeepCopy() *GCPDisk {
- if in == nil {
- return nil
- }
- out := new(GCPDisk)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPMachineClass) DeepCopyInto(out *GCPMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPMachineClass.
-func (in *GCPMachineClass) DeepCopy() *GCPMachineClass {
- if in == nil {
- return nil
- }
- out := new(GCPMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *GCPMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPMachineClassList) DeepCopyInto(out *GCPMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]GCPMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPMachineClassList.
-func (in *GCPMachineClassList) DeepCopy() *GCPMachineClassList {
- if in == nil {
- return nil
- }
- out := new(GCPMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *GCPMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPMachineClassSpec) DeepCopyInto(out *GCPMachineClassSpec) {
- *out = *in
- if in.Description != nil {
- in, out := &in.Description, &out.Description
- *out = new(string)
- **out = **in
- }
- if in.Disks != nil {
- in, out := &in.Disks, &out.Disks
- *out = make([]*GCPDisk, len(*in))
- for i := range *in {
- if (*in)[i] != nil {
- in, out := &(*in)[i], &(*out)[i]
- *out = new(GCPDisk)
- (*in).DeepCopyInto(*out)
- }
- }
- }
- if in.Labels != nil {
- in, out := &in.Labels, &out.Labels
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.Metadata != nil {
- in, out := &in.Metadata, &out.Metadata
- *out = make([]*GCPMetadata, len(*in))
- for i := range *in {
- if (*in)[i] != nil {
- in, out := &(*in)[i], &(*out)[i]
- *out = new(GCPMetadata)
- (*in).DeepCopyInto(*out)
- }
- }
- }
- if in.NetworkInterfaces != nil {
- in, out := &in.NetworkInterfaces, &out.NetworkInterfaces
- *out = make([]*GCPNetworkInterface, len(*in))
- for i := range *in {
- if (*in)[i] != nil {
- in, out := &(*in)[i], &(*out)[i]
- *out = new(GCPNetworkInterface)
- **out = **in
- }
- }
- }
- out.Scheduling = in.Scheduling
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.ServiceAccounts != nil {
- in, out := &in.ServiceAccounts, &out.ServiceAccounts
- *out = make([]GCPServiceAccount, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPMachineClassSpec.
-func (in *GCPMachineClassSpec) DeepCopy() *GCPMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(GCPMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPMetadata) DeepCopyInto(out *GCPMetadata) {
- *out = *in
- if in.Value != nil {
- in, out := &in.Value, &out.Value
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPMetadata.
-func (in *GCPMetadata) DeepCopy() *GCPMetadata {
- if in == nil {
- return nil
- }
- out := new(GCPMetadata)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPNetworkInterface) DeepCopyInto(out *GCPNetworkInterface) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPNetworkInterface.
-func (in *GCPNetworkInterface) DeepCopy() *GCPNetworkInterface {
- if in == nil {
- return nil
- }
- out := new(GCPNetworkInterface)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPScheduling) DeepCopyInto(out *GCPScheduling) {
+func (in *ClassSpec) DeepCopyInto(out *ClassSpec) {
*out = *in
return
}
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPScheduling.
-func (in *GCPScheduling) DeepCopy() *GCPScheduling {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClassSpec.
+func (in *ClassSpec) DeepCopy() *ClassSpec {
if in == nil {
return nil
}
- out := new(GCPScheduling)
+ out := new(ClassSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *GCPServiceAccount) DeepCopyInto(out *GCPServiceAccount) {
+func (in *CurrentStatus) DeepCopyInto(out *CurrentStatus) {
*out = *in
- if in.Scopes != nil {
- in, out := &in.Scopes, &out.Scopes
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
+ in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
return
}
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPServiceAccount.
-func (in *GCPServiceAccount) DeepCopy() *GCPServiceAccount {
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CurrentStatus.
+func (in *CurrentStatus) DeepCopy() *CurrentStatus {
if in == nil {
return nil
}
- out := new(GCPServiceAccount)
+ out := new(CurrentStatus)
in.DeepCopyInto(out)
return out
}
@@ -1826,241 +785,6 @@ func (in *NodeTemplateSpec) DeepCopy() *NodeTemplateSpec {
return out
}
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OpenStackMachineClass) DeepCopyInto(out *OpenStackMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackMachineClass.
-func (in *OpenStackMachineClass) DeepCopy() *OpenStackMachineClass {
- if in == nil {
- return nil
- }
- out := new(OpenStackMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *OpenStackMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OpenStackMachineClassList) DeepCopyInto(out *OpenStackMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]OpenStackMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackMachineClassList.
-func (in *OpenStackMachineClassList) DeepCopy() *OpenStackMachineClassList {
- if in == nil {
- return nil
- }
- out := new(OpenStackMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *OpenStackMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OpenStackMachineClassSpec) DeepCopyInto(out *OpenStackMachineClassSpec) {
- *out = *in
- if in.SecurityGroups != nil {
- in, out := &in.SecurityGroups, &out.SecurityGroups
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make(map[string]string, len(*in))
- for key, val := range *in {
- (*out)[key] = val
- }
- }
- if in.Networks != nil {
- in, out := &in.Networks, &out.Networks
- *out = make([]OpenStackNetwork, len(*in))
- copy(*out, *in)
- }
- if in.SubnetID != nil {
- in, out := &in.SubnetID, &out.SubnetID
- *out = new(string)
- **out = **in
- }
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.UseConfigDrive != nil {
- in, out := &in.UseConfigDrive, &out.UseConfigDrive
- *out = new(bool)
- **out = **in
- }
- if in.ServerGroupID != nil {
- in, out := &in.ServerGroupID, &out.ServerGroupID
- *out = new(string)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackMachineClassSpec.
-func (in *OpenStackMachineClassSpec) DeepCopy() *OpenStackMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(OpenStackMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *OpenStackNetwork) DeepCopyInto(out *OpenStackNetwork) {
- *out = *in
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OpenStackNetwork.
-func (in *OpenStackNetwork) DeepCopy() *OpenStackNetwork {
- if in == nil {
- return nil
- }
- out := new(OpenStackNetwork)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *PacketMachineClass) DeepCopyInto(out *PacketMachineClass) {
- *out = *in
- in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
- out.TypeMeta = in.TypeMeta
- in.Spec.DeepCopyInto(&out.Spec)
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PacketMachineClass.
-func (in *PacketMachineClass) DeepCopy() *PacketMachineClass {
- if in == nil {
- return nil
- }
- out := new(PacketMachineClass)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *PacketMachineClass) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *PacketMachineClassList) DeepCopyInto(out *PacketMachineClassList) {
- *out = *in
- out.TypeMeta = in.TypeMeta
- in.ListMeta.DeepCopyInto(&out.ListMeta)
- if in.Items != nil {
- in, out := &in.Items, &out.Items
- *out = make([]PacketMachineClass, len(*in))
- for i := range *in {
- (*in)[i].DeepCopyInto(&(*out)[i])
- }
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PacketMachineClassList.
-func (in *PacketMachineClassList) DeepCopy() *PacketMachineClassList {
- if in == nil {
- return nil
- }
- out := new(PacketMachineClassList)
- in.DeepCopyInto(out)
- return out
-}
-
-// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
-func (in *PacketMachineClassList) DeepCopyObject() runtime.Object {
- if c := in.DeepCopy(); c != nil {
- return c
- }
- return nil
-}
-
-// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
-func (in *PacketMachineClassSpec) DeepCopyInto(out *PacketMachineClassSpec) {
- *out = *in
- if in.Facility != nil {
- in, out := &in.Facility, &out.Facility
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.Tags != nil {
- in, out := &in.Tags, &out.Tags
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.SSHKeys != nil {
- in, out := &in.SSHKeys, &out.SSHKeys
- *out = make([]string, len(*in))
- copy(*out, *in)
- }
- if in.SecretRef != nil {
- in, out := &in.SecretRef, &out.SecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- if in.CredentialsSecretRef != nil {
- in, out := &in.CredentialsSecretRef, &out.CredentialsSecretRef
- *out = new(v1.SecretReference)
- **out = **in
- }
- return
-}
-
-// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PacketMachineClassSpec.
-func (in *PacketMachineClassSpec) DeepCopy() *PacketMachineClassSpec {
- if in == nil {
- return nil
- }
- out := new(PacketMachineClassSpec)
- in.DeepCopyInto(out)
- return out
-}
-
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RollbackConfig) DeepCopyInto(out *RollbackConfig) {
*out = *in
diff --git a/pkg/client/clientset/internalversion/fake/register.go b/pkg/client/clientset/internalversion/fake/register.go
index 71cf202d6..444857c84 100644
--- a/pkg/client/clientset/internalversion/fake/register.go
+++ b/pkg/client/clientset/internalversion/fake/register.go
@@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
-// import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-// )
+// import (
+// "k8s.io/client-go/kubernetes"
+// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
//
-// kclientset, _ := kubernetes.NewForConfig(c)
-// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/alicloudmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/alicloudmachineclass.go
deleted file mode 100644
index 8b3b0bfc6..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/alicloudmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// AlicloudMachineClassesGetter has a method to return a AlicloudMachineClassInterface.
-// A group's client should implement this interface.
-type AlicloudMachineClassesGetter interface {
- AlicloudMachineClasses(namespace string) AlicloudMachineClassInterface
-}
-
-// AlicloudMachineClassInterface has methods to work with AlicloudMachineClass resources.
-type AlicloudMachineClassInterface interface {
- Create(ctx context.Context, alicloudMachineClass *machine.AlicloudMachineClass, opts v1.CreateOptions) (*machine.AlicloudMachineClass, error)
- Update(ctx context.Context, alicloudMachineClass *machine.AlicloudMachineClass, opts v1.UpdateOptions) (*machine.AlicloudMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*machine.AlicloudMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*machine.AlicloudMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AlicloudMachineClass, err error)
- AlicloudMachineClassExpansion
-}
-
-// alicloudMachineClasses implements AlicloudMachineClassInterface
-type alicloudMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newAlicloudMachineClasses returns a AlicloudMachineClasses
-func newAlicloudMachineClasses(c *MachineClient, namespace string) *alicloudMachineClasses {
- return &alicloudMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the alicloudMachineClass, and returns the corresponding alicloudMachineClass object, and an error if there is any.
-func (c *alicloudMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.AlicloudMachineClass, err error) {
- result = &machine.AlicloudMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of AlicloudMachineClasses that match those selectors.
-func (c *alicloudMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.AlicloudMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &machine.AlicloudMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested alicloudMachineClasses.
-func (c *alicloudMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a alicloudMachineClass and creates it. Returns the server's representation of the alicloudMachineClass, and an error, if there is any.
-func (c *alicloudMachineClasses) Create(ctx context.Context, alicloudMachineClass *machine.AlicloudMachineClass, opts v1.CreateOptions) (result *machine.AlicloudMachineClass, err error) {
- result = &machine.AlicloudMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(alicloudMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a alicloudMachineClass and updates it. Returns the server's representation of the alicloudMachineClass, and an error, if there is any.
-func (c *alicloudMachineClasses) Update(ctx context.Context, alicloudMachineClass *machine.AlicloudMachineClass, opts v1.UpdateOptions) (result *machine.AlicloudMachineClass, err error) {
- result = &machine.AlicloudMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- Name(alicloudMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(alicloudMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the alicloudMachineClass and deletes it. Returns an error if one occurs.
-func (c *alicloudMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *alicloudMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched alicloudMachineClass.
-func (c *alicloudMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AlicloudMachineClass, err error) {
- result = &machine.AlicloudMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/awsmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/awsmachineclass.go
deleted file mode 100644
index e5a3a5eb6..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/awsmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// AWSMachineClassesGetter has a method to return a AWSMachineClassInterface.
-// A group's client should implement this interface.
-type AWSMachineClassesGetter interface {
- AWSMachineClasses(namespace string) AWSMachineClassInterface
-}
-
-// AWSMachineClassInterface has methods to work with AWSMachineClass resources.
-type AWSMachineClassInterface interface {
- Create(ctx context.Context, aWSMachineClass *machine.AWSMachineClass, opts v1.CreateOptions) (*machine.AWSMachineClass, error)
- Update(ctx context.Context, aWSMachineClass *machine.AWSMachineClass, opts v1.UpdateOptions) (*machine.AWSMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*machine.AWSMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*machine.AWSMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AWSMachineClass, err error)
- AWSMachineClassExpansion
-}
-
-// aWSMachineClasses implements AWSMachineClassInterface
-type aWSMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newAWSMachineClasses returns a AWSMachineClasses
-func newAWSMachineClasses(c *MachineClient, namespace string) *aWSMachineClasses {
- return &aWSMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the aWSMachineClass, and returns the corresponding aWSMachineClass object, and an error if there is any.
-func (c *aWSMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.AWSMachineClass, err error) {
- result = &machine.AWSMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of AWSMachineClasses that match those selectors.
-func (c *aWSMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.AWSMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &machine.AWSMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested aWSMachineClasses.
-func (c *aWSMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a aWSMachineClass and creates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any.
-func (c *aWSMachineClasses) Create(ctx context.Context, aWSMachineClass *machine.AWSMachineClass, opts v1.CreateOptions) (result *machine.AWSMachineClass, err error) {
- result = &machine.AWSMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(aWSMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a aWSMachineClass and updates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any.
-func (c *aWSMachineClasses) Update(ctx context.Context, aWSMachineClass *machine.AWSMachineClass, opts v1.UpdateOptions) (result *machine.AWSMachineClass, err error) {
- result = &machine.AWSMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- Name(aWSMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(aWSMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the aWSMachineClass and deletes it. Returns an error if one occurs.
-func (c *aWSMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *aWSMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched aWSMachineClass.
-func (c *aWSMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AWSMachineClass, err error) {
- result = &machine.AWSMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("awsmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/azuremachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/azuremachineclass.go
deleted file mode 100644
index 7b876755e..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/azuremachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// AzureMachineClassesGetter has a method to return a AzureMachineClassInterface.
-// A group's client should implement this interface.
-type AzureMachineClassesGetter interface {
- AzureMachineClasses(namespace string) AzureMachineClassInterface
-}
-
-// AzureMachineClassInterface has methods to work with AzureMachineClass resources.
-type AzureMachineClassInterface interface {
- Create(ctx context.Context, azureMachineClass *machine.AzureMachineClass, opts v1.CreateOptions) (*machine.AzureMachineClass, error)
- Update(ctx context.Context, azureMachineClass *machine.AzureMachineClass, opts v1.UpdateOptions) (*machine.AzureMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*machine.AzureMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*machine.AzureMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AzureMachineClass, err error)
- AzureMachineClassExpansion
-}
-
-// azureMachineClasses implements AzureMachineClassInterface
-type azureMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newAzureMachineClasses returns a AzureMachineClasses
-func newAzureMachineClasses(c *MachineClient, namespace string) *azureMachineClasses {
- return &azureMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the azureMachineClass, and returns the corresponding azureMachineClass object, and an error if there is any.
-func (c *azureMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.AzureMachineClass, err error) {
- result = &machine.AzureMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of AzureMachineClasses that match those selectors.
-func (c *azureMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.AzureMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &machine.AzureMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested azureMachineClasses.
-func (c *azureMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a azureMachineClass and creates it. Returns the server's representation of the azureMachineClass, and an error, if there is any.
-func (c *azureMachineClasses) Create(ctx context.Context, azureMachineClass *machine.AzureMachineClass, opts v1.CreateOptions) (result *machine.AzureMachineClass, err error) {
- result = &machine.AzureMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(azureMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a azureMachineClass and updates it. Returns the server's representation of the azureMachineClass, and an error, if there is any.
-func (c *azureMachineClasses) Update(ctx context.Context, azureMachineClass *machine.AzureMachineClass, opts v1.UpdateOptions) (result *machine.AzureMachineClass, err error) {
- result = &machine.AzureMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- Name(azureMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(azureMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the azureMachineClass and deletes it. Returns an error if one occurs.
-func (c *azureMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *azureMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched azureMachineClass.
-func (c *azureMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AzureMachineClass, err error) {
- result = &machine.AzureMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("azuremachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_alicloudmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_alicloudmachineclass.go
deleted file mode 100644
index a8357c96a..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_alicloudmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeAlicloudMachineClasses implements AlicloudMachineClassInterface
-type FakeAlicloudMachineClasses struct {
- Fake *FakeMachine
- ns string
-}
-
-var alicloudmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "alicloudmachineclasses"}
-
-var alicloudmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", Kind: "AlicloudMachineClass"}
-
-// Get takes name of the alicloudMachineClass, and returns the corresponding alicloudMachineClass object, and an error if there is any.
-func (c *FakeAlicloudMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.AlicloudMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(alicloudmachineclassesResource, c.ns, name), &machine.AlicloudMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AlicloudMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of AlicloudMachineClasses that match those selectors.
-func (c *FakeAlicloudMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.AlicloudMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(alicloudmachineclassesResource, alicloudmachineclassesKind, c.ns, opts), &machine.AlicloudMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &machine.AlicloudMachineClassList{ListMeta: obj.(*machine.AlicloudMachineClassList).ListMeta}
- for _, item := range obj.(*machine.AlicloudMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested alicloudMachineClasses.
-func (c *FakeAlicloudMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(alicloudmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a alicloudMachineClass and creates it. Returns the server's representation of the alicloudMachineClass, and an error, if there is any.
-func (c *FakeAlicloudMachineClasses) Create(ctx context.Context, alicloudMachineClass *machine.AlicloudMachineClass, opts v1.CreateOptions) (result *machine.AlicloudMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(alicloudmachineclassesResource, c.ns, alicloudMachineClass), &machine.AlicloudMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AlicloudMachineClass), err
-}
-
-// Update takes the representation of a alicloudMachineClass and updates it. Returns the server's representation of the alicloudMachineClass, and an error, if there is any.
-func (c *FakeAlicloudMachineClasses) Update(ctx context.Context, alicloudMachineClass *machine.AlicloudMachineClass, opts v1.UpdateOptions) (result *machine.AlicloudMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(alicloudmachineclassesResource, c.ns, alicloudMachineClass), &machine.AlicloudMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AlicloudMachineClass), err
-}
-
-// Delete takes name of the alicloudMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeAlicloudMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(alicloudmachineclassesResource, c.ns, name), &machine.AlicloudMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeAlicloudMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(alicloudmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &machine.AlicloudMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched alicloudMachineClass.
-func (c *FakeAlicloudMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AlicloudMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(alicloudmachineclassesResource, c.ns, name, pt, data, subresources...), &machine.AlicloudMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AlicloudMachineClass), err
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_awsmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_awsmachineclass.go
deleted file mode 100644
index 0d9908cfc..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_awsmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeAWSMachineClasses implements AWSMachineClassInterface
-type FakeAWSMachineClasses struct {
- Fake *FakeMachine
- ns string
-}
-
-var awsmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "awsmachineclasses"}
-
-var awsmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", Kind: "AWSMachineClass"}
-
-// Get takes name of the aWSMachineClass, and returns the corresponding aWSMachineClass object, and an error if there is any.
-func (c *FakeAWSMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.AWSMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(awsmachineclassesResource, c.ns, name), &machine.AWSMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AWSMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of AWSMachineClasses that match those selectors.
-func (c *FakeAWSMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.AWSMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(awsmachineclassesResource, awsmachineclassesKind, c.ns, opts), &machine.AWSMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &machine.AWSMachineClassList{ListMeta: obj.(*machine.AWSMachineClassList).ListMeta}
- for _, item := range obj.(*machine.AWSMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested aWSMachineClasses.
-func (c *FakeAWSMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(awsmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a aWSMachineClass and creates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any.
-func (c *FakeAWSMachineClasses) Create(ctx context.Context, aWSMachineClass *machine.AWSMachineClass, opts v1.CreateOptions) (result *machine.AWSMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(awsmachineclassesResource, c.ns, aWSMachineClass), &machine.AWSMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AWSMachineClass), err
-}
-
-// Update takes the representation of a aWSMachineClass and updates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any.
-func (c *FakeAWSMachineClasses) Update(ctx context.Context, aWSMachineClass *machine.AWSMachineClass, opts v1.UpdateOptions) (result *machine.AWSMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(awsmachineclassesResource, c.ns, aWSMachineClass), &machine.AWSMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AWSMachineClass), err
-}
-
-// Delete takes name of the aWSMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeAWSMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(awsmachineclassesResource, c.ns, name), &machine.AWSMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeAWSMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(awsmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &machine.AWSMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched aWSMachineClass.
-func (c *FakeAWSMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AWSMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(awsmachineclassesResource, c.ns, name, pt, data, subresources...), &machine.AWSMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AWSMachineClass), err
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_azuremachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_azuremachineclass.go
deleted file mode 100644
index 316c6a27b..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_azuremachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeAzureMachineClasses implements AzureMachineClassInterface
-type FakeAzureMachineClasses struct {
- Fake *FakeMachine
- ns string
-}
-
-var azuremachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "azuremachineclasses"}
-
-var azuremachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", Kind: "AzureMachineClass"}
-
-// Get takes name of the azureMachineClass, and returns the corresponding azureMachineClass object, and an error if there is any.
-func (c *FakeAzureMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.AzureMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(azuremachineclassesResource, c.ns, name), &machine.AzureMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AzureMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of AzureMachineClasses that match those selectors.
-func (c *FakeAzureMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.AzureMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(azuremachineclassesResource, azuremachineclassesKind, c.ns, opts), &machine.AzureMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &machine.AzureMachineClassList{ListMeta: obj.(*machine.AzureMachineClassList).ListMeta}
- for _, item := range obj.(*machine.AzureMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested azureMachineClasses.
-func (c *FakeAzureMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(azuremachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a azureMachineClass and creates it. Returns the server's representation of the azureMachineClass, and an error, if there is any.
-func (c *FakeAzureMachineClasses) Create(ctx context.Context, azureMachineClass *machine.AzureMachineClass, opts v1.CreateOptions) (result *machine.AzureMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(azuremachineclassesResource, c.ns, azureMachineClass), &machine.AzureMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AzureMachineClass), err
-}
-
-// Update takes the representation of a azureMachineClass and updates it. Returns the server's representation of the azureMachineClass, and an error, if there is any.
-func (c *FakeAzureMachineClasses) Update(ctx context.Context, azureMachineClass *machine.AzureMachineClass, opts v1.UpdateOptions) (result *machine.AzureMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(azuremachineclassesResource, c.ns, azureMachineClass), &machine.AzureMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AzureMachineClass), err
-}
-
-// Delete takes name of the azureMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeAzureMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(azuremachineclassesResource, c.ns, name), &machine.AzureMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeAzureMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(azuremachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &machine.AzureMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched azureMachineClass.
-func (c *FakeAzureMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.AzureMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(azuremachineclassesResource, c.ns, name, pt, data, subresources...), &machine.AzureMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.AzureMachineClass), err
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_machine_client.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_machine_client.go
index a603de5d2..9e7eb1c76 100644
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_machine_client.go
+++ b/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_machine_client.go
@@ -28,22 +28,6 @@ type FakeMachine struct {
*testing.Fake
}
-func (c *FakeMachine) AWSMachineClasses(namespace string) internalversion.AWSMachineClassInterface {
- return &FakeAWSMachineClasses{c, namespace}
-}
-
-func (c *FakeMachine) AlicloudMachineClasses(namespace string) internalversion.AlicloudMachineClassInterface {
- return &FakeAlicloudMachineClasses{c, namespace}
-}
-
-func (c *FakeMachine) AzureMachineClasses(namespace string) internalversion.AzureMachineClassInterface {
- return &FakeAzureMachineClasses{c, namespace}
-}
-
-func (c *FakeMachine) GCPMachineClasses(namespace string) internalversion.GCPMachineClassInterface {
- return &FakeGCPMachineClasses{c, namespace}
-}
-
func (c *FakeMachine) Machines(namespace string) internalversion.MachineInterface {
return &FakeMachines{c, namespace}
}
@@ -64,14 +48,6 @@ func (c *FakeMachine) MachineTemplates(namespace string) internalversion.Machine
return &FakeMachineTemplates{c, namespace}
}
-func (c *FakeMachine) OpenStackMachineClasses(namespace string) internalversion.OpenStackMachineClassInterface {
- return &FakeOpenStackMachineClasses{c, namespace}
-}
-
-func (c *FakeMachine) PacketMachineClasses(namespace string) internalversion.PacketMachineClassInterface {
- return &FakePacketMachineClasses{c, namespace}
-}
-
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeMachine) RESTClient() rest.Interface {
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_openstackmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_openstackmachineclass.go
deleted file mode 100644
index 0df552a29..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_openstackmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeOpenStackMachineClasses implements OpenStackMachineClassInterface
-type FakeOpenStackMachineClasses struct {
- Fake *FakeMachine
- ns string
-}
-
-var openstackmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "openstackmachineclasses"}
-
-var openstackmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", Kind: "OpenStackMachineClass"}
-
-// Get takes name of the openStackMachineClass, and returns the corresponding openStackMachineClass object, and an error if there is any.
-func (c *FakeOpenStackMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.OpenStackMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(openstackmachineclassesResource, c.ns, name), &machine.OpenStackMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.OpenStackMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of OpenStackMachineClasses that match those selectors.
-func (c *FakeOpenStackMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.OpenStackMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(openstackmachineclassesResource, openstackmachineclassesKind, c.ns, opts), &machine.OpenStackMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &machine.OpenStackMachineClassList{ListMeta: obj.(*machine.OpenStackMachineClassList).ListMeta}
- for _, item := range obj.(*machine.OpenStackMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested openStackMachineClasses.
-func (c *FakeOpenStackMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(openstackmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a openStackMachineClass and creates it. Returns the server's representation of the openStackMachineClass, and an error, if there is any.
-func (c *FakeOpenStackMachineClasses) Create(ctx context.Context, openStackMachineClass *machine.OpenStackMachineClass, opts v1.CreateOptions) (result *machine.OpenStackMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(openstackmachineclassesResource, c.ns, openStackMachineClass), &machine.OpenStackMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.OpenStackMachineClass), err
-}
-
-// Update takes the representation of a openStackMachineClass and updates it. Returns the server's representation of the openStackMachineClass, and an error, if there is any.
-func (c *FakeOpenStackMachineClasses) Update(ctx context.Context, openStackMachineClass *machine.OpenStackMachineClass, opts v1.UpdateOptions) (result *machine.OpenStackMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(openstackmachineclassesResource, c.ns, openStackMachineClass), &machine.OpenStackMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.OpenStackMachineClass), err
-}
-
-// Delete takes name of the openStackMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeOpenStackMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(openstackmachineclassesResource, c.ns, name), &machine.OpenStackMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeOpenStackMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(openstackmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &machine.OpenStackMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched openStackMachineClass.
-func (c *FakeOpenStackMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.OpenStackMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(openstackmachineclassesResource, c.ns, name, pt, data, subresources...), &machine.OpenStackMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.OpenStackMachineClass), err
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_packetmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_packetmachineclass.go
deleted file mode 100644
index 70fa90a7f..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/fake/fake_packetmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakePacketMachineClasses implements PacketMachineClassInterface
-type FakePacketMachineClasses struct {
- Fake *FakeMachine
- ns string
-}
-
-var packetmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "", Resource: "packetmachineclasses"}
-
-var packetmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "", Kind: "PacketMachineClass"}
-
-// Get takes name of the packetMachineClass, and returns the corresponding packetMachineClass object, and an error if there is any.
-func (c *FakePacketMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.PacketMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(packetmachineclassesResource, c.ns, name), &machine.PacketMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.PacketMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of PacketMachineClasses that match those selectors.
-func (c *FakePacketMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.PacketMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(packetmachineclassesResource, packetmachineclassesKind, c.ns, opts), &machine.PacketMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &machine.PacketMachineClassList{ListMeta: obj.(*machine.PacketMachineClassList).ListMeta}
- for _, item := range obj.(*machine.PacketMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested packetMachineClasses.
-func (c *FakePacketMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(packetmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a packetMachineClass and creates it. Returns the server's representation of the packetMachineClass, and an error, if there is any.
-func (c *FakePacketMachineClasses) Create(ctx context.Context, packetMachineClass *machine.PacketMachineClass, opts v1.CreateOptions) (result *machine.PacketMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(packetmachineclassesResource, c.ns, packetMachineClass), &machine.PacketMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.PacketMachineClass), err
-}
-
-// Update takes the representation of a packetMachineClass and updates it. Returns the server's representation of the packetMachineClass, and an error, if there is any.
-func (c *FakePacketMachineClasses) Update(ctx context.Context, packetMachineClass *machine.PacketMachineClass, opts v1.UpdateOptions) (result *machine.PacketMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(packetmachineclassesResource, c.ns, packetMachineClass), &machine.PacketMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.PacketMachineClass), err
-}
-
-// Delete takes name of the packetMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakePacketMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(packetmachineclassesResource, c.ns, name), &machine.PacketMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakePacketMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(packetmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &machine.PacketMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched packetMachineClass.
-func (c *FakePacketMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.PacketMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(packetmachineclassesResource, c.ns, name, pt, data, subresources...), &machine.PacketMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*machine.PacketMachineClass), err
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/gcpmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/gcpmachineclass.go
deleted file mode 100644
index 7995388ff..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/gcpmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// GCPMachineClassesGetter has a method to return a GCPMachineClassInterface.
-// A group's client should implement this interface.
-type GCPMachineClassesGetter interface {
- GCPMachineClasses(namespace string) GCPMachineClassInterface
-}
-
-// GCPMachineClassInterface has methods to work with GCPMachineClass resources.
-type GCPMachineClassInterface interface {
- Create(ctx context.Context, gCPMachineClass *machine.GCPMachineClass, opts v1.CreateOptions) (*machine.GCPMachineClass, error)
- Update(ctx context.Context, gCPMachineClass *machine.GCPMachineClass, opts v1.UpdateOptions) (*machine.GCPMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*machine.GCPMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*machine.GCPMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.GCPMachineClass, err error)
- GCPMachineClassExpansion
-}
-
-// gCPMachineClasses implements GCPMachineClassInterface
-type gCPMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newGCPMachineClasses returns a GCPMachineClasses
-func newGCPMachineClasses(c *MachineClient, namespace string) *gCPMachineClasses {
- return &gCPMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the gCPMachineClass, and returns the corresponding gCPMachineClass object, and an error if there is any.
-func (c *gCPMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.GCPMachineClass, err error) {
- result = &machine.GCPMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of GCPMachineClasses that match those selectors.
-func (c *gCPMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.GCPMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &machine.GCPMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested gCPMachineClasses.
-func (c *gCPMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a gCPMachineClass and creates it. Returns the server's representation of the gCPMachineClass, and an error, if there is any.
-func (c *gCPMachineClasses) Create(ctx context.Context, gCPMachineClass *machine.GCPMachineClass, opts v1.CreateOptions) (result *machine.GCPMachineClass, err error) {
- result = &machine.GCPMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(gCPMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a gCPMachineClass and updates it. Returns the server's representation of the gCPMachineClass, and an error, if there is any.
-func (c *gCPMachineClasses) Update(ctx context.Context, gCPMachineClass *machine.GCPMachineClass, opts v1.UpdateOptions) (result *machine.GCPMachineClass, err error) {
- result = &machine.GCPMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- Name(gCPMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(gCPMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the gCPMachineClass and deletes it. Returns an error if one occurs.
-func (c *gCPMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *gCPMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched gCPMachineClass.
-func (c *gCPMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.GCPMachineClass, err error) {
- result = &machine.GCPMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/generated_expansion.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/generated_expansion.go
index abad70f11..b973b7cec 100644
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/generated_expansion.go
+++ b/pkg/client/clientset/internalversion/typed/machine/internalversion/generated_expansion.go
@@ -18,14 +18,6 @@ limitations under the License.
package internalversion
-type AWSMachineClassExpansion interface{}
-
-type AlicloudMachineClassExpansion interface{}
-
-type AzureMachineClassExpansion interface{}
-
-type GCPMachineClassExpansion interface{}
-
type MachineExpansion interface{}
type MachineClassExpansion interface{}
@@ -35,7 +27,3 @@ type MachineDeploymentExpansion interface{}
type MachineSetExpansion interface{}
type MachineTemplateExpansion interface{}
-
-type OpenStackMachineClassExpansion interface{}
-
-type PacketMachineClassExpansion interface{}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go
index 9d63ea283..f346606a2 100644
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go
+++ b/pkg/client/clientset/internalversion/typed/machine/internalversion/machine_client.go
@@ -25,17 +25,11 @@ import (
type MachineInterface interface {
RESTClient() rest.Interface
- AWSMachineClassesGetter
- AlicloudMachineClassesGetter
- AzureMachineClassesGetter
- GCPMachineClassesGetter
MachinesGetter
MachineClassesGetter
MachineDeploymentsGetter
MachineSetsGetter
MachineTemplatesGetter
- OpenStackMachineClassesGetter
- PacketMachineClassesGetter
}
// MachineClient is used to interact with features provided by the machine.sapcloud.io group.
@@ -43,22 +37,6 @@ type MachineClient struct {
restClient rest.Interface
}
-func (c *MachineClient) AWSMachineClasses(namespace string) AWSMachineClassInterface {
- return newAWSMachineClasses(c, namespace)
-}
-
-func (c *MachineClient) AlicloudMachineClasses(namespace string) AlicloudMachineClassInterface {
- return newAlicloudMachineClasses(c, namespace)
-}
-
-func (c *MachineClient) AzureMachineClasses(namespace string) AzureMachineClassInterface {
- return newAzureMachineClasses(c, namespace)
-}
-
-func (c *MachineClient) GCPMachineClasses(namespace string) GCPMachineClassInterface {
- return newGCPMachineClasses(c, namespace)
-}
-
func (c *MachineClient) Machines(namespace string) MachineInterface {
return newMachines(c, namespace)
}
@@ -79,14 +57,6 @@ func (c *MachineClient) MachineTemplates(namespace string) MachineTemplateInterf
return newMachineTemplates(c, namespace)
}
-func (c *MachineClient) OpenStackMachineClasses(namespace string) OpenStackMachineClassInterface {
- return newOpenStackMachineClasses(c, namespace)
-}
-
-func (c *MachineClient) PacketMachineClasses(namespace string) PacketMachineClassInterface {
- return newPacketMachineClasses(c, namespace)
-}
-
// NewForConfig creates a new MachineClient for the given config.
func NewForConfig(c *rest.Config) (*MachineClient, error) {
config := *c
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/openstackmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/openstackmachineclass.go
deleted file mode 100644
index ae1d31e58..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/openstackmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// OpenStackMachineClassesGetter has a method to return a OpenStackMachineClassInterface.
-// A group's client should implement this interface.
-type OpenStackMachineClassesGetter interface {
- OpenStackMachineClasses(namespace string) OpenStackMachineClassInterface
-}
-
-// OpenStackMachineClassInterface has methods to work with OpenStackMachineClass resources.
-type OpenStackMachineClassInterface interface {
- Create(ctx context.Context, openStackMachineClass *machine.OpenStackMachineClass, opts v1.CreateOptions) (*machine.OpenStackMachineClass, error)
- Update(ctx context.Context, openStackMachineClass *machine.OpenStackMachineClass, opts v1.UpdateOptions) (*machine.OpenStackMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*machine.OpenStackMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*machine.OpenStackMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.OpenStackMachineClass, err error)
- OpenStackMachineClassExpansion
-}
-
-// openStackMachineClasses implements OpenStackMachineClassInterface
-type openStackMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newOpenStackMachineClasses returns a OpenStackMachineClasses
-func newOpenStackMachineClasses(c *MachineClient, namespace string) *openStackMachineClasses {
- return &openStackMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the openStackMachineClass, and returns the corresponding openStackMachineClass object, and an error if there is any.
-func (c *openStackMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.OpenStackMachineClass, err error) {
- result = &machine.OpenStackMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of OpenStackMachineClasses that match those selectors.
-func (c *openStackMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.OpenStackMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &machine.OpenStackMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested openStackMachineClasses.
-func (c *openStackMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a openStackMachineClass and creates it. Returns the server's representation of the openStackMachineClass, and an error, if there is any.
-func (c *openStackMachineClasses) Create(ctx context.Context, openStackMachineClass *machine.OpenStackMachineClass, opts v1.CreateOptions) (result *machine.OpenStackMachineClass, err error) {
- result = &machine.OpenStackMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(openStackMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a openStackMachineClass and updates it. Returns the server's representation of the openStackMachineClass, and an error, if there is any.
-func (c *openStackMachineClasses) Update(ctx context.Context, openStackMachineClass *machine.OpenStackMachineClass, opts v1.UpdateOptions) (result *machine.OpenStackMachineClass, err error) {
- result = &machine.OpenStackMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- Name(openStackMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(openStackMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the openStackMachineClass and deletes it. Returns an error if one occurs.
-func (c *openStackMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *openStackMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched openStackMachineClass.
-func (c *openStackMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.OpenStackMachineClass, err error) {
- result = &machine.OpenStackMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/internalversion/typed/machine/internalversion/packetmachineclass.go b/pkg/client/clientset/internalversion/typed/machine/internalversion/packetmachineclass.go
deleted file mode 100644
index 950e8d157..000000000
--- a/pkg/client/clientset/internalversion/typed/machine/internalversion/packetmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// PacketMachineClassesGetter has a method to return a PacketMachineClassInterface.
-// A group's client should implement this interface.
-type PacketMachineClassesGetter interface {
- PacketMachineClasses(namespace string) PacketMachineClassInterface
-}
-
-// PacketMachineClassInterface has methods to work with PacketMachineClass resources.
-type PacketMachineClassInterface interface {
- Create(ctx context.Context, packetMachineClass *machine.PacketMachineClass, opts v1.CreateOptions) (*machine.PacketMachineClass, error)
- Update(ctx context.Context, packetMachineClass *machine.PacketMachineClass, opts v1.UpdateOptions) (*machine.PacketMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*machine.PacketMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*machine.PacketMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.PacketMachineClass, err error)
- PacketMachineClassExpansion
-}
-
-// packetMachineClasses implements PacketMachineClassInterface
-type packetMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newPacketMachineClasses returns a PacketMachineClasses
-func newPacketMachineClasses(c *MachineClient, namespace string) *packetMachineClasses {
- return &packetMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the packetMachineClass, and returns the corresponding packetMachineClass object, and an error if there is any.
-func (c *packetMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *machine.PacketMachineClass, err error) {
- result = &machine.PacketMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of PacketMachineClasses that match those selectors.
-func (c *packetMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *machine.PacketMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &machine.PacketMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested packetMachineClasses.
-func (c *packetMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a packetMachineClass and creates it. Returns the server's representation of the packetMachineClass, and an error, if there is any.
-func (c *packetMachineClasses) Create(ctx context.Context, packetMachineClass *machine.PacketMachineClass, opts v1.CreateOptions) (result *machine.PacketMachineClass, err error) {
- result = &machine.PacketMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(packetMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a packetMachineClass and updates it. Returns the server's representation of the packetMachineClass, and an error, if there is any.
-func (c *packetMachineClasses) Update(ctx context.Context, packetMachineClass *machine.PacketMachineClass, opts v1.UpdateOptions) (result *machine.PacketMachineClass, err error) {
- result = &machine.PacketMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- Name(packetMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(packetMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the packetMachineClass and deletes it. Returns an error if one occurs.
-func (c *packetMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *packetMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched packetMachineClass.
-func (c *packetMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *machine.PacketMachineClass, err error) {
- result = &machine.PacketMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("packetmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go
index d7f44b851..519163ace 100644
--- a/pkg/client/clientset/versioned/fake/register.go
+++ b/pkg/client/clientset/versioned/fake/register.go
@@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
-// import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-// )
+// import (
+// "k8s.io/client-go/kubernetes"
+// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
//
-// kclientset, _ := kubernetes.NewForConfig(c)
-// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go
index 7595471ba..1fb02f61c 100644
--- a/pkg/client/clientset/versioned/scheme/register.go
+++ b/pkg/client/clientset/versioned/scheme/register.go
@@ -37,14 +37,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
-// import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-// )
+// import (
+// "k8s.io/client-go/kubernetes"
+// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
//
-// kclientset, _ := kubernetes.NewForConfig(c)
-// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/alicloudmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/alicloudmachineclass.go
deleted file mode 100644
index 40ac04536..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/alicloudmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- "time"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// AlicloudMachineClassesGetter has a method to return a AlicloudMachineClassInterface.
-// A group's client should implement this interface.
-type AlicloudMachineClassesGetter interface {
- AlicloudMachineClasses(namespace string) AlicloudMachineClassInterface
-}
-
-// AlicloudMachineClassInterface has methods to work with AlicloudMachineClass resources.
-type AlicloudMachineClassInterface interface {
- Create(ctx context.Context, alicloudMachineClass *v1alpha1.AlicloudMachineClass, opts v1.CreateOptions) (*v1alpha1.AlicloudMachineClass, error)
- Update(ctx context.Context, alicloudMachineClass *v1alpha1.AlicloudMachineClass, opts v1.UpdateOptions) (*v1alpha1.AlicloudMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.AlicloudMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AlicloudMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AlicloudMachineClass, err error)
- AlicloudMachineClassExpansion
-}
-
-// alicloudMachineClasses implements AlicloudMachineClassInterface
-type alicloudMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newAlicloudMachineClasses returns a AlicloudMachineClasses
-func newAlicloudMachineClasses(c *MachineV1alpha1Client, namespace string) *alicloudMachineClasses {
- return &alicloudMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the alicloudMachineClass, and returns the corresponding alicloudMachineClass object, and an error if there is any.
-func (c *alicloudMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AlicloudMachineClass, err error) {
- result = &v1alpha1.AlicloudMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of AlicloudMachineClasses that match those selectors.
-func (c *alicloudMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AlicloudMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &v1alpha1.AlicloudMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested alicloudMachineClasses.
-func (c *alicloudMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a alicloudMachineClass and creates it. Returns the server's representation of the alicloudMachineClass, and an error, if there is any.
-func (c *alicloudMachineClasses) Create(ctx context.Context, alicloudMachineClass *v1alpha1.AlicloudMachineClass, opts v1.CreateOptions) (result *v1alpha1.AlicloudMachineClass, err error) {
- result = &v1alpha1.AlicloudMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(alicloudMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a alicloudMachineClass and updates it. Returns the server's representation of the alicloudMachineClass, and an error, if there is any.
-func (c *alicloudMachineClasses) Update(ctx context.Context, alicloudMachineClass *v1alpha1.AlicloudMachineClass, opts v1.UpdateOptions) (result *v1alpha1.AlicloudMachineClass, err error) {
- result = &v1alpha1.AlicloudMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- Name(alicloudMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(alicloudMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the alicloudMachineClass and deletes it. Returns an error if one occurs.
-func (c *alicloudMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *alicloudMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched alicloudMachineClass.
-func (c *alicloudMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AlicloudMachineClass, err error) {
- result = &v1alpha1.AlicloudMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("alicloudmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/awsmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/awsmachineclass.go
deleted file mode 100644
index b93ccbe2f..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/awsmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- "time"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// AWSMachineClassesGetter has a method to return a AWSMachineClassInterface.
-// A group's client should implement this interface.
-type AWSMachineClassesGetter interface {
- AWSMachineClasses(namespace string) AWSMachineClassInterface
-}
-
-// AWSMachineClassInterface has methods to work with AWSMachineClass resources.
-type AWSMachineClassInterface interface {
- Create(ctx context.Context, aWSMachineClass *v1alpha1.AWSMachineClass, opts v1.CreateOptions) (*v1alpha1.AWSMachineClass, error)
- Update(ctx context.Context, aWSMachineClass *v1alpha1.AWSMachineClass, opts v1.UpdateOptions) (*v1alpha1.AWSMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.AWSMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AWSMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AWSMachineClass, err error)
- AWSMachineClassExpansion
-}
-
-// aWSMachineClasses implements AWSMachineClassInterface
-type aWSMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newAWSMachineClasses returns a AWSMachineClasses
-func newAWSMachineClasses(c *MachineV1alpha1Client, namespace string) *aWSMachineClasses {
- return &aWSMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the aWSMachineClass, and returns the corresponding aWSMachineClass object, and an error if there is any.
-func (c *aWSMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AWSMachineClass, err error) {
- result = &v1alpha1.AWSMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of AWSMachineClasses that match those selectors.
-func (c *aWSMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AWSMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &v1alpha1.AWSMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested aWSMachineClasses.
-func (c *aWSMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a aWSMachineClass and creates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any.
-func (c *aWSMachineClasses) Create(ctx context.Context, aWSMachineClass *v1alpha1.AWSMachineClass, opts v1.CreateOptions) (result *v1alpha1.AWSMachineClass, err error) {
- result = &v1alpha1.AWSMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(aWSMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a aWSMachineClass and updates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any.
-func (c *aWSMachineClasses) Update(ctx context.Context, aWSMachineClass *v1alpha1.AWSMachineClass, opts v1.UpdateOptions) (result *v1alpha1.AWSMachineClass, err error) {
- result = &v1alpha1.AWSMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- Name(aWSMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(aWSMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the aWSMachineClass and deletes it. Returns an error if one occurs.
-func (c *aWSMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *aWSMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("awsmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched aWSMachineClass.
-func (c *aWSMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AWSMachineClass, err error) {
- result = &v1alpha1.AWSMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("awsmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/azuremachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/azuremachineclass.go
deleted file mode 100644
index 2445d0308..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/azuremachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- "time"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// AzureMachineClassesGetter has a method to return a AzureMachineClassInterface.
-// A group's client should implement this interface.
-type AzureMachineClassesGetter interface {
- AzureMachineClasses(namespace string) AzureMachineClassInterface
-}
-
-// AzureMachineClassInterface has methods to work with AzureMachineClass resources.
-type AzureMachineClassInterface interface {
- Create(ctx context.Context, azureMachineClass *v1alpha1.AzureMachineClass, opts v1.CreateOptions) (*v1alpha1.AzureMachineClass, error)
- Update(ctx context.Context, azureMachineClass *v1alpha1.AzureMachineClass, opts v1.UpdateOptions) (*v1alpha1.AzureMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.AzureMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AzureMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureMachineClass, err error)
- AzureMachineClassExpansion
-}
-
-// azureMachineClasses implements AzureMachineClassInterface
-type azureMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newAzureMachineClasses returns a AzureMachineClasses
-func newAzureMachineClasses(c *MachineV1alpha1Client, namespace string) *azureMachineClasses {
- return &azureMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the azureMachineClass, and returns the corresponding azureMachineClass object, and an error if there is any.
-func (c *azureMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AzureMachineClass, err error) {
- result = &v1alpha1.AzureMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of AzureMachineClasses that match those selectors.
-func (c *azureMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &v1alpha1.AzureMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested azureMachineClasses.
-func (c *azureMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a azureMachineClass and creates it. Returns the server's representation of the azureMachineClass, and an error, if there is any.
-func (c *azureMachineClasses) Create(ctx context.Context, azureMachineClass *v1alpha1.AzureMachineClass, opts v1.CreateOptions) (result *v1alpha1.AzureMachineClass, err error) {
- result = &v1alpha1.AzureMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(azureMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a azureMachineClass and updates it. Returns the server's representation of the azureMachineClass, and an error, if there is any.
-func (c *azureMachineClasses) Update(ctx context.Context, azureMachineClass *v1alpha1.AzureMachineClass, opts v1.UpdateOptions) (result *v1alpha1.AzureMachineClass, err error) {
- result = &v1alpha1.AzureMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- Name(azureMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(azureMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the azureMachineClass and deletes it. Returns an error if one occurs.
-func (c *azureMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *azureMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("azuremachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched azureMachineClass.
-func (c *azureMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureMachineClass, err error) {
- result = &v1alpha1.AzureMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("azuremachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_alicloudmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_alicloudmachineclass.go
deleted file mode 100644
index fff3d3638..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_alicloudmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeAlicloudMachineClasses implements AlicloudMachineClassInterface
-type FakeAlicloudMachineClasses struct {
- Fake *FakeMachineV1alpha1
- ns string
-}
-
-var alicloudmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "alicloudmachineclasses"}
-
-var alicloudmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "v1alpha1", Kind: "AlicloudMachineClass"}
-
-// Get takes name of the alicloudMachineClass, and returns the corresponding alicloudMachineClass object, and an error if there is any.
-func (c *FakeAlicloudMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AlicloudMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(alicloudmachineclassesResource, c.ns, name), &v1alpha1.AlicloudMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AlicloudMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of AlicloudMachineClasses that match those selectors.
-func (c *FakeAlicloudMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AlicloudMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(alicloudmachineclassesResource, alicloudmachineclassesKind, c.ns, opts), &v1alpha1.AlicloudMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &v1alpha1.AlicloudMachineClassList{ListMeta: obj.(*v1alpha1.AlicloudMachineClassList).ListMeta}
- for _, item := range obj.(*v1alpha1.AlicloudMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested alicloudMachineClasses.
-func (c *FakeAlicloudMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(alicloudmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a alicloudMachineClass and creates it. Returns the server's representation of the alicloudMachineClass, and an error, if there is any.
-func (c *FakeAlicloudMachineClasses) Create(ctx context.Context, alicloudMachineClass *v1alpha1.AlicloudMachineClass, opts v1.CreateOptions) (result *v1alpha1.AlicloudMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(alicloudmachineclassesResource, c.ns, alicloudMachineClass), &v1alpha1.AlicloudMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AlicloudMachineClass), err
-}
-
-// Update takes the representation of a alicloudMachineClass and updates it. Returns the server's representation of the alicloudMachineClass, and an error, if there is any.
-func (c *FakeAlicloudMachineClasses) Update(ctx context.Context, alicloudMachineClass *v1alpha1.AlicloudMachineClass, opts v1.UpdateOptions) (result *v1alpha1.AlicloudMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(alicloudmachineclassesResource, c.ns, alicloudMachineClass), &v1alpha1.AlicloudMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AlicloudMachineClass), err
-}
-
-// Delete takes name of the alicloudMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeAlicloudMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(alicloudmachineclassesResource, c.ns, name), &v1alpha1.AlicloudMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeAlicloudMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(alicloudmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &v1alpha1.AlicloudMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched alicloudMachineClass.
-func (c *FakeAlicloudMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AlicloudMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(alicloudmachineclassesResource, c.ns, name, pt, data, subresources...), &v1alpha1.AlicloudMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AlicloudMachineClass), err
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_awsmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_awsmachineclass.go
deleted file mode 100644
index fdc62ce6e..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_awsmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeAWSMachineClasses implements AWSMachineClassInterface
-type FakeAWSMachineClasses struct {
- Fake *FakeMachineV1alpha1
- ns string
-}
-
-var awsmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "awsmachineclasses"}
-
-var awsmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "v1alpha1", Kind: "AWSMachineClass"}
-
-// Get takes name of the aWSMachineClass, and returns the corresponding aWSMachineClass object, and an error if there is any.
-func (c *FakeAWSMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AWSMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(awsmachineclassesResource, c.ns, name), &v1alpha1.AWSMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AWSMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of AWSMachineClasses that match those selectors.
-func (c *FakeAWSMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AWSMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(awsmachineclassesResource, awsmachineclassesKind, c.ns, opts), &v1alpha1.AWSMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &v1alpha1.AWSMachineClassList{ListMeta: obj.(*v1alpha1.AWSMachineClassList).ListMeta}
- for _, item := range obj.(*v1alpha1.AWSMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested aWSMachineClasses.
-func (c *FakeAWSMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(awsmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a aWSMachineClass and creates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any.
-func (c *FakeAWSMachineClasses) Create(ctx context.Context, aWSMachineClass *v1alpha1.AWSMachineClass, opts v1.CreateOptions) (result *v1alpha1.AWSMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(awsmachineclassesResource, c.ns, aWSMachineClass), &v1alpha1.AWSMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AWSMachineClass), err
-}
-
-// Update takes the representation of a aWSMachineClass and updates it. Returns the server's representation of the aWSMachineClass, and an error, if there is any.
-func (c *FakeAWSMachineClasses) Update(ctx context.Context, aWSMachineClass *v1alpha1.AWSMachineClass, opts v1.UpdateOptions) (result *v1alpha1.AWSMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(awsmachineclassesResource, c.ns, aWSMachineClass), &v1alpha1.AWSMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AWSMachineClass), err
-}
-
-// Delete takes name of the aWSMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeAWSMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(awsmachineclassesResource, c.ns, name), &v1alpha1.AWSMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeAWSMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(awsmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &v1alpha1.AWSMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched aWSMachineClass.
-func (c *FakeAWSMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AWSMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(awsmachineclassesResource, c.ns, name, pt, data, subresources...), &v1alpha1.AWSMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AWSMachineClass), err
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_azuremachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_azuremachineclass.go
deleted file mode 100644
index 170e43992..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_azuremachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeAzureMachineClasses implements AzureMachineClassInterface
-type FakeAzureMachineClasses struct {
- Fake *FakeMachineV1alpha1
- ns string
-}
-
-var azuremachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "azuremachineclasses"}
-
-var azuremachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "v1alpha1", Kind: "AzureMachineClass"}
-
-// Get takes name of the azureMachineClass, and returns the corresponding azureMachineClass object, and an error if there is any.
-func (c *FakeAzureMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.AzureMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(azuremachineclassesResource, c.ns, name), &v1alpha1.AzureMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AzureMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of AzureMachineClasses that match those selectors.
-func (c *FakeAzureMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.AzureMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(azuremachineclassesResource, azuremachineclassesKind, c.ns, opts), &v1alpha1.AzureMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &v1alpha1.AzureMachineClassList{ListMeta: obj.(*v1alpha1.AzureMachineClassList).ListMeta}
- for _, item := range obj.(*v1alpha1.AzureMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested azureMachineClasses.
-func (c *FakeAzureMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(azuremachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a azureMachineClass and creates it. Returns the server's representation of the azureMachineClass, and an error, if there is any.
-func (c *FakeAzureMachineClasses) Create(ctx context.Context, azureMachineClass *v1alpha1.AzureMachineClass, opts v1.CreateOptions) (result *v1alpha1.AzureMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(azuremachineclassesResource, c.ns, azureMachineClass), &v1alpha1.AzureMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AzureMachineClass), err
-}
-
-// Update takes the representation of a azureMachineClass and updates it. Returns the server's representation of the azureMachineClass, and an error, if there is any.
-func (c *FakeAzureMachineClasses) Update(ctx context.Context, azureMachineClass *v1alpha1.AzureMachineClass, opts v1.UpdateOptions) (result *v1alpha1.AzureMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(azuremachineclassesResource, c.ns, azureMachineClass), &v1alpha1.AzureMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AzureMachineClass), err
-}
-
-// Delete takes name of the azureMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeAzureMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(azuremachineclassesResource, c.ns, name), &v1alpha1.AzureMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeAzureMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(azuremachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &v1alpha1.AzureMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched azureMachineClass.
-func (c *FakeAzureMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.AzureMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(azuremachineclassesResource, c.ns, name, pt, data, subresources...), &v1alpha1.AzureMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.AzureMachineClass), err
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_gcpmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_gcpmachineclass.go
deleted file mode 100644
index ec05b6b90..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_gcpmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeGCPMachineClasses implements GCPMachineClassInterface
-type FakeGCPMachineClasses struct {
- Fake *FakeMachineV1alpha1
- ns string
-}
-
-var gcpmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "gcpmachineclasses"}
-
-var gcpmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "v1alpha1", Kind: "GCPMachineClass"}
-
-// Get takes name of the gCPMachineClass, and returns the corresponding gCPMachineClass object, and an error if there is any.
-func (c *FakeGCPMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GCPMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(gcpmachineclassesResource, c.ns, name), &v1alpha1.GCPMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.GCPMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of GCPMachineClasses that match those selectors.
-func (c *FakeGCPMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GCPMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(gcpmachineclassesResource, gcpmachineclassesKind, c.ns, opts), &v1alpha1.GCPMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &v1alpha1.GCPMachineClassList{ListMeta: obj.(*v1alpha1.GCPMachineClassList).ListMeta}
- for _, item := range obj.(*v1alpha1.GCPMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested gCPMachineClasses.
-func (c *FakeGCPMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(gcpmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a gCPMachineClass and creates it. Returns the server's representation of the gCPMachineClass, and an error, if there is any.
-func (c *FakeGCPMachineClasses) Create(ctx context.Context, gCPMachineClass *v1alpha1.GCPMachineClass, opts v1.CreateOptions) (result *v1alpha1.GCPMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(gcpmachineclassesResource, c.ns, gCPMachineClass), &v1alpha1.GCPMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.GCPMachineClass), err
-}
-
-// Update takes the representation of a gCPMachineClass and updates it. Returns the server's representation of the gCPMachineClass, and an error, if there is any.
-func (c *FakeGCPMachineClasses) Update(ctx context.Context, gCPMachineClass *v1alpha1.GCPMachineClass, opts v1.UpdateOptions) (result *v1alpha1.GCPMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(gcpmachineclassesResource, c.ns, gCPMachineClass), &v1alpha1.GCPMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.GCPMachineClass), err
-}
-
-// Delete takes name of the gCPMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeGCPMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(gcpmachineclassesResource, c.ns, name), &v1alpha1.GCPMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeGCPMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(gcpmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &v1alpha1.GCPMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched gCPMachineClass.
-func (c *FakeGCPMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GCPMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(gcpmachineclassesResource, c.ns, name, pt, data, subresources...), &v1alpha1.GCPMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.GCPMachineClass), err
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_machine_client.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_machine_client.go
index d262daff5..fa14e6722 100644
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_machine_client.go
+++ b/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_machine_client.go
@@ -28,22 +28,6 @@ type FakeMachineV1alpha1 struct {
*testing.Fake
}
-func (c *FakeMachineV1alpha1) AWSMachineClasses(namespace string) v1alpha1.AWSMachineClassInterface {
- return &FakeAWSMachineClasses{c, namespace}
-}
-
-func (c *FakeMachineV1alpha1) AlicloudMachineClasses(namespace string) v1alpha1.AlicloudMachineClassInterface {
- return &FakeAlicloudMachineClasses{c, namespace}
-}
-
-func (c *FakeMachineV1alpha1) AzureMachineClasses(namespace string) v1alpha1.AzureMachineClassInterface {
- return &FakeAzureMachineClasses{c, namespace}
-}
-
-func (c *FakeMachineV1alpha1) GCPMachineClasses(namespace string) v1alpha1.GCPMachineClassInterface {
- return &FakeGCPMachineClasses{c, namespace}
-}
-
func (c *FakeMachineV1alpha1) Machines(namespace string) v1alpha1.MachineInterface {
return &FakeMachines{c, namespace}
}
@@ -60,14 +44,6 @@ func (c *FakeMachineV1alpha1) MachineSets(namespace string) v1alpha1.MachineSetI
return &FakeMachineSets{c, namespace}
}
-func (c *FakeMachineV1alpha1) OpenStackMachineClasses(namespace string) v1alpha1.OpenStackMachineClassInterface {
- return &FakeOpenStackMachineClasses{c, namespace}
-}
-
-func (c *FakeMachineV1alpha1) PacketMachineClasses(namespace string) v1alpha1.PacketMachineClassInterface {
- return &FakePacketMachineClasses{c, namespace}
-}
-
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeMachineV1alpha1) RESTClient() rest.Interface {
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_openstackmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_openstackmachineclass.go
deleted file mode 100644
index 7c434982a..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_openstackmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakeOpenStackMachineClasses implements OpenStackMachineClassInterface
-type FakeOpenStackMachineClasses struct {
- Fake *FakeMachineV1alpha1
- ns string
-}
-
-var openstackmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "openstackmachineclasses"}
-
-var openstackmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "v1alpha1", Kind: "OpenStackMachineClass"}
-
-// Get takes name of the openStackMachineClass, and returns the corresponding openStackMachineClass object, and an error if there is any.
-func (c *FakeOpenStackMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.OpenStackMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(openstackmachineclassesResource, c.ns, name), &v1alpha1.OpenStackMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.OpenStackMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of OpenStackMachineClasses that match those selectors.
-func (c *FakeOpenStackMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.OpenStackMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(openstackmachineclassesResource, openstackmachineclassesKind, c.ns, opts), &v1alpha1.OpenStackMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &v1alpha1.OpenStackMachineClassList{ListMeta: obj.(*v1alpha1.OpenStackMachineClassList).ListMeta}
- for _, item := range obj.(*v1alpha1.OpenStackMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested openStackMachineClasses.
-func (c *FakeOpenStackMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(openstackmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a openStackMachineClass and creates it. Returns the server's representation of the openStackMachineClass, and an error, if there is any.
-func (c *FakeOpenStackMachineClasses) Create(ctx context.Context, openStackMachineClass *v1alpha1.OpenStackMachineClass, opts v1.CreateOptions) (result *v1alpha1.OpenStackMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(openstackmachineclassesResource, c.ns, openStackMachineClass), &v1alpha1.OpenStackMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.OpenStackMachineClass), err
-}
-
-// Update takes the representation of a openStackMachineClass and updates it. Returns the server's representation of the openStackMachineClass, and an error, if there is any.
-func (c *FakeOpenStackMachineClasses) Update(ctx context.Context, openStackMachineClass *v1alpha1.OpenStackMachineClass, opts v1.UpdateOptions) (result *v1alpha1.OpenStackMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(openstackmachineclassesResource, c.ns, openStackMachineClass), &v1alpha1.OpenStackMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.OpenStackMachineClass), err
-}
-
-// Delete takes name of the openStackMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakeOpenStackMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(openstackmachineclassesResource, c.ns, name), &v1alpha1.OpenStackMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakeOpenStackMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(openstackmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &v1alpha1.OpenStackMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched openStackMachineClass.
-func (c *FakeOpenStackMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.OpenStackMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(openstackmachineclassesResource, c.ns, name, pt, data, subresources...), &v1alpha1.OpenStackMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.OpenStackMachineClass), err
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_packetmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_packetmachineclass.go
deleted file mode 100644
index d492591f8..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake/fake_packetmachineclass.go
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package fake
-
-import (
- "context"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- labels "k8s.io/apimachinery/pkg/labels"
- schema "k8s.io/apimachinery/pkg/runtime/schema"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- testing "k8s.io/client-go/testing"
-)
-
-// FakePacketMachineClasses implements PacketMachineClassInterface
-type FakePacketMachineClasses struct {
- Fake *FakeMachineV1alpha1
- ns string
-}
-
-var packetmachineclassesResource = schema.GroupVersionResource{Group: "machine.sapcloud.io", Version: "v1alpha1", Resource: "packetmachineclasses"}
-
-var packetmachineclassesKind = schema.GroupVersionKind{Group: "machine.sapcloud.io", Version: "v1alpha1", Kind: "PacketMachineClass"}
-
-// Get takes name of the packetMachineClass, and returns the corresponding packetMachineClass object, and an error if there is any.
-func (c *FakePacketMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PacketMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewGetAction(packetmachineclassesResource, c.ns, name), &v1alpha1.PacketMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.PacketMachineClass), err
-}
-
-// List takes label and field selectors, and returns the list of PacketMachineClasses that match those selectors.
-func (c *FakePacketMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PacketMachineClassList, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewListAction(packetmachineclassesResource, packetmachineclassesKind, c.ns, opts), &v1alpha1.PacketMachineClassList{})
-
- if obj == nil {
- return nil, err
- }
-
- label, _, _ := testing.ExtractFromListOptions(opts)
- if label == nil {
- label = labels.Everything()
- }
- list := &v1alpha1.PacketMachineClassList{ListMeta: obj.(*v1alpha1.PacketMachineClassList).ListMeta}
- for _, item := range obj.(*v1alpha1.PacketMachineClassList).Items {
- if label.Matches(labels.Set(item.Labels)) {
- list.Items = append(list.Items, item)
- }
- }
- return list, err
-}
-
-// Watch returns a watch.Interface that watches the requested packetMachineClasses.
-func (c *FakePacketMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- return c.Fake.
- InvokesWatch(testing.NewWatchAction(packetmachineclassesResource, c.ns, opts))
-
-}
-
-// Create takes the representation of a packetMachineClass and creates it. Returns the server's representation of the packetMachineClass, and an error, if there is any.
-func (c *FakePacketMachineClasses) Create(ctx context.Context, packetMachineClass *v1alpha1.PacketMachineClass, opts v1.CreateOptions) (result *v1alpha1.PacketMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewCreateAction(packetmachineclassesResource, c.ns, packetMachineClass), &v1alpha1.PacketMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.PacketMachineClass), err
-}
-
-// Update takes the representation of a packetMachineClass and updates it. Returns the server's representation of the packetMachineClass, and an error, if there is any.
-func (c *FakePacketMachineClasses) Update(ctx context.Context, packetMachineClass *v1alpha1.PacketMachineClass, opts v1.UpdateOptions) (result *v1alpha1.PacketMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewUpdateAction(packetmachineclassesResource, c.ns, packetMachineClass), &v1alpha1.PacketMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.PacketMachineClass), err
-}
-
-// Delete takes name of the packetMachineClass and deletes it. Returns an error if one occurs.
-func (c *FakePacketMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- _, err := c.Fake.
- Invokes(testing.NewDeleteAction(packetmachineclassesResource, c.ns, name), &v1alpha1.PacketMachineClass{})
-
- return err
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *FakePacketMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- action := testing.NewDeleteCollectionAction(packetmachineclassesResource, c.ns, listOpts)
-
- _, err := c.Fake.Invokes(action, &v1alpha1.PacketMachineClassList{})
- return err
-}
-
-// Patch applies the patch and returns the patched packetMachineClass.
-func (c *FakePacketMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PacketMachineClass, err error) {
- obj, err := c.Fake.
- Invokes(testing.NewPatchSubresourceAction(packetmachineclassesResource, c.ns, name, pt, data, subresources...), &v1alpha1.PacketMachineClass{})
-
- if obj == nil {
- return nil, err
- }
- return obj.(*v1alpha1.PacketMachineClass), err
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/gcpmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/gcpmachineclass.go
deleted file mode 100644
index c99adffb1..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/gcpmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- "time"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// GCPMachineClassesGetter has a method to return a GCPMachineClassInterface.
-// A group's client should implement this interface.
-type GCPMachineClassesGetter interface {
- GCPMachineClasses(namespace string) GCPMachineClassInterface
-}
-
-// GCPMachineClassInterface has methods to work with GCPMachineClass resources.
-type GCPMachineClassInterface interface {
- Create(ctx context.Context, gCPMachineClass *v1alpha1.GCPMachineClass, opts v1.CreateOptions) (*v1alpha1.GCPMachineClass, error)
- Update(ctx context.Context, gCPMachineClass *v1alpha1.GCPMachineClass, opts v1.UpdateOptions) (*v1alpha1.GCPMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.GCPMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.GCPMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GCPMachineClass, err error)
- GCPMachineClassExpansion
-}
-
-// gCPMachineClasses implements GCPMachineClassInterface
-type gCPMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newGCPMachineClasses returns a GCPMachineClasses
-func newGCPMachineClasses(c *MachineV1alpha1Client, namespace string) *gCPMachineClasses {
- return &gCPMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the gCPMachineClass, and returns the corresponding gCPMachineClass object, and an error if there is any.
-func (c *gCPMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.GCPMachineClass, err error) {
- result = &v1alpha1.GCPMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of GCPMachineClasses that match those selectors.
-func (c *gCPMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.GCPMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &v1alpha1.GCPMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested gCPMachineClasses.
-func (c *gCPMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a gCPMachineClass and creates it. Returns the server's representation of the gCPMachineClass, and an error, if there is any.
-func (c *gCPMachineClasses) Create(ctx context.Context, gCPMachineClass *v1alpha1.GCPMachineClass, opts v1.CreateOptions) (result *v1alpha1.GCPMachineClass, err error) {
- result = &v1alpha1.GCPMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(gCPMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a gCPMachineClass and updates it. Returns the server's representation of the gCPMachineClass, and an error, if there is any.
-func (c *gCPMachineClasses) Update(ctx context.Context, gCPMachineClass *v1alpha1.GCPMachineClass, opts v1.UpdateOptions) (result *v1alpha1.GCPMachineClass, err error) {
- result = &v1alpha1.GCPMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- Name(gCPMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(gCPMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the gCPMachineClass and deletes it. Returns an error if one occurs.
-func (c *gCPMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *gCPMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched gCPMachineClass.
-func (c *gCPMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.GCPMachineClass, err error) {
- result = &v1alpha1.GCPMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("gcpmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/generated_expansion.go
index 211712f63..24844caae 100644
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/generated_expansion.go
+++ b/pkg/client/clientset/versioned/typed/machine/v1alpha1/generated_expansion.go
@@ -18,14 +18,6 @@ limitations under the License.
package v1alpha1
-type AWSMachineClassExpansion interface{}
-
-type AlicloudMachineClassExpansion interface{}
-
-type AzureMachineClassExpansion interface{}
-
-type GCPMachineClassExpansion interface{}
-
type MachineExpansion interface{}
type MachineClassExpansion interface{}
@@ -33,7 +25,3 @@ type MachineClassExpansion interface{}
type MachineDeploymentExpansion interface{}
type MachineSetExpansion interface{}
-
-type OpenStackMachineClassExpansion interface{}
-
-type PacketMachineClassExpansion interface{}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/machine_client.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/machine_client.go
index 683468cd9..3011861a3 100644
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/machine_client.go
+++ b/pkg/client/clientset/versioned/typed/machine/v1alpha1/machine_client.go
@@ -26,16 +26,10 @@ import (
type MachineV1alpha1Interface interface {
RESTClient() rest.Interface
- AWSMachineClassesGetter
- AlicloudMachineClassesGetter
- AzureMachineClassesGetter
- GCPMachineClassesGetter
MachinesGetter
MachineClassesGetter
MachineDeploymentsGetter
MachineSetsGetter
- OpenStackMachineClassesGetter
- PacketMachineClassesGetter
}
// MachineV1alpha1Client is used to interact with features provided by the machine.sapcloud.io group.
@@ -43,22 +37,6 @@ type MachineV1alpha1Client struct {
restClient rest.Interface
}
-func (c *MachineV1alpha1Client) AWSMachineClasses(namespace string) AWSMachineClassInterface {
- return newAWSMachineClasses(c, namespace)
-}
-
-func (c *MachineV1alpha1Client) AlicloudMachineClasses(namespace string) AlicloudMachineClassInterface {
- return newAlicloudMachineClasses(c, namespace)
-}
-
-func (c *MachineV1alpha1Client) AzureMachineClasses(namespace string) AzureMachineClassInterface {
- return newAzureMachineClasses(c, namespace)
-}
-
-func (c *MachineV1alpha1Client) GCPMachineClasses(namespace string) GCPMachineClassInterface {
- return newGCPMachineClasses(c, namespace)
-}
-
func (c *MachineV1alpha1Client) Machines(namespace string) MachineInterface {
return newMachines(c, namespace)
}
@@ -75,14 +53,6 @@ func (c *MachineV1alpha1Client) MachineSets(namespace string) MachineSetInterfac
return newMachineSets(c, namespace)
}
-func (c *MachineV1alpha1Client) OpenStackMachineClasses(namespace string) OpenStackMachineClassInterface {
- return newOpenStackMachineClasses(c, namespace)
-}
-
-func (c *MachineV1alpha1Client) PacketMachineClasses(namespace string) PacketMachineClassInterface {
- return newPacketMachineClasses(c, namespace)
-}
-
// NewForConfig creates a new MachineV1alpha1Client for the given config.
func NewForConfig(c *rest.Config) (*MachineV1alpha1Client, error) {
config := *c
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/openstackmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/openstackmachineclass.go
deleted file mode 100644
index 5eedde047..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/openstackmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- "time"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// OpenStackMachineClassesGetter has a method to return a OpenStackMachineClassInterface.
-// A group's client should implement this interface.
-type OpenStackMachineClassesGetter interface {
- OpenStackMachineClasses(namespace string) OpenStackMachineClassInterface
-}
-
-// OpenStackMachineClassInterface has methods to work with OpenStackMachineClass resources.
-type OpenStackMachineClassInterface interface {
- Create(ctx context.Context, openStackMachineClass *v1alpha1.OpenStackMachineClass, opts v1.CreateOptions) (*v1alpha1.OpenStackMachineClass, error)
- Update(ctx context.Context, openStackMachineClass *v1alpha1.OpenStackMachineClass, opts v1.UpdateOptions) (*v1alpha1.OpenStackMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.OpenStackMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.OpenStackMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.OpenStackMachineClass, err error)
- OpenStackMachineClassExpansion
-}
-
-// openStackMachineClasses implements OpenStackMachineClassInterface
-type openStackMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newOpenStackMachineClasses returns a OpenStackMachineClasses
-func newOpenStackMachineClasses(c *MachineV1alpha1Client, namespace string) *openStackMachineClasses {
- return &openStackMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the openStackMachineClass, and returns the corresponding openStackMachineClass object, and an error if there is any.
-func (c *openStackMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.OpenStackMachineClass, err error) {
- result = &v1alpha1.OpenStackMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of OpenStackMachineClasses that match those selectors.
-func (c *openStackMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.OpenStackMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &v1alpha1.OpenStackMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested openStackMachineClasses.
-func (c *openStackMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a openStackMachineClass and creates it. Returns the server's representation of the openStackMachineClass, and an error, if there is any.
-func (c *openStackMachineClasses) Create(ctx context.Context, openStackMachineClass *v1alpha1.OpenStackMachineClass, opts v1.CreateOptions) (result *v1alpha1.OpenStackMachineClass, err error) {
- result = &v1alpha1.OpenStackMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(openStackMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a openStackMachineClass and updates it. Returns the server's representation of the openStackMachineClass, and an error, if there is any.
-func (c *openStackMachineClasses) Update(ctx context.Context, openStackMachineClass *v1alpha1.OpenStackMachineClass, opts v1.UpdateOptions) (result *v1alpha1.OpenStackMachineClass, err error) {
- result = &v1alpha1.OpenStackMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- Name(openStackMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(openStackMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the openStackMachineClass and deletes it. Returns an error if one occurs.
-func (c *openStackMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *openStackMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched openStackMachineClass.
-func (c *openStackMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.OpenStackMachineClass, err error) {
- result = &v1alpha1.OpenStackMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("openstackmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/clientset/versioned/typed/machine/v1alpha1/packetmachineclass.go b/pkg/client/clientset/versioned/typed/machine/v1alpha1/packetmachineclass.go
deleted file mode 100644
index c4c2b7aab..000000000
--- a/pkg/client/clientset/versioned/typed/machine/v1alpha1/packetmachineclass.go
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by client-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- "time"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- scheme "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/scheme"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- types "k8s.io/apimachinery/pkg/types"
- watch "k8s.io/apimachinery/pkg/watch"
- rest "k8s.io/client-go/rest"
-)
-
-// PacketMachineClassesGetter has a method to return a PacketMachineClassInterface.
-// A group's client should implement this interface.
-type PacketMachineClassesGetter interface {
- PacketMachineClasses(namespace string) PacketMachineClassInterface
-}
-
-// PacketMachineClassInterface has methods to work with PacketMachineClass resources.
-type PacketMachineClassInterface interface {
- Create(ctx context.Context, packetMachineClass *v1alpha1.PacketMachineClass, opts v1.CreateOptions) (*v1alpha1.PacketMachineClass, error)
- Update(ctx context.Context, packetMachineClass *v1alpha1.PacketMachineClass, opts v1.UpdateOptions) (*v1alpha1.PacketMachineClass, error)
- Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
- DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
- Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.PacketMachineClass, error)
- List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PacketMachineClassList, error)
- Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
- Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PacketMachineClass, err error)
- PacketMachineClassExpansion
-}
-
-// packetMachineClasses implements PacketMachineClassInterface
-type packetMachineClasses struct {
- client rest.Interface
- ns string
-}
-
-// newPacketMachineClasses returns a PacketMachineClasses
-func newPacketMachineClasses(c *MachineV1alpha1Client, namespace string) *packetMachineClasses {
- return &packetMachineClasses{
- client: c.RESTClient(),
- ns: namespace,
- }
-}
-
-// Get takes name of the packetMachineClass, and returns the corresponding packetMachineClass object, and an error if there is any.
-func (c *packetMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.PacketMachineClass, err error) {
- result = &v1alpha1.PacketMachineClass{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- Name(name).
- VersionedParams(&options, scheme.ParameterCodec).
- Do(ctx).
- Into(result)
- return
-}
-
-// List takes label and field selectors, and returns the list of PacketMachineClasses that match those selectors.
-func (c *packetMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.PacketMachineClassList, err error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- result = &v1alpha1.PacketMachineClassList{}
- err = c.client.Get().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Do(ctx).
- Into(result)
- return
-}
-
-// Watch returns a watch.Interface that watches the requested packetMachineClasses.
-func (c *packetMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
- var timeout time.Duration
- if opts.TimeoutSeconds != nil {
- timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
- }
- opts.Watch = true
- return c.client.Get().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Timeout(timeout).
- Watch(ctx)
-}
-
-// Create takes the representation of a packetMachineClass and creates it. Returns the server's representation of the packetMachineClass, and an error, if there is any.
-func (c *packetMachineClasses) Create(ctx context.Context, packetMachineClass *v1alpha1.PacketMachineClass, opts v1.CreateOptions) (result *v1alpha1.PacketMachineClass, err error) {
- result = &v1alpha1.PacketMachineClass{}
- err = c.client.Post().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(packetMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Update takes the representation of a packetMachineClass and updates it. Returns the server's representation of the packetMachineClass, and an error, if there is any.
-func (c *packetMachineClasses) Update(ctx context.Context, packetMachineClass *v1alpha1.PacketMachineClass, opts v1.UpdateOptions) (result *v1alpha1.PacketMachineClass, err error) {
- result = &v1alpha1.PacketMachineClass{}
- err = c.client.Put().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- Name(packetMachineClass.Name).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(packetMachineClass).
- Do(ctx).
- Into(result)
- return
-}
-
-// Delete takes name of the packetMachineClass and deletes it. Returns an error if one occurs.
-func (c *packetMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
- return c.client.Delete().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- Name(name).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// DeleteCollection deletes a collection of objects.
-func (c *packetMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
- var timeout time.Duration
- if listOpts.TimeoutSeconds != nil {
- timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
- }
- return c.client.Delete().
- Namespace(c.ns).
- Resource("packetmachineclasses").
- VersionedParams(&listOpts, scheme.ParameterCodec).
- Timeout(timeout).
- Body(&opts).
- Do(ctx).
- Error()
-}
-
-// Patch applies the patch and returns the patched packetMachineClass.
-func (c *packetMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.PacketMachineClass, err error) {
- result = &v1alpha1.PacketMachineClass{}
- err = c.client.Patch(pt).
- Namespace(c.ns).
- Resource("packetmachineclasses").
- Name(name).
- SubResource(subresources...).
- VersionedParams(&opts, scheme.ParameterCodec).
- Body(data).
- Do(ctx).
- Into(result)
- return
-}
diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go
index c04f764c5..b97973f44 100644
--- a/pkg/client/informers/externalversions/generic.go
+++ b/pkg/client/informers/externalversions/generic.go
@@ -53,14 +53,6 @@ func (f *genericInformer) Lister() cache.GenericLister {
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=machine.sapcloud.io, Version=v1alpha1
- case v1alpha1.SchemeGroupVersion.WithResource("awsmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().AWSMachineClasses().Informer()}, nil
- case v1alpha1.SchemeGroupVersion.WithResource("alicloudmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().AlicloudMachineClasses().Informer()}, nil
- case v1alpha1.SchemeGroupVersion.WithResource("azuremachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().AzureMachineClasses().Informer()}, nil
- case v1alpha1.SchemeGroupVersion.WithResource("gcpmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().GCPMachineClasses().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("machines"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().Machines().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("machineclasses"):
@@ -69,10 +61,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().MachineDeployments().Informer()}, nil
case v1alpha1.SchemeGroupVersion.WithResource("machinesets"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().MachineSets().Informer()}, nil
- case v1alpha1.SchemeGroupVersion.WithResource("openstackmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().OpenStackMachineClasses().Informer()}, nil
- case v1alpha1.SchemeGroupVersion.WithResource("packetmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().V1alpha1().PacketMachineClasses().Informer()}, nil
}
diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/alicloudmachineclass.go b/pkg/client/informers/externalversions/machine/v1alpha1/alicloudmachineclass.go
deleted file mode 100644
index bfc777ebc..000000000
--- a/pkg/client/informers/externalversions/machine/v1alpha1/alicloudmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- time "time"
-
- machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- versioned "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/internalinterfaces"
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// AlicloudMachineClassInformer provides access to a shared informer and lister for
-// AlicloudMachineClasses.
-type AlicloudMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() v1alpha1.AlicloudMachineClassLister
-}
-
-type alicloudMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewAlicloudMachineClassInformer constructs a new informer for AlicloudMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewAlicloudMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredAlicloudMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredAlicloudMachineClassInformer constructs a new informer for AlicloudMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredAlicloudMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().AlicloudMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().AlicloudMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machinev1alpha1.AlicloudMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *alicloudMachineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredAlicloudMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *alicloudMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machinev1alpha1.AlicloudMachineClass{}, f.defaultInformer)
-}
-
-func (f *alicloudMachineClassInformer) Lister() v1alpha1.AlicloudMachineClassLister {
- return v1alpha1.NewAlicloudMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/awsmachineclass.go b/pkg/client/informers/externalversions/machine/v1alpha1/awsmachineclass.go
deleted file mode 100644
index b6c325025..000000000
--- a/pkg/client/informers/externalversions/machine/v1alpha1/awsmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- time "time"
-
- machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- versioned "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/internalinterfaces"
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// AWSMachineClassInformer provides access to a shared informer and lister for
-// AWSMachineClasses.
-type AWSMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() v1alpha1.AWSMachineClassLister
-}
-
-type aWSMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewAWSMachineClassInformer constructs a new informer for AWSMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewAWSMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredAWSMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredAWSMachineClassInformer constructs a new informer for AWSMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredAWSMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().AWSMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().AWSMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machinev1alpha1.AWSMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *aWSMachineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredAWSMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *aWSMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machinev1alpha1.AWSMachineClass{}, f.defaultInformer)
-}
-
-func (f *aWSMachineClassInformer) Lister() v1alpha1.AWSMachineClassLister {
- return v1alpha1.NewAWSMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/azuremachineclass.go b/pkg/client/informers/externalversions/machine/v1alpha1/azuremachineclass.go
deleted file mode 100644
index 7f7144106..000000000
--- a/pkg/client/informers/externalversions/machine/v1alpha1/azuremachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- time "time"
-
- machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- versioned "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/internalinterfaces"
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// AzureMachineClassInformer provides access to a shared informer and lister for
-// AzureMachineClasses.
-type AzureMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() v1alpha1.AzureMachineClassLister
-}
-
-type azureMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewAzureMachineClassInformer constructs a new informer for AzureMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewAzureMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredAzureMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredAzureMachineClassInformer constructs a new informer for AzureMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredAzureMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().AzureMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().AzureMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machinev1alpha1.AzureMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *azureMachineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredAzureMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *azureMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machinev1alpha1.AzureMachineClass{}, f.defaultInformer)
-}
-
-func (f *azureMachineClassInformer) Lister() v1alpha1.AzureMachineClassLister {
- return v1alpha1.NewAzureMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/gcpmachineclass.go b/pkg/client/informers/externalversions/machine/v1alpha1/gcpmachineclass.go
deleted file mode 100644
index 4686096e7..000000000
--- a/pkg/client/informers/externalversions/machine/v1alpha1/gcpmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- time "time"
-
- machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- versioned "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/internalinterfaces"
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// GCPMachineClassInformer provides access to a shared informer and lister for
-// GCPMachineClasses.
-type GCPMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() v1alpha1.GCPMachineClassLister
-}
-
-type gCPMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewGCPMachineClassInformer constructs a new informer for GCPMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewGCPMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredGCPMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredGCPMachineClassInformer constructs a new informer for GCPMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredGCPMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().GCPMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().GCPMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machinev1alpha1.GCPMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *gCPMachineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredGCPMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *gCPMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machinev1alpha1.GCPMachineClass{}, f.defaultInformer)
-}
-
-func (f *gCPMachineClassInformer) Lister() v1alpha1.GCPMachineClassLister {
- return v1alpha1.NewGCPMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/interface.go b/pkg/client/informers/externalversions/machine/v1alpha1/interface.go
index fe210170c..a13aa025b 100644
--- a/pkg/client/informers/externalversions/machine/v1alpha1/interface.go
+++ b/pkg/client/informers/externalversions/machine/v1alpha1/interface.go
@@ -24,14 +24,6 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
- // AWSMachineClasses returns a AWSMachineClassInformer.
- AWSMachineClasses() AWSMachineClassInformer
- // AlicloudMachineClasses returns a AlicloudMachineClassInformer.
- AlicloudMachineClasses() AlicloudMachineClassInformer
- // AzureMachineClasses returns a AzureMachineClassInformer.
- AzureMachineClasses() AzureMachineClassInformer
- // GCPMachineClasses returns a GCPMachineClassInformer.
- GCPMachineClasses() GCPMachineClassInformer
// Machines returns a MachineInformer.
Machines() MachineInformer
// MachineClasses returns a MachineClassInformer.
@@ -40,10 +32,6 @@ type Interface interface {
MachineDeployments() MachineDeploymentInformer
// MachineSets returns a MachineSetInformer.
MachineSets() MachineSetInformer
- // OpenStackMachineClasses returns a OpenStackMachineClassInformer.
- OpenStackMachineClasses() OpenStackMachineClassInformer
- // PacketMachineClasses returns a PacketMachineClassInformer.
- PacketMachineClasses() PacketMachineClassInformer
}
type version struct {
@@ -57,26 +45,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
-// AWSMachineClasses returns a AWSMachineClassInformer.
-func (v *version) AWSMachineClasses() AWSMachineClassInformer {
- return &aWSMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
-// AlicloudMachineClasses returns a AlicloudMachineClassInformer.
-func (v *version) AlicloudMachineClasses() AlicloudMachineClassInformer {
- return &alicloudMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
-// AzureMachineClasses returns a AzureMachineClassInformer.
-func (v *version) AzureMachineClasses() AzureMachineClassInformer {
- return &azureMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
-// GCPMachineClasses returns a GCPMachineClassInformer.
-func (v *version) GCPMachineClasses() GCPMachineClassInformer {
- return &gCPMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
// Machines returns a MachineInformer.
func (v *version) Machines() MachineInformer {
return &machineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
@@ -96,13 +64,3 @@ func (v *version) MachineDeployments() MachineDeploymentInformer {
func (v *version) MachineSets() MachineSetInformer {
return &machineSetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
-
-// OpenStackMachineClasses returns a OpenStackMachineClassInformer.
-func (v *version) OpenStackMachineClasses() OpenStackMachineClassInformer {
- return &openStackMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
-// PacketMachineClasses returns a PacketMachineClassInformer.
-func (v *version) PacketMachineClasses() PacketMachineClassInformer {
- return &packetMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/openstackmachineclass.go b/pkg/client/informers/externalversions/machine/v1alpha1/openstackmachineclass.go
deleted file mode 100644
index c8bc6de6f..000000000
--- a/pkg/client/informers/externalversions/machine/v1alpha1/openstackmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- time "time"
-
- machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- versioned "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/internalinterfaces"
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// OpenStackMachineClassInformer provides access to a shared informer and lister for
-// OpenStackMachineClasses.
-type OpenStackMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() v1alpha1.OpenStackMachineClassLister
-}
-
-type openStackMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewOpenStackMachineClassInformer constructs a new informer for OpenStackMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewOpenStackMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredOpenStackMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredOpenStackMachineClassInformer constructs a new informer for OpenStackMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredOpenStackMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().OpenStackMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().OpenStackMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machinev1alpha1.OpenStackMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *openStackMachineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredOpenStackMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *openStackMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machinev1alpha1.OpenStackMachineClass{}, f.defaultInformer)
-}
-
-func (f *openStackMachineClassInformer) Lister() v1alpha1.OpenStackMachineClassLister {
- return v1alpha1.NewOpenStackMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/externalversions/machine/v1alpha1/packetmachineclass.go b/pkg/client/informers/externalversions/machine/v1alpha1/packetmachineclass.go
deleted file mode 100644
index a4bf4a2d0..000000000
--- a/pkg/client/informers/externalversions/machine/v1alpha1/packetmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- "context"
- time "time"
-
- machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- versioned "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/internalinterfaces"
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// PacketMachineClassInformer provides access to a shared informer and lister for
-// PacketMachineClasses.
-type PacketMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() v1alpha1.PacketMachineClassLister
-}
-
-type packetMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewPacketMachineClassInformer constructs a new informer for PacketMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewPacketMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredPacketMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredPacketMachineClassInformer constructs a new informer for PacketMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredPacketMachineClassInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().PacketMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.MachineV1alpha1().PacketMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machinev1alpha1.PacketMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *packetMachineClassInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredPacketMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *packetMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machinev1alpha1.PacketMachineClass{}, f.defaultInformer)
-}
-
-func (f *packetMachineClassInformer) Lister() v1alpha1.PacketMachineClassLister {
- return v1alpha1.NewPacketMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/internalversion/generic.go b/pkg/client/informers/internalversion/generic.go
index 7069b84b2..e0c405a9e 100644
--- a/pkg/client/informers/internalversion/generic.go
+++ b/pkg/client/informers/internalversion/generic.go
@@ -53,14 +53,6 @@ func (f *genericInformer) Lister() cache.GenericLister {
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
switch resource {
// Group=machine.sapcloud.io, Version=internalVersion
- case machine.SchemeGroupVersion.WithResource("awsmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().AWSMachineClasses().Informer()}, nil
- case machine.SchemeGroupVersion.WithResource("alicloudmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().AlicloudMachineClasses().Informer()}, nil
- case machine.SchemeGroupVersion.WithResource("azuremachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().AzureMachineClasses().Informer()}, nil
- case machine.SchemeGroupVersion.WithResource("gcpmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().GCPMachineClasses().Informer()}, nil
case machine.SchemeGroupVersion.WithResource("machines"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().Machines().Informer()}, nil
case machine.SchemeGroupVersion.WithResource("machineclasses"):
@@ -71,10 +63,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().MachineSets().Informer()}, nil
case machine.SchemeGroupVersion.WithResource("machinetemplates"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().MachineTemplates().Informer()}, nil
- case machine.SchemeGroupVersion.WithResource("openstackmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().OpenStackMachineClasses().Informer()}, nil
- case machine.SchemeGroupVersion.WithResource("packetmachineclasses"):
- return &genericInformer{resource: resource.GroupResource(), informer: f.Machine().InternalVersion().PacketMachineClasses().Informer()}, nil
}
diff --git a/pkg/client/informers/internalversion/machine/internalversion/alicloudmachineclass.go b/pkg/client/informers/internalversion/machine/internalversion/alicloudmachineclass.go
deleted file mode 100644
index 43836c26e..000000000
--- a/pkg/client/informers/internalversion/machine/internalversion/alicloudmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- time "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- clientsetinternalversion "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/internalversion/internalinterfaces"
- internalversion "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/internalversion"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// AlicloudMachineClassInformer provides access to a shared informer and lister for
-// AlicloudMachineClasses.
-type AlicloudMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() internalversion.AlicloudMachineClassLister
-}
-
-type alicloudMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewAlicloudMachineClassInformer constructs a new informer for AlicloudMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewAlicloudMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredAlicloudMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredAlicloudMachineClassInformer constructs a new informer for AlicloudMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredAlicloudMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().AlicloudMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().AlicloudMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machine.AlicloudMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *alicloudMachineClassInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredAlicloudMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *alicloudMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machine.AlicloudMachineClass{}, f.defaultInformer)
-}
-
-func (f *alicloudMachineClassInformer) Lister() internalversion.AlicloudMachineClassLister {
- return internalversion.NewAlicloudMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/internalversion/machine/internalversion/awsmachineclass.go b/pkg/client/informers/internalversion/machine/internalversion/awsmachineclass.go
deleted file mode 100644
index 2d956b345..000000000
--- a/pkg/client/informers/internalversion/machine/internalversion/awsmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- time "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- clientsetinternalversion "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/internalversion/internalinterfaces"
- internalversion "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/internalversion"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// AWSMachineClassInformer provides access to a shared informer and lister for
-// AWSMachineClasses.
-type AWSMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() internalversion.AWSMachineClassLister
-}
-
-type aWSMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewAWSMachineClassInformer constructs a new informer for AWSMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewAWSMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredAWSMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredAWSMachineClassInformer constructs a new informer for AWSMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredAWSMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().AWSMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().AWSMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machine.AWSMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *aWSMachineClassInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredAWSMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *aWSMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machine.AWSMachineClass{}, f.defaultInformer)
-}
-
-func (f *aWSMachineClassInformer) Lister() internalversion.AWSMachineClassLister {
- return internalversion.NewAWSMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/internalversion/machine/internalversion/azuremachineclass.go b/pkg/client/informers/internalversion/machine/internalversion/azuremachineclass.go
deleted file mode 100644
index 35a3c5ee5..000000000
--- a/pkg/client/informers/internalversion/machine/internalversion/azuremachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- time "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- clientsetinternalversion "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/internalversion/internalinterfaces"
- internalversion "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/internalversion"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// AzureMachineClassInformer provides access to a shared informer and lister for
-// AzureMachineClasses.
-type AzureMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() internalversion.AzureMachineClassLister
-}
-
-type azureMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewAzureMachineClassInformer constructs a new informer for AzureMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewAzureMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredAzureMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredAzureMachineClassInformer constructs a new informer for AzureMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredAzureMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().AzureMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().AzureMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machine.AzureMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *azureMachineClassInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredAzureMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *azureMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machine.AzureMachineClass{}, f.defaultInformer)
-}
-
-func (f *azureMachineClassInformer) Lister() internalversion.AzureMachineClassLister {
- return internalversion.NewAzureMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/internalversion/machine/internalversion/gcpmachineclass.go b/pkg/client/informers/internalversion/machine/internalversion/gcpmachineclass.go
deleted file mode 100644
index a26704d41..000000000
--- a/pkg/client/informers/internalversion/machine/internalversion/gcpmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- time "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- clientsetinternalversion "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/internalversion/internalinterfaces"
- internalversion "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/internalversion"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// GCPMachineClassInformer provides access to a shared informer and lister for
-// GCPMachineClasses.
-type GCPMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() internalversion.GCPMachineClassLister
-}
-
-type gCPMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewGCPMachineClassInformer constructs a new informer for GCPMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewGCPMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredGCPMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredGCPMachineClassInformer constructs a new informer for GCPMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredGCPMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().GCPMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().GCPMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machine.GCPMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *gCPMachineClassInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredGCPMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *gCPMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machine.GCPMachineClass{}, f.defaultInformer)
-}
-
-func (f *gCPMachineClassInformer) Lister() internalversion.GCPMachineClassLister {
- return internalversion.NewGCPMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/internalversion/machine/internalversion/interface.go b/pkg/client/informers/internalversion/machine/internalversion/interface.go
index acb2efdde..a52a02fc2 100644
--- a/pkg/client/informers/internalversion/machine/internalversion/interface.go
+++ b/pkg/client/informers/internalversion/machine/internalversion/interface.go
@@ -24,14 +24,6 @@ import (
// Interface provides access to all the informers in this group version.
type Interface interface {
- // AWSMachineClasses returns a AWSMachineClassInformer.
- AWSMachineClasses() AWSMachineClassInformer
- // AlicloudMachineClasses returns a AlicloudMachineClassInformer.
- AlicloudMachineClasses() AlicloudMachineClassInformer
- // AzureMachineClasses returns a AzureMachineClassInformer.
- AzureMachineClasses() AzureMachineClassInformer
- // GCPMachineClasses returns a GCPMachineClassInformer.
- GCPMachineClasses() GCPMachineClassInformer
// Machines returns a MachineInformer.
Machines() MachineInformer
// MachineClasses returns a MachineClassInformer.
@@ -42,10 +34,6 @@ type Interface interface {
MachineSets() MachineSetInformer
// MachineTemplates returns a MachineTemplateInformer.
MachineTemplates() MachineTemplateInformer
- // OpenStackMachineClasses returns a OpenStackMachineClassInformer.
- OpenStackMachineClasses() OpenStackMachineClassInformer
- // PacketMachineClasses returns a PacketMachineClassInformer.
- PacketMachineClasses() PacketMachineClassInformer
}
type version struct {
@@ -59,26 +47,6 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
-// AWSMachineClasses returns a AWSMachineClassInformer.
-func (v *version) AWSMachineClasses() AWSMachineClassInformer {
- return &aWSMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
-// AlicloudMachineClasses returns a AlicloudMachineClassInformer.
-func (v *version) AlicloudMachineClasses() AlicloudMachineClassInformer {
- return &alicloudMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
-// AzureMachineClasses returns a AzureMachineClassInformer.
-func (v *version) AzureMachineClasses() AzureMachineClassInformer {
- return &azureMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
-// GCPMachineClasses returns a GCPMachineClassInformer.
-func (v *version) GCPMachineClasses() GCPMachineClassInformer {
- return &gCPMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
// Machines returns a MachineInformer.
func (v *version) Machines() MachineInformer {
return &machineInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
@@ -103,13 +71,3 @@ func (v *version) MachineSets() MachineSetInformer {
func (v *version) MachineTemplates() MachineTemplateInformer {
return &machineTemplateInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
-
-// OpenStackMachineClasses returns a OpenStackMachineClassInformer.
-func (v *version) OpenStackMachineClasses() OpenStackMachineClassInformer {
- return &openStackMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
-
-// PacketMachineClasses returns a PacketMachineClassInformer.
-func (v *version) PacketMachineClasses() PacketMachineClassInformer {
- return &packetMachineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
-}
diff --git a/pkg/client/informers/internalversion/machine/internalversion/openstackmachineclass.go b/pkg/client/informers/internalversion/machine/internalversion/openstackmachineclass.go
deleted file mode 100644
index 6814941c2..000000000
--- a/pkg/client/informers/internalversion/machine/internalversion/openstackmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- time "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- clientsetinternalversion "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/internalversion/internalinterfaces"
- internalversion "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/internalversion"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// OpenStackMachineClassInformer provides access to a shared informer and lister for
-// OpenStackMachineClasses.
-type OpenStackMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() internalversion.OpenStackMachineClassLister
-}
-
-type openStackMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewOpenStackMachineClassInformer constructs a new informer for OpenStackMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewOpenStackMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredOpenStackMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredOpenStackMachineClassInformer constructs a new informer for OpenStackMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredOpenStackMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().OpenStackMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().OpenStackMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machine.OpenStackMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *openStackMachineClassInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredOpenStackMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *openStackMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machine.OpenStackMachineClass{}, f.defaultInformer)
-}
-
-func (f *openStackMachineClassInformer) Lister() internalversion.OpenStackMachineClassLister {
- return internalversion.NewOpenStackMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/informers/internalversion/machine/internalversion/packetmachineclass.go b/pkg/client/informers/internalversion/machine/internalversion/packetmachineclass.go
deleted file mode 100644
index cd2321db0..000000000
--- a/pkg/client/informers/internalversion/machine/internalversion/packetmachineclass.go
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by informer-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- "context"
- time "time"
-
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- clientsetinternalversion "github.com/gardener/machine-controller-manager/pkg/client/clientset/internalversion"
- internalinterfaces "github.com/gardener/machine-controller-manager/pkg/client/informers/internalversion/internalinterfaces"
- internalversion "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/internalversion"
- v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- runtime "k8s.io/apimachinery/pkg/runtime"
- watch "k8s.io/apimachinery/pkg/watch"
- cache "k8s.io/client-go/tools/cache"
-)
-
-// PacketMachineClassInformer provides access to a shared informer and lister for
-// PacketMachineClasses.
-type PacketMachineClassInformer interface {
- Informer() cache.SharedIndexInformer
- Lister() internalversion.PacketMachineClassLister
-}
-
-type packetMachineClassInformer struct {
- factory internalinterfaces.SharedInformerFactory
- tweakListOptions internalinterfaces.TweakListOptionsFunc
- namespace string
-}
-
-// NewPacketMachineClassInformer constructs a new informer for PacketMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewPacketMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
- return NewFilteredPacketMachineClassInformer(client, namespace, resyncPeriod, indexers, nil)
-}
-
-// NewFilteredPacketMachineClassInformer constructs a new informer for PacketMachineClass type.
-// Always prefer using an informer factory to get a shared informer instead of getting an independent
-// one. This reduces memory footprint and number of connections to the server.
-func NewFilteredPacketMachineClassInformer(client clientsetinternalversion.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
- return cache.NewSharedIndexInformer(
- &cache.ListWatch{
- ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().PacketMachineClasses(namespace).List(context.TODO(), options)
- },
- WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
- if tweakListOptions != nil {
- tweakListOptions(&options)
- }
- return client.Machine().PacketMachineClasses(namespace).Watch(context.TODO(), options)
- },
- },
- &machine.PacketMachineClass{},
- resyncPeriod,
- indexers,
- )
-}
-
-func (f *packetMachineClassInformer) defaultInformer(client clientsetinternalversion.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
- return NewFilteredPacketMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
-}
-
-func (f *packetMachineClassInformer) Informer() cache.SharedIndexInformer {
- return f.factory.InformerFor(&machine.PacketMachineClass{}, f.defaultInformer)
-}
-
-func (f *packetMachineClassInformer) Lister() internalversion.PacketMachineClassLister {
- return internalversion.NewPacketMachineClassLister(f.Informer().GetIndexer())
-}
diff --git a/pkg/client/listers/machine/internalversion/alicloudmachineclass.go b/pkg/client/listers/machine/internalversion/alicloudmachineclass.go
deleted file mode 100644
index 892327241..000000000
--- a/pkg/client/listers/machine/internalversion/alicloudmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// AlicloudMachineClassLister helps list AlicloudMachineClasses.
-// All objects returned here must be treated as read-only.
-type AlicloudMachineClassLister interface {
- // List lists all AlicloudMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.AlicloudMachineClass, err error)
- // AlicloudMachineClasses returns an object that can list and get AlicloudMachineClasses.
- AlicloudMachineClasses(namespace string) AlicloudMachineClassNamespaceLister
- AlicloudMachineClassListerExpansion
-}
-
-// alicloudMachineClassLister implements the AlicloudMachineClassLister interface.
-type alicloudMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewAlicloudMachineClassLister returns a new AlicloudMachineClassLister.
-func NewAlicloudMachineClassLister(indexer cache.Indexer) AlicloudMachineClassLister {
- return &alicloudMachineClassLister{indexer: indexer}
-}
-
-// List lists all AlicloudMachineClasses in the indexer.
-func (s *alicloudMachineClassLister) List(selector labels.Selector) (ret []*machine.AlicloudMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.AlicloudMachineClass))
- })
- return ret, err
-}
-
-// AlicloudMachineClasses returns an object that can list and get AlicloudMachineClasses.
-func (s *alicloudMachineClassLister) AlicloudMachineClasses(namespace string) AlicloudMachineClassNamespaceLister {
- return alicloudMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// AlicloudMachineClassNamespaceLister helps list and get AlicloudMachineClasses.
-// All objects returned here must be treated as read-only.
-type AlicloudMachineClassNamespaceLister interface {
- // List lists all AlicloudMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.AlicloudMachineClass, err error)
- // Get retrieves the AlicloudMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*machine.AlicloudMachineClass, error)
- AlicloudMachineClassNamespaceListerExpansion
-}
-
-// alicloudMachineClassNamespaceLister implements the AlicloudMachineClassNamespaceLister
-// interface.
-type alicloudMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all AlicloudMachineClasses in the indexer for a given namespace.
-func (s alicloudMachineClassNamespaceLister) List(selector labels.Selector) (ret []*machine.AlicloudMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.AlicloudMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the AlicloudMachineClass from the indexer for a given namespace and name.
-func (s alicloudMachineClassNamespaceLister) Get(name string) (*machine.AlicloudMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(machine.Resource("alicloudmachineclass"), name)
- }
- return obj.(*machine.AlicloudMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/internalversion/awsmachineclass.go b/pkg/client/listers/machine/internalversion/awsmachineclass.go
deleted file mode 100644
index ec63e445c..000000000
--- a/pkg/client/listers/machine/internalversion/awsmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// AWSMachineClassLister helps list AWSMachineClasses.
-// All objects returned here must be treated as read-only.
-type AWSMachineClassLister interface {
- // List lists all AWSMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.AWSMachineClass, err error)
- // AWSMachineClasses returns an object that can list and get AWSMachineClasses.
- AWSMachineClasses(namespace string) AWSMachineClassNamespaceLister
- AWSMachineClassListerExpansion
-}
-
-// aWSMachineClassLister implements the AWSMachineClassLister interface.
-type aWSMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewAWSMachineClassLister returns a new AWSMachineClassLister.
-func NewAWSMachineClassLister(indexer cache.Indexer) AWSMachineClassLister {
- return &aWSMachineClassLister{indexer: indexer}
-}
-
-// List lists all AWSMachineClasses in the indexer.
-func (s *aWSMachineClassLister) List(selector labels.Selector) (ret []*machine.AWSMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.AWSMachineClass))
- })
- return ret, err
-}
-
-// AWSMachineClasses returns an object that can list and get AWSMachineClasses.
-func (s *aWSMachineClassLister) AWSMachineClasses(namespace string) AWSMachineClassNamespaceLister {
- return aWSMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// AWSMachineClassNamespaceLister helps list and get AWSMachineClasses.
-// All objects returned here must be treated as read-only.
-type AWSMachineClassNamespaceLister interface {
- // List lists all AWSMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.AWSMachineClass, err error)
- // Get retrieves the AWSMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*machine.AWSMachineClass, error)
- AWSMachineClassNamespaceListerExpansion
-}
-
-// aWSMachineClassNamespaceLister implements the AWSMachineClassNamespaceLister
-// interface.
-type aWSMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all AWSMachineClasses in the indexer for a given namespace.
-func (s aWSMachineClassNamespaceLister) List(selector labels.Selector) (ret []*machine.AWSMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.AWSMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the AWSMachineClass from the indexer for a given namespace and name.
-func (s aWSMachineClassNamespaceLister) Get(name string) (*machine.AWSMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(machine.Resource("awsmachineclass"), name)
- }
- return obj.(*machine.AWSMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/internalversion/azuremachineclass.go b/pkg/client/listers/machine/internalversion/azuremachineclass.go
deleted file mode 100644
index d2aa9a6d5..000000000
--- a/pkg/client/listers/machine/internalversion/azuremachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// AzureMachineClassLister helps list AzureMachineClasses.
-// All objects returned here must be treated as read-only.
-type AzureMachineClassLister interface {
- // List lists all AzureMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.AzureMachineClass, err error)
- // AzureMachineClasses returns an object that can list and get AzureMachineClasses.
- AzureMachineClasses(namespace string) AzureMachineClassNamespaceLister
- AzureMachineClassListerExpansion
-}
-
-// azureMachineClassLister implements the AzureMachineClassLister interface.
-type azureMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewAzureMachineClassLister returns a new AzureMachineClassLister.
-func NewAzureMachineClassLister(indexer cache.Indexer) AzureMachineClassLister {
- return &azureMachineClassLister{indexer: indexer}
-}
-
-// List lists all AzureMachineClasses in the indexer.
-func (s *azureMachineClassLister) List(selector labels.Selector) (ret []*machine.AzureMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.AzureMachineClass))
- })
- return ret, err
-}
-
-// AzureMachineClasses returns an object that can list and get AzureMachineClasses.
-func (s *azureMachineClassLister) AzureMachineClasses(namespace string) AzureMachineClassNamespaceLister {
- return azureMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// AzureMachineClassNamespaceLister helps list and get AzureMachineClasses.
-// All objects returned here must be treated as read-only.
-type AzureMachineClassNamespaceLister interface {
- // List lists all AzureMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.AzureMachineClass, err error)
- // Get retrieves the AzureMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*machine.AzureMachineClass, error)
- AzureMachineClassNamespaceListerExpansion
-}
-
-// azureMachineClassNamespaceLister implements the AzureMachineClassNamespaceLister
-// interface.
-type azureMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all AzureMachineClasses in the indexer for a given namespace.
-func (s azureMachineClassNamespaceLister) List(selector labels.Selector) (ret []*machine.AzureMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.AzureMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the AzureMachineClass from the indexer for a given namespace and name.
-func (s azureMachineClassNamespaceLister) Get(name string) (*machine.AzureMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(machine.Resource("azuremachineclass"), name)
- }
- return obj.(*machine.AzureMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/internalversion/expansion_generated.go b/pkg/client/listers/machine/internalversion/expansion_generated.go
index aa20f8492..c0f75f102 100644
--- a/pkg/client/listers/machine/internalversion/expansion_generated.go
+++ b/pkg/client/listers/machine/internalversion/expansion_generated.go
@@ -18,38 +18,6 @@ limitations under the License.
package internalversion
-// AWSMachineClassListerExpansion allows custom methods to be added to
-// AWSMachineClassLister.
-type AWSMachineClassListerExpansion interface{}
-
-// AWSMachineClassNamespaceListerExpansion allows custom methods to be added to
-// AWSMachineClassNamespaceLister.
-type AWSMachineClassNamespaceListerExpansion interface{}
-
-// AlicloudMachineClassListerExpansion allows custom methods to be added to
-// AlicloudMachineClassLister.
-type AlicloudMachineClassListerExpansion interface{}
-
-// AlicloudMachineClassNamespaceListerExpansion allows custom methods to be added to
-// AlicloudMachineClassNamespaceLister.
-type AlicloudMachineClassNamespaceListerExpansion interface{}
-
-// AzureMachineClassListerExpansion allows custom methods to be added to
-// AzureMachineClassLister.
-type AzureMachineClassListerExpansion interface{}
-
-// AzureMachineClassNamespaceListerExpansion allows custom methods to be added to
-// AzureMachineClassNamespaceLister.
-type AzureMachineClassNamespaceListerExpansion interface{}
-
-// GCPMachineClassListerExpansion allows custom methods to be added to
-// GCPMachineClassLister.
-type GCPMachineClassListerExpansion interface{}
-
-// GCPMachineClassNamespaceListerExpansion allows custom methods to be added to
-// GCPMachineClassNamespaceLister.
-type GCPMachineClassNamespaceListerExpansion interface{}
-
// MachineListerExpansion allows custom methods to be added to
// MachineLister.
type MachineListerExpansion interface{}
@@ -89,19 +57,3 @@ type MachineTemplateListerExpansion interface{}
// MachineTemplateNamespaceListerExpansion allows custom methods to be added to
// MachineTemplateNamespaceLister.
type MachineTemplateNamespaceListerExpansion interface{}
-
-// OpenStackMachineClassListerExpansion allows custom methods to be added to
-// OpenStackMachineClassLister.
-type OpenStackMachineClassListerExpansion interface{}
-
-// OpenStackMachineClassNamespaceListerExpansion allows custom methods to be added to
-// OpenStackMachineClassNamespaceLister.
-type OpenStackMachineClassNamespaceListerExpansion interface{}
-
-// PacketMachineClassListerExpansion allows custom methods to be added to
-// PacketMachineClassLister.
-type PacketMachineClassListerExpansion interface{}
-
-// PacketMachineClassNamespaceListerExpansion allows custom methods to be added to
-// PacketMachineClassNamespaceLister.
-type PacketMachineClassNamespaceListerExpansion interface{}
diff --git a/pkg/client/listers/machine/internalversion/gcpmachineclass.go b/pkg/client/listers/machine/internalversion/gcpmachineclass.go
deleted file mode 100644
index f72607b92..000000000
--- a/pkg/client/listers/machine/internalversion/gcpmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// GCPMachineClassLister helps list GCPMachineClasses.
-// All objects returned here must be treated as read-only.
-type GCPMachineClassLister interface {
- // List lists all GCPMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.GCPMachineClass, err error)
- // GCPMachineClasses returns an object that can list and get GCPMachineClasses.
- GCPMachineClasses(namespace string) GCPMachineClassNamespaceLister
- GCPMachineClassListerExpansion
-}
-
-// gCPMachineClassLister implements the GCPMachineClassLister interface.
-type gCPMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewGCPMachineClassLister returns a new GCPMachineClassLister.
-func NewGCPMachineClassLister(indexer cache.Indexer) GCPMachineClassLister {
- return &gCPMachineClassLister{indexer: indexer}
-}
-
-// List lists all GCPMachineClasses in the indexer.
-func (s *gCPMachineClassLister) List(selector labels.Selector) (ret []*machine.GCPMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.GCPMachineClass))
- })
- return ret, err
-}
-
-// GCPMachineClasses returns an object that can list and get GCPMachineClasses.
-func (s *gCPMachineClassLister) GCPMachineClasses(namespace string) GCPMachineClassNamespaceLister {
- return gCPMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// GCPMachineClassNamespaceLister helps list and get GCPMachineClasses.
-// All objects returned here must be treated as read-only.
-type GCPMachineClassNamespaceLister interface {
- // List lists all GCPMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.GCPMachineClass, err error)
- // Get retrieves the GCPMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*machine.GCPMachineClass, error)
- GCPMachineClassNamespaceListerExpansion
-}
-
-// gCPMachineClassNamespaceLister implements the GCPMachineClassNamespaceLister
-// interface.
-type gCPMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all GCPMachineClasses in the indexer for a given namespace.
-func (s gCPMachineClassNamespaceLister) List(selector labels.Selector) (ret []*machine.GCPMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.GCPMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the GCPMachineClass from the indexer for a given namespace and name.
-func (s gCPMachineClassNamespaceLister) Get(name string) (*machine.GCPMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(machine.Resource("gcpmachineclass"), name)
- }
- return obj.(*machine.GCPMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/internalversion/openstackmachineclass.go b/pkg/client/listers/machine/internalversion/openstackmachineclass.go
deleted file mode 100644
index 51c37bc21..000000000
--- a/pkg/client/listers/machine/internalversion/openstackmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// OpenStackMachineClassLister helps list OpenStackMachineClasses.
-// All objects returned here must be treated as read-only.
-type OpenStackMachineClassLister interface {
- // List lists all OpenStackMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.OpenStackMachineClass, err error)
- // OpenStackMachineClasses returns an object that can list and get OpenStackMachineClasses.
- OpenStackMachineClasses(namespace string) OpenStackMachineClassNamespaceLister
- OpenStackMachineClassListerExpansion
-}
-
-// openStackMachineClassLister implements the OpenStackMachineClassLister interface.
-type openStackMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewOpenStackMachineClassLister returns a new OpenStackMachineClassLister.
-func NewOpenStackMachineClassLister(indexer cache.Indexer) OpenStackMachineClassLister {
- return &openStackMachineClassLister{indexer: indexer}
-}
-
-// List lists all OpenStackMachineClasses in the indexer.
-func (s *openStackMachineClassLister) List(selector labels.Selector) (ret []*machine.OpenStackMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.OpenStackMachineClass))
- })
- return ret, err
-}
-
-// OpenStackMachineClasses returns an object that can list and get OpenStackMachineClasses.
-func (s *openStackMachineClassLister) OpenStackMachineClasses(namespace string) OpenStackMachineClassNamespaceLister {
- return openStackMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// OpenStackMachineClassNamespaceLister helps list and get OpenStackMachineClasses.
-// All objects returned here must be treated as read-only.
-type OpenStackMachineClassNamespaceLister interface {
- // List lists all OpenStackMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.OpenStackMachineClass, err error)
- // Get retrieves the OpenStackMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*machine.OpenStackMachineClass, error)
- OpenStackMachineClassNamespaceListerExpansion
-}
-
-// openStackMachineClassNamespaceLister implements the OpenStackMachineClassNamespaceLister
-// interface.
-type openStackMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all OpenStackMachineClasses in the indexer for a given namespace.
-func (s openStackMachineClassNamespaceLister) List(selector labels.Selector) (ret []*machine.OpenStackMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.OpenStackMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the OpenStackMachineClass from the indexer for a given namespace and name.
-func (s openStackMachineClassNamespaceLister) Get(name string) (*machine.OpenStackMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(machine.Resource("openstackmachineclass"), name)
- }
- return obj.(*machine.OpenStackMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/internalversion/packetmachineclass.go b/pkg/client/listers/machine/internalversion/packetmachineclass.go
deleted file mode 100644
index 7dbe74164..000000000
--- a/pkg/client/listers/machine/internalversion/packetmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package internalversion
-
-import (
- machine "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// PacketMachineClassLister helps list PacketMachineClasses.
-// All objects returned here must be treated as read-only.
-type PacketMachineClassLister interface {
- // List lists all PacketMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.PacketMachineClass, err error)
- // PacketMachineClasses returns an object that can list and get PacketMachineClasses.
- PacketMachineClasses(namespace string) PacketMachineClassNamespaceLister
- PacketMachineClassListerExpansion
-}
-
-// packetMachineClassLister implements the PacketMachineClassLister interface.
-type packetMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewPacketMachineClassLister returns a new PacketMachineClassLister.
-func NewPacketMachineClassLister(indexer cache.Indexer) PacketMachineClassLister {
- return &packetMachineClassLister{indexer: indexer}
-}
-
-// List lists all PacketMachineClasses in the indexer.
-func (s *packetMachineClassLister) List(selector labels.Selector) (ret []*machine.PacketMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.PacketMachineClass))
- })
- return ret, err
-}
-
-// PacketMachineClasses returns an object that can list and get PacketMachineClasses.
-func (s *packetMachineClassLister) PacketMachineClasses(namespace string) PacketMachineClassNamespaceLister {
- return packetMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// PacketMachineClassNamespaceLister helps list and get PacketMachineClasses.
-// All objects returned here must be treated as read-only.
-type PacketMachineClassNamespaceLister interface {
- // List lists all PacketMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*machine.PacketMachineClass, err error)
- // Get retrieves the PacketMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*machine.PacketMachineClass, error)
- PacketMachineClassNamespaceListerExpansion
-}
-
-// packetMachineClassNamespaceLister implements the PacketMachineClassNamespaceLister
-// interface.
-type packetMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all PacketMachineClasses in the indexer for a given namespace.
-func (s packetMachineClassNamespaceLister) List(selector labels.Selector) (ret []*machine.PacketMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*machine.PacketMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the PacketMachineClass from the indexer for a given namespace and name.
-func (s packetMachineClassNamespaceLister) Get(name string) (*machine.PacketMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(machine.Resource("packetmachineclass"), name)
- }
- return obj.(*machine.PacketMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/v1alpha1/alicloudmachineclass.go b/pkg/client/listers/machine/v1alpha1/alicloudmachineclass.go
deleted file mode 100644
index 995e5c383..000000000
--- a/pkg/client/listers/machine/v1alpha1/alicloudmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// AlicloudMachineClassLister helps list AlicloudMachineClasses.
-// All objects returned here must be treated as read-only.
-type AlicloudMachineClassLister interface {
- // List lists all AlicloudMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.AlicloudMachineClass, err error)
- // AlicloudMachineClasses returns an object that can list and get AlicloudMachineClasses.
- AlicloudMachineClasses(namespace string) AlicloudMachineClassNamespaceLister
- AlicloudMachineClassListerExpansion
-}
-
-// alicloudMachineClassLister implements the AlicloudMachineClassLister interface.
-type alicloudMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewAlicloudMachineClassLister returns a new AlicloudMachineClassLister.
-func NewAlicloudMachineClassLister(indexer cache.Indexer) AlicloudMachineClassLister {
- return &alicloudMachineClassLister{indexer: indexer}
-}
-
-// List lists all AlicloudMachineClasses in the indexer.
-func (s *alicloudMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.AlicloudMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.AlicloudMachineClass))
- })
- return ret, err
-}
-
-// AlicloudMachineClasses returns an object that can list and get AlicloudMachineClasses.
-func (s *alicloudMachineClassLister) AlicloudMachineClasses(namespace string) AlicloudMachineClassNamespaceLister {
- return alicloudMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// AlicloudMachineClassNamespaceLister helps list and get AlicloudMachineClasses.
-// All objects returned here must be treated as read-only.
-type AlicloudMachineClassNamespaceLister interface {
- // List lists all AlicloudMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.AlicloudMachineClass, err error)
- // Get retrieves the AlicloudMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*v1alpha1.AlicloudMachineClass, error)
- AlicloudMachineClassNamespaceListerExpansion
-}
-
-// alicloudMachineClassNamespaceLister implements the AlicloudMachineClassNamespaceLister
-// interface.
-type alicloudMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all AlicloudMachineClasses in the indexer for a given namespace.
-func (s alicloudMachineClassNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AlicloudMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.AlicloudMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the AlicloudMachineClass from the indexer for a given namespace and name.
-func (s alicloudMachineClassNamespaceLister) Get(name string) (*v1alpha1.AlicloudMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(v1alpha1.Resource("alicloudmachineclass"), name)
- }
- return obj.(*v1alpha1.AlicloudMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/v1alpha1/awsmachineclass.go b/pkg/client/listers/machine/v1alpha1/awsmachineclass.go
deleted file mode 100644
index db7853b45..000000000
--- a/pkg/client/listers/machine/v1alpha1/awsmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// AWSMachineClassLister helps list AWSMachineClasses.
-// All objects returned here must be treated as read-only.
-type AWSMachineClassLister interface {
- // List lists all AWSMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.AWSMachineClass, err error)
- // AWSMachineClasses returns an object that can list and get AWSMachineClasses.
- AWSMachineClasses(namespace string) AWSMachineClassNamespaceLister
- AWSMachineClassListerExpansion
-}
-
-// aWSMachineClassLister implements the AWSMachineClassLister interface.
-type aWSMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewAWSMachineClassLister returns a new AWSMachineClassLister.
-func NewAWSMachineClassLister(indexer cache.Indexer) AWSMachineClassLister {
- return &aWSMachineClassLister{indexer: indexer}
-}
-
-// List lists all AWSMachineClasses in the indexer.
-func (s *aWSMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.AWSMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.AWSMachineClass))
- })
- return ret, err
-}
-
-// AWSMachineClasses returns an object that can list and get AWSMachineClasses.
-func (s *aWSMachineClassLister) AWSMachineClasses(namespace string) AWSMachineClassNamespaceLister {
- return aWSMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// AWSMachineClassNamespaceLister helps list and get AWSMachineClasses.
-// All objects returned here must be treated as read-only.
-type AWSMachineClassNamespaceLister interface {
- // List lists all AWSMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.AWSMachineClass, err error)
- // Get retrieves the AWSMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*v1alpha1.AWSMachineClass, error)
- AWSMachineClassNamespaceListerExpansion
-}
-
-// aWSMachineClassNamespaceLister implements the AWSMachineClassNamespaceLister
-// interface.
-type aWSMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all AWSMachineClasses in the indexer for a given namespace.
-func (s aWSMachineClassNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AWSMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.AWSMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the AWSMachineClass from the indexer for a given namespace and name.
-func (s aWSMachineClassNamespaceLister) Get(name string) (*v1alpha1.AWSMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(v1alpha1.Resource("awsmachineclass"), name)
- }
- return obj.(*v1alpha1.AWSMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/v1alpha1/azuremachineclass.go b/pkg/client/listers/machine/v1alpha1/azuremachineclass.go
deleted file mode 100644
index 6a3cf74e9..000000000
--- a/pkg/client/listers/machine/v1alpha1/azuremachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// AzureMachineClassLister helps list AzureMachineClasses.
-// All objects returned here must be treated as read-only.
-type AzureMachineClassLister interface {
- // List lists all AzureMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.AzureMachineClass, err error)
- // AzureMachineClasses returns an object that can list and get AzureMachineClasses.
- AzureMachineClasses(namespace string) AzureMachineClassNamespaceLister
- AzureMachineClassListerExpansion
-}
-
-// azureMachineClassLister implements the AzureMachineClassLister interface.
-type azureMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewAzureMachineClassLister returns a new AzureMachineClassLister.
-func NewAzureMachineClassLister(indexer cache.Indexer) AzureMachineClassLister {
- return &azureMachineClassLister{indexer: indexer}
-}
-
-// List lists all AzureMachineClasses in the indexer.
-func (s *azureMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.AzureMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.AzureMachineClass))
- })
- return ret, err
-}
-
-// AzureMachineClasses returns an object that can list and get AzureMachineClasses.
-func (s *azureMachineClassLister) AzureMachineClasses(namespace string) AzureMachineClassNamespaceLister {
- return azureMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// AzureMachineClassNamespaceLister helps list and get AzureMachineClasses.
-// All objects returned here must be treated as read-only.
-type AzureMachineClassNamespaceLister interface {
- // List lists all AzureMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.AzureMachineClass, err error)
- // Get retrieves the AzureMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*v1alpha1.AzureMachineClass, error)
- AzureMachineClassNamespaceListerExpansion
-}
-
-// azureMachineClassNamespaceLister implements the AzureMachineClassNamespaceLister
-// interface.
-type azureMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all AzureMachineClasses in the indexer for a given namespace.
-func (s azureMachineClassNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.AzureMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.AzureMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the AzureMachineClass from the indexer for a given namespace and name.
-func (s azureMachineClassNamespaceLister) Get(name string) (*v1alpha1.AzureMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(v1alpha1.Resource("azuremachineclass"), name)
- }
- return obj.(*v1alpha1.AzureMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/v1alpha1/expansion_generated.go b/pkg/client/listers/machine/v1alpha1/expansion_generated.go
index 47c74ada8..f27ed704f 100644
--- a/pkg/client/listers/machine/v1alpha1/expansion_generated.go
+++ b/pkg/client/listers/machine/v1alpha1/expansion_generated.go
@@ -18,38 +18,6 @@ limitations under the License.
package v1alpha1
-// AWSMachineClassListerExpansion allows custom methods to be added to
-// AWSMachineClassLister.
-type AWSMachineClassListerExpansion interface{}
-
-// AWSMachineClassNamespaceListerExpansion allows custom methods to be added to
-// AWSMachineClassNamespaceLister.
-type AWSMachineClassNamespaceListerExpansion interface{}
-
-// AlicloudMachineClassListerExpansion allows custom methods to be added to
-// AlicloudMachineClassLister.
-type AlicloudMachineClassListerExpansion interface{}
-
-// AlicloudMachineClassNamespaceListerExpansion allows custom methods to be added to
-// AlicloudMachineClassNamespaceLister.
-type AlicloudMachineClassNamespaceListerExpansion interface{}
-
-// AzureMachineClassListerExpansion allows custom methods to be added to
-// AzureMachineClassLister.
-type AzureMachineClassListerExpansion interface{}
-
-// AzureMachineClassNamespaceListerExpansion allows custom methods to be added to
-// AzureMachineClassNamespaceLister.
-type AzureMachineClassNamespaceListerExpansion interface{}
-
-// GCPMachineClassListerExpansion allows custom methods to be added to
-// GCPMachineClassLister.
-type GCPMachineClassListerExpansion interface{}
-
-// GCPMachineClassNamespaceListerExpansion allows custom methods to be added to
-// GCPMachineClassNamespaceLister.
-type GCPMachineClassNamespaceListerExpansion interface{}
-
// MachineListerExpansion allows custom methods to be added to
// MachineLister.
type MachineListerExpansion interface{}
@@ -81,19 +49,3 @@ type MachineSetListerExpansion interface{}
// MachineSetNamespaceListerExpansion allows custom methods to be added to
// MachineSetNamespaceLister.
type MachineSetNamespaceListerExpansion interface{}
-
-// OpenStackMachineClassListerExpansion allows custom methods to be added to
-// OpenStackMachineClassLister.
-type OpenStackMachineClassListerExpansion interface{}
-
-// OpenStackMachineClassNamespaceListerExpansion allows custom methods to be added to
-// OpenStackMachineClassNamespaceLister.
-type OpenStackMachineClassNamespaceListerExpansion interface{}
-
-// PacketMachineClassListerExpansion allows custom methods to be added to
-// PacketMachineClassLister.
-type PacketMachineClassListerExpansion interface{}
-
-// PacketMachineClassNamespaceListerExpansion allows custom methods to be added to
-// PacketMachineClassNamespaceLister.
-type PacketMachineClassNamespaceListerExpansion interface{}
diff --git a/pkg/client/listers/machine/v1alpha1/gcpmachineclass.go b/pkg/client/listers/machine/v1alpha1/gcpmachineclass.go
deleted file mode 100644
index ee588b11d..000000000
--- a/pkg/client/listers/machine/v1alpha1/gcpmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// GCPMachineClassLister helps list GCPMachineClasses.
-// All objects returned here must be treated as read-only.
-type GCPMachineClassLister interface {
- // List lists all GCPMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.GCPMachineClass, err error)
- // GCPMachineClasses returns an object that can list and get GCPMachineClasses.
- GCPMachineClasses(namespace string) GCPMachineClassNamespaceLister
- GCPMachineClassListerExpansion
-}
-
-// gCPMachineClassLister implements the GCPMachineClassLister interface.
-type gCPMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewGCPMachineClassLister returns a new GCPMachineClassLister.
-func NewGCPMachineClassLister(indexer cache.Indexer) GCPMachineClassLister {
- return &gCPMachineClassLister{indexer: indexer}
-}
-
-// List lists all GCPMachineClasses in the indexer.
-func (s *gCPMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.GCPMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.GCPMachineClass))
- })
- return ret, err
-}
-
-// GCPMachineClasses returns an object that can list and get GCPMachineClasses.
-func (s *gCPMachineClassLister) GCPMachineClasses(namespace string) GCPMachineClassNamespaceLister {
- return gCPMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// GCPMachineClassNamespaceLister helps list and get GCPMachineClasses.
-// All objects returned here must be treated as read-only.
-type GCPMachineClassNamespaceLister interface {
- // List lists all GCPMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.GCPMachineClass, err error)
- // Get retrieves the GCPMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*v1alpha1.GCPMachineClass, error)
- GCPMachineClassNamespaceListerExpansion
-}
-
-// gCPMachineClassNamespaceLister implements the GCPMachineClassNamespaceLister
-// interface.
-type gCPMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all GCPMachineClasses in the indexer for a given namespace.
-func (s gCPMachineClassNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.GCPMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.GCPMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the GCPMachineClass from the indexer for a given namespace and name.
-func (s gCPMachineClassNamespaceLister) Get(name string) (*v1alpha1.GCPMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(v1alpha1.Resource("gcpmachineclass"), name)
- }
- return obj.(*v1alpha1.GCPMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/v1alpha1/openstackmachineclass.go b/pkg/client/listers/machine/v1alpha1/openstackmachineclass.go
deleted file mode 100644
index 69081bce7..000000000
--- a/pkg/client/listers/machine/v1alpha1/openstackmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// OpenStackMachineClassLister helps list OpenStackMachineClasses.
-// All objects returned here must be treated as read-only.
-type OpenStackMachineClassLister interface {
- // List lists all OpenStackMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.OpenStackMachineClass, err error)
- // OpenStackMachineClasses returns an object that can list and get OpenStackMachineClasses.
- OpenStackMachineClasses(namespace string) OpenStackMachineClassNamespaceLister
- OpenStackMachineClassListerExpansion
-}
-
-// openStackMachineClassLister implements the OpenStackMachineClassLister interface.
-type openStackMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewOpenStackMachineClassLister returns a new OpenStackMachineClassLister.
-func NewOpenStackMachineClassLister(indexer cache.Indexer) OpenStackMachineClassLister {
- return &openStackMachineClassLister{indexer: indexer}
-}
-
-// List lists all OpenStackMachineClasses in the indexer.
-func (s *openStackMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.OpenStackMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.OpenStackMachineClass))
- })
- return ret, err
-}
-
-// OpenStackMachineClasses returns an object that can list and get OpenStackMachineClasses.
-func (s *openStackMachineClassLister) OpenStackMachineClasses(namespace string) OpenStackMachineClassNamespaceLister {
- return openStackMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// OpenStackMachineClassNamespaceLister helps list and get OpenStackMachineClasses.
-// All objects returned here must be treated as read-only.
-type OpenStackMachineClassNamespaceLister interface {
- // List lists all OpenStackMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.OpenStackMachineClass, err error)
- // Get retrieves the OpenStackMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*v1alpha1.OpenStackMachineClass, error)
- OpenStackMachineClassNamespaceListerExpansion
-}
-
-// openStackMachineClassNamespaceLister implements the OpenStackMachineClassNamespaceLister
-// interface.
-type openStackMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all OpenStackMachineClasses in the indexer for a given namespace.
-func (s openStackMachineClassNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.OpenStackMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.OpenStackMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the OpenStackMachineClass from the indexer for a given namespace and name.
-func (s openStackMachineClassNamespaceLister) Get(name string) (*v1alpha1.OpenStackMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(v1alpha1.Resource("openstackmachineclass"), name)
- }
- return obj.(*v1alpha1.OpenStackMachineClass), nil
-}
diff --git a/pkg/client/listers/machine/v1alpha1/packetmachineclass.go b/pkg/client/listers/machine/v1alpha1/packetmachineclass.go
deleted file mode 100644
index a8ebe487f..000000000
--- a/pkg/client/listers/machine/v1alpha1/packetmachineclass.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Code generated by lister-gen. DO NOT EDIT.
-
-package v1alpha1
-
-import (
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "k8s.io/apimachinery/pkg/api/errors"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/client-go/tools/cache"
-)
-
-// PacketMachineClassLister helps list PacketMachineClasses.
-// All objects returned here must be treated as read-only.
-type PacketMachineClassLister interface {
- // List lists all PacketMachineClasses in the indexer.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.PacketMachineClass, err error)
- // PacketMachineClasses returns an object that can list and get PacketMachineClasses.
- PacketMachineClasses(namespace string) PacketMachineClassNamespaceLister
- PacketMachineClassListerExpansion
-}
-
-// packetMachineClassLister implements the PacketMachineClassLister interface.
-type packetMachineClassLister struct {
- indexer cache.Indexer
-}
-
-// NewPacketMachineClassLister returns a new PacketMachineClassLister.
-func NewPacketMachineClassLister(indexer cache.Indexer) PacketMachineClassLister {
- return &packetMachineClassLister{indexer: indexer}
-}
-
-// List lists all PacketMachineClasses in the indexer.
-func (s *packetMachineClassLister) List(selector labels.Selector) (ret []*v1alpha1.PacketMachineClass, err error) {
- err = cache.ListAll(s.indexer, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.PacketMachineClass))
- })
- return ret, err
-}
-
-// PacketMachineClasses returns an object that can list and get PacketMachineClasses.
-func (s *packetMachineClassLister) PacketMachineClasses(namespace string) PacketMachineClassNamespaceLister {
- return packetMachineClassNamespaceLister{indexer: s.indexer, namespace: namespace}
-}
-
-// PacketMachineClassNamespaceLister helps list and get PacketMachineClasses.
-// All objects returned here must be treated as read-only.
-type PacketMachineClassNamespaceLister interface {
- // List lists all PacketMachineClasses in the indexer for a given namespace.
- // Objects returned here must be treated as read-only.
- List(selector labels.Selector) (ret []*v1alpha1.PacketMachineClass, err error)
- // Get retrieves the PacketMachineClass from the indexer for a given namespace and name.
- // Objects returned here must be treated as read-only.
- Get(name string) (*v1alpha1.PacketMachineClass, error)
- PacketMachineClassNamespaceListerExpansion
-}
-
-// packetMachineClassNamespaceLister implements the PacketMachineClassNamespaceLister
-// interface.
-type packetMachineClassNamespaceLister struct {
- indexer cache.Indexer
- namespace string
-}
-
-// List lists all PacketMachineClasses in the indexer for a given namespace.
-func (s packetMachineClassNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.PacketMachineClass, err error) {
- err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
- ret = append(ret, m.(*v1alpha1.PacketMachineClass))
- })
- return ret, err
-}
-
-// Get retrieves the PacketMachineClass from the indexer for a given namespace and name.
-func (s packetMachineClassNamespaceLister) Get(name string) (*v1alpha1.PacketMachineClass, error) {
- obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
- if err != nil {
- return nil, err
- }
- if !exists {
- return nil, errors.NewNotFound(v1alpha1.Resource("packetmachineclass"), name)
- }
- return obj.(*v1alpha1.PacketMachineClass), nil
-}
diff --git a/pkg/controller/alicloudmachineclass.go b/pkg/controller/alicloudmachineclass.go
deleted file mode 100644
index c01d4b97d..000000000
--- a/pkg/controller/alicloudmachineclass.go
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "fmt"
- "time"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/tools/cache"
-
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
-)
-
-// AlicloudMachineClassKind is used to identify the machineClassKind as Alicloud
-const AlicloudMachineClassKind = "AlicloudMachineClass"
-
-func (c *controller) machineDeploymentToAlicloudMachineClassDelete(obj interface{}) {
- machineDeployment, ok := obj.(*v1alpha1.MachineDeployment)
- if machineDeployment == nil || !ok {
- return
- }
- if machineDeployment.Spec.Template.Spec.Class.Kind == AlicloudMachineClassKind {
- c.alicloudMachineClassQueue.Add(machineDeployment.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineSetToAlicloudMachineClassDelete(obj interface{}) {
- machineSet, ok := obj.(*v1alpha1.MachineSet)
- if machineSet == nil || !ok {
- return
- }
- if machineSet.Spec.Template.Spec.Class.Kind == AlicloudMachineClassKind {
- c.alicloudMachineClassQueue.Add(machineSet.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToAlicloudMachineClassAdd(obj interface{}) {
- machine, ok := obj.(*v1alpha1.Machine)
- if machine == nil || !ok {
- return
- }
- if machine.Spec.Class.Kind == AlicloudMachineClassKind {
- c.alicloudMachineClassQueue.Add(machine.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToAlicloudMachineClassUpdate(oldObj, newObj interface{}) {
- oldMachine, ok := oldObj.(*v1alpha1.Machine)
- if oldMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", oldObj)
- return
- }
- newMachine, ok := newObj.(*v1alpha1.Machine)
- if newMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", newObj)
- return
- }
-
- if oldMachine.Spec.Class.Kind == newMachine.Spec.Class.Kind {
- if newMachine.Spec.Class.Kind == AlicloudMachineClassKind {
- // Both old and new machine refer to the same machineClass object
- // And the correct kind so enqueuing only one of them.
- c.alicloudMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- } else {
- // If both are pointing to different machineClasses
- // we might have to enqueue both.
- if oldMachine.Spec.Class.Kind == AlicloudMachineClassKind {
- c.alicloudMachineClassQueue.Add(oldMachine.Spec.Class.Name)
- }
- if newMachine.Spec.Class.Kind == AlicloudMachineClassKind {
- c.alicloudMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- }
-}
-
-func (c *controller) machineToAlicloudMachineClassDelete(obj interface{}) {
- c.machineToAlicloudMachineClassAdd(obj)
-}
-
-func (c *controller) alicloudMachineClassAdd(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
- c.alicloudMachineClassQueue.Add(key)
-}
-
-func (c *controller) alicloudMachineClassUpdate(oldObj, newObj interface{}) {
- old, ok := oldObj.(*v1alpha1.AlicloudMachineClass)
- if old == nil || !ok {
- return
- }
- new, ok := newObj.(*v1alpha1.AlicloudMachineClass)
- if new == nil || !ok {
- return
- }
-
- c.alicloudMachineClassAdd(newObj)
-}
-
-func (c *controller) alicloudMachineClassDelete(obj interface{}) {
- c.alicloudMachineClassAdd(obj)
-}
-
-// reconcileClusterAlicloudMachineClassKey reconciles an AlicloudMachineClass due to controller resync
-// or an event on the alicloudMachineClass.
-func (c *controller) reconcileClusterAlicloudMachineClassKey(key string) error {
- ctx := context.Background()
- _, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return err
- }
-
- class, err := c.alicloudMachineClassLister.AlicloudMachineClasses(c.namespace).Get(name)
- if errors.IsNotFound(err) {
- klog.Infof("%s %q: Not doing work because it has been deleted", AlicloudMachineClassKind, key)
- return nil
- }
- if err != nil {
- klog.Infof("%s %q: Unable to retrieve object from store: %v", AlicloudMachineClassKind, key, err)
- return err
- }
-
- err = c.reconcileClusterAlicloudMachineClass(ctx, class)
- if err != nil {
- // Re-enqueue after a 10s window
- c.enqueueAlicloudMachineClassAfter(class, 10*time.Second)
- } else {
- // Re-enqueue periodically to avoid missing of events
- // TODO: Get ride of this logic
- c.enqueueAlicloudMachineClassAfter(class, 10*time.Minute)
- }
- return nil
-}
-
-func (c *controller) reconcileClusterAlicloudMachineClass(ctx context.Context, class *v1alpha1.AlicloudMachineClass) error {
- klog.V(4).Info("Start Reconciling alicloudmachineclass: ", class.Name)
- defer klog.V(4).Info("Stop Reconciling alicloudmachineclass: ", class.Name)
-
- internalClass := &machine.AlicloudMachineClass{}
- err := c.internalExternalScheme.Convert(class, internalClass, nil)
- if err != nil {
- return err
- }
-
- validationerr := validation.ValidateAlicloudMachineClass(internalClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.V(2).Infof("Validation of %s failed %s", AlicloudMachineClassKind, validationerr.ToAggregate().Error())
- return nil
- }
-
- // Add finalizer to avoid losing machineClass object
- if class.DeletionTimestamp == nil {
- err = c.addAlicloudMachineClassFinalizers(ctx, class)
- if err != nil {
- return err
- }
- }
-
- machines, err := c.findMachinesForClass(AlicloudMachineClassKind, class.Name)
- if err != nil {
- return err
- }
-
- if class.DeletionTimestamp == nil {
- // If deletion timestamp doesn't exist
- _, annotationPresent := class.Annotations[machineutils.MigratedMachineClass]
-
- if c.deleteMigratedMachineClass && annotationPresent && len(machines) == 0 {
- // If controller has deleteMigratedMachineClass flag set
- // and the migratedMachineClass annotation is set
- err = c.controlMachineClient.AlicloudMachineClasses(class.Namespace).Delete(ctx, class.Name, metav1.DeleteOptions{})
- if err != nil {
- return err
- }
- return fmt.Errorf("Retry deletion as deletion timestamp is now set")
- }
-
- return nil
- }
-
- if len(machines) > 0 {
- // machines are still referring the machine class, please wait before deletion
- klog.V(3).Infof("Cannot remove finalizer on %s because still (%d) machines are referencing it", class.Name, len(machines))
-
- for _, machine := range machines {
- c.addMachine(machine)
- }
-
- return fmt.Errorf("Retry as machine objects are still referring the machineclass")
- }
-
- // delete machine class finalizer if exists
- return c.deleteAlicloudMachineClassFinalizers(ctx, class)
-}
-
-/*
- SECTION
- Manipulate Finalizers
-*/
-
-func (c *controller) addAlicloudMachineClassFinalizers(ctx context.Context, class *v1alpha1.AlicloudMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- finalizers.Insert(DeleteFinalizerName)
- return c.updateAlicloudMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) deleteAlicloudMachineClassFinalizers(ctx context.Context, class *v1alpha1.AlicloudMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- finalizers.Delete(DeleteFinalizerName)
- return c.updateAlicloudMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) updateAlicloudMachineClassFinalizers(ctx context.Context, class *v1alpha1.AlicloudMachineClass, finalizers []string) error {
- // Get the latest version of the class so that we can avoid conflicts
- class, err := c.controlMachineClient.AlicloudMachineClasses(class.Namespace).Get(ctx, class.Name, metav1.GetOptions{})
- if err != nil {
- return err
- }
-
- clone := class.DeepCopy()
- clone.Finalizers = finalizers
- _, err = c.controlMachineClient.AlicloudMachineClasses(class.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warning("Updating AlicloudMachineClass failed, retrying. ", class.Name, err)
- return err
- }
- klog.V(3).Infof("Successfully added/removed finalizer on the alicloudmachineclass %q", class.Name)
- return err
-}
-
-func (c *controller) enqueueAlicloudMachineClassAfter(obj interface{}, after time.Duration) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- return
- }
- c.alicloudMachineClassQueue.AddAfter(key, after)
-}
diff --git a/pkg/controller/awsmachineclass.go b/pkg/controller/awsmachineclass.go
deleted file mode 100644
index bc0b4f092..000000000
--- a/pkg/controller/awsmachineclass.go
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "fmt"
- "time"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/tools/cache"
-
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
-)
-
-// AWSMachineClassKind is used to identify the machineClassKind as AWS
-const AWSMachineClassKind = "AWSMachineClass"
-
-func (c *controller) machineDeploymentToAWSMachineClassDelete(obj interface{}) {
- machineDeployment, ok := obj.(*v1alpha1.MachineDeployment)
- if machineDeployment == nil || !ok {
- return
- }
- if machineDeployment.Spec.Template.Spec.Class.Kind == AWSMachineClassKind {
- c.awsMachineClassQueue.Add(machineDeployment.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineSetToAWSMachineClassDelete(obj interface{}) {
- machineSet, ok := obj.(*v1alpha1.MachineSet)
- if machineSet == nil || !ok {
- return
- }
- if machineSet.Spec.Template.Spec.Class.Kind == AWSMachineClassKind {
- c.awsMachineClassQueue.Add(machineSet.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToAWSMachineClassAdd(obj interface{}) {
- machine, ok := obj.(*v1alpha1.Machine)
- if machine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", obj)
- return
- }
- if machine.Spec.Class.Kind == AWSMachineClassKind {
- c.awsMachineClassQueue.Add(machine.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToAWSMachineClassUpdate(oldObj, newObj interface{}) {
- oldMachine, ok := oldObj.(*v1alpha1.Machine)
- if oldMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", oldObj)
- return
- }
- newMachine, ok := newObj.(*v1alpha1.Machine)
- if newMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", newObj)
- return
- }
-
- if oldMachine.Spec.Class.Kind == newMachine.Spec.Class.Kind {
- if newMachine.Spec.Class.Kind == AWSMachineClassKind {
- // Both old and new machine refer to the same machineClass object
- // And the correct kind so enqueuing only one of them.
- c.awsMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- } else {
- // If both are pointing to different machineClasses
- // we might have to enqueue both.
- if oldMachine.Spec.Class.Kind == AWSMachineClassKind {
- c.awsMachineClassQueue.Add(oldMachine.Spec.Class.Name)
- }
- if newMachine.Spec.Class.Kind == AWSMachineClassKind {
- c.awsMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- }
-}
-
-func (c *controller) machineToAWSMachineClassDelete(obj interface{}) {
- c.machineToAWSMachineClassAdd(obj)
-}
-
-func (c *controller) awsMachineClassAdd(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
- c.awsMachineClassQueue.Add(key)
-}
-
-func (c *controller) awsMachineClassUpdate(oldObj, newObj interface{}) {
- old, ok := oldObj.(*v1alpha1.AWSMachineClass)
- if old == nil || !ok {
- return
- }
- new, ok := newObj.(*v1alpha1.AWSMachineClass)
- if new == nil || !ok {
- return
- }
-
- c.awsMachineClassAdd(newObj)
-}
-
-func (c *controller) awsMachineClassDelete(obj interface{}) {
- c.awsMachineClassAdd(obj)
-}
-
-// reconcileClusterAWSMachineClassKey reconciles an AWSMachineClass due to controller resync
-// or an event on the awsMachineClass.
-func (c *controller) reconcileClusterAWSMachineClassKey(key string) error {
- ctx := context.Background()
- _, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return err
- }
-
- class, err := c.awsMachineClassLister.AWSMachineClasses(c.namespace).Get(name)
- if errors.IsNotFound(err) {
- klog.Infof("%s %q: Not doing work because it has been deleted", AWSMachineClassKind, key)
- return nil
- }
- if err != nil {
- klog.Infof("%s %q: Unable to retrieve object from store: %v", AWSMachineClassKind, key, err)
- return err
- }
-
- err = c.reconcileClusterAWSMachineClass(ctx, class)
- if err != nil {
- c.enqueueAWSMachineClassAfter(class, 10*time.Second)
- } else {
- // Re-enqueue periodically to avoid missing of events
- // TODO: Infuture to get ride of this logic
- c.enqueueAWSMachineClassAfter(class, 10*time.Minute)
- }
-
- return nil
-}
-
-func (c *controller) reconcileClusterAWSMachineClass(ctx context.Context, class *v1alpha1.AWSMachineClass) error {
- klog.V(4).Info("Start Reconciling AWSmachineclass: ", class.Name)
- defer klog.V(4).Info("Stop Reconciling AWSmachineclass: ", class.Name)
-
- internalClass := &machine.AWSMachineClass{}
- err := c.internalExternalScheme.Convert(class, internalClass, nil)
- if err != nil {
- return err
- }
-
- validationerr := validation.ValidateAWSMachineClass(internalClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.Errorf("Validation of %s failed %s", AWSMachineClassKind, validationerr.ToAggregate().Error())
- return nil
- }
-
- // Add finalizer to avoid losing machineClass object
- if class.DeletionTimestamp == nil {
- err = c.addAWSMachineClassFinalizers(ctx, class)
- if err != nil {
- return err
- }
- }
-
- machines, err := c.findMachinesForClass(AWSMachineClassKind, class.Name)
- if err != nil {
- return err
- }
-
- if class.DeletionTimestamp == nil {
- // If deletion timestamp doesn't exist
- _, annotationPresent := class.Annotations[machineutils.MigratedMachineClass]
-
- if c.deleteMigratedMachineClass && annotationPresent && len(machines) == 0 {
- // If controller has deleteMigratedMachineClass flag set
- // and the migratedMachineClass annotation is set
- err = c.controlMachineClient.AWSMachineClasses(class.Namespace).Delete(ctx, class.Name, metav1.DeleteOptions{})
- if err != nil {
- return err
- }
- return fmt.Errorf("Retry deletion as deletion timestamp is now set")
- }
-
- return nil
- }
-
- if len(machines) > 0 {
- // machines are still referring the machine class, please wait before deletion
- klog.V(3).Infof("Cannot remove finalizer on %s because still (%d) machines are referencing it", class.Name, len(machines))
-
- for _, machine := range machines {
- c.addMachine(machine)
- }
-
- return fmt.Errorf("Retry as machine objects are still referring the machineclass")
- }
-
- return c.deleteAWSMachineClassFinalizers(ctx, class)
-}
-
-/*
- SECTION
- Manipulate Finalizers
-*/
-
-func (c *controller) addAWSMachineClassFinalizers(ctx context.Context, class *v1alpha1.AWSMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- finalizers.Insert(DeleteFinalizerName)
- return c.updateAWSMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) deleteAWSMachineClassFinalizers(ctx context.Context, class *v1alpha1.AWSMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- finalizers.Delete(DeleteFinalizerName)
- return c.updateAWSMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) updateAWSMachineClassFinalizers(ctx context.Context, class *v1alpha1.AWSMachineClass, finalizers []string) error {
- // Get the latest version of the class so that we can avoid conflicts
- class, err := c.controlMachineClient.AWSMachineClasses(class.Namespace).Get(ctx, class.Name, metav1.GetOptions{})
- if err != nil {
- return err
- }
-
- clone := class.DeepCopy()
- clone.Finalizers = finalizers
- _, err = c.controlMachineClient.AWSMachineClasses(class.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warning("Updating AWSMachineClass failed, retrying. ", class.Name, err)
- return err
- }
- klog.V(3).Infof("Successfully added/removed finalizer on the awsmachineclass %q", class.Name)
- return err
-}
-
-func (c *controller) enqueueAWSMachineClassAfter(obj interface{}, after time.Duration) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- return
- }
- c.awsMachineClassQueue.AddAfter(key, after)
-}
diff --git a/pkg/controller/awsmachineclass_test.go b/pkg/controller/awsmachineclass_test.go
deleted file mode 100644
index 2ac997c4d..000000000
--- a/pkg/controller/awsmachineclass_test.go
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package controller
-
-import (
- "context"
- "fmt"
- "math"
- "time"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- customfake "github.com/gardener/machine-controller-manager/pkg/fakeclient"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/driver"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/ginkgo/extensions/table"
- . "github.com/onsi/gomega"
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-var (
- awsMachineClassSpec = v1alpha1.AWSMachineClassSpec{
- AMI: "test-ami",
- Region: "test-region",
- BlockDevices: []v1alpha1.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "test-device",
- Ebs: v1alpha1.AWSEbsBlockDeviceSpec{
- DeleteOnTermination: new(bool),
- Encrypted: false,
- Iops: 100,
- KmsKeyID: new(string),
- SnapshotID: new(string),
- VolumeSize: 50,
- VolumeType: "gp2",
- },
- NoDevice: "test-no",
- VirtualName: "test-vname",
- },
- },
- EbsOptimized: false,
- IAM: v1alpha1.AWSIAMProfileSpec{
- ARN: "test-arn",
- Name: "test-iam",
- },
- MachineType: "m4.xlarge",
- KeyName: "test-key",
- Monitoring: false,
- NetworkInterfaces: []v1alpha1.AWSNetworkInterfaceSpec{
- {
- AssociatePublicIPAddress: new(bool),
- DeleteOnTermination: new(bool),
- Description: new(string),
- SecurityGroupIDs: []string{"sg-0324245"},
- SubnetID: "test-subnet",
- },
- },
- Tags: map[string]string{
- "kubernetes.io/cluster/name": "1",
- "kubernetes.io/role/node": "1",
- },
- SpotPrice: new(string),
- SecretRef: &v1.SecretReference{
- Name: "test-secret",
- Namespace: TestNamespace,
- },
- }
-)
-
-var _ = Describe("machineclass", func() {
- Describe("#reconcileClusterAWSMachineClass", func() {
- type setup struct {
- machineClasses []*v1alpha1.AWSMachineClass
- machines []*v1alpha1.Machine
- fakeResourceActions *customfake.ResourceActions
- }
- type action struct {
- fakeDriver *driver.FakeDriver
- machineClassName string
- }
- type expect struct {
- machineClass *v1alpha1.AWSMachineClass
- err error
- deleted bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineObjects := []runtime.Object{}
- for _, o := range data.setup.machineClasses {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range data.setup.machines {
- machineObjects = append(machineObjects, o)
- }
-
- controller, trackers := createController(stop, TestNamespace, machineObjects, nil, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, controller)
-
- action := data.action
- machineClass, err := controller.controlMachineClient.AWSMachineClasses(TestNamespace).Get(context.TODO(), action.machineClassName, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
-
- if data.setup.fakeResourceActions != nil {
- trackers.TargetCore.SetFakeResourceActions(data.setup.fakeResourceActions, math.MaxInt32)
- }
-
- err = controller.reconcileClusterAWSMachineClass(context.TODO(), machineClass)
- if data.expect.err == nil {
- Expect(err).To(Not(HaveOccurred()))
- } else {
- Expect(err).To(Equal(data.expect.err))
- }
-
- machineClass, err = controller.controlMachineClient.AWSMachineClasses(TestNamespace).Get(context.TODO(), action.machineClassName, metav1.GetOptions{})
- if data.expect.deleted {
- Expect(err).To((HaveOccurred()))
- } else {
- Expect(err).To(Not(HaveOccurred()))
- Expect(data.expect.machineClass).To(Equal(machineClass))
- }
- },
- Entry(
- "Add finalizer to a machine class",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.AWSMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- },
- machines: []*v1alpha1.Machine{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Name: TestMachineClassName,
- Kind: AWSMachineClassKind,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- Status: v1alpha1.MachineStatus{},
- },
- },
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.AWSMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- err: nil,
- },
- },
- ),
- Entry(
- "Finalizer exists so do nothing",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.AWSMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- },
- machines: []*v1alpha1.Machine{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Name: TestMachineClassName,
- Kind: AWSMachineClassKind,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- Status: v1alpha1.MachineStatus{},
- },
- },
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.AWSMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- err: nil,
- },
- },
- ),
- Entry(
- "Class deletion failure due to machines referring to it",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.AWSMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- },
- machines: []*v1alpha1.Machine{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Name: TestMachineClassName,
- Kind: AWSMachineClassKind,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- Status: v1alpha1.MachineStatus{},
- },
- },
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.AWSMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- err: fmt.Errorf("Retry as machine objects are still referring the machineclass"),
- },
- },
- ),
- Entry(
- "Class deletion succeeds with removal of finalizer",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.AWSMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- },
- machines: []*v1alpha1.Machine{},
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.AWSMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- err: nil,
- },
- },
- ),
- Entry(
- "Class deletion succeeds as no finalizer exists",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.AWSMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- },
- machines: []*v1alpha1.Machine{},
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.AWSMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- err: nil,
- },
- },
- ),
- Entry(
- "Class migration has completed, set deletion timestamp",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.AWSMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- machineutils.MigratedMachineClass: "present",
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- },
- machines: []*v1alpha1.Machine{},
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.AWSMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: awsMachineClassSpec,
- },
- err: fmt.Errorf("Retry deletion as deletion timestamp is now set"),
- deleted: true,
- },
- },
- ),
- )
- })
-})
diff --git a/pkg/controller/azuremachineclass.go b/pkg/controller/azuremachineclass.go
deleted file mode 100644
index 7210e22cc..000000000
--- a/pkg/controller/azuremachineclass.go
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "fmt"
- "time"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/tools/cache"
-
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
-)
-
-// AzureMachineClassKind is used to identify the machineClassKind as Azure
-const AzureMachineClassKind = "AzureMachineClass"
-
-func (c *controller) machineDeploymentToAzureMachineClassDelete(obj interface{}) {
- machineDeployment, ok := obj.(*v1alpha1.MachineDeployment)
- if machineDeployment == nil || !ok {
- return
- }
- if machineDeployment.Spec.Template.Spec.Class.Kind == AzureMachineClassKind {
- c.azureMachineClassQueue.Add(machineDeployment.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineSetToAzureMachineClassDelete(obj interface{}) {
- machineSet, ok := obj.(*v1alpha1.MachineSet)
- if machineSet == nil || !ok {
- return
- }
- if machineSet.Spec.Template.Spec.Class.Kind == AzureMachineClassKind {
- c.azureMachineClassQueue.Add(machineSet.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToAzureMachineClassAdd(obj interface{}) {
- machine, ok := obj.(*v1alpha1.Machine)
- if machine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", obj)
- return
- }
- if machine.Spec.Class.Kind == AzureMachineClassKind {
- c.azureMachineClassQueue.Add(machine.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToAzureMachineClassUpdate(oldObj, newObj interface{}) {
- oldMachine, ok := oldObj.(*v1alpha1.Machine)
- if oldMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", oldObj)
- return
- }
- newMachine, ok := newObj.(*v1alpha1.Machine)
- if newMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", newObj)
- return
- }
-
- if oldMachine.Spec.Class.Kind == newMachine.Spec.Class.Kind {
- if newMachine.Spec.Class.Kind == AzureMachineClassKind {
- // Both old and new machine refer to the same machineClass object
- // And the correct kind so enqueuing only one of them.
- c.azureMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- } else {
- // If both are pointing to different machineClasses
- // we might have to enqueue both.
- if oldMachine.Spec.Class.Kind == AzureMachineClassKind {
- c.azureMachineClassQueue.Add(oldMachine.Spec.Class.Name)
- }
- if newMachine.Spec.Class.Kind == AzureMachineClassKind {
- c.azureMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- }
-}
-
-func (c *controller) machineToAzureMachineClassDelete(obj interface{}) {
- c.machineToAzureMachineClassAdd(obj)
-}
-
-func (c *controller) azureMachineClassAdd(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
- c.azureMachineClassQueue.Add(key)
-}
-
-func (c *controller) azureMachineClassUpdate(oldObj, newObj interface{}) {
- old, ok := oldObj.(*v1alpha1.AzureMachineClass)
- if old == nil || !ok {
- return
- }
- new, ok := newObj.(*v1alpha1.AzureMachineClass)
- if new == nil || !ok {
- return
- }
-
- c.azureMachineClassAdd(newObj)
-}
-
-func (c *controller) azureMachineClassDelete(obj interface{}) {
- c.azureMachineClassAdd(obj)
-}
-
-// reconcileClusterAzureMachineClassKey reconciles an AzureMachineClass due to controller resync
-// or an event on the azureMachineClass.
-func (c *controller) reconcileClusterAzureMachineClassKey(key string) error {
- ctx := context.Background()
- _, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return err
- }
-
- class, err := c.azureMachineClassLister.AzureMachineClasses(c.namespace).Get(name)
-
- if errors.IsNotFound(err) {
- klog.Infof("%s %q: Not doing work because it has been deleted", AzureMachineClassKind, key)
- return nil
- }
- if err != nil {
- klog.Infof("%s %q: Unable to retrieve object from store: %v", AzureMachineClassKind, key, err)
- return err
- }
-
- err = c.reconcileClusterAzureMachineClass(ctx, class)
- if err != nil {
- c.enqueueAzureMachineClassAfter(class, 10*time.Second)
- } else {
- // Re-enqueue periodically to avoid missing of events
- // TODO: Infuture to get ride of this logic
- c.enqueueAzureMachineClassAfter(class, 10*time.Minute)
- }
-
- return nil
-}
-
-func (c *controller) reconcileClusterAzureMachineClass(ctx context.Context, class *v1alpha1.AzureMachineClass) error {
- klog.V(4).Info("Start Reconciling Azuremachineclass: ", class.Name)
- defer klog.V(4).Info("Stop Reconciling Azuremachineclass: ", class.Name)
-
- internalClass := &machine.AzureMachineClass{}
- err := c.internalExternalScheme.Convert(class, internalClass, nil)
- if err != nil {
- return err
- }
-
- validationerr := validation.ValidateAzureMachineClass(internalClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.Errorf("Validation of %s failed %s", AzureMachineClassKind, validationerr.ToAggregate().Error())
- return nil
- }
-
- // Add finalizer to avoid losing machineClass object
- if class.DeletionTimestamp == nil {
- err = c.addAzureMachineClassFinalizers(ctx, class)
- if err != nil {
- return err
- }
- }
-
- machines, err := c.findMachinesForClass(AzureMachineClassKind, class.Name)
- if err != nil {
- return err
- }
-
- if class.DeletionTimestamp == nil {
- // If deletion timestamp doesn't exist
- _, annotationPresent := class.Annotations[machineutils.MigratedMachineClass]
-
- if c.deleteMigratedMachineClass && annotationPresent && len(machines) == 0 {
- // If controller has deleteMigratedMachineClass flag set
- // and the migratedMachineClass annotation is set
- err = c.controlMachineClient.AzureMachineClasses(class.Namespace).Delete(ctx, class.Name, metav1.DeleteOptions{})
- if err != nil {
- return err
- }
- return fmt.Errorf("Retry deletion as deletion timestamp is now set")
- }
-
- return nil
- }
-
- if len(machines) > 0 {
- // machines are still referring the machine class, please wait before deletion
- klog.V(3).Infof("Cannot remove finalizer on %s because still (%d) machines are referencing it", class.Name, len(machines))
-
- for _, machine := range machines {
- c.addMachine(machine)
- }
-
- return fmt.Errorf("Retry as machine objects are still referring the machineclass")
- }
-
- return c.deleteAzureMachineClassFinalizers(ctx, class)
-}
-
-/*
- SECTION
- Manipulate Finalizers
-*/
-
-func (c *controller) addAzureMachineClassFinalizers(ctx context.Context, class *v1alpha1.AzureMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- finalizers.Insert(DeleteFinalizerName)
- return c.updateAzureMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) deleteAzureMachineClassFinalizers(ctx context.Context, class *v1alpha1.AzureMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- finalizers.Delete(DeleteFinalizerName)
- return c.updateAzureMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) updateAzureMachineClassFinalizers(ctx context.Context, class *v1alpha1.AzureMachineClass, finalizers []string) error {
- // Get the latest version of the class so that we can avoid conflicts
- class, err := c.controlMachineClient.AzureMachineClasses(class.Namespace).Get(ctx, class.Name, metav1.GetOptions{})
- if err != nil {
- return err
- }
-
- clone := class.DeepCopy()
- clone.Finalizers = finalizers
- _, err = c.controlMachineClient.AzureMachineClasses(class.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warning("Updating AzureMachineClass failed, retrying. ", class.Name, err)
- return err
- }
- klog.V(3).Infof("Successfully added/removed finalizer on the azuremachineclass %q", class.Name)
- return err
-}
-
-func (c *controller) enqueueAzureMachineClassAfter(obj interface{}, after time.Duration) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- return
- }
- c.azureMachineClassQueue.AddAfter(key, after)
-}
diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go
index 116a03a2a..678e66566 100644
--- a/pkg/controller/controller.go
+++ b/pkg/controller/controller.go
@@ -20,7 +20,6 @@ package controller
import (
"fmt"
"sync"
- "time"
machineinternal "github.com/gardener/machine-controller-manager/pkg/apis/machine"
machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
@@ -28,15 +27,14 @@ import (
machineapi "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/typed/machine/v1alpha1"
machineinformers "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/machine/v1alpha1"
machinelisters "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
-
"github.com/gardener/machine-controller-manager/pkg/handlers"
"github.com/gardener/machine-controller-manager/pkg/options"
+ "github.com/gardener/machine-controller-manager/pkg/util/worker"
"github.com/prometheus/client_golang/prometheus"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
runtimeutil "k8s.io/apimachinery/pkg/util/runtime"
- "k8s.io/apimachinery/pkg/util/wait"
coreinformers "k8s.io/client-go/informers/core/v1"
"k8s.io/client-go/kubernetes"
typedcorev1 "k8s.io/client-go/kubernetes/typed/core/v1"
@@ -48,12 +46,6 @@ import (
)
const (
- maxRetries = 15
-
- // ClassAnnotation is the annotation used to identify a machine class
- ClassAnnotation = "machine.sapcloud.io/class"
- // MachineIDAnnotation is the annotation used to identify a machine ID
- MachineIDAnnotation = "machine.sapcloud.io/id"
// DeleteFinalizerName is the finalizer used to identify the controller acting on an object
DeleteFinalizerName = "machine.sapcloud.io/machine-controller-manager"
)
@@ -64,51 +56,28 @@ func NewController(
controlMachineClient machineapi.MachineV1alpha1Interface,
controlCoreClient kubernetes.Interface,
targetCoreClient kubernetes.Interface,
- pvcInformer coreinformers.PersistentVolumeClaimInformer,
- pvInformer coreinformers.PersistentVolumeInformer,
- secretInformer coreinformers.SecretInformer,
nodeInformer coreinformers.NodeInformer,
- openStackMachineClassInformer machineinformers.OpenStackMachineClassInformer,
- awsMachineClassInformer machineinformers.AWSMachineClassInformer,
- azureMachineClassInformer machineinformers.AzureMachineClassInformer,
- gcpMachineClassInformer machineinformers.GCPMachineClassInformer,
- alicloudMachineClassInformer machineinformers.AlicloudMachineClassInformer,
- packetMachineClassInformer machineinformers.PacketMachineClassInformer,
machineInformer machineinformers.MachineInformer,
machineSetInformer machineinformers.MachineSetInformer,
machineDeploymentInformer machineinformers.MachineDeploymentInformer,
recorder record.EventRecorder,
safetyOptions options.SafetyOptions,
- nodeConditions string,
- bootstrapTokenAuthExtraGroups string,
- deleteMigratedMachineClass bool,
autoscalerScaleDownAnnotationDuringRollout bool,
) (Controller, error) {
controller := &controller{
- namespace: namespace,
- controlMachineClient: controlMachineClient,
- controlCoreClient: controlCoreClient,
- targetCoreClient: targetCoreClient,
- recorder: recorder,
- expectations: NewUIDTrackingContExpectations(NewContExpectations()),
- secretQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "secret"),
- nodeQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "node"),
- openStackMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "openstackmachineclass"),
- awsMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "awsmachineclass"),
- azureMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "azuremachineclass"),
- gcpMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "gcpmachineclass"),
- alicloudMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "alicloudmachineclass"),
- packetMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "packetmachineclass"),
- machineQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machine"),
- machineSetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineset"),
- machineDeploymentQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinedeployment"),
- machineSafetyOrphanVMsQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinesafetyorphanvms"),
- machineSafetyOvershootingQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinesafetyovershooting"),
- machineSafetyAPIServerQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinesafetyapiserver"),
- safetyOptions: safetyOptions,
- nodeConditions: nodeConditions,
- bootstrapTokenAuthExtraGroups: bootstrapTokenAuthExtraGroups,
- deleteMigratedMachineClass: deleteMigratedMachineClass,
+ namespace: namespace,
+ controlMachineClient: controlMachineClient,
+ controlCoreClient: controlCoreClient,
+ targetCoreClient: targetCoreClient,
+ recorder: recorder,
+ expectations: NewUIDTrackingContExpectations(NewContExpectations()),
+ secretQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "secret"),
+ nodeQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "node"),
+ machineQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machine"),
+ machineSetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineset"),
+ machineDeploymentQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinedeployment"),
+ machineSafetyOvershootingQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinesafetyovershooting"),
+ safetyOptions: safetyOptions,
autoscalerScaleDownAnnotationDuringRollout: autoscalerScaleDownAnnotationDuringRollout,
}
@@ -137,229 +106,17 @@ func NewController(
}
// Controller listers
- controller.pvcLister = pvcInformer.Lister()
- controller.pvLister = pvInformer.Lister()
- controller.secretLister = secretInformer.Lister()
- controller.openStackMachineClassLister = openStackMachineClassInformer.Lister()
- controller.awsMachineClassLister = awsMachineClassInformer.Lister()
- controller.azureMachineClassLister = azureMachineClassInformer.Lister()
- controller.gcpMachineClassLister = gcpMachineClassInformer.Lister()
- controller.alicloudMachineClassLister = alicloudMachineClassInformer.Lister()
- controller.packetMachineClassLister = packetMachineClassInformer.Lister()
controller.nodeLister = nodeInformer.Lister()
controller.machineLister = machineInformer.Lister()
controller.machineSetLister = machineSetInformer.Lister()
controller.machineDeploymentLister = machineDeploymentInformer.Lister()
// Controller syncs
- controller.secretSynced = secretInformer.Informer().HasSynced
- controller.openStackMachineClassSynced = openStackMachineClassInformer.Informer().HasSynced
- controller.awsMachineClassSynced = awsMachineClassInformer.Informer().HasSynced
- controller.azureMachineClassSynced = azureMachineClassInformer.Informer().HasSynced
- controller.gcpMachineClassSynced = gcpMachineClassInformer.Informer().HasSynced
- controller.alicloudMachineClassSynced = alicloudMachineClassInformer.Informer().HasSynced
- controller.packetMachineClassSynced = packetMachineClassInformer.Informer().HasSynced
controller.nodeSynced = nodeInformer.Informer().HasSynced
controller.machineSynced = machineInformer.Informer().HasSynced
controller.machineSetSynced = machineSetInformer.Informer().HasSynced
controller.machineDeploymentSynced = machineDeploymentInformer.Informer().HasSynced
- // Secret Controller Informers
- secretInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.secretAdd,
- DeleteFunc: controller.secretDelete,
- })
-
- openStackMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.openStackMachineClassToSecretAdd,
- UpdateFunc: controller.openStackMachineClassToSecretUpdate,
- DeleteFunc: controller.openStackMachineClassToSecretDelete,
- })
-
- gcpMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.gcpMachineClassToSecretAdd,
- UpdateFunc: controller.gcpMachineClassToSecretUpdate,
- DeleteFunc: controller.gcpMachineClassToSecretDelete,
- })
-
- azureMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.azureMachineClassToSecretAdd,
- UpdateFunc: controller.azureMachineClassToSecretUpdate,
- DeleteFunc: controller.azureMachineClassToSecretDelete,
- })
-
- alicloudMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.alicloudMachineClassToSecretAdd,
- UpdateFunc: controller.alicloudMachineClassToSecretUpdate,
- DeleteFunc: controller.alicloudMachineClassToSecretDelete,
- })
-
- awsMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.awsMachineClassToSecretAdd,
- UpdateFunc: controller.awsMachineClassToSecretUpdate,
- DeleteFunc: controller.awsMachineClassToSecretDelete,
- })
-
- packetMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.packetMachineClassToSecretAdd,
- UpdateFunc: controller.packetMachineClassToSecretUpdate,
- DeleteFunc: controller.packetMachineClassToSecretDelete,
- })
-
- // Openstack Controller Informers
- machineDeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineDeploymentToOpenStackMachineClassDelete,
- })
-
- machineSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineSetToOpenStackMachineClassDelete,
- })
-
- machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.machineToOpenStackMachineClassAdd,
- UpdateFunc: controller.machineToOpenStackMachineClassUpdate,
- DeleteFunc: controller.machineToOpenStackMachineClassDelete,
- })
-
- openStackMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.openStackMachineClassAdd,
- UpdateFunc: controller.openStackMachineClassUpdate,
- DeleteFunc: controller.openStackMachineClassDelete,
- })
-
- // AWS Controller Informers
- machineDeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineDeploymentToAWSMachineClassDelete,
- })
-
- machineSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineSetToAWSMachineClassDelete,
- })
-
- machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.machineToAWSMachineClassAdd,
- UpdateFunc: controller.machineToAWSMachineClassUpdate,
- DeleteFunc: controller.machineToAWSMachineClassDelete,
- })
-
- awsMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.awsMachineClassAdd,
- UpdateFunc: controller.awsMachineClassUpdate,
- DeleteFunc: controller.awsMachineClassDelete,
- })
-
- // Azure Controller Informers
- machineDeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineDeploymentToAzureMachineClassDelete,
- })
-
- machineSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineSetToAzureMachineClassDelete,
- })
-
- machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.machineToAzureMachineClassAdd,
- UpdateFunc: controller.machineToAzureMachineClassUpdate,
- DeleteFunc: controller.machineToAzureMachineClassDelete,
- })
-
- azureMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.azureMachineClassAdd,
- UpdateFunc: controller.azureMachineClassUpdate,
- DeleteFunc: controller.azureMachineClassDelete,
- })
-
- // GCP Controller Informers
- machineDeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineDeploymentToGCPMachineClassDelete,
- })
-
- machineSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineSetToGCPMachineClassDelete,
- })
-
- machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.machineToGCPMachineClassAdd,
- UpdateFunc: controller.machineToGCPMachineClassUpdate,
- DeleteFunc: controller.machineToGCPMachineClassDelete,
- })
-
- gcpMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.gcpMachineClassAdd,
- UpdateFunc: controller.gcpMachineClassUpdate,
- DeleteFunc: controller.gcpMachineClassDelete,
- })
-
- // Alicloud Controller Informers
- machineDeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineDeploymentToAlicloudMachineClassDelete,
- })
-
- machineSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineSetToAlicloudMachineClassDelete,
- })
-
- machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.machineToAlicloudMachineClassAdd,
- UpdateFunc: controller.machineToAlicloudMachineClassUpdate,
- DeleteFunc: controller.machineToAlicloudMachineClassDelete,
- })
-
- alicloudMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.alicloudMachineClassAdd,
- UpdateFunc: controller.alicloudMachineClassUpdate,
- DeleteFunc: controller.alicloudMachineClassDelete,
- })
-
- // Packet Controller Informers
- machineDeploymentInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineDeploymentToPacketMachineClassDelete,
- })
-
- machineSetInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- DeleteFunc: controller.machineSetToPacketMachineClassDelete,
- })
-
- machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.machineToPacketMachineClassAdd,
- UpdateFunc: controller.machineToPacketMachineClassUpdate,
- DeleteFunc: controller.machineToPacketMachineClassDelete,
- })
-
- packetMachineClassInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.packetMachineClassAdd,
- UpdateFunc: controller.packetMachineClassUpdate,
- DeleteFunc: controller.packetMachineClassDelete,
- })
-
- /* Node Controller Informers - Don't remove this, saved for future use case.
- nodeInformer.Informer().AddEventHandler(
- cache.FilteringResourceEventHandler{
- FilterFunc: func(obj interface{}) bool {
- //node := obj.(*apicorev1.Node)
- return true //metav1.HasAnnotation(node.ObjectMeta, ClassAnnotation)
- },
- Handler: cache.ResourceEventHandlerFuncs{
- AddFunc: controller.nodeAdd,
- UpdateFunc: controller.nodeUpdate,
- DeleteFunc: controller.nodeDelete,
- },
- })
- */
-
- // Machine Controller Informers
- nodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.addNodeToMachine,
- UpdateFunc: controller.updateNodeToMachine,
- DeleteFunc: controller.deleteNodeToMachine,
- })
-
- machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- AddFunc: controller.addMachine,
- UpdateFunc: controller.updateMachine,
- DeleteFunc: controller.deleteMachine,
- })
-
// MachineSet Controller Informers
machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: controller.addMachineToMachineSet,
@@ -395,15 +152,11 @@ func NewController(
// We follow the kubernetes way of reconciling the safety controller
// done by adding empty key objects. We initialize it, to trigger
// running of different safety loop on MCM startup.
- controller.machineSafetyOrphanVMsQueue.Add("")
controller.machineSafetyOvershootingQueue.Add("")
- controller.machineSafetyAPIServerQueue.Add("")
machineInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
- // addMachineToSafety makes sure machine objects does not overshoot
- AddFunc: controller.addMachineToSafety,
- // deleteMachineToSafety makes sure that orphan VM handler is invoked
- DeleteFunc: controller.deleteMachineToSafety,
+ // addMachineToSafetyOvershooting makes sure machine objects does not overshoot
+ AddFunc: controller.addMachineToSafetyOvershooting,
})
return controller, nil
@@ -420,9 +173,6 @@ type Controller interface {
// controller is a concrete Controller.
type controller struct {
namespace string
- nodeConditions string
- bootstrapTokenAuthExtraGroups string
- deleteMigratedMachineClass bool
autoscalerScaleDownAnnotationDuringRollout bool
controlMachineClient machineapi.MachineV1alpha1Interface
@@ -437,46 +187,23 @@ type controller struct {
internalExternalScheme *runtime.Scheme
// listers
- pvcLister corelisters.PersistentVolumeClaimLister
- pvLister corelisters.PersistentVolumeLister
- secretLister corelisters.SecretLister
- nodeLister corelisters.NodeLister
- openStackMachineClassLister machinelisters.OpenStackMachineClassLister
- awsMachineClassLister machinelisters.AWSMachineClassLister
- azureMachineClassLister machinelisters.AzureMachineClassLister
- gcpMachineClassLister machinelisters.GCPMachineClassLister
- alicloudMachineClassLister machinelisters.AlicloudMachineClassLister
- packetMachineClassLister machinelisters.PacketMachineClassLister
- machineLister machinelisters.MachineLister
- machineSetLister machinelisters.MachineSetLister
- machineDeploymentLister machinelisters.MachineDeploymentLister
+ nodeLister corelisters.NodeLister
+ machineLister machinelisters.MachineLister
+ machineSetLister machinelisters.MachineSetLister
+ machineDeploymentLister machinelisters.MachineDeploymentLister
// queues
secretQueue workqueue.RateLimitingInterface
nodeQueue workqueue.RateLimitingInterface
- openStackMachineClassQueue workqueue.RateLimitingInterface
- awsMachineClassQueue workqueue.RateLimitingInterface
- azureMachineClassQueue workqueue.RateLimitingInterface
- gcpMachineClassQueue workqueue.RateLimitingInterface
- alicloudMachineClassQueue workqueue.RateLimitingInterface
- packetMachineClassQueue workqueue.RateLimitingInterface
machineQueue workqueue.RateLimitingInterface
machineSetQueue workqueue.RateLimitingInterface
machineDeploymentQueue workqueue.RateLimitingInterface
- machineSafetyOrphanVMsQueue workqueue.RateLimitingInterface
machineSafetyOvershootingQueue workqueue.RateLimitingInterface
- machineSafetyAPIServerQueue workqueue.RateLimitingInterface
// syncs
- secretSynced cache.InformerSynced
- nodeSynced cache.InformerSynced
- openStackMachineClassSynced cache.InformerSynced
- awsMachineClassSynced cache.InformerSynced
- azureMachineClassSynced cache.InformerSynced
- gcpMachineClassSynced cache.InformerSynced
- alicloudMachineClassSynced cache.InformerSynced
- packetMachineClassSynced cache.InformerSynced
- machineSynced cache.InformerSynced
- machineSetSynced cache.InformerSynced
- machineDeploymentSynced cache.InformerSynced
+ secretSynced cache.InformerSynced
+ nodeSynced cache.InformerSynced
+ machineSynced cache.InformerSynced
+ machineSetSynced cache.InformerSynced
+ machineDeploymentSynced cache.InformerSynced
}
func (c *controller) Run(workers int, stopCh <-chan struct{}) {
@@ -488,20 +215,12 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) {
defer runtimeutil.HandleCrash()
defer c.nodeQueue.ShutDown()
defer c.secretQueue.ShutDown()
- defer c.openStackMachineClassQueue.ShutDown()
- defer c.awsMachineClassQueue.ShutDown()
- defer c.azureMachineClassQueue.ShutDown()
- defer c.gcpMachineClassQueue.ShutDown()
- defer c.alicloudMachineClassQueue.ShutDown()
- defer c.packetMachineClassQueue.ShutDown()
defer c.machineQueue.ShutDown()
defer c.machineSetQueue.ShutDown()
defer c.machineDeploymentQueue.ShutDown()
- defer c.machineSafetyOrphanVMsQueue.ShutDown()
defer c.machineSafetyOvershootingQueue.ShutDown()
- defer c.machineSafetyAPIServerQueue.ShutDown()
- if !cache.WaitForCacheSync(stopCh, c.secretSynced, c.nodeSynced, c.openStackMachineClassSynced, c.awsMachineClassSynced, c.azureMachineClassSynced, c.gcpMachineClassSynced, c.alicloudMachineClassSynced, c.packetMachineClassSynced, c.machineSynced, c.machineSetSynced, c.machineDeploymentSynced) {
+ if !cache.WaitForCacheSync(stopCh, c.secretSynced, c.nodeSynced, c.machineSynced, c.machineSetSynced, c.machineDeploymentSynced) {
runtimeutil.HandleError(fmt.Errorf("Timed out waiting for caches to sync"))
return
}
@@ -515,20 +234,9 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) {
prometheus.MustRegister(c)
for i := 0; i < workers; i++ {
- createWorker(c.openStackMachineClassQueue, "ClusterOpenStackMachineClass", maxRetries, true, c.reconcileClusterOpenStackMachineClassKey, stopCh, &waitGroup)
- createWorker(c.awsMachineClassQueue, "ClusterAWSMachineClass", maxRetries, true, c.reconcileClusterAWSMachineClassKey, stopCh, &waitGroup)
- createWorker(c.azureMachineClassQueue, "ClusterAzureMachineClass", maxRetries, true, c.reconcileClusterAzureMachineClassKey, stopCh, &waitGroup)
- createWorker(c.gcpMachineClassQueue, "ClusterGCPMachineClass", maxRetries, true, c.reconcileClusterGCPMachineClassKey, stopCh, &waitGroup)
- createWorker(c.alicloudMachineClassQueue, "ClusterAlicloudMachineClass", maxRetries, true, c.reconcileClusterAlicloudMachineClassKey, stopCh, &waitGroup)
- createWorker(c.packetMachineClassQueue, "ClusterPacketMachineClass", maxRetries, true, c.reconcileClusterPacketMachineClassKey, stopCh, &waitGroup)
- createWorker(c.secretQueue, "ClusterSecret", maxRetries, true, c.reconcileClusterSecretKey, stopCh, &waitGroup)
- createWorker(c.nodeQueue, "ClusterNode", maxRetries, true, c.reconcileClusterNodeKey, stopCh, &waitGroup)
- createWorker(c.machineQueue, "ClusterMachine", maxRetries, true, c.reconcileClusterMachineKey, stopCh, &waitGroup)
- createWorker(c.machineSetQueue, "ClusterMachineSet", maxRetries, true, c.reconcileClusterMachineSet, stopCh, &waitGroup)
- createWorker(c.machineDeploymentQueue, "ClusterMachineDeployment", maxRetries, true, c.reconcileClusterMachineDeployment, stopCh, &waitGroup)
- createWorker(c.machineSafetyOrphanVMsQueue, "ClusterMachineSafetyOrphanVMs", maxRetries, true, c.reconcileClusterMachineSafetyOrphanVMs, stopCh, &waitGroup)
- createWorker(c.machineSafetyOvershootingQueue, "ClusterMachineSafetyOvershooting", maxRetries, true, c.reconcileClusterMachineSafetyOvershooting, stopCh, &waitGroup)
- createWorker(c.machineSafetyAPIServerQueue, "ClusterMachineAPIServer", maxRetries, true, c.reconcileClusterMachineSafetyAPIServer, stopCh, &waitGroup)
+ worker.Run(c.machineSetQueue, "ClusterMachineSet", worker.DefaultMaxRetries, true, c.reconcileClusterMachineSet, stopCh, &waitGroup)
+ worker.Run(c.machineDeploymentQueue, "ClusterMachineDeployment", worker.DefaultMaxRetries, true, c.reconcileClusterMachineDeployment, stopCh, &waitGroup)
+ worker.Run(c.machineSafetyOvershootingQueue, "ClusterMachineSafetyOvershooting", worker.DefaultMaxRetries, true, c.reconcileClusterMachineSafetyOvershooting, stopCh, &waitGroup)
}
<-stopCh
@@ -537,52 +245,3 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) {
waitGroup.Wait()
}
-
-// createWorker creates and runs a worker thread that just processes items in the
-// specified queue. The worker will run until stopCh is closed. The worker will be
-// added to the wait group when started and marked done when finished.
-func createWorker(queue workqueue.RateLimitingInterface, resourceType string, maxRetries int, forgetAfterSuccess bool, reconciler func(key string) error, stopCh <-chan struct{}, waitGroup *sync.WaitGroup) {
- waitGroup.Add(1)
- go func() {
- wait.Until(worker(queue, resourceType, maxRetries, forgetAfterSuccess, reconciler), time.Second, stopCh)
- waitGroup.Done()
- }()
-}
-
-// worker runs a worker thread that just dequeues items, processes them, and marks them done.
-// If reconciler returns an error, requeue the item up to maxRetries before giving up.
-// It enforces that the reconciler is never invoked concurrently with the same key.
-// If forgetAfterSuccess is true, it will cause the queue to forget the item should reconciliation
-// have no error.
-func worker(queue workqueue.RateLimitingInterface, resourceType string, maxRetries int, forgetAfterSuccess bool, reconciler func(key string) error) func() {
- return func() {
- exit := false
- for !exit {
- exit = func() bool {
- key, quit := queue.Get()
- if quit {
- return true
- }
- defer queue.Done(key)
-
- err := reconciler(key.(string))
- if err == nil {
- if forgetAfterSuccess {
- queue.Forget(key)
- }
- return false
- }
-
- if queue.NumRequeues(key) < maxRetries {
- klog.V(4).Infof("Error syncing %s %v: %v", resourceType, key, err)
- queue.AddRateLimited(key)
- return false
- }
-
- klog.V(4).Infof("Dropping %s %q out of the queue: %v", resourceType, key, err)
- queue.Forget(key)
- return false
- }()
- }
- }
-}
diff --git a/pkg/controller/controller_suite_test.go b/pkg/controller/controller_suite_test.go
index 6bdf813ba..af78f0f0b 100644
--- a/pkg/controller/controller_suite_test.go
+++ b/pkg/controller/controller_suite_test.go
@@ -353,7 +353,7 @@ func newMachines(
}
func newNode(
- nodeCount int,
+ _ int,
nodeSpec *corev1.NodeSpec,
nodeStatus *corev1.NodeStatus,
) *corev1.Node {
@@ -363,7 +363,7 @@ func newNode(
func newNodes(
nodeCount int,
nodeSpec *corev1.NodeSpec,
- nodeStatus *corev1.NodeStatus,
+ _ *corev1.NodeStatus,
) []*corev1.Node {
nodes := make([]*corev1.Node, nodeCount)
@@ -465,8 +465,6 @@ func createController(
defer coreTargetInformerFactory.Start(stop)
coreTargetSharedInformers := coreTargetInformerFactory.Core().V1()
nodes := coreTargetSharedInformers.Nodes()
- pvcs := coreTargetSharedInformers.PersistentVolumeClaims()
- pvs := coreTargetSharedInformers.PersistentVolumes()
coreControlInformerFactory := coreinformers.NewFilteredSharedInformerFactory(
fakeControlCoreClient,
@@ -487,10 +485,6 @@ func createController(
defer controlMachineInformerFactory.Start(stop)
machineSharedInformers := controlMachineInformerFactory.Machine().V1alpha1()
- aws := machineSharedInformers.AWSMachineClasses()
- azure := machineSharedInformers.AzureMachineClasses()
- gcp := machineSharedInformers.GCPMachineClasses()
- openstack := machineSharedInformers.OpenStackMachineClasses()
machines := machineSharedInformers.Machines()
machineSets := machineSharedInformers.MachineSets()
machineDeployments := machineSharedInformers.MachineDeployments()
@@ -500,33 +494,19 @@ func createController(
Expect(v1alpha1.AddToScheme(internalExternalScheme)).To(Succeed())
safetyOptions := options.SafetyOptions{
- SafetyUp: 2,
- SafetyDown: 1,
- MachineCreationTimeout: metav1.Duration{Duration: 20 * time.Minute},
- MachineHealthTimeout: metav1.Duration{Duration: 10 * time.Minute},
- MachineDrainTimeout: metav1.Duration{Duration: 5 * time.Minute},
- MachineSafetyOrphanVMsPeriod: metav1.Duration{Duration: 30 * time.Minute},
- MachineSafetyOvershootingPeriod: metav1.Duration{Duration: 1 * time.Minute},
- MachineSafetyAPIServerStatusCheckPeriod: metav1.Duration{Duration: 1 * time.Minute},
- MachineSafetyAPIServerStatusCheckTimeout: metav1.Duration{Duration: 30 * time.Second},
+ SafetyUp: 2,
+ SafetyDown: 1,
+ MachineSafetyOvershootingPeriod: metav1.Duration{Duration: 1 * time.Minute},
}
controller := &controller{
namespace: namespace,
safetyOptions: safetyOptions,
- awsMachineClassLister: aws.Lister(),
- awsMachineClassSynced: aws.Informer().HasSynced,
- azureMachineClassLister: azure.Lister(),
- gcpMachineClassLister: gcp.Lister(),
- openStackMachineClassLister: openstack.Lister(),
targetCoreClient: fakeTargetCoreClient,
controlCoreClient: fakeControlCoreClient,
controlMachineClient: fakeTypedMachineClient,
internalExternalScheme: internalExternalScheme,
nodeLister: nodes.Lister(),
- pvcLister: pvcs.Lister(),
- pvLister: pvs.Lister(),
- secretLister: secret.Lister(),
machineLister: machines.Lister(),
machineSetLister: machineSets.Lister(),
machineDeploymentLister: machineDeployments.Lister(),
@@ -537,19 +517,12 @@ func createController(
secretSynced: secret.Informer().HasSynced,
secretQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "secret"),
nodeQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "node"),
- openStackMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "openstackmachineclass"),
- awsMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "awsmachineclass"),
- azureMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "azuremachineclass"),
- gcpMachineClassQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "gcpmachineclass"),
machineQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machine"),
machineSetQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machineset"),
machineDeploymentQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinedeployment"),
- machineSafetyOrphanVMsQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinesafetyorphanvms"),
machineSafetyOvershootingQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinesafetyovershooting"),
- machineSafetyAPIServerQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "machinesafetyapiserver"),
expectations: NewUIDTrackingContExpectations(NewContExpectations()),
recorder: record.NewBroadcaster().NewRecorder(nil, corev1.EventSource{Component: ""}),
- deleteMigratedMachineClass: true,
}
// controller.internalExternalScheme = runtime.NewScheme()
@@ -568,7 +541,6 @@ func createController(
func waitForCacheSync(stop <-chan struct{}, controller *controller) {
Expect(cache.WaitForCacheSync(
stop,
- controller.awsMachineClassSynced,
controller.machineSynced,
controller.machineSetSynced,
controller.machineDeploymentSynced,
diff --git a/pkg/controller/controller_utils.go b/pkg/controller/controller_utils.go
index cd69ed263..ef691ebeb 100644
--- a/pkg/controller/controller_utils.go
+++ b/pkg/controller/controller_utils.go
@@ -39,6 +39,7 @@ import (
hashutil "github.com/gardener/machine-controller-manager/pkg/util/hash"
"github.com/google/uuid"
+ "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
@@ -114,13 +115,6 @@ func NoResyncPeriodFunc() time.Duration {
return 0
}
-// StaticResyncPeriodFunc returns the resync period specified
-func StaticResyncPeriodFunc(resyncPeriod time.Duration) ResyncPeriodFunc {
- return func() time.Duration {
- return resyncPeriod
- }
-}
-
// Expectations are a way for controllers to tell the controller manager what they expect. eg:
// ContExpectations: {
// controller1: expects 2 adds in 2 minutes
@@ -745,8 +739,8 @@ func (s ActiveMachines) Less(i, j int) bool {
machineIPriority := 3
machineJPriority := 3
- if s[i].Annotations != nil && s[i].Annotations[MachinePriority] != "" {
- num, err := strconv.Atoi(s[i].Annotations[MachinePriority])
+ if s[i].Annotations != nil && s[i].Annotations[machineutils.MachinePriority] != "" {
+ num, err := strconv.Atoi(s[i].Annotations[machineutils.MachinePriority])
if err == nil {
machineIPriority = num
} else {
@@ -754,8 +748,8 @@ func (s ActiveMachines) Less(i, j int) bool {
}
}
- if s[j].Annotations != nil && s[j].Annotations[MachinePriority] != "" {
- num, err := strconv.Atoi(s[j].Annotations[MachinePriority])
+ if s[j].Annotations != nil && s[j].Annotations[machineutils.MachinePriority] != "" {
+ num, err := strconv.Atoi(s[j].Annotations[machineutils.MachinePriority])
if err == nil {
machineJPriority = num
} else {
diff --git a/pkg/controller/controller_utils_test.go b/pkg/controller/controller_utils_test.go
index 5ffeec18c..8338a63d1 100644
--- a/pkg/controller/controller_utils_test.go
+++ b/pkg/controller/controller_utils_test.go
@@ -17,6 +17,7 @@ package controller
import (
"context"
+ "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
"sort"
"strconv"
@@ -30,6 +31,8 @@ import (
"k8s.io/apimachinery/pkg/runtime"
)
+const testNamespace = "test"
+
var _ = Describe("#controllerUtils", func() {
Describe("##activeMachines", func() {
type data struct {
@@ -58,7 +61,7 @@ var _ = Describe("#controllerUtils", func() {
},
nil,
map[string]string{
- MachinePriority: strconv.Itoa(1),
+ machineutils.MachinePriority: strconv.Itoa(1),
},
nil,
),
@@ -98,7 +101,7 @@ var _ = Describe("#controllerUtils", func() {
},
nil,
map[string]string{
- MachinePriority: strconv.Itoa(5),
+ machineutils.MachinePriority: strconv.Itoa(5),
},
nil,
),
diff --git a/pkg/controller/deployment.go b/pkg/controller/deployment.go
index 767139365..5e497236e 100644
--- a/pkg/controller/deployment.go
+++ b/pkg/controller/deployment.go
@@ -25,6 +25,7 @@ package controller
import (
"context"
"fmt"
+ "github.com/gardener/machine-controller-manager/pkg/util/worker"
"reflect"
"sync"
"time"
@@ -349,7 +350,7 @@ func (dc *controller) handleErr(err error, key interface{}) {
return
}
- if dc.machineDeploymentQueue.NumRequeues(key) < maxRetries {
+ if dc.machineDeploymentQueue.NumRequeues(key) < worker.DefaultMaxRetries {
klog.V(2).Infof("Error syncing deployment %v: %v", key, err)
dc.machineDeploymentQueue.AddRateLimited(key)
return
diff --git a/pkg/controller/drain.go b/pkg/controller/drain.go
deleted file mode 100644
index 66fa876ae..000000000
--- a/pkg/controller/drain.go
+++ /dev/null
@@ -1,979 +0,0 @@
-/*
-Copyright 2015 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-This file was copied and modified from the kubernetes/kubernetes project
-https://github.com/kubernetes/kubernetes/blob/release-1.8/pkg/kubectl/cmd/drain.go
-
-Modifications Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "errors"
- "fmt"
- "io"
- "regexp"
- "sort"
- "strings"
- "time"
-
- "github.com/gardener/machine-controller-manager/pkg/driver"
- api "k8s.io/api/core/v1"
- corev1 "k8s.io/api/core/v1"
- policy "k8s.io/api/policy/v1beta1"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/fields"
- utilerrors "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/apimachinery/pkg/util/wait"
- "k8s.io/client-go/kubernetes"
- corelisters "k8s.io/client-go/listers/core/v1"
- "k8s.io/klog/v2"
-)
-
-// DrainOptions are configurable options while draining a node before deletion
-type DrainOptions struct {
- client kubernetes.Interface
- ForceDeletePods bool
- IgnorePodsWithoutControllers bool
- GracePeriodSeconds int
- IgnoreDaemonsets bool
- Timeout time.Duration
- MaxEvictRetries int32
- PvDetachTimeout time.Duration
- DeleteLocalData bool
- nodeName string
- nodeNotReadyDuration time.Duration
- Out io.Writer
- ErrOut io.Writer
- Driver driver.Driver
- pvcLister corelisters.PersistentVolumeClaimLister
- pvLister corelisters.PersistentVolumeLister
- drainStartedOn time.Time
- drainEndedOn time.Time
-}
-
-// Takes a pod and returns a bool indicating whether or not to operate on the
-// pod, an optional warning message, and an optional fatal error.
-type podFilter func(api.Pod) (include bool, w *warning, f *fatal)
-type warning struct {
- string
-}
-type fatal struct {
- string
-}
-
-const (
- // EvictionKind is the kind used for eviction
- EvictionKind = "Eviction"
- // EvictionSubresource is the kind used for evicting pods
- EvictionSubresource = "pods/eviction"
-
- // DefaultMachineDrainTimeout is the default value for MachineDrainTimeout
- DefaultMachineDrainTimeout = 2 * time.Hour
-
- // PodsWithoutPVDrainGracePeriod defines the grace period to wait for the pods without PV during machine drain.
- // This is in addition to the maximum terminationGracePeriod amount the pods.
- PodsWithoutPVDrainGracePeriod = 3 * time.Minute
-
- // Interval is the default Poll interval
- Interval = time.Second * 5
-
- // PodEvictionRetryInterval is the interval in which to retry eviction for pods
- PodEvictionRetryInterval = time.Second * 20
-
- // GetPvDetailsRetryInterval is the interval in which to retry getting PV details
- GetPvDetailsRetryInterval = time.Second * 5
- // GetPvDetailsMaxRetries is the number of max retries to get PV details
- GetPvDetailsMaxRetries = 3
- // VolumeDetachPollInterval is the interval in which to recheck if the volume is detached from the node
- VolumeDetachPollInterval = time.Second * 5
-
- daemonsetFatal = "DaemonSet-managed pods (use --ignore-daemonsets to ignore)"
- daemonsetWarning = "Ignoring DaemonSet-managed pods"
- localStorageFatal = "pods with local storage (use --delete-local-data to override)"
- localStorageWarning = "Deleting pods with local storage"
- unmanagedFatal = "pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet (use --force to override)"
- unmanagedWarning = "Deleting pods not managed by ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet"
-)
-
-var (
- // DefaultMaxEvictRetries is the default value for MaxEvictRetries
- DefaultMaxEvictRetries = int32(DefaultMachineDrainTimeout.Seconds() / PodEvictionRetryInterval.Seconds())
-)
-
-// NewDrainOptions creates a new DrainOptions struct and returns a pointer to it
-func NewDrainOptions(
- client kubernetes.Interface,
- timeout time.Duration,
- maxEvictRetries int32,
- pvDetachTimeout time.Duration,
- nodeName string,
- nodeNotReadyDuration time.Duration,
- gracePeriodSeconds int,
- forceDeletePods bool,
- ignorePodsWithoutControllers bool,
- ignoreDaemonsets bool,
- deleteLocalData bool,
- out io.Writer,
- errOut io.Writer,
- driver driver.Driver,
- pvcLister corelisters.PersistentVolumeClaimLister,
- pvLister corelisters.PersistentVolumeLister,
-) *DrainOptions {
- if nodeNotReadyDuration == 0 {
- nodeNotReadyDuration = 5 * time.Minute
- }
-
- return &DrainOptions{
- client: client,
- ForceDeletePods: forceDeletePods,
- IgnorePodsWithoutControllers: ignorePodsWithoutControllers,
- GracePeriodSeconds: gracePeriodSeconds,
- IgnoreDaemonsets: ignoreDaemonsets,
- MaxEvictRetries: maxEvictRetries,
- Timeout: timeout,
- PvDetachTimeout: pvDetachTimeout,
- DeleteLocalData: deleteLocalData,
- nodeName: nodeName,
- nodeNotReadyDuration: nodeNotReadyDuration,
- Out: out,
- ErrOut: errOut,
- Driver: driver,
- pvcLister: pvcLister,
- pvLister: pvLister,
- }
-
-}
-
-// RunDrain runs the 'drain' command
-func (o *DrainOptions) RunDrain(ctx context.Context) error {
- o.drainStartedOn = time.Now()
- klog.V(4).Infof(
- "Machine drain started on %s for %q",
- o.drainStartedOn,
- o.nodeName,
- )
-
- defer func() {
- o.drainEndedOn = time.Now()
- klog.Infof(
- "Machine drain ended on %s and took %s for %q",
- o.drainEndedOn,
- o.drainEndedOn.Sub(o.drainStartedOn),
- o.nodeName,
- )
- }()
-
- if err := o.RunCordonOrUncordon(ctx, true); err != nil {
- klog.Errorf("Drain Error: Cordoning of node failed with error: %v", err)
- return err
- }
-
- node, err := o.client.CoreV1().Nodes().Get(ctx, o.nodeName, metav1.GetOptions{})
- if apierrors.IsNotFound(err) {
- klog.V(3).Infof("Node %q not found, skipping drain", o.nodeName)
- return nil
- } else if err != nil {
- klog.Errorf("Error getting details for node: %q. Err: %v", o.nodeName, err)
- return err
- }
-
- for _, condition := range node.Status.Conditions {
- if condition.Type == corev1.NodeReady && condition.Status != corev1.ConditionTrue && (time.Since(condition.LastTransitionTime.Time) > o.nodeNotReadyDuration) {
- klog.Warningf("Skipping drain for NotReady Node %q", o.nodeName)
- return nil
- }
- }
-
- err = o.deleteOrEvictPodsSimple(ctx)
- return err
-}
-
-func (o *DrainOptions) deleteOrEvictPodsSimple(ctx context.Context) error {
- pods, err := o.getPodsForDeletion(ctx)
- if err != nil {
- return err
- }
-
- err = o.deleteOrEvictPods(ctx, pods)
- if err != nil {
- pendingPods, newErr := o.getPodsForDeletion(ctx)
- if newErr != nil {
- return newErr
- }
- fmt.Fprintf(o.ErrOut, "There are pending pods when an error occurred: %v\n", err)
- for _, pendingPod := range pendingPods {
- fmt.Fprintf(o.ErrOut, "%s/%s\n", pendingPod.Namespace, pendingPod.Name)
- }
- }
- return err
-}
-
-func (o *DrainOptions) getPodController(pod api.Pod) *metav1.OwnerReference {
- return metav1.GetControllerOf(&pod)
-}
-
-func (o *DrainOptions) unreplicatedFilter(pod api.Pod) (bool, *warning, *fatal) {
- // any finished pod can be removed
- if pod.Status.Phase == api.PodSucceeded || pod.Status.Phase == api.PodFailed {
- return true, nil, nil
- }
-
- controllerRef := o.getPodController(pod)
- if controllerRef != nil {
- return true, nil, nil
- }
- if !o.IgnorePodsWithoutControllers {
- return false, nil, &fatal{unmanagedFatal}
- }
- return true, &warning{unmanagedWarning}, nil
-}
-
-func (o *DrainOptions) daemonsetFilter(pod api.Pod) (bool, *warning, *fatal) {
- // Note that we return false in cases where the pod is DaemonSet managed,
- // regardless of flags. We never delete them, the only question is whether
- // their presence constitutes an error.
- //
- // TODO: Might need to revisit this. This feature is ignored for now
- // The exception is for pods that are orphaned (the referencing
- // management resource - including DaemonSet - is not found).
- // Such pods will be deleted if --force is used.
- controllerRef := o.getPodController(pod)
- if controllerRef == nil || controllerRef.Kind != "DaemonSet" {
- return true, nil, nil
- }
- if !o.IgnoreDaemonsets {
- return false, nil, &fatal{daemonsetFatal}
- }
- return false, &warning{daemonsetWarning}, nil
-}
-
-func mirrorPodFilter(pod api.Pod) (bool, *warning, *fatal) {
- if _, found := pod.ObjectMeta.Annotations[corev1.MirrorPodAnnotationKey]; found {
- return false, nil, nil
- }
- return true, nil, nil
-}
-
-func hasLocalStorage(pod api.Pod) bool {
- for _, volume := range pod.Spec.Volumes {
- if volume.EmptyDir != nil {
- return true
- }
- }
-
- return false
-}
-
-func (o *DrainOptions) localStorageFilter(pod api.Pod) (bool, *warning, *fatal) {
- if !hasLocalStorage(pod) {
- return true, nil, nil
- }
- if !o.DeleteLocalData {
- return false, nil, &fatal{localStorageFatal}
- }
- return true, &warning{localStorageWarning}, nil
-}
-
-// Map of status message to a list of pod names having that status.
-type podStatuses map[string][]string
-
-func (ps podStatuses) Message() string {
- msgs := []string{}
-
- for key, pods := range ps {
- msgs = append(msgs, fmt.Sprintf("%s: %s", key, strings.Join(pods, ", ")))
- }
- return strings.Join(msgs, "; ")
-}
-
-// getPodsForDeletion returns all the pods we're going to delete. If there are
-// any pods preventing us from deleting, we return that list in an error.
-func (o *DrainOptions) getPodsForDeletion(ctx context.Context) (pods []api.Pod, err error) {
- podList, err := o.client.CoreV1().Pods(metav1.NamespaceAll).List(ctx, metav1.ListOptions{
- FieldSelector: fields.SelectorFromSet(fields.Set{"spec.nodeName": o.nodeName}).String()})
- if err != nil {
- return pods, err
- }
-
- ws := podStatuses{}
- fs := podStatuses{}
-
- for _, pod := range podList.Items {
- podOk := true
- for _, filt := range []podFilter{mirrorPodFilter, o.localStorageFilter, o.unreplicatedFilter, o.daemonsetFilter} {
- filterOk, w, f := filt(pod)
-
- podOk = podOk && filterOk
- if w != nil {
- ws[w.string] = append(ws[w.string], pod.Name)
- }
- if f != nil {
- fs[f.string] = append(fs[f.string], pod.Name)
- }
- }
- if podOk {
- pods = append(pods, pod)
- }
- }
-
- if len(fs) > 0 {
- return []api.Pod{}, errors.New(fs.Message())
- }
- if len(ws) > 0 {
- fmt.Fprintf(o.ErrOut, "WARNING: %s\n", ws.Message())
- }
- return pods, nil
-}
-
-func (o *DrainOptions) deletePod(ctx context.Context, pod *api.Pod) error {
- deleteOptions := metav1.DeleteOptions{}
- gracePeriodSeconds := int64(0)
- deleteOptions.GracePeriodSeconds = &gracePeriodSeconds
-
- klog.V(3).Infof("Attempting to force-delete the pod:%q from node %q", pod.Name, o.nodeName)
- return o.client.CoreV1().Pods(pod.Namespace).Delete(ctx, pod.Name, deleteOptions)
-}
-
-func (o *DrainOptions) evictPod(ctx context.Context, pod *api.Pod, policyGroupVersion string) error {
- deleteOptions := &metav1.DeleteOptions{}
- if o.GracePeriodSeconds >= 0 {
- gracePeriodSeconds := int64(o.GracePeriodSeconds)
- deleteOptions.GracePeriodSeconds = &gracePeriodSeconds
- }
- eviction := &policy.Eviction{
- TypeMeta: metav1.TypeMeta{
- APIVersion: policyGroupVersion,
- Kind: EvictionKind,
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: pod.Name,
- Namespace: pod.Namespace,
- },
- DeleteOptions: deleteOptions,
- }
- klog.V(3).Infof("Attempting to evict the pod:%q from node %q", pod.Name, o.nodeName)
- // TODO: Remember to change the URL manipulation func when Evction's version change
- return o.client.PolicyV1beta1().Evictions(eviction.Namespace).Evict(ctx, eviction)
-}
-
-// deleteOrEvictPods deletes or evicts the pods on the api server
-func (o *DrainOptions) deleteOrEvictPods(ctx context.Context, pods []api.Pod) error {
- if len(pods) == 0 {
- return nil
- }
-
- policyGroupVersion, err := SupportEviction(o.client)
- if err != nil {
- return err
- }
-
- getPodFn := func(namespace, name string) (*api.Pod, error) {
- return o.client.CoreV1().Pods(namespace).Get(ctx, name, metav1.GetOptions{})
- }
-
- attemptEvict := !o.ForceDeletePods && len(policyGroupVersion) > 0
-
- return o.evictPods(ctx, attemptEvict, pods, policyGroupVersion, getPodFn)
-}
-
-func volIsPvc(vol *corev1.Volume) bool {
- return vol.PersistentVolumeClaim != nil
-}
-
-func filterPodsWithPv(pods []api.Pod) ([]*api.Pod, []*api.Pod) {
- podsWithPv, podsWithoutPv := []*api.Pod{}, []*api.Pod{}
-
- for i := range pods {
- hasPv := false
- pod := &pods[i]
- vols := pod.Spec.Volumes
- for k := range vols {
- vol := &vols[k]
- hasPv = volIsPvc(vol)
- if hasPv {
- podsWithPv = append(podsWithPv, pod)
- // No need to process rest of the volumes
- break
- }
- }
- if !hasPv {
- podsWithoutPv = append(podsWithoutPv, pod)
- }
- }
- return podsWithPv, podsWithoutPv
-}
-
-func (o *DrainOptions) getTerminationGracePeriod(pod *api.Pod) time.Duration {
- if pod == nil || pod.Spec.TerminationGracePeriodSeconds == nil {
- return time.Duration(0)
- }
-
- return time.Duration(*pod.Spec.TerminationGracePeriodSeconds) * time.Second
-}
-
-func (o *DrainOptions) getGlobalTimeoutForPodsWithoutPV(pods []*api.Pod) time.Duration {
- var tgpsMax time.Duration
- for _, pod := range pods {
- tgps := o.getTerminationGracePeriod(pod)
- if tgps > tgpsMax {
- tgpsMax = tgps
- }
- }
-
- return tgpsMax + PodsWithoutPVDrainGracePeriod
-}
-
-func (o *DrainOptions) evictPods(ctx context.Context, attemptEvict bool, pods []api.Pod, policyGroupVersion string, getPodFn func(namespace, name string) (*api.Pod, error)) error {
- returnCh := make(chan error, len(pods))
- defer close(returnCh)
-
- if o.ForceDeletePods {
- podsToDrain := make([]*api.Pod, len(pods))
- for i := range pods {
- podsToDrain[i] = &pods[i]
- }
-
- klog.V(3).Infof("Forceful eviction of pods on the node: %q", o.nodeName)
-
- // evict all pods in parallel without waiting for pods or volume detachment
- go o.evictPodsWithoutPv(ctx, attemptEvict, podsToDrain, policyGroupVersion, getPodFn, returnCh)
- } else {
- podsWithPv, podsWithoutPv := filterPodsWithPv(pods)
-
- klog.V(3).Infof("Normal eviction of pods on the node: %q", o.nodeName)
-
- // evcit all pods without PV in parallel and with PV in serial (waiting for vol detachment)
- go o.evictPodsWithPv(ctx, attemptEvict, podsWithPv, policyGroupVersion, getPodFn, returnCh)
- go o.evictPodsWithoutPv(ctx, attemptEvict, podsWithoutPv, policyGroupVersion, getPodFn, returnCh)
- }
-
- doneCount := 0
- var errors []error
-
- numPods := len(pods)
- for doneCount < numPods {
- err := <-returnCh
- doneCount++
- if err != nil {
- errors = append(errors, err)
- }
- }
- return utilerrors.NewAggregate(errors)
-}
-
-func (o *DrainOptions) evictPodsWithoutPv(ctx context.Context, attemptEvict bool, pods []*corev1.Pod,
- policyGroupVersion string,
- getPodFn func(namespace, name string) (*api.Pod, error),
- returnCh chan error,
-) {
- for _, pod := range pods {
- go o.evictPodWithoutPVInternal(ctx, attemptEvict, pod, policyGroupVersion, getPodFn, returnCh)
- }
- return
-}
-
-func sortPodsByPriority(pods []*corev1.Pod) {
- sort.Slice(pods, func(i, j int) bool {
- return *pods[i].Spec.Priority > *pods[j].Spec.Priority
- })
-}
-
-// doAccountingOfPvs returns the map with keys as pod names and values as array of attached volumes' IDs
-func (o *DrainOptions) doAccountingOfPvs(pods []*corev1.Pod) map[string][]string {
- volMap := make(map[string][]string)
- pvMap := make(map[string][]string)
-
- for _, pod := range pods {
- podPVs, _ := o.getPvs(pod)
- pvMap[pod.Namespace+"/"+pod.Name] = podPVs
- }
- klog.V(4).Info("PV map: ", pvMap)
-
- filterSharedPVs(pvMap)
-
- for i := range pvMap {
- pvList := pvMap[i]
- vols, err := o.getVolIDsFromDriver(pvList)
- if err != nil {
- // In case of error, log and skip this set of volumes
- klog.Errorf("Error getting volume ID from cloud provider. Skipping volumes for pod: %v. Err: %v", i, err)
- continue
- }
- volMap[i] = vols
- }
- klog.V(4).Info("Volume map: ", volMap)
- return volMap
-}
-
-// filterSharedPVs filters out the PVs that are shared among pods.
-func filterSharedPVs(pvMap map[string][]string) {
- sharedVol := make(map[string]bool)
- sharedVolumesFound := false
-
- // Create hash map of volumes:
- // Key: volume name
- // Value: 'true' if any other pod shares this volume, else 'false'
- for _, vols := range pvMap {
- for _, vol := range vols {
- if _, ok := sharedVol[vol]; !ok {
- sharedVol[vol] = false
- } else {
- sharedVol[vol] = true
- sharedVolumesFound = true
- }
- }
- }
-
- if !sharedVolumesFound {
- klog.V(4).Info("No shared volumes found.")
- return
- }
-
- // Recreate the values of pvMap. Append volume if it is not shared
- for pod, vols := range pvMap {
- volList := []string{}
- for _, vol := range vols {
- if sharedVol[vol] == false {
- volList = append(volList, vol)
- }
- }
- pvMap[pod] = volList
- }
- klog.V(3).Info("Removed shared volumes. Filtered list of pods with volumes: ", pvMap)
-}
-
-func (o *DrainOptions) evictPodsWithPv(ctx context.Context, attemptEvict bool, pods []*corev1.Pod,
- policyGroupVersion string,
- getPodFn func(namespace, name string) (*api.Pod, error),
- returnCh chan error,
-) {
- sortPodsByPriority(pods)
-
- volMap := o.doAccountingOfPvs(pods)
-
- var (
- remainingPods []*api.Pod
- fastTrack bool
- nretries = int(o.MaxEvictRetries)
- )
-
- if attemptEvict {
- for i := 0; i < nretries; i++ {
- remainingPods, fastTrack = o.evictPodsWithPVInternal(ctx, attemptEvict, pods, volMap, policyGroupVersion, getPodFn, returnCh)
- if fastTrack || len(remainingPods) == 0 {
- //Either all pods got evicted or we need to fast track the return (node deletion detected)
- break
- }
-
- klog.V(4).Infof(
- "Eviction/deletion for some pods will be retried after %s for node %q",
- PodEvictionRetryInterval,
- o.nodeName,
- )
- pods = remainingPods
- time.Sleep(PodEvictionRetryInterval)
- }
-
- if !fastTrack && len(remainingPods) > 0 {
- // Force delete the pods remaining after evict retries.
- pods = remainingPods
- remainingPods, _ = o.evictPodsWithPVInternal(ctx, false, pods, volMap, policyGroupVersion, getPodFn, returnCh)
- }
- } else {
- remainingPods, _ = o.evictPodsWithPVInternal(ctx, false, pods, volMap, policyGroupVersion, getPodFn, returnCh)
- }
-
- // Placate the caller by returning the nil status for the remaining pods.
- for _, pod := range remainingPods {
- klog.V(4).Infof("Returning success for remaining pods for node %q", o.nodeName)
- if fastTrack {
- // This is executed when node is not found anymore.
- // Return success to caller for all non-processed pods so that the caller function can move on.
- returnCh <- nil
- } else if attemptEvict {
- returnCh <- fmt.Errorf("Error evicting pod %s/%s from node %q", pod.Namespace, pod.Name, pod.Spec.NodeName)
- } else {
- returnCh <- fmt.Errorf("Error deleting pod %s/%s from node %q", pod.Namespace, pod.Name, pod.Spec.NodeName)
- }
- }
-
- return
-}
-
-func (o *DrainOptions) evictPodsWithPVInternal(ctx context.Context, attemptEvict bool, pods []*corev1.Pod, volMap map[string][]string,
- policyGroupVersion string,
- getPodFn func(namespace, name string) (*api.Pod, error),
- returnCh chan error) (remainingPods []*api.Pod, fastTrack bool) {
- var (
- mainContext context.Context
- cancelMainContext context.CancelFunc
- retryPods []*api.Pod
- )
- mainContext, cancelMainContext = context.WithDeadline(ctx, o.drainStartedOn.Add(o.Timeout))
- defer cancelMainContext()
-
- for i, pod := range pods {
- select {
- case <-mainContext.Done():
- // Timeout occurred. Abort and report the remaining pods.
- returnCh <- nil
- return append(retryPods, pods[i+1:]...), true
- default:
- }
-
- var (
- err error
- podEvictionStartTime time.Time
- )
-
- podEvictionStartTime = time.Now()
-
- if attemptEvict {
- err = o.evictPod(ctx, pod, policyGroupVersion)
- } else {
- err = o.deletePod(ctx, pod)
- }
-
- if attemptEvict && apierrors.IsTooManyRequests(err) {
- // Pod eviction failed because of PDB violation, we will retry one we are done with this list.
- klog.V(3).Info("Pod ", pod.Namespace, "/", pod.Name, " from node ", pod.Spec.NodeName, " couldn't be evicted. This may also occur due to PDB violation. Will be retried. Error:", err)
- retryPods = append(retryPods, pod)
- continue
- } else if apierrors.IsNotFound(err) {
- klog.V(3).Info("\t", pod.Name, " from node ", pod.Spec.NodeName, " is already gone")
- returnCh <- nil
- continue
- } else if err != nil {
- klog.Errorf("error when evicting pod: %v/%v from node %v. Will be retried. Err: %v", pod.Namespace, pod.Name, pod.Spec.NodeName, err)
- retryPods = append(retryPods, pod)
- continue
- }
-
- // Eviction was successful. Wait for pvs for this pod to detach
- klog.V(3).Infof(
- "Pod eviction/deletion for Pod %s/%s in Node %q and took %v. Now waiting for volume detachment.",
- pod.Namespace,
- pod.Name,
- pod.Spec.NodeName,
- time.Since(podEvictionStartTime),
- )
-
- pvs := volMap[pod.Namespace+"/"+pod.Name]
- ctx, cancelFn := context.WithTimeout(mainContext, o.getTerminationGracePeriod(pod)+o.PvDetachTimeout)
- err = o.waitForDetach(ctx, pvs, o.nodeName)
- cancelFn()
-
- if apierrors.IsNotFound(err) {
- klog.V(3).Info("Node not found anymore")
- returnCh <- nil
- return append(retryPods, pods[i+1:]...), true
- } else if err != nil {
- klog.Errorf("Error when waiting for volume to detach from node. Err: %v", err)
- returnCh <- err
- continue
- }
- klog.V(3).Infof(
- "Volume detached for Pod %s/%s in Node %q and took %v (including pod eviction/deletion time).",
- pod.Namespace,
- pod.Name,
- pod.Spec.NodeName,
- time.Since(podEvictionStartTime),
- )
- returnCh <- nil
- }
-
- return retryPods, false
-}
-
-func (o *DrainOptions) getPvs(pod *corev1.Pod) ([]string, error) {
- pvs := []string{}
- for i := range pod.Spec.Volumes {
- vol := &pod.Spec.Volumes[i]
-
- if vol.PersistentVolumeClaim != nil {
- try := 0
-
- for {
- pvc, err := o.pvcLister.PersistentVolumeClaims(pod.Namespace).Get(vol.PersistentVolumeClaim.ClaimName)
-
- if apierrors.IsNotFound(err) {
- // If this PVC is not found, move on to the next PVC
- break
- } else if err != nil {
- try++
-
- if try == GetPvDetailsMaxRetries {
- // Log warning, and skip trying this volume anymore
- klog.Errorf("Error getting PVC. Err: %v", err)
- break
- }
- // In case of error, try again after few seconds
- time.Sleep(GetPvDetailsRetryInterval)
- continue
- }
-
- // Found PVC; append and exit
- pvs = append(pvs, pvc.Spec.VolumeName)
- break
- }
- }
- }
- return pvs, nil
-}
-
-func (o *DrainOptions) waitForDetach(ctx context.Context, volumeIDs []string, nodeName string) error {
- if volumeIDs == nil || len(volumeIDs) == 0 || nodeName == "" {
- // If volume or node name is not available, nothing to do. Just log this as warning
- klog.Warningf("Node name: %q, list of pod PVs to wait for detach: %v", nodeName, volumeIDs)
- return nil
- }
-
- klog.V(4).Info("Waiting for following volumes to detach: ", volumeIDs)
-
- found := true
-
- for found {
- select {
- case <-ctx.Done():
- klog.Warningf("Timeout occurred while waiting for PVs to detach from node %q", nodeName)
- return fmt.Errorf("Timeout while waiting for PVs to detach from node")
- default:
- }
-
- found = false
-
- node, err := o.client.CoreV1().Nodes().Get(ctx, nodeName, metav1.GetOptions{})
- if apierrors.IsNotFound(err) {
- klog.V(4).Info("Node not found: ", nodeName)
- return err
- } else if err != nil {
- klog.Errorf("Error getting details for node: %q. Err: %v", nodeName, err)
- return err
- }
-
- klog.V(4).Infof("No of attached volumes for node %q is %s", nodeName, node.Status.VolumesAttached)
- attachedVols := node.Status.VolumesAttached
- if len(attachedVols) == 0 {
- klog.V(4).Infof("No volumes attached to the node %q", nodeName)
- return nil
- }
-
- LookUpVolume:
- for i := range volumeIDs {
- volumeID := &volumeIDs[i]
-
- for j := range attachedVols {
- attachedVol := &attachedVols[j]
-
- found, _ = regexp.MatchString(*volumeID, string(attachedVol.Name))
-
- if found {
- klog.V(4).Infof(
- "Found volume:%s still attached to node %q. Will re-check in %s",
- *volumeID,
- nodeName,
- VolumeDetachPollInterval,
- )
- time.Sleep(VolumeDetachPollInterval)
- break LookUpVolume
- }
- }
- }
- }
-
- klog.V(4).Infof("Detached volumes:%s from node %q", volumeIDs, nodeName)
- return nil
-}
-
-func (o *DrainOptions) getVolIDsFromDriver(pvNames []string) ([]string, error) {
- pvSpecs := []corev1.PersistentVolumeSpec{}
-
- for _, pvName := range pvNames {
- try := 0
-
- for {
- pv, err := o.pvLister.Get(pvName)
-
- if apierrors.IsNotFound(err) {
- break
- } else if err != nil {
- try++
- if try == GetPvDetailsMaxRetries {
- break
- }
- // In case of error, try again after few seconds
- time.Sleep(GetPvDetailsRetryInterval)
- continue
- }
-
- // Found PV; append and exit
- pvSpecs = append(pvSpecs, pv.Spec)
- break
- }
- }
-
- return o.Driver.GetVolNames(pvSpecs)
-}
-
-func (o *DrainOptions) evictPodWithoutPVInternal(ctx context.Context, attemptEvict bool, pod *corev1.Pod, policyGroupVersion string, getPodFn func(namespace, name string) (*api.Pod, error), returnCh chan error) {
- var err error
- klog.V(3).Infof(
- "Evicting pod %s/%s from node %q ",
- pod.Namespace,
- pod.Name,
- pod.Spec.NodeName,
- )
-
- nretries := int(o.MaxEvictRetries)
- for i := 0; ; i++ {
- if i >= nretries {
- attemptEvict = false
- }
-
- if attemptEvict {
- err = o.evictPod(ctx, pod, policyGroupVersion)
- } else {
- err = o.deletePod(ctx, pod)
- }
-
- if err == nil {
- break
- } else if apierrors.IsNotFound(err) {
- klog.V(3).Info("\t", pod.Name, " evicted from node ", pod.Spec.NodeName)
- returnCh <- nil
- return
- } else if attemptEvict && apierrors.IsTooManyRequests(err) {
- // Pod couldn't be evicted because of PDB violation
- time.Sleep(PodEvictionRetryInterval)
- } else {
- returnCh <- fmt.Errorf("error when evicting pod %q: %v scheduled on node %v", pod.Name, err, pod.Spec.NodeName)
- return
- }
- }
-
- if o.ForceDeletePods {
- // Skip waiting for pod termination in case of forced drain
- if err == nil {
- returnCh <- nil
- } else {
- returnCh <- err
- }
- return
- }
-
- podArray := []*api.Pod{pod}
-
- timeout := o.getTerminationGracePeriod(pod)
- if timeout > o.Timeout {
- klog.V(3).Infof("Overriding large termination grace period (%s) for the pod %s/%s and setting it to %s", timeout.String(), pod.Namespace, pod.Name, o.Timeout)
- timeout = o.Timeout
- }
-
- bufferPeriod := 30 * time.Second
- podArray, err = o.waitForDelete(podArray, Interval, timeout+bufferPeriod, true, getPodFn)
- if err == nil {
- if len(podArray) > 0 {
- returnCh <- fmt.Errorf("timeout expired while waiting for pod %q terminating scheduled on node %v", pod.Name, pod.Spec.NodeName)
- } else {
- returnCh <- nil
- }
- } else {
- returnCh <- fmt.Errorf("error when waiting for pod %q/%v terminating: %v", pod.Name, pod.Spec.NodeName, err)
- }
-}
-
-func (o *DrainOptions) waitForDelete(pods []*api.Pod, interval, timeout time.Duration, usingEviction bool, getPodFn func(string, string) (*api.Pod, error)) ([]*api.Pod, error) {
- err := wait.PollImmediate(interval, timeout, func() (bool, error) {
- pendingPods := []*api.Pod{}
- for i, pod := range pods {
- p, err := getPodFn(pod.Namespace, pod.Name)
- if apierrors.IsNotFound(err) || (p != nil && p.ObjectMeta.UID != pod.ObjectMeta.UID) {
- //cmdutil.PrintSuccess(o.mapper, false, o.Out, "pod", pod.Name, false, verbStr)
- //klog.Info("pod deleted successfully found")
- continue
- } else if err != nil {
- return false, err
- } else {
- pendingPods = append(pendingPods, pods[i])
- }
- }
- pods = pendingPods
- if len(pendingPods) > 0 {
- return false, nil
- }
- return true, nil
- })
- return pods, err
-}
-
-// SupportEviction uses Discovery API to find out if the server support eviction subresource
-// If support, it will return its groupVersion; Otherwise, it will return ""
-func SupportEviction(clientset kubernetes.Interface) (string, error) {
- discoveryClient := clientset.Discovery()
- groupList, err := discoveryClient.ServerGroups()
- if err != nil {
- return "", err
- }
- foundPolicyGroup := false
- var policyGroupVersion string
- for _, group := range groupList.Groups {
- if group.Name == "policy" {
- foundPolicyGroup = true
- policyGroupVersion = group.PreferredVersion.GroupVersion
- break
- }
- }
- if !foundPolicyGroup {
- return "", nil
- }
- resourceList, err := discoveryClient.ServerResourcesForGroupVersion("v1")
- if err != nil {
- return "", err
- }
- for _, resource := range resourceList.APIResources {
- if resource.Name == EvictionSubresource && resource.Kind == EvictionKind {
- return policyGroupVersion, nil
- }
- }
- return "", nil
-}
-
-// RunCordonOrUncordon runs either Cordon or Uncordon. The desired value for
-// "Unschedulable" is passed as the first arg.
-func (o *DrainOptions) RunCordonOrUncordon(ctx context.Context, desired bool) error {
- node, err := o.client.CoreV1().Nodes().Get(ctx, o.nodeName, metav1.GetOptions{})
- if err != nil {
- // Deletion could be triggered when machine is just being created, no node present then
- return nil
- }
- unsched := node.Spec.Unschedulable
- if unsched == desired {
- klog.V(3).Infof("Scheduling state for node %q is already in desired state", node.Name)
- } else {
- clone := node.DeepCopy()
- clone.Spec.Unschedulable = desired
-
- _, err = o.client.CoreV1().Nodes().Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
- }
- return nil
-}
diff --git a/pkg/controller/drain_test.go b/pkg/controller/drain_test.go
deleted file mode 100644
index e4a71e560..000000000
--- a/pkg/controller/drain_test.go
+++ /dev/null
@@ -1,944 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package controller
-
-import (
- "context"
- "fmt"
- "regexp"
- "sync"
- "time"
-
- "github.com/gardener/machine-controller-manager/pkg/driver"
- "github.com/gardener/machine-controller-manager/pkg/fakeclient"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/cache"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/ginkgo/extensions/table"
- . "github.com/onsi/gomega"
- api "k8s.io/api/core/v1"
- corev1 "k8s.io/api/core/v1"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/client-go/kubernetes"
- k8stesting "k8s.io/client-go/testing"
-)
-
-var _ = Describe("drain", func() {
- const testNodeName = "node"
- const terminationGracePeriodShort = 5 * time.Second
- const terminationGracePeriodShortBy4 = terminationGracePeriodShort / 4
- const terminationGracePeriodShortBy8 = terminationGracePeriodShort / 8
- const terminationGracePeriodMedium = 10 * time.Second
- const terminationGracePeriodDefault = 20 * time.Second
- const terminationGracePeriodLong = 2 * time.Minute
-
- type stats struct {
- nPodsWithoutPV int
- nPodsWithOnlyExclusivePV int
- nPodsWithOnlySharedPV int
- nPodsWithExclusiveAndSharedPV int
- }
- type setup struct {
- stats
- attemptEviction bool
- maxEvictRetries int32
- terminationGracePeriod time.Duration
- force bool
- evictError error
- deleteError error
- }
-
- type expectation struct {
- stats
- timeout time.Duration
- drainTimeout bool
- drainError error
- nEvictions int
- minDrainDuration time.Duration
- }
-
- type podDrainHandler func(client kubernetes.Interface, pod *api.Pod, detachExclusiveVolumesCh chan<- *api.Pod) error
-
- run := func(setup *setup, podDrainHandlers []podDrainHandler, expected *expectation) {
- stop := make(chan struct{})
- defer close(stop)
-
- wg := sync.WaitGroup{}
-
- podsWithoutPV := getPodsWithoutPV(setup.nPodsWithoutPV, testNamespace, "nopv-", testNodeName, setup.terminationGracePeriod, map[string]string{
- "volumes": "none",
- })
- podsWithOnlyExclusivePV := getPodsWithPV(setup.nPodsWithOnlyExclusivePV, setup.nPodsWithOnlyExclusivePV, 0, testNamespace, "expv-", "expv-", "", testNodeName, setup.terminationGracePeriod, map[string]string{
- "volumes": "only-exclusive",
- })
- podsWithOnlySharedPV := getPodsWithPV(setup.nPodsWithOnlySharedPV, 0, setup.nPodsWithOnlySharedPV/2, testNamespace, "shpv-", "", "shpv-", testNodeName, setup.terminationGracePeriod, map[string]string{
- "volumes": "only-shared",
- })
- nPodsWithExclusiveAndSharedPV := getPodsWithPV(setup.nPodsWithExclusiveAndSharedPV, setup.nPodsWithExclusiveAndSharedPV, setup.nPodsWithExclusiveAndSharedPV/2, testNamespace, "exshpv-", "exshexpv-", "exshshpv-", testNodeName, setup.terminationGracePeriod, map[string]string{
- "volumes": "exclusive-and-shared",
- })
-
- var pods []*api.Pod
- pods = append(pods, podsWithoutPV...)
- pods = append(pods, podsWithOnlyExclusivePV...)
- pods = append(pods, podsWithOnlySharedPV...)
- pods = append(pods, nPodsWithExclusiveAndSharedPV...)
-
- pvcs := getPVCs(pods)
- pvs := getPVs(pvcs)
- nodes := []*corev1.Node{getNode(testNodeName, pvs)}
-
- var targetCoreObjects []runtime.Object
- targetCoreObjects = appendPods(targetCoreObjects, pods)
- targetCoreObjects = appendPVCs(targetCoreObjects, pvcs)
- targetCoreObjects = appendPVs(targetCoreObjects, pvs)
- targetCoreObjects = appendNodes(targetCoreObjects, nodes)
- c, trackers := createController(stop, testNamespace, nil, nil, targetCoreObjects)
- defer trackers.Stop()
-
- Expect(cache.WaitForCacheSync(stop, c.machineSetSynced, c.machineDeploymentSynced)).To(BeTrue())
-
- maxEvictRetries := setup.maxEvictRetries
- if maxEvictRetries <= 0 {
- maxEvictRetries = 3
- }
- d := &DrainOptions{
- DeleteLocalData: true,
- Driver: &drainDriver{},
- ErrOut: GinkgoWriter,
- ForceDeletePods: setup.force,
- IgnorePodsWithoutControllers: true,
- GracePeriodSeconds: 30,
- IgnoreDaemonsets: true,
- MaxEvictRetries: maxEvictRetries,
- Out: GinkgoWriter,
- PvDetachTimeout: 3 * time.Minute,
- Timeout: time.Minute,
- client: c.targetCoreClient,
- nodeName: testNodeName,
- pvcLister: c.pvcLister,
- pvLister: c.pvLister,
- }
-
- // Get the pod directly from the ObjectTracker to avoid locking issues in the Fake object.
- getPod := func(gvr schema.GroupVersionResource, ns, name string) (*api.Pod, error) {
- ro, err := trackers.TargetCore.Get(gvr, ns, name)
- if err != nil {
- return nil, err
- }
-
- return ro.(*api.Pod), nil
- }
-
- // Serialize volume detachment to avoid concurrency issues during node update.
- detachExclusiveVolumesCh := make(chan *api.Pod)
- defer close(detachExclusiveVolumesCh)
-
- runPodDrainHandlers := func(pod *api.Pod) {
- var err error
- for _, handler := range podDrainHandlers {
- err = handler(d.client, pod, detachExclusiveVolumesCh)
- if err != nil {
- break
- }
- }
-
- if err != nil {
- fmt.Fprintf(GinkgoWriter, "Error simulating eviction for the pod %s/%s: %s", pod.Namespace, pod.Name, err)
- }
- }
-
- // Serialize volume detachment to avoid concurrency issues during node update.
- go func() {
- for pod := range detachExclusiveVolumesCh {
- nodes := d.client.CoreV1().Nodes()
- node, err := nodes.Get(context.TODO(), pod.Spec.NodeName, metav1.GetOptions{})
- if err != nil {
- fmt.Fprintln(GinkgoWriter, err)
- continue
- }
-
- node = node.DeepCopy()
- nodeUpdateRequired := false
- {
- remainingVolumesAttached := []corev1.AttachedVolume{}
- pvcs := getPVCs([]*api.Pod{pod})
- pvs := getPVs(pvcs)
- for i := range node.Status.VolumesAttached {
- va := &node.Status.VolumesAttached[i]
- if matched, err := regexp.Match("expv-", []byte(va.Name)); err != nil || !matched {
- // Detach only exclusive volumes
- remainingVolumesAttached = append(remainingVolumesAttached, *va)
- continue
- }
-
- found := false
- for _, pv := range pvs {
- if va.Name == corev1.UniqueVolumeName(getDrainTestVolumeName(&pv.Spec)) {
- found = true
- break
- }
- }
- if !found {
- remainingVolumesAttached = append(remainingVolumesAttached, *va)
- }
- }
- if nodeUpdateRequired = len(remainingVolumesAttached) != len(node.Status.VolumesAttached); nodeUpdateRequired {
- node.Status.VolumesAttached = remainingVolumesAttached
- }
- }
-
- if !nodeUpdateRequired {
- continue
- }
-
- _, err = nodes.Update(context.TODO(), node, metav1.UpdateOptions{})
- fmt.Fprintln(GinkgoWriter, err)
- }
- }()
-
- ctx, cancelCtx := context.WithTimeout(context.Background(), expected.timeout)
- defer cancelCtx()
-
- nEvictions := 0
- if setup.attemptEviction {
- fakeTargetCoreClient := c.targetCoreClient.(*fakeclient.Clientset)
- fakeTargetCoreClient.FakeDiscovery.Resources = []*metav1.APIResourceList{
- {
- GroupVersion: "policy/v1",
- },
- {
- GroupVersion: "v1",
- APIResources: []metav1.APIResource{
- {
- Name: EvictionSubresource,
- Kind: EvictionKind,
- },
- },
- },
- }
-
- // Fake eviction
- fakeTargetCoreClient.PrependReactor("post", "pods", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) {
- if setup.evictError != nil {
- return true, nil, setup.evictError
- }
-
- start := time.Now()
- switch ga := action.(type) {
- case k8stesting.GetAction:
- if ga.GetSubresource() != "eviction" {
- return
- }
-
- var pod *api.Pod
- pod, err = getPod(action.GetResource(), ga.GetNamespace(), ga.GetName())
- if err != nil {
- return
- }
-
- // Delete the pod asyncronously to work around the lock problems in testing.Fake
- wg.Add(1)
- go func() {
- defer wg.Done()
- runPodDrainHandlers(pod)
- fmt.Fprintf(GinkgoWriter, "Drained pod %s/%s in %s\n", pod.Namespace, pod.Name, time.Now().Sub(start).String())
- }()
-
- nEvictions++
- return
- default:
- err = fmt.Errorf("Expected type k8stesting.GetAction but got %T", action)
- return
- }
- })
- } else {
- // Work-around: Use a non-handling reactor in place of watch (because watch is not working).
- fakeTargetCoreClient := c.targetCoreClient.(*fakeclient.Clientset)
- fakeTargetCoreClient.PrependReactor("delete", "pods", func(action k8stesting.Action) (handled bool, ret runtime.Object, err error) {
- if setup.deleteError != nil {
- return true, nil, setup.deleteError
- }
-
- start := time.Now()
- switch ga := action.(type) {
- case k8stesting.DeleteAction:
- var pod *api.Pod
- pod, err = getPod(action.GetResource(), ga.GetNamespace(), ga.GetName())
- if err != nil {
- return
- }
-
- // Delete the pod asyncronously to work around the lock problems in testing.Fake
- wg.Add(1)
- go func() {
- defer wg.Done()
- runPodDrainHandlers(pod)
- fmt.Fprintf(GinkgoWriter, "Drained pod %s/%s in %s\n", pod.Namespace, pod.Name, time.Now().Sub(start).String())
- }()
- default:
- err = fmt.Errorf("Expected type k8stesting.GetAction but got %T", action)
- }
-
- return
- })
- }
-
- var drainErr error
- var drainStart, drainEnd *time.Time
- go func() {
- start := time.Now()
- drainStart = &start
- drainErr = d.RunDrain(context.TODO())
- end := time.Now()
- drainEnd = &end
- cancelCtx()
- }()
-
- // Wait for the context to complete or timeout.
- <-ctx.Done()
-
- if expected.drainTimeout {
- Expect(ctx.Err()).To(Equal(context.DeadlineExceeded))
-
- // TODO Find a way to validate rest of the details in case of an expected timeout.
- return
- }
-
- Expect(ctx.Err()).ToNot(Equal(context.DeadlineExceeded))
-
- if expected.drainError == nil {
- Expect(drainErr).ShouldNot(HaveOccurred())
- } else {
- Expect(drainErr).To(Equal(expected.drainError))
- }
-
- wg.Wait()
-
- Expect(nEvictions).To(Equal(expected.nEvictions))
-
- if expected.minDrainDuration > 0 {
- Expect(drainStart).ToNot(BeNil())
- Expect(drainEnd).ToNot(BeNil())
- Expect(drainEnd.Sub(*drainStart)).To(BeNumerically(">=", expected.minDrainDuration))
- }
-
- validatePodCount := func(labelSelector string, nExpected int) {
- podList, err := d.client.CoreV1().Pods(testNamespace).List(context.TODO(), metav1.ListOptions{LabelSelector: labelSelector})
- Expect(err).ShouldNot(HaveOccurred())
- Expect(podList).ToNot(BeNil())
- Expect(podList.Items).To(HaveLen(nExpected))
- }
-
- validatePodCount("volumes=none", expected.nPodsWithoutPV)
- validatePodCount("volumes=only-exclusive", expected.nPodsWithOnlyExclusivePV)
- validatePodCount("volumes=only-shared", expected.nPodsWithOnlySharedPV)
- validatePodCount("volumes=exclusive-and-shared", expected.nPodsWithExclusiveAndSharedPV)
- }
-
- sleepFor := func(d time.Duration) podDrainHandler {
- return func(client kubernetes.Interface, pod *api.Pod, detachExclusiveVolumesCh chan<- *api.Pod) error {
- time.Sleep(d)
- return nil
- }
- }
-
- deletePod := func(client kubernetes.Interface, pod *api.Pod, detachExclusiveVolumesCh chan<- *api.Pod) error {
- return client.CoreV1().Pods(pod.Namespace).Delete(context.TODO(), pod.Name, metav1.DeleteOptions{})
- }
-
- detachExclusiveVolumes := func(client kubernetes.Interface, pod *api.Pod, detachExclusiveVolumesCh chan<- *api.Pod) error {
- detachExclusiveVolumesCh <- pod
- return nil
- }
-
- DescribeTable("RunDrain", run,
- Entry("Successful drain without support for eviction pods without volume",
- &setup{
- stats: stats{
- nPodsWithoutPV: 10,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: false,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- nil,
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- timeout: terminationGracePeriodShort,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 0,
- minDrainDuration: 0,
- }),
- Entry("Successful drain with support for eviction of pods without volume",
- &setup{
- stats: stats{
- nPodsWithoutPV: 10,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: true,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- []podDrainHandler{deletePod},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- // Because waitForDelete polling Interval is equal to terminationGracePeriodShort
- timeout: terminationGracePeriodMedium,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 10,
- // Because waitForDelete polling Interval is equal to terminationGracePeriodShort
- minDrainDuration: terminationGracePeriodShort,
- }),
- Entry("Successful drain without support for eviction of pods with exclusive volumes",
- &setup{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 2,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: false,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- []podDrainHandler{sleepFor(terminationGracePeriodShortBy8), detachExclusiveVolumes},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- timeout: terminationGracePeriodDefault,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 0,
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- minDrainDuration: terminationGracePeriodMedium,
- }),
- Entry("Successful drain with support for eviction of pods with exclusive volumes",
- &setup{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 2,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: true,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- []podDrainHandler{deletePod, sleepFor(terminationGracePeriodShortBy8), detachExclusiveVolumes},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- timeout: terminationGracePeriodDefault,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 2,
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- minDrainDuration: terminationGracePeriodMedium,
- }),
- Entry("Successful drain without support for eviction of pods with shared volumes",
- &setup{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 2,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: false,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- nil,
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- timeout: terminationGracePeriodShort,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 0,
- minDrainDuration: 0,
- }),
- Entry("Successful drain with support for eviction of pods with shared volumes",
- &setup{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 2,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: true,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- []podDrainHandler{sleepFor(terminationGracePeriodShortBy4), deletePod},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- timeout: terminationGracePeriodShort,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 2,
- minDrainDuration: 0,
- }),
- Entry("Successful drain without support for eviction of pods with exclusive and shared volumes",
- &setup{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 2,
- },
- attemptEviction: false,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- []podDrainHandler{sleepFor(terminationGracePeriodShortBy8), detachExclusiveVolumes},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- timeout: terminationGracePeriodDefault,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 0,
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- minDrainDuration: terminationGracePeriodMedium,
- }),
- Entry("Successful drain with support for eviction of pods with exclusive and shared volumes",
- &setup{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 2,
- },
- attemptEviction: true,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- []podDrainHandler{deletePod, sleepFor(terminationGracePeriodShortBy8), detachExclusiveVolumes},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- timeout: terminationGracePeriodDefault,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 2,
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- minDrainDuration: terminationGracePeriodMedium,
- }),
- Entry("Successful drain without support for eviction of pods with and without volume",
- &setup{
- stats: stats{
- nPodsWithoutPV: 10,
- nPodsWithOnlyExclusivePV: 2,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: false,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- []podDrainHandler{sleepFor(terminationGracePeriodShortBy8), detachExclusiveVolumes},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- timeout: terminationGracePeriodDefault,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 0,
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- minDrainDuration: terminationGracePeriodMedium,
- }),
- Entry("Successful drain with support for eviction of pods with and without volume",
- &setup{
- stats: stats{
- nPodsWithoutPV: 10,
- nPodsWithOnlyExclusivePV: 2,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: true,
- terminationGracePeriod: terminationGracePeriodShort,
- },
- []podDrainHandler{deletePod, sleepFor(terminationGracePeriodShortBy8), detachExclusiveVolumes},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- timeout: terminationGracePeriodDefault,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 12,
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- minDrainDuration: terminationGracePeriodMedium,
- }),
- Entry("Successful forced drain without support for eviction of pods with and without volume",
- &setup{
- stats: stats{
- nPodsWithoutPV: 10,
- nPodsWithOnlyExclusivePV: 2,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: false,
- terminationGracePeriod: terminationGracePeriodShort,
- force: true,
- },
- nil,
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- timeout: terminationGracePeriodShort,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 0,
- minDrainDuration: 0,
- }),
- Entry("Successful forced drain with support for eviction of pods with and without volume",
- &setup{
- stats: stats{
- nPodsWithoutPV: 10,
- nPodsWithOnlyExclusivePV: 2,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: true,
- terminationGracePeriod: terminationGracePeriodShort,
- force: true,
- },
- []podDrainHandler{deletePod},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- timeout: terminationGracePeriodShort,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 0,
- minDrainDuration: 0,
- }),
- Entry("Successful forced drain with support for eviction of pods with and without volume when eviction fails",
- &setup{
- stats: stats{
- nPodsWithoutPV: 10,
- nPodsWithOnlyExclusivePV: 2,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- maxEvictRetries: 1,
- attemptEviction: true,
- terminationGracePeriod: terminationGracePeriodShort,
- force: true,
- evictError: apierrors.NewTooManyRequestsError(""),
- },
- nil,
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- timeout: terminationGracePeriodMedium,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 0,
- minDrainDuration: 0,
- }),
- Entry("Successful drain for pods with long termination grace period",
- &setup{
- stats: stats{
- nPodsWithoutPV: 10,
- nPodsWithOnlyExclusivePV: 2,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- attemptEviction: true,
- terminationGracePeriod: terminationGracePeriodLong,
- },
- []podDrainHandler{deletePod, sleepFor(terminationGracePeriodShortBy8), detachExclusiveVolumes},
- &expectation{
- stats: stats{
- nPodsWithoutPV: 0,
- nPodsWithOnlyExclusivePV: 0,
- nPodsWithOnlySharedPV: 0,
- nPodsWithExclusiveAndSharedPV: 0,
- },
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- timeout: terminationGracePeriodLong,
- drainTimeout: false,
- drainError: nil,
- nEvictions: 12,
- // Because waitForDetach polling Interval is equal to terminationGracePeriodShort
- minDrainDuration: terminationGracePeriodMedium,
- }),
- )
-})
-
-func getPodWithoutPV(ns, name, nodeName string, terminationGracePeriod time.Duration, labels map[string]string) *corev1.Pod {
- controller := true
- priority := int32(0)
- tgps := int64(terminationGracePeriod / time.Second)
- return &corev1.Pod{
- ObjectMeta: metav1.ObjectMeta{
- Name: name,
- Namespace: ns,
- Labels: labels,
- OwnerReferences: []metav1.OwnerReference{
- {Controller: &controller},
- },
- },
- Spec: corev1.PodSpec{
- NodeName: nodeName,
- TerminationGracePeriodSeconds: &tgps,
- Priority: &priority,
- },
- }
-}
-
-func getPodsWithoutPV(n int, ns, podPrefix, nodeName string, terminationGracePeriod time.Duration, labels map[string]string) []*corev1.Pod {
- pods := make([]*corev1.Pod, n)
- for i := range pods {
- pods[i] = getPodWithoutPV(ns, fmt.Sprintf("%s%d", podPrefix, i), nodeName, terminationGracePeriod, labels)
- }
- return pods
-}
-
-func getPodWithPV(ns, name, exclusivePV, sharedPV, nodeName string, terminationGracePeriod time.Duration, labels map[string]string) *corev1.Pod {
- pod := getPodWithoutPV(ns, name, nodeName, terminationGracePeriod, labels)
-
- appendVolume := func(pod *api.Pod, vol string) {
- pod.Spec.Volumes = append(pod.Spec.Volumes, corev1.Volume{
- Name: vol,
- VolumeSource: corev1.VolumeSource{
- PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
- ClaimName: vol,
- },
- },
- })
- }
-
- if exclusivePV != "" {
- appendVolume(pod, exclusivePV)
- }
- if sharedPV != "" {
- appendVolume(pod, sharedPV)
- }
- return pod
-}
-
-func getPodsWithPV(nPod, nExclusivePV, nSharedPV int, ns, podPrefix, exclusivePVPrefix, sharedPVPrefix, nodeName string, terminationGracePeriod time.Duration, labels map[string]string) []*corev1.Pod {
- pods := make([]*corev1.Pod, nPod)
- for i := range pods {
- var (
- podName = fmt.Sprintf("%s%d", podPrefix, i)
- exclusivePV string
- sharedPV string
- )
- if nExclusivePV > 0 {
- exclusivePV = fmt.Sprintf("%s%d", exclusivePVPrefix, i%nExclusivePV)
- }
- if nSharedPV > 0 {
- sharedPV = fmt.Sprintf("%s%d", sharedPVPrefix, i%nSharedPV)
- }
- pods[i] = getPodWithPV(ns, podName, exclusivePV, sharedPV, nodeName, terminationGracePeriod, labels)
- }
- return pods
-}
-
-func getPVCs(pods []*corev1.Pod) []*corev1.PersistentVolumeClaim {
- m := make(map[string]*corev1.PersistentVolumeClaim)
- for _, pod := range pods {
- for i := range pod.Spec.Volumes {
- vol := &pod.Spec.Volumes[i]
- if vol.PersistentVolumeClaim != nil {
- pvc := vol.PersistentVolumeClaim
-
- if _, ok := m[pvc.ClaimName]; ok {
- continue
- }
-
- m[pvc.ClaimName] = &corev1.PersistentVolumeClaim{
- ObjectMeta: metav1.ObjectMeta{
- Name: pvc.ClaimName,
- Namespace: pod.Namespace,
- },
- Spec: corev1.PersistentVolumeClaimSpec{
- VolumeName: pvc.ClaimName,
- },
- }
- }
- }
- }
-
- pvcs := make([]*corev1.PersistentVolumeClaim, len(m))
- var i = 0
- for _, pvc := range m {
- pvcs[i] = pvc
- i++
- }
- return pvcs
-}
-
-func getPVs(pvcs []*corev1.PersistentVolumeClaim) []*corev1.PersistentVolume {
- m := make(map[string]*corev1.PersistentVolume)
- for _, pvc := range pvcs {
- if _, ok := m[pvc.Spec.VolumeName]; ok {
- continue
- }
-
- m[pvc.Spec.VolumeName] = &corev1.PersistentVolume{
- ObjectMeta: metav1.ObjectMeta{
- Name: pvc.Spec.VolumeName,
- },
- Spec: corev1.PersistentVolumeSpec{
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- VolumeHandle: pvc.Spec.VolumeName,
- },
- },
- },
- }
- }
-
- pvs := make([]*corev1.PersistentVolume, len(m))
- var i = 0
- for _, pv := range m {
- pvs[i] = pv
- i++
- }
- return pvs
-}
-
-func getNode(name string, pvs []*corev1.PersistentVolume) *corev1.Node {
- n := &corev1.Node{
- ObjectMeta: metav1.ObjectMeta{
- Name: name,
- },
- }
-
- vols := make([]corev1.AttachedVolume, len(pvs))
- for i, pv := range pvs {
- vols[i] = corev1.AttachedVolume{
- Name: corev1.UniqueVolumeName(getDrainTestVolumeName(&pv.Spec)),
- }
- }
-
- n.Status.VolumesAttached = vols
-
- return n
-}
-
-func getDrainTestVolumeName(pvSpec *corev1.PersistentVolumeSpec) string {
- if pvSpec.CSI == nil {
- return ""
- }
- return pvSpec.CSI.VolumeHandle
-}
-
-type drainDriver struct {
- *driver.FakeDriver
-}
-
-func (d *drainDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error) {
- volNames := make([]string, len(specs))
- for i := range specs {
- volNames[i] = getDrainTestVolumeName(&specs[i])
- }
- return volNames, nil
-}
-
-func appendPods(objects []runtime.Object, pods []*corev1.Pod) []runtime.Object {
- for _, pod := range pods {
- objects = append(objects, pod)
- }
- return objects
-}
-
-func appendPVCs(objects []runtime.Object, pvcs []*corev1.PersistentVolumeClaim) []runtime.Object {
- for _, pvc := range pvcs {
- objects = append(objects, pvc)
- }
- return objects
-}
-
-func appendPVs(objects []runtime.Object, pvs []*corev1.PersistentVolume) []runtime.Object {
- for _, pv := range pvs {
- objects = append(objects, pv)
- }
- return objects
-}
-
-func appendNodes(objects []runtime.Object, nodes []*corev1.Node) []runtime.Object {
- for _, n := range nodes {
- objects = append(objects, n)
- }
- return objects
-}
diff --git a/pkg/controller/gcpmachineclass.go b/pkg/controller/gcpmachineclass.go
deleted file mode 100644
index d9336afce..000000000
--- a/pkg/controller/gcpmachineclass.go
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "fmt"
- "time"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/tools/cache"
-
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
-)
-
-// GCPMachineClassKind is used to identify the machineClassKind as GCP
-const GCPMachineClassKind = "GCPMachineClass"
-
-func (c *controller) machineDeploymentToGCPMachineClassDelete(obj interface{}) {
- machineDeployment, ok := obj.(*v1alpha1.MachineDeployment)
- if machineDeployment == nil || !ok {
- return
- }
- if machineDeployment.Spec.Template.Spec.Class.Kind == GCPMachineClassKind {
- c.gcpMachineClassQueue.Add(machineDeployment.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineSetToGCPMachineClassDelete(obj interface{}) {
- machineSet, ok := obj.(*v1alpha1.MachineSet)
- if machineSet == nil || !ok {
- return
- }
- if machineSet.Spec.Template.Spec.Class.Kind == GCPMachineClassKind {
- c.gcpMachineClassQueue.Add(machineSet.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToGCPMachineClassAdd(obj interface{}) {
- machine, ok := obj.(*v1alpha1.Machine)
- if machine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", machine)
- return
- }
- if machine.Spec.Class.Kind == GCPMachineClassKind {
- c.gcpMachineClassQueue.Add(machine.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToGCPMachineClassUpdate(oldObj, newObj interface{}) {
- oldMachine, ok := oldObj.(*v1alpha1.Machine)
- if oldMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", oldObj)
- return
- }
- newMachine, ok := newObj.(*v1alpha1.Machine)
- if newMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", newObj)
- return
- }
-
- if oldMachine.Spec.Class.Kind == newMachine.Spec.Class.Kind {
- if newMachine.Spec.Class.Kind == GCPMachineClassKind {
- // Both old and new machine refer to the same machineClass object
- // And the correct kind so enqueuing only one of them.
- c.gcpMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- } else {
- // If both are pointing to different machineClasses
- // we might have to enqueue both.
- if oldMachine.Spec.Class.Kind == GCPMachineClassKind {
- c.gcpMachineClassQueue.Add(oldMachine.Spec.Class.Name)
- }
- if newMachine.Spec.Class.Kind == GCPMachineClassKind {
- c.gcpMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- }
-}
-
-func (c *controller) machineToGCPMachineClassDelete(obj interface{}) {
- c.machineToGCPMachineClassAdd(obj)
-}
-
-func (c *controller) gcpMachineClassAdd(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
- c.gcpMachineClassQueue.Add(key)
-}
-
-func (c *controller) gcpMachineClassUpdate(oldObj, newObj interface{}) {
- old, ok := oldObj.(*v1alpha1.GCPMachineClass)
- if old == nil || !ok {
- return
- }
- new, ok := newObj.(*v1alpha1.GCPMachineClass)
- if new == nil || !ok {
- return
- }
-
- c.gcpMachineClassAdd(newObj)
-}
-
-func (c *controller) gcpMachineClassDelete(obj interface{}) {
- c.gcpMachineClassAdd(obj)
-}
-
-// reconcileClusterGCPMachineClassKey reconciles an GCPMachineClass due to controller resync
-// or an event on the gcpMachineClass.
-func (c *controller) reconcileClusterGCPMachineClassKey(key string) error {
- ctx := context.Background()
- _, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return err
- }
-
- class, err := c.gcpMachineClassLister.GCPMachineClasses(c.namespace).Get(name)
-
- if errors.IsNotFound(err) {
- klog.Infof("%s %q: Not doing work because it has been deleted", GCPMachineClassKind, key)
- return nil
- }
- if err != nil {
- klog.Infof("%s %q: Unable to retrieve object from store: %v", GCPMachineClassKind, key, err)
- return err
- }
-
- err = c.reconcileClusterGCPMachineClass(ctx, class)
- if err != nil {
- c.enqueueGCPMachineClassAfter(class, 10*time.Second)
- } else {
- // Re-enqueue periodically to avoid missing of events
- // TODO: Infuture to get ride of this logic
- c.enqueueGCPMachineClassAfter(class, 10*time.Minute)
- }
-
- return nil
-}
-
-func (c *controller) reconcileClusterGCPMachineClass(ctx context.Context, class *v1alpha1.GCPMachineClass) error {
- klog.V(4).Info("Start Reconciling GCPmachineclass: ", class.Name)
- defer klog.V(4).Info("Stop Reconciling GCPmachineclass: ", class.Name)
-
- internalClass := &machine.GCPMachineClass{}
- err := c.internalExternalScheme.Convert(class, internalClass, nil)
- if err != nil {
- return err
- }
-
- validationerr := validation.ValidateGCPMachineClass(internalClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.Errorf("Validation of %s failed %s", GCPMachineClassKind, validationerr.ToAggregate().Error())
- return nil
- }
-
- // Add finalizer to avoid losing machineClass object
- if class.DeletionTimestamp == nil {
- err = c.addGCPMachineClassFinalizers(ctx, class)
- if err != nil {
- return err
- }
- }
-
- machines, err := c.findMachinesForClass(GCPMachineClassKind, class.Name)
- if err != nil {
- return err
- }
-
- if class.DeletionTimestamp == nil {
- // If deletion timestamp doesn't exist
- _, annotationPresent := class.Annotations[machineutils.MigratedMachineClass]
-
- if c.deleteMigratedMachineClass && annotationPresent && len(machines) == 0 {
- // If controller has deleteMigratedMachineClass flag set
- // and the migratedMachineClass annotation is set
- err = c.controlMachineClient.GCPMachineClasses(class.Namespace).Delete(ctx, class.Name, metav1.DeleteOptions{})
- if err != nil {
- return err
- }
- return fmt.Errorf("Retry deletion as deletion timestamp is now set")
- }
-
- return nil
- }
-
- if len(machines) > 0 {
- // machines are still referring the machine class, please wait before deletion
- klog.V(3).Infof("Cannot remove finalizer on %s because still (%d) machines are referencing it", class.Name, len(machines))
-
- for _, machine := range machines {
- c.addMachine(machine)
- }
-
- return fmt.Errorf("Retry as machine objects are still referring the machineclass")
- }
-
- return c.deleteGCPMachineClassFinalizers(ctx, class)
-}
-
-/*
- SECTION
- Manipulate Finalizers
-*/
-
-func (c *controller) addGCPMachineClassFinalizers(ctx context.Context, class *v1alpha1.GCPMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- finalizers.Insert(DeleteFinalizerName)
- return c.updateGCPMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) deleteGCPMachineClassFinalizers(ctx context.Context, class *v1alpha1.GCPMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- finalizers.Delete(DeleteFinalizerName)
- return c.updateGCPMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) updateGCPMachineClassFinalizers(ctx context.Context, class *v1alpha1.GCPMachineClass, finalizers []string) error {
- // Get the latest version of the class so that we can avoid conflicts
- class, err := c.controlMachineClient.GCPMachineClasses(class.Namespace).Get(ctx, class.Name, metav1.GetOptions{})
- if err != nil {
- return err
- }
-
- clone := class.DeepCopy()
- clone.Finalizers = finalizers
- _, err = c.controlMachineClient.GCPMachineClasses(class.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warning("Updating GCPMachineClass failed, retrying. ", class.Name, err)
- return err
- }
- klog.V(3).Infof("Successfully added/removed finalizer on the gcpmachineclass %q", class.Name)
- return err
-}
-
-func (c *controller) enqueueGCPMachineClassAfter(obj interface{}, after time.Duration) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- return
- }
- c.gcpMachineClassQueue.AddAfter(key, after)
-}
diff --git a/pkg/controller/gcpmachineclass_test.go b/pkg/controller/gcpmachineclass_test.go
deleted file mode 100644
index a30634d76..000000000
--- a/pkg/controller/gcpmachineclass_test.go
+++ /dev/null
@@ -1,927 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package controller
-
-import (
- "context"
- "fmt"
- "math"
- "time"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- customfake "github.com/gardener/machine-controller-manager/pkg/fakeclient"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/driver"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/ginkgo/extensions/table"
- . "github.com/onsi/gomega"
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-const (
- TestMachineName = "test-machine"
- TestMachineClassName = "test-mc"
- TestNamespace = "test-ns"
- TestSecret = "test-secret"
-)
-
-var _ = Describe("machineclass", func() {
- Describe("#reconcileClusterGCPMachineClass", func() {
- type setup struct {
- machineClasses []*v1alpha1.GCPMachineClass
- machines []*v1alpha1.Machine
- fakeResourceActions *customfake.ResourceActions
- }
- type action struct {
- fakeDriver *driver.FakeDriver
- machineClassName string
- }
- type expect struct {
- machineClass *v1alpha1.GCPMachineClass
- err error
- deleted bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineObjects := []runtime.Object{}
- for _, o := range data.setup.machineClasses {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range data.setup.machines {
- machineObjects = append(machineObjects, o)
- }
-
- controller, trackers := createController(stop, TestNamespace, machineObjects, nil, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, controller)
-
- action := data.action
- machineClass, err := controller.controlMachineClient.GCPMachineClasses(TestNamespace).Get(context.TODO(), action.machineClassName, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
-
- if data.setup.fakeResourceActions != nil {
- trackers.TargetCore.SetFakeResourceActions(data.setup.fakeResourceActions, math.MaxInt32)
- }
-
- err = controller.reconcileClusterGCPMachineClass(context.TODO(), machineClass)
- if data.expect.err == nil {
- Expect(err).To(Not(HaveOccurred()))
- } else {
- Expect(err).To(Equal(data.expect.err))
- }
-
- machineClass, err = controller.controlMachineClient.GCPMachineClasses(TestNamespace).Get(context.TODO(), action.machineClassName, metav1.GetOptions{})
- if data.expect.deleted {
- Expect(err).To((HaveOccurred()))
- } else {
- Expect(err).To(Not(HaveOccurred()))
- Expect(data.expect.machineClass).To(Equal(machineClass))
- }
- },
- Entry(
- "Add finalizer to a machine class",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.GCPMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- },
- machines: []*v1alpha1.Machine{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Name: TestMachineClassName,
- Kind: GCPMachineClassKind,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- Status: v1alpha1.MachineStatus{},
- },
- },
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.GCPMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- err: nil,
- },
- },
- ),
- Entry(
- "Finalizer exists so do nothing",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.GCPMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- },
- machines: []*v1alpha1.Machine{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Name: TestMachineClassName,
- Kind: GCPMachineClassKind,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- Status: v1alpha1.MachineStatus{},
- },
- },
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.GCPMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- err: nil,
- },
- },
- ),
- Entry(
- "Class deletion failure due to machines referring to it",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.GCPMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- },
- machines: []*v1alpha1.Machine{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Name: TestMachineClassName,
- Kind: GCPMachineClassKind,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- Status: v1alpha1.MachineStatus{},
- },
- },
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.GCPMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- err: fmt.Errorf("Retry as machine objects are still referring the machineclass"),
- },
- },
- ),
- Entry(
- "Class deletion succeeds with removal of finalizer",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.GCPMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- },
- machines: []*v1alpha1.Machine{},
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.GCPMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- err: nil,
- },
- },
- ),
- Entry(
- "Class deletion succeeds as no finalizer exists",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.GCPMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- },
- machines: []*v1alpha1.Machine{},
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.GCPMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- err: nil,
- },
- },
- ),
- Entry(
- "Class migration has completed, set deletion timestamp",
- &data{
- setup: setup{
- machineClasses: []*v1alpha1.GCPMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- machineutils.MigratedMachineClass: "present",
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- },
- machines: []*v1alpha1.Machine{},
- fakeResourceActions: &customfake.ResourceActions{},
- },
- action: action{
- fakeDriver: &driver.FakeDriver{},
- machineClassName: TestMachineClassName,
- },
- expect: expect{
- machineClass: &v1alpha1.GCPMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- DeletionTimestamp: &metav1.Time{
- Time: time.Time{},
- },
- Finalizers: []string{DeleteFinalizerName},
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{
- CanIpForward: false,
- DeletionProtection: false,
- Description: new(string),
- Disks: []*v1alpha1.GCPDisk{
- {
- AutoDelete: new(bool),
- Boot: true,
- SizeGb: 50,
- Type: "pd-ssd",
- Image: "test-image",
- },
- },
- Labels: map[string]string{},
- MachineType: "test-type",
- Metadata: []*v1alpha1.GCPMetadata{},
- NetworkInterfaces: []*v1alpha1.GCPNetworkInterface{
- {
- DisableExternalIP: false,
- Network: "test-network",
- Subnetwork: "test-subnetwork",
- },
- },
- Scheduling: v1alpha1.GCPScheduling{
- AutomaticRestart: false,
- OnHostMaintenance: "MIGRATE",
- Preemptible: false,
- },
- SecretRef: &v1.SecretReference{
- Name: TestSecret,
- Namespace: TestNamespace,
- },
- ServiceAccounts: []v1alpha1.GCPServiceAccount{
- {
- Email: "test@test.com",
- Scopes: []string{"test-scope"},
- },
- },
- Tags: []string{
- "kubernetes-io-cluster-test",
- "kubernetes-io-role-node",
- },
- Region: "test-region",
- Zone: "test-zone",
- },
- },
- err: fmt.Errorf("Retry deletion as deletion timestamp is now set"),
- deleted: true,
- },
- },
- ),
- )
- })
-})
diff --git a/pkg/controller/machine.go b/pkg/controller/machine.go
deleted file mode 100644
index 20d7b4640..000000000
--- a/pkg/controller/machine.go
+++ /dev/null
@@ -1,1177 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "bytes"
- "context"
- "errors"
- "fmt"
- "math"
- "strings"
- "time"
-
- "k8s.io/klog/v2"
-
- corev1 "k8s.io/api/core/v1"
- v1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/selection"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/tools/cache"
-
- apiequality "k8s.io/apimachinery/pkg/api/equality"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-
- machineapi "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- "github.com/gardener/machine-controller-manager/pkg/driver"
- utiltime "github.com/gardener/machine-controller-manager/pkg/util/time"
-)
-
-const (
- // MachinePriority is the annotation used to specify priority
- // associated with a machine while deleting it. The less its
- // priority the more likely it is to be deleted first
- // Default priority for a machine is set to 3
- MachinePriority = "machinepriority.machine.sapcloud.io"
-
- // MachineEnqueueRetryPeriod period after which a machine object is re-enqueued upon creation or deletion failures.
- MachineEnqueueRetryPeriod = 2 * time.Minute
-)
-
-/*
-SECTION
-Machine controller - Machine add, update, delete watches
-*/
-func (c *controller) addMachine(obj interface{}) {
- klog.V(4).Infof("Adding machine object")
- c.enqueueMachine(obj)
-}
-
-func (c *controller) updateMachine(oldObj, newObj interface{}) {
- klog.V(4).Info("Updating machine object")
- c.enqueueMachine(newObj)
-}
-
-func (c *controller) deleteMachine(obj interface{}) {
- klog.V(4).Info("Deleting machine object")
- c.enqueueMachine(obj)
-}
-
-func (c *controller) enqueueMachine(obj interface{}) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
-
- machine := obj.(*v1alpha1.Machine)
- switch machine.Spec.Class.Kind {
- case AlicloudMachineClassKind, AWSMachineClassKind, AzureMachineClassKind, GCPMachineClassKind, OpenStackMachineClassKind, PacketMachineClassKind:
- // Checking if machineClass is to be processed by MCM, and then only enqueue the machine object
- klog.V(4).Infof("Adding machine object to the queue %q", key)
- c.machineQueue.Add(key)
- default:
- klog.V(4).Infof("ClassKind %q not found. Machine maybe be processed by external controller", machine.Spec.Class.Kind)
- }
-}
-
-func (c *controller) enqueueMachineAfter(obj interface{}, after time.Duration) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
-
- machine := obj.(*v1alpha1.Machine)
-
- switch machine.Spec.Class.Kind {
- case AlicloudMachineClassKind, AWSMachineClassKind, AzureMachineClassKind, GCPMachineClassKind, OpenStackMachineClassKind, PacketMachineClassKind:
- // Checking if machineClass is to be processed by MCM, and then only enqueue the machine object
- klog.V(4).Infof("Adding machine object to the queue %q after %s", key, after)
- c.machineQueue.AddAfter(key, after)
- default:
- klog.V(4).Infof("ClassKind %q not found. Machine maybe be processed by external controller", machine.Spec.Class.Kind)
- }
-}
-
-func (c *controller) reconcileClusterMachineKey(key string) error {
- ctx := context.Background()
- _, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return err
- }
-
- machine, err := c.machineLister.Machines(c.namespace).Get(name)
- if apierrors.IsNotFound(err) {
- klog.V(4).Infof("Machine %q: Not doing work because it is not found", key)
- return nil
- }
-
- if err != nil {
- klog.Errorf("ClusterMachine %q: Unable to retrieve object from store: %v", key, err)
- return err
- }
-
- return c.reconcileClusterMachine(ctx, machine)
-}
-
-func (c *controller) reconcileClusterMachine(ctx context.Context, machine *v1alpha1.Machine) error {
- klog.V(4).Info("Start Reconciling machine: ", machine.Name)
- defer func() {
- c.enqueueMachineAfter(machine, 10*time.Minute)
- klog.V(4).Info("Stop Reconciling machine: ", machine.Name)
- }()
-
- if c.safetyOptions.MachineControllerFrozen && machine.DeletionTimestamp == nil {
- message := "Machine controller has frozen. Retrying reconcile after 10 minutes"
- klog.V(3).Info(message)
- return errors.New(message)
- }
-
- if !shouldReconcileMachine(machine, time.Now()) {
- return nil
- }
-
- // Validate Machine
- internalMachine := &machineapi.Machine{}
- err := c.internalExternalScheme.Convert(machine, internalMachine, nil)
- if err != nil {
- return err
- }
- validationerr := validation.ValidateMachine(internalMachine)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.Errorf("Validation of Machine failed %s", validationerr.ToAggregate().Error())
- return nil
- }
-
- // Validate MachineClass
- MachineClass, secretData, err := c.validateMachineClass(&machine.Spec.Class)
- if err != nil || secretData == nil {
- c.enqueueMachineAfter(machine, MachineEnqueueRetryPeriod)
- return nil
- }
-
- driver := driver.NewDriver(machine.Spec.ProviderID, secretData, machine.Spec.Class.Kind, MachineClass, machine.Name)
- actualProviderID, err := driver.GetExisting()
- if err != nil {
- return err
- } else if actualProviderID == "fake" {
- klog.Warning("Fake driver type")
- return nil
- }
-
- machine, err = c.machineLister.Machines(machine.Namespace).Get(machine.Name)
- if err != nil {
- klog.Errorf("Could not fetch machine object %s", err)
- if apierrors.IsNotFound(err) {
- // Ignore the error "Not Found"
- return nil
- }
-
- return err
- }
-
- machine, err = c.updateMachineState(ctx, machine)
- if err != nil {
- klog.Errorf("Could not update machine state for: %s", machine.Name)
- return err
- }
-
- // Sync nodeTemplate between machine and node-objects.
- node, _ := c.nodeLister.Get(machine.Labels[v1alpha1.NodeLabelKey])
- if node != nil {
- err = c.syncMachineNodeTemplates(ctx, machine)
- if err != nil {
- klog.Errorf("Could not update nodeTemplate for machine %s err: %q", machine.Name, err)
- return err
- }
- }
- if machine.DeletionTimestamp != nil {
- // Processing of delete event
- if err := c.machineDelete(ctx, machine, driver); err != nil {
- c.enqueueMachineAfter(machine, MachineEnqueueRetryPeriod)
- return nil
- }
- } else if machine.Status.CurrentStatus.TimeoutActive {
- // Processing machine
- c.checkMachineTimeout(ctx, machine)
- } else {
- // Processing of create or update event
- c.addMachineFinalizers(ctx, machine)
-
- if machine.Status.CurrentStatus.Phase == v1alpha1.MachineFailed {
- return nil
- } else if actualProviderID == "" {
- if err := c.machineCreate(ctx, machine, driver); err != nil {
- c.enqueueMachineAfter(machine, MachineEnqueueRetryPeriod)
- return nil
- }
- } else if actualProviderID != machine.Spec.ProviderID {
- if err := c.machineUpdate(ctx, machine, actualProviderID); err != nil {
- return err
- }
- }
- }
-
- return nil
-}
-
-/*
-SECTION
-Machine controller - nodeToMachine
-*/
-func (c *controller) addNodeToMachine(obj interface{}) {
- node := obj.(*corev1.Node)
- if node == nil {
- klog.Errorf("Couldn't convert to node from object")
- return
- }
-
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
-
- machine, err := c.getMachineFromNode(key)
- if err != nil {
- klog.Errorf("Couldn't fetch machine %s, Error: %s", key, err)
- return
- } else if machine == nil {
- return
- }
-
- if machine.Status.CurrentStatus.Phase != v1alpha1.MachineCrashLoopBackOff && nodeConditionsHaveChanged(machine.Status.Conditions, node.Status.Conditions) {
- klog.V(4).Infof("Enqueue machine object %q as backing node's conditions have changed", machine.Name)
- c.enqueueMachine(machine)
- }
-}
-
-func (c *controller) updateNodeToMachine(oldObj, newObj interface{}) {
- c.addNodeToMachine(newObj)
-}
-
-func (c *controller) deleteNodeToMachine(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
-
- machine, err := c.getMachineFromNode(key)
- if err != nil {
- klog.Errorf("Couldn't fetch machine %s, Error: %s", key, err)
- return
- } else if machine == nil {
- return
- }
-
- c.enqueueMachine(machine)
-}
-
-/*
- SECTION
- NodeToMachine operations
-*/
-
-func (c *controller) getMachineFromNode(nodeName string) (*v1alpha1.Machine, error) {
- var (
- list = []string{nodeName}
- selector = labels.NewSelector()
- req, _ = labels.NewRequirement(v1alpha1.NodeLabelKey, selection.Equals, list)
- )
-
- selector = selector.Add(*req)
- machines, _ := c.machineLister.List(selector)
-
- if len(machines) > 1 {
- return nil, errors.New("Multiple machines matching node")
- } else if len(machines) < 1 {
- return nil, nil
- }
-
- return machines[0], nil
-}
-
-func (c *controller) updateMachineState(ctx context.Context, machine *v1alpha1.Machine) (*v1alpha1.Machine, error) {
- nodeName := ""
- nodeName = machine.Labels[v1alpha1.NodeLabelKey]
-
- if nodeName == "" {
- // Check if any existing node-object can be adopted.
- nodeList, err := c.nodeLister.List(labels.Everything())
- if err != nil {
- klog.Errorf("Could not list the nodes due to error: %v", err)
- return machine, err
- }
- for _, node := range nodeList {
- nID, mID := decodeMachineID(node.Spec.ProviderID), decodeMachineID(machine.Spec.ProviderID)
- if nID == "" {
- continue
- }
-
- if nID == mID {
- klog.V(2).Infof("Adopting the node object %s for machine %s", node.Name, machine.Name)
- nodeName = node.Name
- clone := machine.DeepCopy()
- if clone.Labels == nil {
- clone.Labels = make(map[string]string)
- }
- clone.Labels[v1alpha1.NodeLabelKey] = nodeName
- clone, err = c.controlMachineClient.Machines(clone.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Errorf("Could not update the node label for machine-object %s due to error %v", machine.Name, err)
- return clone, err
- }
- break
- }
- }
- // Couldnt adopt any node-object.
- if nodeName == "" {
- // There are no objects mapped to this machine object
- // Hence return
- return machine, nil
- }
- }
-
- node, err := c.nodeLister.Get(nodeName)
- if err != nil && apierrors.IsNotFound(err) {
- // Node object is not found
-
- if len(machine.Status.Conditions) > 0 &&
- machine.Status.CurrentStatus.Phase == v1alpha1.MachineRunning {
- // If machine has conditions on it,
- // and corresponding node object went missing
- // and machine is still healthy
- msg := fmt.Sprintf(
- "Node object went missing. Machine %s is unhealthy - changing MachineState to Unknown",
- machine.Name,
- )
- klog.Warning(msg)
-
- currentStatus := v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineUnknown,
- TimeoutActive: true,
- LastUpdateTime: metav1.Now(),
- }
- lastOperation := v1alpha1.LastOperation{
- Description: msg,
- State: v1alpha1.MachineStateProcessing,
- Type: v1alpha1.MachineOperationHealthCheck,
- LastUpdateTime: metav1.Now(),
- }
- clone, err := c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
- if err != nil {
- klog.Errorf("Machine updated failed for %s, Error: %q", machine.Name, err)
- return machine, err
- }
- return clone, nil
- }
- // Cannot update node status as node doesn't exist
- // Hence returning
- return machine, nil
- } else if err != nil {
- // Any other types of errors while fetching node object
- klog.Errorf("Could not fetch node object for machine %s", machine.Name)
- return machine, err
- }
-
- machine, err = c.updateMachineConditions(ctx, machine, node.Status.Conditions)
-
- return machine, err
-}
-
-/*
- SECTION
- Machine operations - Create, Update, Delete
-*/
-
-func (c *controller) machineCreate(ctx context.Context, machine *v1alpha1.Machine, driver driver.Driver) error {
- klog.V(2).Infof("Creating machine %q, please wait!", machine.Name)
- var actualProviderID, nodeName string
-
- err := c.addBootstrapTokenToUserData(ctx, machine.Name, driver)
- if err != nil {
- klog.Errorf("Error while creating bootstrap token for machine %s: %s", machine.Name, err.Error())
- lastOperation := v1alpha1.LastOperation{
- Description: "MCM message - " + err.Error(),
- State: v1alpha1.MachineStateFailed,
- Type: v1alpha1.MachineOperationCreate,
- LastUpdateTime: metav1.Now(),
- }
- currentStatus := v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineFailed,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- }
- c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
- return err
- }
- // Before actually creating the machine, we should once check and adopt if the virtual machine already exists.
- VMList, err := driver.GetVMs("")
- if err != nil {
-
- klog.Errorf("Error while listing machine %s: %s", machine.Name, err.Error())
- lastOperation := v1alpha1.LastOperation{
- Description: "Cloud provider message - " + err.Error(),
- State: v1alpha1.MachineStateFailed,
- Type: v1alpha1.MachineOperationCreate,
- LastUpdateTime: metav1.Now(),
- }
- currentStatus := v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineCrashLoopBackOff,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- }
- c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
-
- // Delete the bootstrap token
- if err := c.deleteBootstrapToken(ctx, machine.Name); err != nil {
- klog.Warning(err)
- }
-
- klog.Errorf("Failed to list VMs before creating machine %q %+v", machine.Name, err)
- return err
- }
- for providerID, machineName := range VMList {
- if machineName == machine.Name {
- klog.V(2).Infof("Adopted an existing VM %s for machine object %s.", providerID, machineName)
- actualProviderID = providerID
- }
- }
- if actualProviderID == "" {
- actualProviderID, nodeName, err = driver.Create()
- }
-
- if err != nil {
- klog.Errorf("Error while creating machine %s: %s", machine.Name, err.Error())
- lastOperation := v1alpha1.LastOperation{
- Description: "Cloud provider message - " + err.Error(),
- State: v1alpha1.MachineStateFailed,
- Type: v1alpha1.MachineOperationCreate,
- LastUpdateTime: metav1.Now(),
- }
- currentStatus := v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineCrashLoopBackOff,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- }
- c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
-
- // Delete the bootstrap token
- if err := c.deleteBootstrapToken(ctx, machine.Name); err != nil {
- klog.Warning(err)
- }
-
- return err
- }
- klog.V(2).Infof("Created/Adopted machine: %q, MachineID: %s", machine.Name, actualProviderID)
-
- for {
- machineName := machine.Name
- // Get the latest version of the machine so that we can avoid conflicts
- machine, err := c.controlMachineClient.Machines(machine.Namespace).Get(ctx, machine.Name, metav1.GetOptions{})
- if err != nil {
-
- if apierrors.IsNotFound(err) {
- klog.Infof("Machine %q not found on APIServer anymore. Deleting created (orphan) VM", machineName)
-
- if err = driver.Delete(actualProviderID); err != nil {
- klog.Errorf(
- "Deletion failed for orphan machine %q with provider-ID %q: %s",
- machine.Name,
- actualProviderID,
- err,
- )
- }
-
- // Return with error
- return fmt.Errorf("Couldn't find machine object, hence deleted orphan VM")
- }
-
- klog.Warningf("Machine GET failed for %q. Retrying, error: %s", machineName, err)
- continue
- }
-
- lastOperation := v1alpha1.LastOperation{
- Description: "Creating machine on cloud provider",
- State: v1alpha1.MachineStateProcessing,
- Type: v1alpha1.MachineOperationCreate,
- LastUpdateTime: metav1.Now(),
- }
- currentStatus := v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachinePending,
- TimeoutActive: true,
- LastUpdateTime: metav1.Now(),
- }
-
- clone := machine.DeepCopy()
- if clone.Labels == nil {
- clone.Labels = make(map[string]string)
- }
- clone.Labels[v1alpha1.NodeLabelKey] = nodeName
-
- if clone.Annotations == nil {
- clone.Annotations = make(map[string]string)
- }
- if clone.Annotations[MachinePriority] == "" {
- clone.Annotations[MachinePriority] = "3"
- }
- clone.Spec.ProviderID = actualProviderID
- machine, err = c.controlMachineClient.Machines(clone.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warningf("Machine UPDATE failed for %q. Retrying, error: %s", machineName, err)
- continue
- }
-
- clone = machine.DeepCopy()
- clone.Status.LastOperation = lastOperation
- clone.Status.CurrentStatus = currentStatus
- _, err = c.controlMachineClient.Machines(clone.Namespace).UpdateStatus(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warningf("Machine/status UPDATE failed for %q. Retrying, error: %s", machineName, err)
- continue
- }
- // Update went through, exit out of infinite loop
- break
- }
-
- return nil
-}
-
-func (c *controller) machineUpdate(ctx context.Context, machine *v1alpha1.Machine, actualProviderID string) error {
- klog.V(2).Infof("Setting MachineId of %s to %s", machine.Name, actualProviderID)
-
- for {
- machine, err := c.controlMachineClient.Machines(machine.Namespace).Get(ctx, machine.Name, metav1.GetOptions{})
- if err != nil {
- klog.Errorf("Could not fetch machine object while setting up MachineId %s for Machine %s due to error %s", actualProviderID, machine.Name, err)
- return err
- }
-
- clone := machine.DeepCopy()
- clone.Spec.ProviderID = actualProviderID
- machine, err = c.controlMachineClient.Machines(clone.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warningf("Machine update failed. Retrying, error: %s", err)
- continue
- }
-
- clone = machine.DeepCopy()
- lastOperation := v1alpha1.LastOperation{
- Description: "Updated provider ID",
- State: v1alpha1.MachineStateSuccessful,
- Type: v1alpha1.MachineOperationUpdate,
- LastUpdateTime: metav1.Now(),
- }
- clone.Status.LastOperation = lastOperation
- _, err = c.controlMachineClient.Machines(clone.Namespace).UpdateStatus(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warningf("Machine/status update failed. Retrying, error: %s", err)
- continue
- }
- // Update went through, exit out of infinite loop
- break
- }
-
- return nil
-}
-
-func (c *controller) machineDelete(ctx context.Context, machine *v1alpha1.Machine, driver driver.Driver) error {
- var err error
- nodeName := machine.Labels[v1alpha1.NodeLabelKey]
-
- if finalizers := sets.NewString(machine.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- klog.V(2).Infof("Deleting Machine %q", machine.Name)
- var (
- forceDeletePods = false
- forceDeleteMachine = false
- timeOutOccurred = false
- maxEvictRetries = int32(math.Min(float64(*c.getEffectiveMaxEvictRetries(machine)), c.getEffectiveDrainTimeout(machine).Seconds()/PodEvictionRetryInterval.Seconds()))
- pvDetachTimeOut = c.safetyOptions.PvDetachTimeout.Duration
- timeOutDuration = c.getEffectiveDrainTimeout(machine).Duration
- forceDeleteLabelPresent = machine.Labels["force-deletion"] == "True"
- )
-
- if machine.Status.CurrentStatus.Phase != v1alpha1.MachineTerminating {
- lastOperation := v1alpha1.LastOperation{
- Description: "Deleting machine from cloud provider",
- State: v1alpha1.MachineStateProcessing,
- Type: v1alpha1.MachineOperationDelete,
- LastUpdateTime: metav1.Now(),
- }
- currentStatus := v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineTerminating,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- }
-
- err = c.deleteBootstrapToken(ctx, machine.Name)
- if err != nil {
- klog.Warning(err)
- }
-
- machine, err = c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
- if err != nil && apierrors.IsNotFound(err) {
- // Object no longer exists and has been deleted
- klog.Warning(err)
- return nil
- } else if err != nil {
- // Any other type of errors
- klog.Error(err)
- return err
- }
- }
-
- timeOutOccurred = utiltime.HasTimeOutOccurred(*machine.DeletionTimestamp, timeOutDuration)
-
- if forceDeleteLabelPresent || timeOutOccurred {
- // To perform forceful machine drain/delete either one of the below conditions must be satified
- // 1. force-deletion: "True" label must be present
- // 2. Deletion operation is more than drain-timeout minutes old
- forceDeleteMachine = true
- forceDeletePods = true
- timeOutDuration = 1 * time.Minute
- maxEvictRetries = 1
-
- klog.V(2).Infof(
- "Force delete/drain has been triggerred for machine %q due to Label:%t, timeout:%t",
- machine.Name,
- forceDeleteLabelPresent,
- timeOutOccurred,
- )
- } else {
- klog.V(2).Infof(
- "Normal delete/drain has been triggerred for machine %q with drain-timeout:%v & maxEvictRetries:%d",
- machine.Name,
- timeOutDuration,
- maxEvictRetries,
- )
- }
-
- // If machine was created on the cloud provider
- machineID, _ := driver.GetExisting()
-
- // update node with the machine's state prior to termination
- if nodeName != "" && machineID != "" {
- if err = c.UpdateNodeTerminationCondition(ctx, machine); err != nil {
- if forceDeleteMachine {
- klog.Warningf("failed to update node conditions: %v. However, since it's a force deletion shall continue deletion of VM.", err)
- } else {
- klog.Error(err)
- return err
- }
- }
- }
-
- if machineID != "" && nodeName != "" {
- // Begin drain logic only when the nodeName & providerID exist's for the machine
- buf := bytes.NewBuffer([]byte{})
- errBuf := bytes.NewBuffer([]byte{})
-
- drainOptions := NewDrainOptions(
- c.targetCoreClient,
- timeOutDuration,
- maxEvictRetries,
- pvDetachTimeOut,
- nodeName,
- 5*time.Minute,
- -1,
- forceDeletePods,
- true,
- true,
- true,
- buf,
- errBuf,
- driver,
- c.pvcLister,
- c.pvLister,
- )
- err = drainOptions.RunDrain(ctx)
- if err == nil {
- // Drain successful
- klog.V(2).Infof("Drain successful for machine %q. \nBuf:%v \nErrBuf:%v", machine.Name, buf, errBuf)
-
- } else if err != nil && forceDeleteMachine {
- // Drain failed on force deletion
- klog.Warningf("Drain failed for machine %q. However, since it's a force deletion shall continue deletion of VM. \nBuf:%v \nErrBuf:%v \nErr-Message:%v", machine.Name, buf, errBuf, err)
-
- } else {
- // Drain failed on normal (non-force) deletion, return error for retry
- lastOperation := v1alpha1.LastOperation{
- Description: "Drain failed - " + err.Error(),
- State: v1alpha1.MachineStateFailed,
- Type: v1alpha1.MachineOperationDelete,
- LastUpdateTime: metav1.Now(),
- }
- c.updateMachineStatus(ctx, machine, lastOperation, machine.Status.CurrentStatus)
-
- klog.Warningf("Drain failed for machine %q. \nBuf:%v \nErrBuf:%v \nErr-Message:%v", machine.Name, buf, errBuf, err)
- return err
- }
-
- err = driver.Delete(machineID)
- } else {
- klog.V(2).Infof("Machine %q on deletion doesn't have a providerID attached to it. Checking for any VM linked to this machine object.", machine.Name)
- // As MachineID is missing, we should check once if actual VM was created but MachineID was not updated on machine-object.
- // We list VMs and check if any one them map with the given machine-object.
- var VMList map[string]string
- VMList, err = driver.GetVMs("")
- if err == nil {
- for providerID, machineName := range VMList {
- if machineName == machine.Name {
- klog.V(2).Infof("Deleting the VM %s backing the machine-object %s.", providerID, machine.Name)
- err = driver.Delete(providerID)
- if err != nil {
- klog.Errorf("Error deleting the VM %s backing the machine-object %s due to error %v", providerID, machine.Name, err)
- // Not returning error so that status on the machine object can be updated in the next step if errored.
- } else {
- klog.V(2).Infof("VM %s backing the machine-object %s is deleted successfully", providerID, machine.Name)
- }
- }
- }
- } else {
- klog.Errorf("Failed to list VMs while deleting the machine %q %v", machine.Name, err)
- }
- }
-
- if err != nil {
- // When machine deletion fails
- klog.Errorf("Deletion failed for machine %q: %s", machine.Name, err)
-
- lastOperation := v1alpha1.LastOperation{
- Description: "Cloud provider message - " + err.Error(),
- State: v1alpha1.MachineStateFailed,
- Type: v1alpha1.MachineOperationDelete,
- LastUpdateTime: metav1.Now(),
- }
- currentStatus := v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineTerminating,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- }
- c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
- return err
- }
-
- if nodeName != "" {
- // Delete node object
- err = c.targetCoreClient.CoreV1().Nodes().Delete(ctx, nodeName, metav1.DeleteOptions{})
- if err != nil && !apierrors.IsNotFound(err) {
- // If its an error, and anyother error than object not found
- message := fmt.Sprintf("Deletion of Node Object %q failed due to error: %s", nodeName, err)
- lastOperation := v1alpha1.LastOperation{
- Description: message,
- State: v1alpha1.MachineStateFailed,
- Type: v1alpha1.MachineOperationDelete,
- LastUpdateTime: metav1.Now(),
- }
- c.updateMachineStatus(ctx, machine, lastOperation, machine.Status.CurrentStatus)
- klog.Errorf(message)
- return err
- }
- }
-
- // Remove finalizers from machine object
- c.deleteMachineFinalizers(ctx, machine)
-
- // Delete machine object
- err = c.controlMachineClient.Machines(machine.Namespace).Delete(ctx, machine.Name, metav1.DeleteOptions{})
- if err != nil && !apierrors.IsNotFound(err) {
- // If its an error, and anyother error than object not found
- klog.Errorf("Deletion of Machine Object %q failed due to error: %s", machine.Name, err)
- return err
- }
-
- klog.V(2).Infof("Machine %q deleted successfully", machine.Name)
- }
- return nil
-}
-
-/*
- SECTION
- Update machine object
-*/
-
-func (c *controller) updateMachineStatus(
- ctx context.Context,
- machine *v1alpha1.Machine,
- lastOperation v1alpha1.LastOperation,
- currentStatus v1alpha1.CurrentStatus,
-) (*v1alpha1.Machine, error) {
- // Get the latest version of the machine so that we can avoid conflicts
- latestMachine, err := c.controlMachineClient.Machines(machine.Namespace).Get(ctx, machine.Name, metav1.GetOptions{})
- if err != nil {
- return nil, err
- }
- clone := latestMachine.DeepCopy()
-
- clone.Status.LastOperation = lastOperation
- clone.Status.CurrentStatus = currentStatus
- if isMachineStatusEqual(clone.Status, machine.Status) {
- klog.V(3).Infof("Not updating the status of the machine object %q , as it is already same", clone.Name)
- return machine, nil
- }
-
- clone, err = c.controlMachineClient.Machines(clone.Namespace).UpdateStatus(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- // Keep retrying until update goes through
- klog.V(3).Infof("Warning: Updated failed, retrying, error: %q", err)
- return c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
- }
- return clone, nil
-}
-
-// isMachineStatusEqual checks if the status of 2 machines is similar or not.
-func isMachineStatusEqual(s1, s2 v1alpha1.MachineStatus) bool {
- tolerateTimeDiff := 30 * time.Minute
- s1Copy, s2Copy := s1.DeepCopy(), s2.DeepCopy()
- s1Copy.LastOperation.Description, s2Copy.LastOperation.Description = "", ""
-
- if (s1Copy.LastOperation.LastUpdateTime.Time.Before(time.Now().Add(tolerateTimeDiff * -1))) || (s2Copy.LastOperation.LastUpdateTime.Time.Before(time.Now().Add(tolerateTimeDiff * -1))) {
- return false
- }
- s1Copy.LastOperation.LastUpdateTime, s2Copy.LastOperation.LastUpdateTime = metav1.Time{}, metav1.Time{}
-
- if (s1Copy.CurrentStatus.LastUpdateTime.Time.Before(time.Now().Add(tolerateTimeDiff * -1))) || (s2Copy.CurrentStatus.LastUpdateTime.Time.Before(time.Now().Add(tolerateTimeDiff * -1))) {
- return false
- }
- s1Copy.CurrentStatus.LastUpdateTime, s2Copy.CurrentStatus.LastUpdateTime = metav1.Time{}, metav1.Time{}
-
- return apiequality.Semantic.DeepEqual(s1Copy.LastOperation, s2Copy.LastOperation) && apiequality.Semantic.DeepEqual(s1Copy.CurrentStatus, s2Copy.CurrentStatus)
-}
-
-func (c *controller) updateMachineConditions(ctx context.Context, machine *v1alpha1.Machine, conditions []v1.NodeCondition) (*v1alpha1.Machine, error) {
-
- var (
- msg string
- lastOperationType v1alpha1.MachineOperationType
- objectRequiresUpdate bool
- )
-
- // Get the latest version of the machine so that we can avoid conflicts
- machine, err := c.controlMachineClient.Machines(machine.Namespace).Get(ctx, machine.Name, metav1.GetOptions{})
- if err != nil {
- return machine, err
- }
-
- clone := machine.DeepCopy()
-
- if nodeConditionsHaveChanged(clone.Status.Conditions, conditions) {
- clone.Status.Conditions = conditions
- objectRequiresUpdate = true
- }
-
- if clone.Status.CurrentStatus.Phase == v1alpha1.MachineTerminating {
- // If machine is already in terminating state, don't update health status
-
- } else if !c.isHealthy(clone) && clone.Status.CurrentStatus.Phase == v1alpha1.MachineRunning {
- // If machine is not healthy, and current state is running,
- // change the machinePhase to unknown and activate health check timeout
- msg = fmt.Sprintf("Machine %s is unhealthy - changing MachineState to Unknown. Node conditions: %+v", clone.Name, clone.Status.Conditions)
- klog.Warning(msg)
-
- clone.Status.CurrentStatus = v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineUnknown,
- TimeoutActive: true,
- LastUpdateTime: metav1.Now(),
- }
- clone.Status.LastOperation = v1alpha1.LastOperation{
- Description: msg,
- State: v1alpha1.MachineStateProcessing,
- Type: v1alpha1.MachineOperationHealthCheck,
- LastUpdateTime: metav1.Now(),
- }
- objectRequiresUpdate = true
-
- } else if c.isHealthy(clone) && clone.Status.CurrentStatus.Phase != v1alpha1.MachineRunning {
- // If machine is healhy and current machinePhase is not running.
- // indicates that the machine is not healthy and status needs to be updated.
-
- if clone.Status.LastOperation.Type == v1alpha1.MachineOperationCreate &&
- clone.Status.LastOperation.State != v1alpha1.MachineStateSuccessful {
- // When machine creation went through
- msg = fmt.Sprintf("Machine %s successfully joined the cluster", clone.Name)
- // Delete the bootstrap token
- err = c.deleteBootstrapToken(ctx, clone.Name)
- if err != nil {
- klog.Warning(err)
- }
-
- lastOperationType = v1alpha1.MachineOperationCreate
- } else {
- // Machine rejoined the cluster after a healthcheck
- msg = fmt.Sprintf("Machine %s successfully re-joined the cluster", clone.Name)
- lastOperationType = v1alpha1.MachineOperationHealthCheck
- }
- klog.V(2).Infof(msg)
-
- // Machine is ready and has joined/re-joined the cluster
- clone.Status.LastOperation = v1alpha1.LastOperation{
- Description: msg,
- State: v1alpha1.MachineStateSuccessful,
- Type: lastOperationType,
- LastUpdateTime: metav1.Now(),
- }
- clone.Status.CurrentStatus = v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineRunning,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- }
- objectRequiresUpdate = true
-
- }
-
- if objectRequiresUpdate {
- clone, err = c.controlMachineClient.Machines(clone.Namespace).UpdateStatus(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- // Keep retrying until update goes through
- klog.Warningf("Updated failed, retrying, error: %q", err)
- return c.updateMachineConditions(ctx, machine, conditions)
- }
-
- return clone, nil
- }
-
- return machine, nil
-}
-
-func (c *controller) updateMachineFinalizers(ctx context.Context, machine *v1alpha1.Machine, finalizers []string) {
- // Get the latest version of the machine so that we can avoid conflicts
- machine, err := c.controlMachineClient.Machines(machine.Namespace).Get(ctx, machine.Name, metav1.GetOptions{})
- if err != nil {
- return
- }
-
- clone := machine.DeepCopy()
- clone.Finalizers = finalizers
- _, err = c.controlMachineClient.Machines(clone.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- // Keep retrying until update goes through
- klog.Warningf("Warning: Updated failed, retrying, error: %q", err)
- c.updateMachineFinalizers(ctx, machine, finalizers)
- }
-}
-
-/*
- SECTION
- Manipulate Finalizers
-*/
-
-func (c *controller) addMachineFinalizers(ctx context.Context, machine *v1alpha1.Machine) {
- clone := machine.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- finalizers.Insert(DeleteFinalizerName)
- c.updateMachineFinalizers(ctx, clone, finalizers.List())
- }
-}
-
-func (c *controller) deleteMachineFinalizers(ctx context.Context, machine *v1alpha1.Machine) {
- clone := machine.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- finalizers.Delete(DeleteFinalizerName)
- c.updateMachineFinalizers(ctx, clone, finalizers.List())
- }
-}
-
-/*
-SECTION
-Helper Functions
-*/
-func (c *controller) isHealthy(machine *v1alpha1.Machine) bool {
- numOfConditions := len(machine.Status.Conditions)
-
- if numOfConditions == 0 {
- // Kubernetes node object for this machine hasn't been received
- return false
- }
-
- for _, condition := range machine.Status.Conditions {
- if condition.Type == v1.NodeReady && condition.Status != v1.ConditionTrue {
- // If Kubelet is not ready
- return false
- }
- conditions := strings.Split(*c.getEffectiveNodeConditions(machine), ",")
- for _, c := range conditions {
- if string(condition.Type) == c && condition.Status != v1.ConditionFalse {
- return false
- }
- }
- }
- return true
-}
-
-func (c *controller) getSecret(ref *v1.SecretReference, machineClassName string) (*v1.Secret, error) {
- secretRef, err := c.secretLister.Secrets(ref.Namespace).Get(ref.Name)
- if apierrors.IsNotFound(err) {
- klog.V(3).Infof("No secret %q: found for MachineClass %q", ref, machineClassName)
- return nil, err
- }
- if err != nil {
- klog.Errorf("Unable get secret %q for MachineClass %q: %v", ref, machineClassName, err)
- return nil, err
- }
- return secretRef, err
-}
-
-func (c *controller) checkMachineTimeout(ctx context.Context, machine *v1alpha1.Machine) {
-
- // If machine phase is running already, ignore this loop
- if machine.Status.CurrentStatus.Phase != v1alpha1.MachineRunning {
-
- var (
- description string
- lastOperation v1alpha1.LastOperation
- currentStatus v1alpha1.CurrentStatus
- timeOutDuration time.Duration
- )
-
- checkCreationTimeout := machine.Status.CurrentStatus.Phase == v1alpha1.MachinePending
- sleepTime := 1 * time.Minute
-
- if checkCreationTimeout {
- timeOutDuration = c.getEffectiveCreationTimeout(machine).Duration
- } else {
- timeOutDuration = c.getEffectiveHealthTimeout(machine).Duration
- }
-
- // Timeout value obtained by subtracting last operation with expected time out period
- timeOut := metav1.Now().Add(-timeOutDuration).Sub(machine.Status.CurrentStatus.LastUpdateTime.Time)
- if timeOut > 0 {
- // Machine health timeout occurs while joining or rejoining of machine
-
- if checkCreationTimeout {
- // Timeout occurred while machine creation
- description = fmt.Sprintf(
- "Machine %s failed to join the cluster in %s minutes.",
- machine.Name,
- timeOutDuration,
- )
- } else {
- // Timeour occurred due to machine being unhealthy for too long
- description = fmt.Sprintf(
- "Machine %s is not healthy since %s minutes. Changing status to failed. Node Conditions: %+v",
- machine.Name,
- timeOutDuration,
- machine.Status.Conditions,
- )
- }
-
- lastOperation = v1alpha1.LastOperation{
- Description: description,
- State: v1alpha1.MachineStateFailed,
- Type: machine.Status.LastOperation.Type,
- LastUpdateTime: metav1.Now(),
- }
- currentStatus = v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineFailed,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- }
- // Log the error message for machine failure
- klog.Error(description)
-
- // Update the machine status to reflect the changes
- c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
-
- } else {
- // If timeout has not occurred, re-enqueue the machine
- // after a specified sleep time
- c.enqueueMachineAfter(machine, sleepTime)
- }
- }
-}
-
-func shouldReconcileMachine(machine *v1alpha1.Machine, now time.Time) bool {
- if machine.DeletionTimestamp != nil {
- return true
- }
- if machine.Spec.ProviderID == "" {
- return true
- }
- // TODO add more cases where this will be false
-
- return true
-}
-
-// decodeMachineID is a generic way of decoding the Spec.ProviderID field of node-objects.
-func decodeMachineID(id string) string {
- splitProviderID := strings.Split(id, "/")
- return splitProviderID[len(splitProviderID)-1]
-}
-
-// getEffectiveDrainTimeout returns the drainTimeout set on the machine-object, otherwise returns the timeout set using the global-flag.
-func (c *controller) getEffectiveDrainTimeout(machine *v1alpha1.Machine) *metav1.Duration {
- var effectiveDrainTimeout *metav1.Duration
- if machine.Spec.MachineConfiguration != nil && machine.Spec.MachineConfiguration.MachineDrainTimeout != nil {
- effectiveDrainTimeout = machine.Spec.MachineConfiguration.MachineDrainTimeout
- } else {
- effectiveDrainTimeout = &c.safetyOptions.MachineDrainTimeout
- }
- return effectiveDrainTimeout
-}
-
-// getEffectiveMaxEvictRetries returns the maxEvictRetries set on the machine-object, otherwise returns the evict retries set using the global-flag.
-func (c *controller) getEffectiveMaxEvictRetries(machine *v1alpha1.Machine) *int32 {
- var maxEvictRetries *int32
- if machine.Spec.MachineConfiguration != nil && machine.Spec.MachineConfiguration.MaxEvictRetries != nil {
- maxEvictRetries = machine.Spec.MachineConfiguration.MaxEvictRetries
- } else {
- maxEvictRetries = &c.safetyOptions.MaxEvictRetries
- }
- return maxEvictRetries
-}
-
-// getEffectiveHealthTimeout returns the healthTimeout set on the machine-object, otherwise returns the timeout set using the global-flag.
-func (c *controller) getEffectiveHealthTimeout(machine *v1alpha1.Machine) *metav1.Duration {
- var effectiveHealthTimeout *metav1.Duration
- if machine.Spec.MachineConfiguration != nil && machine.Spec.MachineConfiguration.MachineHealthTimeout != nil {
- effectiveHealthTimeout = machine.Spec.MachineConfiguration.MachineHealthTimeout
- } else {
- effectiveHealthTimeout = &c.safetyOptions.MachineHealthTimeout
- }
- return effectiveHealthTimeout
-}
-
-// getEffectiveHealthTimeout returns the creationTimeout set on the machine-object, otherwise returns the timeout set using the global-flag.
-func (c *controller) getEffectiveCreationTimeout(machine *v1alpha1.Machine) *metav1.Duration {
- var effectiveCreationTimeout *metav1.Duration
- if machine.Spec.MachineConfiguration != nil && machine.Spec.MachineConfiguration.MachineCreationTimeout != nil {
- effectiveCreationTimeout = machine.Spec.MachineConfiguration.MachineCreationTimeout
- } else {
- effectiveCreationTimeout = &c.safetyOptions.MachineCreationTimeout
- }
- return effectiveCreationTimeout
-}
-
-// getEffectiveNodeConditions returns the nodeConditions set on the machine-object, otherwise returns the conditions set using the global-flag.
-func (c *controller) getEffectiveNodeConditions(machine *v1alpha1.Machine) *string {
- var effectiveNodeConditions *string
- if machine.Spec.MachineConfiguration != nil && machine.Spec.MachineConfiguration.NodeConditions != nil {
- effectiveNodeConditions = machine.Spec.MachineConfiguration.NodeConditions
- } else {
- effectiveNodeConditions = &c.nodeConditions
- }
- return effectiveNodeConditions
-}
diff --git a/pkg/controller/machine_bootstrap_token.go b/pkg/controller/machine_bootstrap_token.go
deleted file mode 100644
index caa63fa32..000000000
--- a/pkg/controller/machine_bootstrap_token.go
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-(c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-Modifications Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "crypto/rand"
- "encoding/hex"
- "math/big"
- "net/url"
- "strings"
- "time"
-
- "github.com/gardener/machine-controller-manager/pkg/driver"
- v1 "k8s.io/api/core/v1"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- bootstraptokenapi "k8s.io/cluster-bootstrap/token/api"
- bootstraptokenutil "k8s.io/cluster-bootstrap/token/util"
- "k8s.io/klog/v2"
-)
-
-const placeholder = "<>"
-
-// urlEncodedPlaceholder is a placeholder that can for instance occur in ignition userdata format
-var urlEncodedPlaceholder = url.QueryEscape(placeholder)
-
-func (c *controller) addBootstrapTokenToUserData(ctx context.Context, machineName string, driver driver.Driver) error {
- userData := driver.GetUserData()
- klog.V(4).Infof("Creating bootstrap token!")
- bootstrapTokenSecret, err := c.getBootstrapTokenOrCreateIfNotExist(ctx, machineName)
- if err != nil {
- return err
- }
-
- token := bootstraptokenutil.TokenFromIDAndSecret(
- string(bootstrapTokenSecret.Data[bootstraptokenapi.BootstrapTokenIDKey]),
- string(bootstrapTokenSecret.Data[bootstraptokenapi.BootstrapTokenSecretKey]),
- )
-
- if strings.Contains(userData, placeholder) {
- klog.V(4).Infof("replacing placeholder %s with %s in user-data!", placeholder, token)
- userData = strings.ReplaceAll(userData, placeholder, token)
- } else if strings.Contains(userData, urlEncodedPlaceholder) {
- klog.V(4).Infof("replacing url encoded placeholder %s with %s in user-data!", urlEncodedPlaceholder, url.QueryEscape(token))
- userData = strings.ReplaceAll(userData, urlEncodedPlaceholder, url.QueryEscape(token))
- } else {
- klog.V(4).Info("no bootstrap token placeholder found in user-data, nothing to replace!")
- }
-
- driver.SetUserData(userData)
- return nil
-}
-
-func (c *controller) getBootstrapTokenOrCreateIfNotExist(ctx context.Context, machineName string) (secret *v1.Secret, err error) {
- tokenID, secretName := getTokenIDAndSecretName(machineName)
-
- secret, err = c.targetCoreClient.CoreV1().Secrets(metav1.NamespaceSystem).Get(ctx, secretName, metav1.GetOptions{})
- if err != nil {
- if apierrors.IsNotFound(err) {
- bootstrapTokenSecretKey, err := generateRandomStringFromCharset(16, "0123456789abcdefghijklmnopqrstuvwxyz")
- if err != nil {
- return nil, err
- }
- data := map[string][]byte{
- bootstraptokenapi.BootstrapTokenDescriptionKey: []byte("A bootstrap token generated by MachineControllManager."),
- bootstraptokenapi.BootstrapTokenIDKey: []byte(tokenID),
- bootstraptokenapi.BootstrapTokenSecretKey: []byte(bootstrapTokenSecretKey),
- bootstraptokenapi.BootstrapTokenExpirationKey: []byte(metav1.Now().Add(c.safetyOptions.MachineCreationTimeout.Duration).Format(time.RFC3339)),
- bootstraptokenapi.BootstrapTokenUsageAuthentication: []byte("true"),
- bootstraptokenapi.BootstrapTokenUsageSigningKey: []byte("true"),
- bootstraptokenapi.BootstrapTokenExtraGroupsKey: []byte(c.bootstrapTokenAuthExtraGroups),
- }
-
- secret = &v1.Secret{
- ObjectMeta: metav1.ObjectMeta{
- Name: secretName,
- Namespace: metav1.NamespaceSystem,
- },
- Type: bootstraptokenapi.SecretTypeBootstrapToken,
- Data: data,
- }
-
- return c.targetCoreClient.CoreV1().Secrets(metav1.NamespaceSystem).Create(ctx, secret, metav1.CreateOptions{})
- }
- return nil, err
- }
-
- return secret, nil
-}
-
-func (c *controller) deleteBootstrapToken(ctx context.Context, machineName string) error {
- _, secretName := getTokenIDAndSecretName(machineName)
- err := c.targetCoreClient.CoreV1().Secrets(metav1.NamespaceSystem).Delete(ctx, secretName, metav1.DeleteOptions{})
- if err != nil && apierrors.IsNotFound(err) {
- // Object no longer exists and has been deleted
- return nil
- }
- return err
-}
-
-// generateRandomStringFromCharset generates a cryptographically secure random string of the specified length .
-// The set of allowed characters can be specified. Returns error if there was a problem during the random generation.
-func generateRandomStringFromCharset(n int, allowedCharacters string) (string, error) {
- output := make([]byte, n)
- max := new(big.Int).SetInt64(int64(len(allowedCharacters)))
- for i := range output {
- randomCharacter, err := rand.Int(rand.Reader, max)
- if err != nil {
- return "", err
- }
- output[i] = allowedCharacters[randomCharacter.Int64()]
- }
- return string(output), nil
-}
-
-func getTokenIDAndSecretName(machineName string) (string, string) {
- tokenID := hex.EncodeToString([]byte(machineName)[len(machineName)-5:])[:6]
- secretName := bootstraptokenutil.BootstrapTokenSecretName(tokenID)
- return tokenID, secretName
-}
diff --git a/pkg/controller/machine_safety.go b/pkg/controller/machine_safety.go
index 3cf98bb9b..005ecdfe3 100644
--- a/pkg/controller/machine_safety.go
+++ b/pkg/controller/machine_safety.go
@@ -20,18 +20,14 @@ package controller
import (
"context"
"fmt"
- "time"
- corev1 "k8s.io/api/core/v1"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
intstrutil "k8s.io/apimachinery/pkg/util/intstr"
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
"github.com/gardener/machine-controller-manager/pkg/util/provider/cache"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/driver"
"k8s.io/klog/v2"
)
@@ -40,29 +36,13 @@ const (
OverShootingReplicaCount = "OverShootingReplicaCount"
// MachineDeploymentStateSync freeze reason when machineDeployment was found with inconsistent state
MachineDeploymentStateSync = "MachineDeploymentStateSync"
- // TimeoutOccurred freeze reason when machineSet timeout occurs
- TimeoutOccurred = "MachineSetTimeoutOccurred"
// UnfreezeAnnotation indicates the controllers to unfreeze this object
UnfreezeAnnotation = "safety.machine.sapcloud.io/unfreeze"
)
-// reconcileClusterMachineSafetyOrphanVMs checks for any orphan VMs and deletes them
-func (c *controller) reconcileClusterMachineSafetyOrphanVMs(key string) error {
- ctx := context.Background()
- reSyncAfter := c.safetyOptions.MachineSafetyOrphanVMsPeriod.Duration
- defer c.machineSafetyOrphanVMsQueue.AddAfter("", reSyncAfter)
-
- klog.V(4).Infof("reconcileClusterMachineSafetyOrphanVMs: Start")
- defer klog.V(4).Infof("reconcileClusterMachineSafetyOrphanVMs: End, reSync-Period: %v", reSyncAfter)
-
- c.checkVMObjects(ctx)
-
- return nil
-}
-
// reconcileClusterMachineSafetyOvershooting checks all machineSet/machineDeployment
// if the number of machine objects backing them is way beyond its desired replicas
-func (c *controller) reconcileClusterMachineSafetyOvershooting(key string) error {
+func (c *controller) reconcileClusterMachineSafetyOvershooting(_ string) error {
ctx := context.Background()
stopCh := make(chan struct{})
defer close(stopCh)
@@ -99,108 +79,6 @@ func (c *controller) reconcileClusterMachineSafetyOvershooting(key string) error
return err
}
-// reconcileClusterMachineSafetyAPIServer checks control and target clusters
-// and checks if their APIServer's are reachable
-// If they are not reachable, they set a machineControllerFreeze flag
-func (c *controller) reconcileClusterMachineSafetyAPIServer(key string) error {
- ctx := context.Background()
- statusCheckTimeout := c.safetyOptions.MachineSafetyAPIServerStatusCheckTimeout.Duration
- statusCheckPeriod := c.safetyOptions.MachineSafetyAPIServerStatusCheckPeriod.Duration
-
- klog.V(4).Infof("reconcileClusterMachineSafetyAPIServer: Start")
- defer klog.V(4).Infof("reconcileClusterMachineSafetyAPIServer: Stop")
-
- if c.safetyOptions.MachineControllerFrozen {
- // MachineController is frozen
- if c.isAPIServerUp(ctx) {
- // APIServer is up now, hence we need reset all machine health checks (to avoid unwanted freezes) and unfreeze
- machines, err := c.machineLister.List(labels.Everything())
- if err != nil {
- klog.Error("SafetyController: Unable to LIST machines. Error:", err)
- return err
- }
- for _, machine := range machines {
- if machine.Status.CurrentStatus.Phase == v1alpha1.MachineUnknown {
- machine, err := c.controlMachineClient.Machines(c.namespace).Get(ctx, machine.Name, metav1.GetOptions{})
- if err != nil {
- klog.Error("SafetyController: Unable to GET machines. Error:", err)
- return err
- }
-
- machine.Status.CurrentStatus = v1alpha1.CurrentStatus{
- Phase: v1alpha1.MachineRunning,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- }
- machine.Status.LastOperation = v1alpha1.LastOperation{
- Description: "Machine Health Timeout was reset due to APIServer being unreachable",
- LastUpdateTime: metav1.Now(),
- State: v1alpha1.MachineStateSuccessful,
- Type: v1alpha1.MachineOperationHealthCheck,
- }
- _, err = c.controlMachineClient.Machines(c.namespace).UpdateStatus(ctx, machine, metav1.UpdateOptions{})
- if err != nil {
- klog.Error("SafetyController: Unable to UPDATE machine/status. Error:", err)
- return err
- }
-
- klog.V(2).Info("SafetyController: Reinitializing machine health check for ", machine.Name)
- }
-
- // En-queue after 30 seconds, to ensure all machine states are reconciled
- c.enqueueMachineAfter(machine, 30*time.Second)
- }
-
- c.safetyOptions.MachineControllerFrozen = false
- c.safetyOptions.APIserverInactiveStartTime = time.Time{}
- klog.V(2).Infof("SafetyController: UnFreezing Machine Controller")
- }
- } else {
- // MachineController is not frozen
- if !c.isAPIServerUp(ctx) {
- // If APIServer is not up
- if c.safetyOptions.APIserverInactiveStartTime.Equal(time.Time{}) {
- // If timeout has not started
- c.safetyOptions.APIserverInactiveStartTime = time.Now()
- }
- if time.Now().Sub(c.safetyOptions.APIserverInactiveStartTime) > statusCheckTimeout {
- // If APIServer has been down for more than statusCheckTimeout
- c.safetyOptions.MachineControllerFrozen = true
- klog.V(2).Infof("SafetyController: Freezing Machine Controller")
- }
-
- // Re-enqueue the safety check more often if APIServer is not active and is not frozen yet
- defer c.machineSafetyAPIServerQueue.AddAfter("", statusCheckTimeout/5)
- return nil
- }
- }
-
- defer c.machineSafetyAPIServerQueue.AddAfter("", statusCheckPeriod)
- return nil
-}
-
-// isAPIServerUp returns true if APIServers are up
-// Both control and target APIServers
-func (c *controller) isAPIServerUp(ctx context.Context) bool {
- // Dummy get call to check if control APIServer is reachable
- _, err := c.controlMachineClient.Machines(c.namespace).Get(ctx, "dummy_name", metav1.GetOptions{})
- if err != nil && !apierrors.IsNotFound(err) {
- // Get returns an error other than object not found = Assume APIServer is not reachable
- klog.Error("SafetyController: Unable to GET on machine objects ", err)
- return false
- }
-
- // Dummy get call to check if target APIServer is reachable
- _, err = c.targetCoreClient.CoreV1().Nodes().Get(ctx, "dummy_name", metav1.GetOptions{})
- if err != nil && !apierrors.IsNotFound(err) {
- // Get returns an error other than object not found = Assume APIServer is not reachable
- klog.Error("SafetyController: Unable to GET on node objects ", err)
- return false
- }
-
- return true
-}
-
// unfreezeMachineDeploymentsWithUnfreezeAnnotation unfreezes machineDeployment with unfreeze annotation
func (c *controller) unfreezeMachineDeploymentsWithUnfreezeAnnotation(ctx context.Context) error {
machineDeployments, err := c.machineDeploymentLister.List(labels.Everything())
@@ -408,258 +286,17 @@ func (c *controller) checkAndFreezeORUnfreezeMachineSets(ctx context.Context) er
return nil
}
-// checkVMObjects checks for orphan VMs (VMs that don't have a machine object backing)
-func (c *controller) checkVMObjects(ctx context.Context) {
- c.checkAWSMachineClass(ctx)
- c.checkOSMachineClass(ctx)
- c.checkAzureMachineClass(ctx)
- c.checkGCPMachineClass(ctx)
- c.checkAlicloudMachineClass(ctx)
- c.checkPacketMachineClass(ctx)
-}
-
-// checkAWSMachineClass checks for orphan VMs in AWSMachinesClasses
-func (c *controller) checkAWSMachineClass(ctx context.Context) {
- AWSMachineClasses, err := c.awsMachineClassLister.List(labels.Everything())
- if err != nil {
- klog.Error("SafetyController: Error while trying to LIST machineClasses ", err)
- return
- }
-
- for _, machineClass := range AWSMachineClasses {
- c.checkMachineClass(
- ctx,
- machineClass,
- machineClass.Spec.SecretRef,
- machineClass.Spec.CredentialsSecretRef,
- machineClass.Name,
- machineClass.Kind,
- )
- }
-}
-
-// checkOSMachineClass checks for orphan VMs in OSMachinesClasses
-func (c *controller) checkOSMachineClass(ctx context.Context) {
- OSMachineClasses, err := c.openStackMachineClassLister.List(labels.Everything())
- if err != nil {
- klog.Error("SafetyController: Error while trying to LIST machineClasses ", err)
- return
- }
-
- for _, machineClass := range OSMachineClasses {
- c.checkMachineClass(
- ctx,
- machineClass,
- machineClass.Spec.SecretRef,
- machineClass.Spec.CredentialsSecretRef,
- machineClass.Name,
- machineClass.Kind,
- )
- }
-}
-
-// checkOSMachineClass checks for orphan VMs in AzureMachinesClasses
-func (c *controller) checkAzureMachineClass(ctx context.Context) {
- AzureMachineClasses, err := c.azureMachineClassLister.List(labels.Everything())
- if err != nil {
- klog.Error("SafetyController: Error while trying to LIST machineClasses ", err)
- return
- }
-
- for _, machineClass := range AzureMachineClasses {
- c.checkMachineClass(
- ctx,
- machineClass,
- machineClass.Spec.SecretRef,
- machineClass.Spec.CredentialsSecretRef,
- machineClass.Name,
- machineClass.Kind,
- )
- }
-}
-
-// checkGCPMachineClass checks for orphan VMs in GCPMachinesClasses
-func (c *controller) checkGCPMachineClass(ctx context.Context) {
- GCPMachineClasses, err := c.gcpMachineClassLister.List(labels.Everything())
- if err != nil {
- klog.Error("SafetyController: Error while trying to LIST machineClasses ", err)
- return
- }
-
- for _, machineClass := range GCPMachineClasses {
- c.checkMachineClass(
- ctx,
- machineClass,
- machineClass.Spec.SecretRef,
- machineClass.Spec.CredentialsSecretRef,
- machineClass.Name,
- machineClass.Kind,
- )
- }
-}
-
-// checkAlicloudMachineClass checks for orphan VMs in AlicloudMachinesClasses
-func (c *controller) checkAlicloudMachineClass(ctx context.Context) {
- AlicloudMachineClasses, err := c.alicloudMachineClassLister.List(labels.Everything())
- if err != nil {
- klog.Error("SafetyController: Error while trying to LIST machineClasses ", err)
- return
- }
-
- for _, machineClass := range AlicloudMachineClasses {
- c.checkMachineClass(
- ctx,
- machineClass,
- machineClass.Spec.SecretRef,
- machineClass.Spec.CredentialsSecretRef,
- machineClass.Name,
- machineClass.Kind,
- )
- }
-}
-
-// checkPacketMachineClass checks for orphan VMs in PacketMachinesClasses
-func (c *controller) checkPacketMachineClass(ctx context.Context) {
- PacketMachineClasses, err := c.packetMachineClassLister.List(labels.Everything())
- if err != nil {
- klog.Error("SafetyController: Error while trying to LIST machineClasses ", err)
- return
- }
-
- for _, machineClass := range PacketMachineClasses {
- c.checkMachineClass(
- ctx,
- machineClass,
- machineClass.Spec.SecretRef,
- machineClass.Spec.CredentialsSecretRef,
- machineClass.Name,
- machineClass.Kind,
- )
- }
-}
-
-// checkMachineClass checks a particular machineClass for orphan instances
-func (c *controller) checkMachineClass(
- ctx context.Context,
- machineClass interface{},
- secretRef *corev1.SecretReference,
- credentialsSecretRef *corev1.SecretReference,
- className string,
- classKind string) {
-
- // Get secret data
- secretData, err := c.getSecretData(className, secretRef, credentialsSecretRef)
- if err != nil || secretData == nil {
- klog.Errorf("SafetyController: Secret Data could not be computed for MachineClass: %q", className)
- return
- }
-
- // Dummy driver object being created to invoke GetVMs
- dvr := driver.NewDriver(
- "",
- secretData,
- classKind,
- machineClass,
- "",
- )
- listOfVMs, err := dvr.GetVMs("")
- if err != nil {
- klog.Errorf("SafetyController: Failed to LIST VMs at provider. Error: %s", err)
- }
-
- // Making sure that its not a VM just being created, machine object not yet updated at API server
- if len(listOfVMs) > 1 {
- stopCh := make(chan struct{})
- defer close(stopCh)
-
- if !cache.WaitForCacheSync(stopCh, c.machineSynced) {
- klog.Errorf("SafetyController: Timed out waiting for caches to sync. Error: %s", err)
- return
- }
- }
-
- for machineID, machineName := range listOfVMs {
- machine, err := c.machineLister.Machines(c.namespace).Get(machineName)
-
- if err != nil && !apierrors.IsNotFound(err) {
- // Any other types of errors
- klog.Errorf("SafetyController: Error while trying to GET machines. Error: %s", err)
- } else if err != nil || machine.Spec.ProviderID != machineID {
- // If machine exists and machine object is still been processed by the machine controller
- if err == nil &&
- (machine.Status.CurrentStatus.Phase == "" || machine.Status.CurrentStatus.Phase == v1alpha1.MachineCrashLoopBackOff) {
- klog.V(3).Infof("SafetyController: Machine object %q is being processed by machine controller, hence skipping", machine.Name)
- continue
- }
-
- // Re-check VM object existence
- // before deleting orphan VM
- result, _ := dvr.GetVMs(machineID)
- for reMachineID := range result {
- if reMachineID == machineID {
- // Get latest version of machine object and verfiy again
- machine, err := c.controlMachineClient.Machines(c.namespace).Get(ctx, machineName, metav1.GetOptions{})
- if (err != nil && apierrors.IsNotFound(err)) || machine.Spec.ProviderID != machineID {
- vm := make(map[string]string)
- vm[machineID] = machineName
- c.deleteOrphanVM(vm, secretData, classKind, machineClass)
- }
- }
- }
-
- }
- }
-}
-
-// addMachineToSafety enqueues into machineSafetyQueue when a new machine is added
-func (c *controller) addMachineToSafety(obj interface{}) {
+// addMachineToSafetyOvershooting enqueues into machineSafetyOvershootingQueue when a new machine is added
+func (c *controller) addMachineToSafetyOvershooting(obj interface{}) {
machine := obj.(*v1alpha1.Machine)
c.enqueueMachineSafetyOvershootingKey(machine)
}
-// deleteMachineToSafety enqueues into machineSafetyQueue when a new machine is deleted
-func (c *controller) deleteMachineToSafety(obj interface{}) {
- machine := obj.(*v1alpha1.Machine)
- c.enqueueMachineSafetyOrphanVMsKey(machine)
-}
-
// enqueueMachineSafetyOvershootingKey enqueues into machineSafetyOvershootingQueue
-func (c *controller) enqueueMachineSafetyOvershootingKey(obj interface{}) {
+func (c *controller) enqueueMachineSafetyOvershootingKey(_ interface{}) {
c.machineSafetyOvershootingQueue.Add("")
}
-// enqueueMachineSafetyOrphanVMsKey enqueues into machineSafetyOrphanVMsQueue
-func (c *controller) enqueueMachineSafetyOrphanVMsKey(obj interface{}) {
- c.machineSafetyOrphanVMsQueue.Add("")
-}
-
-// deleteOrphanVM teriminates's the VM on the cloud provider passed to it
-func (c *controller) deleteOrphanVM(vm driver.VMs, secretData map[string][]byte, kind string, machineClass interface{}) {
-
- var machineID string
- var machineName string
-
- for k, v := range vm {
- machineID = k
- machineName = v
- }
-
- dvr := driver.NewDriver(
- machineID,
- secretData,
- kind,
- machineClass,
- machineName,
- )
-
- err := dvr.Delete(machineID)
- if err != nil {
- klog.Errorf("SafetyController: Error while trying to DELETE VM on CP - %s. Shall retry in next safety controller sync.", err)
- } else {
- klog.V(2).Infof("SafetyController: Orphan VM found and terminated VM: %s, %s", machineName, machineID)
- }
-}
-
// freezeMachineSetAndDeployment freezes machineSet and machineDeployment (who is the owner of the machineSet)
func (c *controller) freezeMachineSetAndDeployment(ctx context.Context, machineSet *v1alpha1.MachineSet, reason string, message string) error {
diff --git a/pkg/controller/machine_safety_test.go b/pkg/controller/machine_safety_test.go
deleted file mode 100644
index b8d7cd46e..000000000
--- a/pkg/controller/machine_safety_test.go
+++ /dev/null
@@ -1,984 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package controller
-
-import (
- "context"
- "time"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- machinev1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/driver"
- cacheutil "github.com/gardener/machine-controller-manager/pkg/util/provider/cache"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/ginkgo/extensions/table"
- . "github.com/onsi/gomega"
- v1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-var _ = Describe("#machine_safety", func() {
-
- DescribeTable("##checkAndFreezeORUnfreezeMachineSets",
- func(
- machineSet *v1alpha1.MachineSet,
- machineCount int,
- FreezeMachineSet bool,
- ) {
- stop := make(chan struct{})
- defer close(stop)
-
- controlMachineObjects := []runtime.Object{}
- if machineSet != nil {
- controlMachineObjects = append(controlMachineObjects, machineSet)
- }
-
- machines := newMachinesFromMachineSet(machineCount, machineSet, nil, nil, nil)
- for _, machine := range machines {
- controlMachineObjects = append(controlMachineObjects, machine)
- }
-
- c, trackers := createController(stop, testNamespace, controlMachineObjects, nil, nil)
- waitForCacheSync(stop, c)
- defer trackers.Stop()
-
- err := c.checkAndFreezeORUnfreezeMachineSets(context.TODO())
- Expect(err).To(BeNil())
- ms, err := c.controlMachineClient.MachineSets(testNamespace).Get(context.TODO(), machineSet.Name, metav1.GetOptions{})
- Expect(err).To(BeNil())
-
- if FreezeMachineSet {
- Expect(ms.Labels["freeze"]).Should(Equal("True"))
- } else {
- Expect(ms.Labels["freeze"]).To(Equal(""))
- }
- },
-
- // When there is 1 machineSet with 1 replica and corresponding 1 machine Object
- // MachineSet is not frozen
- Entry("MachineSet with 1 replica & 1 machine object", newMachineSet(&v1alpha1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine",
- Namespace: testNamespace,
- },
- }, 1, 10, nil, nil, nil, nil), 1, false),
-
- // When there is 1 machineSet with 1 replica and corresponding 5 machine Object
- // MachineSet is frozen by adding a label on MachineSet
- Entry("MachineSet with 1 replica & 5 machine object", newMachineSet(&v1alpha1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine",
- Namespace: testNamespace,
- },
- }, 1, 10, nil, nil, nil, nil), 5, true),
-
- // When there is 1 machineSet with 5 replica and corresponding 2 machine Object
- // with a {"Freeze": "True"} label set on the MachineSe, the MachineSet is unfrozen
- // by removing a label on MachineSet
- Entry("MachineSet with 5 replica & 2 machine object", newMachineSet(&v1alpha1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine",
- Namespace: testNamespace,
- },
- }, 5, 10, nil, nil, nil, map[string]string{"Freeze": "True"}), 2, false),
- )
-
- DescribeTable("##freezeMachineSetsAndDeployments",
- func(machineSet *v1alpha1.MachineSet) {
- stop := make(chan struct{})
- defer close(stop)
-
- const freezeReason = OverShootingReplicaCount
- const freezeMessage = OverShootingReplicaCount
-
- controlMachineObjects := []runtime.Object{}
- if machineSet != nil {
- controlMachineObjects = append(controlMachineObjects, machineSet)
- }
- c, trackers := createController(stop, testNamespace, controlMachineObjects, nil, nil)
- defer trackers.Stop()
-
- machineSets, err := c.controlMachineClient.MachineSets(machineSet.Namespace).List(context.TODO(), metav1.ListOptions{})
- Expect(err).To(BeNil())
- Expect(machineSets).To(Not(BeNil()))
- for _, ms := range machineSets.Items {
- if ms.Name != machineSet.Name {
- continue
- }
-
- c.freezeMachineSetAndDeployment(context.TODO(), &ms, freezeReason, freezeMessage)
- ms, err := c.controlMachineClient.MachineSets(testNamespace).Get(context.TODO(), ms.Name, metav1.GetOptions{})
- Expect(err).To(BeNil())
- Expect(ms.Labels["freeze"]).To(Equal("True"))
- }
- },
- Entry("one machineset", newMachineSet(&v1alpha1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine",
- Namespace: testNamespace,
- },
- }, 1, 10, nil, nil, nil, nil)),
- )
-
- DescribeTable("##unfreezeMachineSetsAndDeployments",
- func(machineSetExists, machineSetIsFrozen, parentExists, parentIsFrozen bool) {
- testMachineSet := newMachineSet(&v1alpha1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine",
- Namespace: testNamespace,
- Labels: map[string]string{
- "name": "testMachineDeployment",
- },
- },
- }, 1, 10, nil, nil, nil, map[string]string{})
- if machineSetIsFrozen {
- testMachineSet.Labels["freeze"] = "True"
- msStatus := testMachineSet.Status
- mscond := NewMachineSetCondition(v1alpha1.MachineSetFrozen, v1alpha1.ConditionTrue, "testing", "freezing the machineset")
- SetCondition(&msStatus, mscond)
- }
-
- testMachineDeployment := &v1alpha1.MachineDeployment{
- ObjectMeta: metav1.ObjectMeta{
- Name: "testMachineDeployment",
- Namespace: testNamespace,
- Labels: map[string]string{},
- },
- Spec: v1alpha1.MachineDeploymentSpec{
- Selector: &metav1.LabelSelector{
- MatchLabels: map[string]string{
- "name": "testMachineDeployment",
- },
- },
- },
- }
- if parentIsFrozen {
- testMachineDeployment.Labels["freeze"] = "True"
- mdStatus := testMachineDeployment.Status
- mdCond := NewMachineDeploymentCondition(v1alpha1.MachineDeploymentFrozen, v1alpha1.ConditionTrue, "testing", "freezing the machinedeployment")
- SetMachineDeploymentCondition(&mdStatus, *mdCond)
- }
-
- stop := make(chan struct{})
- defer close(stop)
-
- controlMachineObjects := []runtime.Object{}
- if machineSetExists {
- controlMachineObjects = append(controlMachineObjects, testMachineSet)
- }
- if parentExists {
- controlMachineObjects = append(controlMachineObjects, testMachineDeployment)
- }
- c, trackers := createController(stop, testNamespace, controlMachineObjects, nil, nil)
- defer trackers.Stop()
-
- Expect(cacheutil.WaitForCacheSync(stop, c.machineSetSynced, c.machineDeploymentSynced)).To(BeTrue())
-
- c.unfreezeMachineSetAndDeployment(context.TODO(), testMachineSet)
- machineSet, err := c.controlMachineClient.MachineSets(testMachineSet.Namespace).Get(context.TODO(), testMachineSet.Name, metav1.GetOptions{})
- if machineSetExists {
- Expect(machineSet.Labels["freeze"]).Should((BeEmpty()))
- Expect(GetCondition(&machineSet.Status, v1alpha1.MachineSetFrozen)).Should(BeNil())
- machineDeployment, err := c.controlMachineClient.MachineDeployments(testMachineDeployment.Namespace).Get(context.TODO(), testMachineDeployment.Name, metav1.GetOptions{})
- if parentExists {
- //Expect(machineDeployment.Labels["freeze"]).Should((BeEmpty()))
- Expect(GetMachineDeploymentCondition(machineDeployment.Status, v1alpha1.MachineDeploymentFrozen)).Should(BeNil())
- } else {
- Expect(err).ShouldNot(BeNil())
- }
- } else {
- Expect(err).ShouldNot(BeNil())
- }
- },
-
- //Entry("Testdata format::::::", machineSetExists, machineSetFrozen, parentExists, parentFrozen)
- Entry("existing, frozen machineset and machinedeployment", true, true, true, true),
- Entry("non-existing but frozen machineset and existing, frozen machinedeployment", false, true, true, true),
- Entry("existing, frozen machineset but non-existing, frozen machinedeployment", true, true, false, true),
- )
-
- type setup struct {
- machineReplicas int
- machineSetAnnotations map[string]string
- machineSetLabels map[string]string
- machineSetConditions []v1alpha1.MachineSetCondition
- machineDeploymentAnnotations map[string]string
- machineDeploymentLabels map[string]string
- machineDeploymentConditions []v1alpha1.MachineDeploymentCondition
- }
- type action struct {
- }
- type expect struct {
- machineSetAnnotations map[string]string
- machineSetLabels map[string]string
- machineSetConditions []v1alpha1.MachineSetCondition
- machineDeploymentAnnotations map[string]string
- machineDeploymentLabels map[string]string
- machineDeploymentConditions []v1alpha1.MachineDeploymentCondition
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
-
- DescribeTable("##reconcileClusterMachineSafetyOvershooting",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineDeployment := newMachineDeployment(
- &v1alpha1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine",
- Namespace: testNamespace,
- Labels: map[string]string{
- "machine": "test",
- },
- },
- },
- 1,
- 10,
- &v1alpha1.MachineDeploymentStatus{
- Conditions: data.setup.machineDeploymentConditions,
- },
- nil,
- data.setup.machineDeploymentAnnotations,
- data.setup.machineDeploymentLabels,
- )
- machineSet := newMachineSetFromMachineDeployment(
- machineDeployment,
- 1,
- &v1alpha1.MachineSetStatus{
- Conditions: data.setup.machineSetConditions,
- },
- data.setup.machineSetAnnotations,
- data.setup.machineSetLabels,
- )
- machines := newMachinesFromMachineSet(
- data.setup.machineReplicas,
- machineSet,
- &v1alpha1.MachineStatus{},
- nil,
- nil,
- )
-
- controlMachineObjects := []runtime.Object{}
- controlMachineObjects = append(controlMachineObjects, machineDeployment)
- controlMachineObjects = append(controlMachineObjects, machineSet)
- for _, o := range machines {
- controlMachineObjects = append(controlMachineObjects, o)
- }
-
- c, trackers := createController(stop, testNamespace, controlMachineObjects, nil, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- machineSets, err := c.machineSetLister.List(labels.Everything())
- Expect(err).To(BeNil())
-
- // Validate MachineSets with Setup Data
- Expect(len(machineSets)).To(Equal(1))
-
- for k, v := range data.setup.machineSetAnnotations {
- Expect(machineSets[0].Annotations).To(HaveKeyWithValue(k, v))
- }
- for k, v := range data.setup.machineSetLabels {
- Expect(machineSets[0].Labels).To(HaveKeyWithValue(k, v))
- }
- if len(machineSets[0].Status.Conditions) > 0 {
- Expect(machineSets[0].Status.Conditions).To(ContainElements([]machinev1.MachineSetCondition(data.setup.machineSetConditions)))
- }
- // Validate MachineDeployment with the Setup Data
- machineDeployments, err := c.machineDeploymentLister.List(labels.Everything())
- Expect(err).To(BeNil())
- for k, v := range data.setup.machineDeploymentAnnotations {
- Expect(machineDeployments[0].Annotations).To(HaveKeyWithValue(k, v))
- }
- for k, v := range data.setup.machineDeploymentLabels {
- Expect(machineDeployments[0].Labels).To(HaveKeyWithValue(k, v))
- }
- if len(machineDeployments[0].Status.Conditions) > 0 {
- Expect(machineDeployments[0].Status.Conditions).To(ContainElements([]machinev1.MachineDeploymentCondition(data.setup.machineDeploymentConditions)))
- }
-
- machines, err = c.machineLister.List(labels.Everything())
- Expect(err).To(BeNil())
- Expect(len(machines)).To(Equal(data.setup.machineReplicas))
-
- c.reconcileClusterMachineSafetyOvershooting("")
-
- ms, err := c.controlMachineClient.MachineSets(testNamespace).List(context.TODO(), metav1.ListOptions{})
- Expect(err).To(BeNil())
- Expect(ms.Items[0].Labels).To(Equal(data.expect.machineSetLabels))
-
- if len(data.expect.machineSetConditions) >= 1 {
- Expect(ms.Items[0].Status.Conditions[0].Type).To(Equal(data.expect.machineSetConditions[0].Type))
- Expect(ms.Items[0].Status.Conditions[0].Status).To(Equal(data.expect.machineSetConditions[0].Status))
- Expect(ms.Items[0].Status.Conditions[0].Message).To(Equal(data.expect.machineSetConditions[0].Message))
- } else {
- Expect(len(ms.Items[0].Status.Conditions)).To(Equal(0))
- }
- Expect(len(ms.Items[0].Annotations)).To(Equal(len(data.expect.machineSetAnnotations)))
-
- machineDeploy, err := c.controlMachineClient.MachineDeployments(testNamespace).List(context.TODO(), metav1.ListOptions{})
- Expect(err).To(BeNil())
-
- Expect(machineDeploy.Items[0].Labels).To(Equal(data.expect.machineDeploymentLabels))
- Expect(len(machineDeploy.Items[0].Status.Conditions)).To(Equal(len(data.expect.machineDeploymentConditions)))
- if len(data.expect.machineDeploymentConditions) >= 1 {
- Expect(machineDeploy.Items[0].Status.Conditions[0].Type).To(Equal(data.expect.machineDeploymentConditions[0].Type))
- } else {
- Expect(len(machineDeploy.Items[0].Status.Conditions)).To(Equal(0))
- }
- Expect(len(machineDeploy.Items[0].Annotations)).To(Equal(len(data.expect.machineDeploymentAnnotations)))
- },
-
- Entry("Freeze a machineSet and its machineDeployment", &data{
- setup: setup{
- machineReplicas: 4,
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "freeze": "True",
- "machine": "test",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- }),
- Entry("Unfreeze a machineSet and its machineDeployment", &data{
- setup: setup{
- machineReplicas: 3,
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Continue to be Frozen for machineSet and its machineDeployment", &data{
- setup: setup{
- machineReplicas: 4,
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "freeze": "True",
- "machine": "test",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- }),
- Entry("Unfreezing machineset with freeze conditions and none on machinedeployment", &data{
- setup: setup{
- machineReplicas: 3,
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Unfreezing machineset with freeze label and none on machinedeployment", &data{
- setup: setup{
- machineReplicas: 3,
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Unfreezing machineset with freeze label and freeze label on machinedeployment", &data{
- setup: setup{
- machineReplicas: 3,
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Unfreezing freeze conditions on machineset and machinedeployment", &data{
- setup: setup{
- machineReplicas: 3,
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- },
- expect: expect{
- machineSetAnnotations: map[string]string{},
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentAnnotations: map[string]string{},
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Unfreeze machineSet manually and let machineDeployment continue to be frozen", &data{
- setup: setup{
- machineReplicas: 4,
- machineSetAnnotations: map[string]string{
- UnfreezeAnnotation: "True",
- },
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetAnnotations: map[string]string{},
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- }),
- Entry("Unfreeze machineDeployment manually and also triggers machineSet to be unfrozen", &data{
- setup: setup{
- machineReplicas: 4,
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentAnnotations: map[string]string{
- UnfreezeAnnotation: "True",
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
-
- machineSetLabels: map[string]string{
- "machine": "test",
- },
-
- machineDeploymentAnnotations: map[string]string{},
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Unfreeze both machineSet & machineDeployment manually", &data{
- setup: setup{
- machineReplicas: 4,
- machineSetAnnotations: map[string]string{
- UnfreezeAnnotation: "True",
- },
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentAnnotations: map[string]string{
- UnfreezeAnnotation: "True",
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetAnnotations: map[string]string{},
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentAnnotations: map[string]string{},
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Unfreeze a machineDeployment with freeze condition and no machinesets frozen", &data{
- setup: setup{
- machineReplicas: 1,
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Unfreeze a machineDeployment with freeze label and no machinesets frozen", &data{
- setup: setup{
- machineReplicas: 1,
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "machine": "test",
- },
- machineDeploymentLabels: map[string]string{},
- },
- }),
- Entry("Freeze a machineDeployment with freeze condition and machinesets frozen", &data{
- setup: setup{
- machineReplicas: 4,
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "machine": "test",
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- }),
- Entry("Freeze a machineDeployment that is not frozen and backing machineset frozen", &data{
- setup: setup{
- machineReplicas: 4,
- machineSetLabels: map[string]string{
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- expect: expect{
- machineSetLabels: map[string]string{
- "machine": "test",
- "freeze": "True",
- },
- machineSetConditions: []v1alpha1.MachineSetCondition{
- {
- Type: v1alpha1.MachineSetFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- machineDeploymentLabels: map[string]string{
- "freeze": "True",
- },
- machineDeploymentConditions: []v1alpha1.MachineDeploymentCondition{
- {
- Type: v1alpha1.MachineDeploymentFrozen,
- Status: v1alpha1.ConditionTrue,
- Message: "The number of machines backing MachineSet: machineset-0 is 4 >= 4 which is the Max-ScaleUp-Limit",
- },
- },
- },
- }),
- )
-
- const (
- zeroDuration = time.Duration(0)
- fiveSecondsDuration = 5 * time.Second
- fiveMinutesDuration = 5 * time.Minute
- )
- DescribeTable("##reconcileClusterMachineSafetyAPIServer",
- func(
- controlAPIServerIsUp bool,
- targetAPIServerIsUp bool,
- apiServerInactiveDuration time.Duration,
- preMachineControllerIsFrozen bool,
- postMachineControllerFrozen bool,
- ) {
- apiServerInactiveStartTime := time.Now().Add(-apiServerInactiveDuration)
- stop := make(chan struct{})
- defer close(stop)
-
- testMachine := &machinev1.Machine{
- ObjectMeta: metav1.ObjectMeta{
- Name: "testmachine1",
- Namespace: testNamespace,
- },
- Status: machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: v1alpha1.MachineUnknown,
- },
- },
- }
- controlMachineObjects := []runtime.Object{}
- controlMachineObjects = append(controlMachineObjects, testMachine)
-
- c, trackers := createController(stop, testNamespace, controlMachineObjects, nil, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- c.safetyOptions.APIserverInactiveStartTime = apiServerInactiveStartTime
- c.safetyOptions.MachineControllerFrozen = preMachineControllerIsFrozen
- if !controlAPIServerIsUp {
- trackers.ControlMachine.SetError("APIServer is Not Reachable")
- trackers.ControlCore.SetError("APIServer is Not Reachable")
- }
- if !targetAPIServerIsUp {
- trackers.TargetCore.SetError("APIServer is Not Reachable")
- }
-
- c.reconcileClusterMachineSafetyAPIServer("")
-
- Expect(c.safetyOptions.MachineControllerFrozen).Should(Equal(postMachineControllerFrozen))
- },
-
- // Both APIServers are reachable
- Entry("Control APIServer: Reachable, Target APIServer: Reachable, Inactive Timer: Inactive, Pre-Frozen: false = Post-Frozen: false",
- true, true, zeroDuration, false, false),
- Entry("Control APIServer: Reachable, Target APIServer: Reachable, Inactive Timer: Inactive, Pre-Frozen: true = Post-Frozen: false",
- true, true, zeroDuration, true, false),
- Entry("Control APIServer: Reachable, Target APIServer: Reachable, Inactive Timer: Started, Pre-Frozen: false = Post-Frozen: false",
- true, true, fiveSecondsDuration, false, false),
- Entry("Control APIServer: Reachable, Target APIServer: Reachable, Inactive Timer: Started, Pre-Frozen: true = Post-Frozen: false",
- true, true, fiveSecondsDuration, true, false),
- Entry("Control APIServer: Reachable, Target APIServer: Reachable, Inactive Timer: Elapsed, Pre-Frozen: false = Post-Frozen: false",
- true, true, fiveMinutesDuration, false, false),
- Entry("Control APIServer: Reachable, Target APIServer: Reachable, Inactive Timer: Elapsed, Pre-Frozen: true = Post-Frozen: false",
- true, true, fiveMinutesDuration, true, false),
-
- // Target APIServer is not reachable
- Entry("Control APIServer: Reachable, Target APIServer: UnReachable, Inactive Timer: Inactive, Pre-Frozen: false = Post-Frozen: false",
- true, false, zeroDuration, false, false),
- Entry("Control APIServer: Reachable, Target APIServer: UnReachable, Inactive Timer: Inactive, Pre-Frozen: true = Post-Frozen: true",
- true, false, zeroDuration, true, true),
- Entry("Control APIServer: Reachable, Target APIServer: UnReachable, Inactive Timer: Started, Pre-Frozen: false = Post-Frozen: false",
- true, false, fiveSecondsDuration, false, false),
- Entry("Control APIServer: Reachable, Target APIServer: UnReachable, Inactive Timer: Started, Pre-Frozen: true = Post-Frozen: true",
- true, false, fiveSecondsDuration, true, true),
- Entry("Control APIServer: Reachable, Target APIServer: UnReachable, Inactive Timer: Elapsed, Pre-Frozen: false = Post-Frozen: true",
- true, false, fiveMinutesDuration, false, true),
- Entry("Control APIServer: Reachable, Target APIServer: UnReachable, Inactive Timer: Elapsed, Pre-Frozen: true = Post-Frozen: true",
- true, false, fiveMinutesDuration, true, true),
-
- // Control APIServer is not reachable
- Entry("Control APIServer: UnReachable, Target APIServer: Reachable, Inactive Timer: Inactive, Pre-Frozen: false = Post-Frozen: false",
- false, true, zeroDuration, false, false),
- Entry("Control APIServer: UnReachable, Target APIServer: Reachable, Inactive Timer: Inactive, Pre-Frozen: true = Post-Frozen: true",
- false, true, zeroDuration, true, true),
- Entry("Control APIServer: UnReachable, Target APIServer: Reachable, Inactive Timer: Started, Pre-Frozen: false = Post-Frozen: false",
- false, true, fiveSecondsDuration, false, false),
- Entry("Control APIServer: UnReachable, Target APIServer: Reachable, Inactive Timer: Started, Pre-Frozen: true = Post-Frozen: true",
- false, true, fiveSecondsDuration, true, true),
- Entry("Control APIServer: UnReachable, Target APIServer: Reachable, Inactive Timer: Elapsed, Pre-Frozen: false = Post-Frozen: true",
- false, true, fiveMinutesDuration, false, true),
- Entry("Control APIServer: UnReachable, Target APIServer: Reachable, Inactive Timer: Elapsed, Pre-Frozen: true = Post-Frozen: true",
- false, true, fiveMinutesDuration, true, true),
-
- // Both APIServers are not reachable
- Entry("Control APIServer: UnReachable, Target APIServer: UnReachable, Inactive Timer: Inactive, Pre-Frozen: false = Post-Frozen: false",
- false, false, zeroDuration, false, false),
- Entry("Control APIServer: UnReachable, Target APIServer: UnReachable, Inactive Timer: Inactive, Pre-Frozen: true = Post-Frozen: true",
- false, false, zeroDuration, true, true),
- Entry("Control APIServer: UnReachable, Target APIServer: UnReachable, Inactive Timer: Started, Pre-Frozen: false = Post-Frozen: false",
- false, false, fiveSecondsDuration, false, false),
- Entry("Control APIServer: UnReachable, Target APIServer: UnReachable, Inactive Timer: Started, Pre-Frozen: true = Post-Frozen: true",
- false, false, fiveSecondsDuration, true, true),
- Entry("Control APIServer: UnReachable, Target APIServer: UnReachable, Inactive Timer: Elapsed, Pre-Frozen: false = Post-Frozen: true",
- false, false, fiveMinutesDuration, false, true),
- Entry("Control APIServer: UnReachable, Target APIServer: UnReachable, Inactive Timer: Elapsed, Pre-Frozen: true = Post-Frozen: true",
- false, false, fiveMinutesDuration, true, true),
- )
-})
-
-var _ = Describe("machineCrashloopBackoff", func() {
- objMeta := &metav1.ObjectMeta{
- GenerateName: "class",
- Namespace: testNamespace,
- }
-
- classKind := "MachineClass"
- secretData := map[string][]byte{
- "userData": []byte("dummy-data"),
- "azureClientId": []byte("dummy-client-id"),
- "azureClientSecret": []byte("dummy-client-secret"),
- "azureSubscriptionId": []byte("dummy-subcription-id"),
- "azureTenantId": []byte("dummy-tenant-id"),
- }
-
- Describe("machineCrashloopBackoff", func() {
-
- It("Should delete the machine (old code)", func() {
- stop := make(chan struct{})
- defer close(stop)
-
- // Create test secret and add it to controlCoreObject list
- testSecret := &v1.Secret{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-secret",
- Namespace: testNamespace,
- },
- Data: secretData,
- }
-
- // Create a test secretReference because the method checkMachineClass needs it
- testSecretReference := &v1.SecretReference{
- Name: "test-secret",
- Namespace: testNamespace,
- }
-
- testMachineClass := &machinev1.MachineClass{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- SecretRef: testSecretReference,
- }
- controlCoreObjects := []runtime.Object{}
- controlCoreObjects = append(controlCoreObjects, testSecret)
-
- // Create test machine object in CrashloopBackoff state
- testMachineObject1 := &machinev1.Machine{
- ObjectMeta: metav1.ObjectMeta{
- Name: "testmachine_1",
- Namespace: testNamespace,
- },
- Status: machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: v1alpha1.MachineCrashLoopBackOff,
- },
- },
- }
-
- // Create another test machine object in Running state
- testMachineObject2 := &machinev1.Machine{
- ObjectMeta: metav1.ObjectMeta{
- Name: "testmachine_2",
- Namespace: testNamespace,
- },
- Status: machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: v1alpha1.MachineRunning,
- },
- },
- }
-
- controlMachineObjects := []runtime.Object{}
- controlMachineObjects = append(controlMachineObjects, testMachineObject1)
- controlMachineObjects = append(controlMachineObjects, testMachineObject2)
-
- c, trackers := createController(stop, testNamespace, controlMachineObjects, controlCoreObjects, nil)
- defer trackers.Stop()
-
- fakeDriver := driver.NewDriver(
- "",
- secretData,
- classKind,
- testMachineClass,
- "",
- )
-
- // use type assertion to let Golang know that the
- // returned fakeDriver is of type *driver.FakeDriver
- fd := fakeDriver.(*driver.FakeDriver)
-
- _ = fd.Add("testmachine-ip1", "testmachine_1")
- _ = fd.Add("testmachine-ip2", "testmachine_2")
-
- waitForCacheSync(stop, c)
-
- // call checkMachineClass to delete the orphan VMs
- c.checkMachineClass(context.TODO(), testMachineClass, testSecretReference, testSecretReference, objMeta.Name, classKind)
-
- listOfVMs, _ := fakeDriver.GetVMs("")
-
- // after this, the testmachine in crashloopbackoff phase should remain and the other one should
- // be deleted because it is an orphan VM
- Expect(listOfVMs["testmachine-ip1"]).To(Equal("testmachine_1"))
- Expect(listOfVMs["testmachine-ip2"]).To(Equal(""))
- })
- })
-})
diff --git a/pkg/controller/machine_test.go b/pkg/controller/machine_test.go
deleted file mode 100644
index 7ddbf1841..000000000
--- a/pkg/controller/machine_test.go
+++ /dev/null
@@ -1,2148 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package controller
-
-import (
- "context"
- "errors"
- "fmt"
- "math"
- "net/http"
- "time"
-
- machineapi "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- machinev1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- fakemachineapi "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/typed/machine/v1alpha1/fake"
- "github.com/gardener/machine-controller-manager/pkg/driver"
- customfake "github.com/gardener/machine-controller-manager/pkg/fakeclient"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/ginkgo/extensions/table"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
- v1 "k8s.io/api/core/v1"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/apimachinery/pkg/runtime/schema"
- "k8s.io/apimachinery/pkg/util/validation/field"
- k8stesting "k8s.io/client-go/testing"
- "k8s.io/klog/v2"
-)
-
-const testNamespace = "test"
-
-var _ = Describe("machine", func() {
- var (
- fakeMachineClient *fakemachineapi.FakeMachineV1alpha1
- c *controller
- )
-
- Describe("getSecret", func() {
-
- var (
- secretRef *v1.SecretReference
- )
-
- BeforeEach(func() {
-
- secretRef = &v1.SecretReference{
- Name: "test-secret",
- Namespace: testNamespace,
- }
- })
-
- It("should return success", func() {
- stop := make(chan struct{})
- defer close(stop)
-
- testSecret := &v1.Secret{
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-secret",
- Namespace: testNamespace,
- },
- }
- objects := []runtime.Object{}
- objects = append(objects, testSecret)
-
- c, trackers := createController(stop, testNamespace, nil, objects, nil)
- defer trackers.Stop()
-
- waitForCacheSync(stop, c)
- secretRet, errRet := c.getSecret(secretRef, "test-aws")
- Expect(errRet).Should(BeNil())
- Expect(secretRet).Should(Not(BeNil()))
- Expect(secretRet).Should(Equal(testSecret))
-
- })
-
- It("should return error", func() {
- err := errors.New("secret \"test-secret\" not found")
- stop := make(chan struct{})
- defer close(stop)
-
- c, trackers := createController(stop, testNamespace, nil, nil, nil)
- defer trackers.Stop()
-
- waitForCacheSync(stop, c)
- secretRet, errRet := c.getSecret(secretRef, "test-aws")
- Expect(errRet).Should(Not(BeNil()))
- Expect(errRet.Error()).Should(Equal(err.Error()))
- Expect(secretRet).Should(BeNil())
- })
-
- })
-
- Describe("#updateMachineStatus", func() {
- var (
- machine *machinev1.Machine
- lastOperation machinev1.LastOperation
- currentStatus machinev1.CurrentStatus
- )
-
- BeforeEach(func() {
- fakeMachineClient = &fakemachineapi.FakeMachineV1alpha1{
- Fake: &k8stesting.Fake{},
- }
- c = &controller{
- controlMachineClient: fakeMachineClient,
- }
- machine = &machinev1.Machine{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine-1",
- Namespace: testNamespace,
- },
- }
- lastOperation = machinev1.LastOperation{
- Description: "test operation",
- LastUpdateTime: metav1.Now(),
- State: machinev1.MachineStateProcessing,
- Type: "Create",
- }
- currentStatus = machinev1.CurrentStatus{
- LastUpdateTime: lastOperation.LastUpdateTime,
- Phase: machinev1.MachinePending,
- TimeoutActive: true,
- }
- })
-
- It("should return error", func() {
- err := errors.New("test error")
-
- fakeMachineClient.AddReactor("get", "machines", func(action k8stesting.Action) (bool, runtime.Object, error) {
- return true, nil, err
- })
-
- machineRet, errRet := c.updateMachineStatus(context.TODO(), machine, lastOperation, currentStatus)
- Expect(errRet).Should(Not(BeNil()))
- Expect(errRet).Should(BeIdenticalTo(err))
- Expect(machineRet).Should(BeNil())
- })
-
- It("shouldn't update status when it is already same", func() {
- machine.Status.LastOperation = lastOperation
- machine.Status.CurrentStatus = currentStatus
-
- lastOperation = machinev1.LastOperation{
- Description: "test operation dummy",
- LastUpdateTime: metav1.Now(),
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationCreate,
- }
- currentStatus = machinev1.CurrentStatus{
- LastUpdateTime: lastOperation.LastUpdateTime,
- Phase: machinev1.MachinePending,
- TimeoutActive: true,
- }
-
- fakeMachineClient.AddReactor("get", "machines", func(action k8stesting.Action) (bool, runtime.Object, error) {
- return true, machine, nil
- })
-
- machineRet, errRet := c.updateMachineStatus(context.TODO(), machine, lastOperation, currentStatus)
- Expect(errRet).Should((BeNil()))
- Expect(machineRet.Status.LastOperation).Should(BeIdenticalTo(machine.Status.LastOperation))
- Expect(machineRet.Status.CurrentStatus).Should(BeIdenticalTo(machine.Status.CurrentStatus))
- })
-
- It("should return success", func() {
- fakeMachineClient.AddReactor("get", "machines", func(action k8stesting.Action) (bool, runtime.Object, error) {
- if action.(k8stesting.GetAction).GetName() == machine.GetName() {
- return true, machine, nil
- }
- return false, nil, nil
- })
-
- var machineUpdated *machinev1.Machine
- fakeMachineClient.AddReactor("update", "machines", func(action k8stesting.Action) (bool, runtime.Object, error) {
- o := action.(k8stesting.UpdateAction).GetObject()
- if o == nil {
- return false, nil, nil
- }
-
- m := o.(*machinev1.Machine)
- if m.GetName() == machine.GetName() {
- machineUpdated = m
- return true, m, nil
- }
-
- return false, nil, nil
-
- })
-
- machineRet, errRet := c.updateMachineStatus(context.TODO(), machine, lastOperation, currentStatus)
- Expect(errRet).Should(BeNil())
- Expect(machineRet).Should(Not(BeNil()))
- Expect(machineUpdated).Should(Not(BeNil()))
-
- Expect(machineUpdated).Should(Not(BeIdenticalTo(machine)))
- Expect(machineRet).Should(Not(BeIdenticalTo(machine)))
- Expect(machineRet).Should(BeIdenticalTo(machineUpdated))
- Expect(machineRet.Status.CurrentStatus).Should(BeIdenticalTo(currentStatus))
- Expect(machineRet.Status.LastOperation).Should(BeIdenticalTo(lastOperation))
- })
- })
-
- Describe("#isHealthy", func() {
- BeforeEach(func() {
- fakeMachineClient = &fakemachineapi.FakeMachineV1alpha1{
- Fake: &k8stesting.Fake{},
- }
- c = &controller{
- controlMachineClient: fakeMachineClient,
- nodeConditions: "ReadonlyFilesystem,KernelDeadlock,DiskPressure,NetworkUnavailable",
- }
- })
-
- testMachine := machinev1.Machine{
- ObjectMeta: metav1.ObjectMeta{
- Name: "testmachine",
- Namespace: testNamespace,
- },
- Status: machinev1.MachineStatus{
- Conditions: []corev1.NodeCondition{},
- },
- }
- DescribeTable("Checking health of the machine",
- func(conditionType corev1.NodeConditionType, conditionStatus corev1.ConditionStatus, expected bool) {
- testMachine.Status.Conditions = []corev1.NodeCondition{
- {
- Type: corev1.NodeReady,
- Status: corev1.ConditionTrue,
- },
- {
- Type: corev1.NodeDiskPressure,
- Status: corev1.ConditionFalse,
- },
- {
- Type: corev1.NodeMemoryPressure,
- Status: corev1.ConditionFalse,
- },
- {
- Type: corev1.NodeNetworkUnavailable,
- Status: corev1.ConditionFalse,
- },
- {
- Type: corev1.NodeReady,
- Status: corev1.ConditionTrue,
- },
- }
- for i, condition := range testMachine.Status.Conditions {
- if condition.Type == conditionType {
- testMachine.Status.Conditions[i].Status = conditionStatus
- break
- }
- }
- Expect(c.isHealthy(&testMachine)).Should(BeIdenticalTo(expected))
- },
- Entry("with NodeReady is True", corev1.NodeReady, corev1.ConditionTrue, true),
- Entry("with NodeReady is False", corev1.NodeReady, corev1.ConditionFalse, false),
- Entry("with NodeReady is Unknown", corev1.NodeReady, corev1.ConditionUnknown, false),
-
- Entry("with NodeDiskPressure is True", corev1.NodeDiskPressure, corev1.ConditionTrue, false),
- Entry("with NodeDiskPressure is False", corev1.NodeDiskPressure, corev1.ConditionFalse, true),
- Entry("with NodeDiskPressure is Unknown", corev1.NodeDiskPressure, corev1.ConditionUnknown, false),
-
- Entry("with NodeMemoryPressure is True", corev1.NodeMemoryPressure, corev1.ConditionTrue, true),
- Entry("with NodeMemoryPressure is False", corev1.NodeMemoryPressure, corev1.ConditionFalse, true),
- Entry("with NodeMemoryPressure is Unknown", corev1.NodeMemoryPressure, corev1.ConditionUnknown, true),
-
- Entry("with NodeNetworkUnavailable is True", corev1.NodeNetworkUnavailable, corev1.ConditionTrue, false),
- Entry("with NodeNetworkUnavailable is False", corev1.NodeNetworkUnavailable, corev1.ConditionFalse, true),
- Entry("with NodeNetworkUnavailable is Unknown", corev1.NodeNetworkUnavailable, corev1.ConditionUnknown, false),
-
- Entry("with NodeReady is True", corev1.NodeReady, corev1.ConditionTrue, true),
- Entry("with NodeReady is False", corev1.NodeReady, corev1.ConditionFalse, false),
- Entry("with NodeReady is Unknown", corev1.NodeReady, corev1.ConditionUnknown, false),
- )
- })
-
- Describe("##updateMachineConditions", func() {
- Describe("Update conditions of a non-existing machine", func() {
- It("should return error", func() {
- stop := make(chan struct{})
- defer close(stop)
-
- objects := []runtime.Object{}
- c, trackers := createController(stop, testNamespace, objects, nil, nil)
- defer trackers.Stop()
-
- testMachine := &machinev1.Machine{
- ObjectMeta: metav1.ObjectMeta{
- Name: "testmachine",
- Namespace: testNamespace,
- },
- Status: machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineTerminating,
- },
- },
- }
- conditions := []corev1.NodeCondition{}
- var _, err = c.updateMachineConditions(context.TODO(), testMachine, conditions)
- Expect(err).Should(Not(BeNil()))
- })
- })
- DescribeTable("Update conditions of an existing machine",
- func(phase machinev1.MachinePhase, conditions []corev1.NodeCondition, expectedPhase machinev1.MachinePhase) {
- stop := make(chan struct{})
- defer close(stop)
-
- testMachine := &machinev1.Machine{
- ObjectMeta: metav1.ObjectMeta{
- Name: "testmachine",
- Namespace: testNamespace,
- },
- Status: machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: phase,
- },
- },
- }
- objects := []runtime.Object{}
- objects = append(objects, testMachine)
-
- c, trackers := createController(stop, testNamespace, objects, nil, nil)
- defer trackers.Stop()
-
- var updatedMachine, err = c.updateMachineConditions(context.TODO(), testMachine, conditions)
- Expect(updatedMachine.Status.Conditions).Should(BeEquivalentTo(conditions))
- Expect(updatedMachine.Status.CurrentStatus.Phase).Should(BeIdenticalTo(expectedPhase))
- Expect(err).Should(BeNil())
- },
- Entry("healthy status but machine terminating", machinev1.MachineTerminating, []corev1.NodeCondition{
- {
- Type: corev1.NodeReady,
- Status: corev1.ConditionTrue,
- },
- }, machinev1.MachineTerminating),
- Entry("unhealthy status but machine running", machinev1.MachineRunning, []corev1.NodeCondition{
- {
- Type: corev1.NodeReady,
- Status: corev1.ConditionFalse,
- },
- }, machinev1.MachineUnknown),
- Entry("healthy status but machine not running", machinev1.MachineAvailable, []corev1.NodeCondition{
- {
- Type: corev1.NodeReady,
- Status: corev1.ConditionTrue,
- },
- }, machinev1.MachineRunning),
- )
- })
-
- Describe("#ValidateMachine", func() {
- type data struct {
- action machineapi.Machine
- expect field.ErrorList
- }
- DescribeTable("#happy path",
- func(data *data) {
- errList := validation.ValidateMachine(&data.action)
- Expect(errList).To(Equal(data.expect))
- },
- Entry("aws", &data{
- action: machineapi.Machine{
- Spec: machineapi.MachineSpec{
- Class: machineapi.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "aws",
- },
- },
- },
- expect: field.ErrorList{},
- }),
- )
- })
-
- Describe("#isMachineStatusEqual", func() {
- type expect struct {
- equal bool
- }
- type action struct {
- s1 machinev1.MachineStatus
- s2 machinev1.MachineStatus
- }
- type data struct {
- action action
- expect expect
- }
-
- lastOperation := machinev1.LastOperation{
- Description: "test operation",
- LastUpdateTime: metav1.Now(),
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationCreate,
- }
- currentStatus := machinev1.CurrentStatus{
- LastUpdateTime: lastOperation.LastUpdateTime,
- Phase: machinev1.MachinePending,
- TimeoutActive: true,
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- equal := isMachineStatusEqual(data.action.s1, data.action.s2)
- Expect(equal).To(Equal(data.expect.equal))
- },
- Entry("return true as status is same", &data{
- action: action{
- s1: machinev1.MachineStatus{
- LastOperation: lastOperation,
- CurrentStatus: currentStatus,
- },
- s2: machinev1.MachineStatus{
- LastOperation: lastOperation,
- CurrentStatus: currentStatus,
- },
- },
- expect: expect{
- equal: true,
- },
- }),
- Entry("return false as status is not equal", &data{
- action: action{
- s1: machinev1.MachineStatus{
- LastOperation: lastOperation,
- CurrentStatus: currentStatus,
- },
- s2: machinev1.MachineStatus{
- LastOperation: machinev1.LastOperation{
- Description: "test operation dummy",
- LastUpdateTime: metav1.Now(),
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationDelete,
- },
- CurrentStatus: machinev1.CurrentStatus{
- LastUpdateTime: lastOperation.LastUpdateTime,
- Phase: machinev1.MachinePending,
- TimeoutActive: true,
- },
- },
- },
- expect: expect{
- equal: false,
- },
- }),
- Entry("return true as only description is not same", &data{
- action: action{
- s1: machinev1.MachineStatus{
- LastOperation: lastOperation,
- CurrentStatus: currentStatus,
- },
- s2: machinev1.MachineStatus{
- LastOperation: machinev1.LastOperation{
- Description: "test operation dummy dummy",
- LastUpdateTime: metav1.Now(),
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationCreate,
- },
- CurrentStatus: machinev1.CurrentStatus{
- LastUpdateTime: lastOperation.LastUpdateTime,
- Phase: machinev1.MachinePending,
- TimeoutActive: true,
- },
- },
- },
- expect: expect{
- equal: true,
- },
- }),
- )
- })
-
- Describe("#validateMachineClass", func() {
- type setup struct {
- aws []*machinev1.AWSMachineClass
- secrets []*corev1.Secret
- }
- type expect struct {
- machineClass interface{}
- secret *corev1.Secret
- err bool
- }
- type data struct {
- setup setup
- action *machinev1.ClassSpec
- expect expect
- }
-
- objMeta := &metav1.ObjectMeta{
- GenerateName: "class",
- Namespace: testNamespace,
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineObjects := []runtime.Object{}
- for _, o := range data.setup.aws {
- machineObjects = append(machineObjects, o)
- }
-
- coreObjects := []runtime.Object{}
- for _, o := range data.setup.secrets {
- coreObjects = append(coreObjects, o)
- }
-
- controller, trackers := createController(stop, objMeta.Namespace, machineObjects, nil, coreObjects)
- defer trackers.Stop()
-
- waitForCacheSync(stop, controller)
- machineClass, secret, err := controller.validateMachineClass(data.action)
-
- if data.expect.machineClass == nil {
- Expect(machineClass).To(BeNil())
- } else {
- Expect(machineClass).To(Equal(data.expect.machineClass))
- }
- if data.expect.secret == nil {
- Expect(secret).To(BeNil())
- } else {
- Expect(secret).To(Equal(data.expect.secret))
- }
- if !data.expect.err {
- Expect(err).To(BeNil())
- } else {
- Expect(err).To(HaveOccurred())
- }
- },
- Entry("non-existing machine class", &data{
- setup: setup{
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- },
- action: &machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "non-existing",
- },
- expect: expect{
- err: true,
- },
- }),
- Entry("non-existing secret", &data{
- setup: setup{
- secrets: []*corev1.Secret{},
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- },
- action: &machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "class-0",
- },
- expect: expect{
- machineClass: &machinev1.AWSMachineClass{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- err: false, //TODO Why? Create issue
- },
- }),
- Entry("valid", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- },
- action: &machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "class-0",
- },
- expect: expect{
- machineClass: &machinev1.AWSMachineClass{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- err: false,
- },
- }),
- )
- })
-
- Describe("#machineCreate", func() {
- type setup struct {
- secrets []*corev1.Secret
- aws []*machinev1.AWSMachineClass
- openstack []*machinev1.OpenStackMachineClass
- machines []*machinev1.Machine
- fakeResourceActions *customfake.ResourceActions
- }
- type action struct {
- machine string
- fakeProviderID string
- fakeNodeName string
- fakeError error
- }
- type expect struct {
- machine *machinev1.Machine
- err bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
- objMeta := &metav1.ObjectMeta{
- GenerateName: "machine",
- Namespace: "test",
- }
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineObjects := []runtime.Object{}
- for _, o := range data.setup.aws {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range data.setup.openstack {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range data.setup.machines {
- machineObjects = append(machineObjects, o)
- }
-
- coreObjects := []runtime.Object{}
- for _, o := range data.setup.secrets {
- coreObjects = append(coreObjects, o)
- }
-
- controller, trackers := createController(stop, objMeta.Namespace, machineObjects, nil, coreObjects)
- defer trackers.Stop()
-
- waitForCacheSync(stop, controller)
-
- action := data.action
- machine, err := controller.controlMachineClient.Machines(objMeta.Namespace).Get(context.TODO(), action.machine, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
-
- if data.setup.fakeResourceActions != nil {
- trackers.ControlMachine.SetFakeResourceActions(data.setup.fakeResourceActions, 1)
- }
-
- err = controller.machineCreate(context.TODO(), machine, driver.NewFakeDriver(
- func() (string, string, error) {
- return action.fakeProviderID, action.fakeNodeName, action.fakeError
- },
- func(string, string) error {
- return nil
- },
- func(string) error {
- return action.fakeError
- }, nil,
- func() (driver.VMs, error) {
- return map[string]string{}, nil
- }, nil, nil, nil,
- ))
-
- if data.expect.err {
- Expect(err).To(HaveOccurred())
- return
- }
-
- Expect(err).To(BeNil())
- actual, err := controller.controlMachineClient.Machines(machine.Namespace).Get(context.TODO(), machine.Name, metav1.GetOptions{})
- Expect(err).To(BeNil())
- Expect(actual.Spec).To(Equal(data.expect.machine.Spec))
- Expect(actual.Labels).ToNot(BeNil())
- Expect(actual.Labels[v1alpha1.NodeLabelKey]).To(Equal(data.expect.machine.Labels[v1alpha1.NodeLabelKey]))
- //TODO Conditions
- },
- Entry("OpenStackSimple", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- openstack: []*machinev1.OpenStackMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.OpenStackMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "OpenStackMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: fmt.Errorf("Test Error"),
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "OpenStackMachineClass",
- Name: "machine-0",
- },
- },
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: "Failed",
- },
- LastOperation: machinev1.LastOperation{
- Description: "Cloud provider message - Test Error",
- },
- }, nil, nil, nil),
- err: true,
- },
- }),
- Entry("AWSSimple", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- ProviderID: "fakeID",
- },
- }, &machinev1.MachineStatus{
- //TODO conditions
- }, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "fakeNode-0"}),
- err: false,
- },
- }),
- Entry("Machine creation success even on temporary APIServer disruption", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- fakeResourceActions: &customfake.ResourceActions{
- Machine: customfake.Actions{
- Get: apierrors.NewGenericServerResponse(
- http.StatusBadRequest,
- "dummy method",
- schema.GroupResource{},
- "dummy name",
- "Failed to GET machine",
- 30,
- true,
- ),
- },
- },
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- ProviderID: "fakeID",
- },
- }, &machinev1.MachineStatus{
- //TODO conditions
- }, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "fakeNode-0"}),
- err: false,
- },
- }),
- Entry("Orphan VM deletion on failing to find referred machine object", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- fakeResourceActions: &customfake.ResourceActions{
- Machine: customfake.Actions{
- Get: apierrors.NewGenericServerResponse(
- http.StatusNotFound,
- "dummy method",
- schema.GroupResource{},
- "dummy name",
- "Machine not found",
- 30,
- true,
- ),
- },
- },
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- },
- expect: expect{
- err: true,
- },
- }),
- Entry("If ProviderID is available and node-name missing, ProviderID should be set back on machine object", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- fakeResourceActions: &customfake.ResourceActions{
- Machine: customfake.Actions{
- Get: apierrors.NewGenericServerResponse(
- http.StatusBadRequest,
- "dummy method",
- schema.GroupResource{},
- "dummy name",
- "Failed to GET machine",
- 30,
- true,
- ),
- },
- },
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "providerid-0",
- fakeNodeName: "",
- fakeError: nil,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- ProviderID: "providerid",
- },
- }, &machinev1.MachineStatus{
- //TODO conditions
- }, nil, nil, map[string]string{v1alpha1.NodeLabelKey: ""}),
- err: false,
- },
- }),
- )
- })
-
- Describe("#machineDelete", func() {
- type setup struct {
- secrets []*corev1.Secret
- aws []*machinev1.AWSMachineClass
- machines []*machinev1.Machine
- fakeResourceActions *customfake.ResourceActions
- }
- type action struct {
- machine string
- fakeProviderID string
- fakeNodeName string
- nodeRecentlyNotReady *bool
- fakeDriverGetVMs func() (driver.VMs, error)
- fakeError error
- forceDeleteLabelPresent bool
- fakeMachineStatus *machinev1.MachineStatus
- }
- type expect struct {
- machine *machinev1.Machine
- errOccurred bool
- machineDeleted bool
- nodeDeleted bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
- objMeta := &metav1.ObjectMeta{
- GenerateName: "machine",
- Namespace: "test",
- }
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineObjects := []runtime.Object{}
- for _, o := range data.setup.aws {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range data.setup.machines {
- machineObjects = append(machineObjects, o)
- }
-
- coreObjects := []runtime.Object{}
- for _, o := range data.setup.secrets {
- coreObjects = append(coreObjects, o)
- }
-
- controller, trackers := createController(stop, objMeta.Namespace, machineObjects, nil, coreObjects)
- defer trackers.Stop()
- waitForCacheSync(stop, controller)
-
- action := data.action
- machine, err := controller.controlMachineClient.Machines(objMeta.Namespace).Get(context.TODO(), action.machine, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
-
- fakeDriverGetVMsTemp := func() (driver.VMs, error) { return nil, nil }
-
- if action.fakeDriverGetVMs != nil {
- fakeDriverGetVMsTemp = action.fakeDriverGetVMs
- }
-
- fakeDriver := driver.NewFakeDriver(
- func() (string, string, error) {
- _, err := controller.targetCoreClient.CoreV1().Nodes().Create(context.TODO(), &v1.Node{
- ObjectMeta: metav1.ObjectMeta{
- Name: action.fakeNodeName,
- },
- }, metav1.CreateOptions{})
- if err != nil {
- return "", "", err
- }
- return action.fakeProviderID, action.fakeNodeName, action.fakeError
- },
- func(string, string) error {
- return nil
- },
- func(string) error {
- return nil
- },
- func() (string, error) {
- return action.fakeProviderID, action.fakeError
- },
- fakeDriverGetVMsTemp,
- nil, nil, nil,
- )
-
- // Create a machine that is to be deleted later
- err = controller.machineCreate(context.TODO(), machine, fakeDriver)
- Expect(err).ToNot(HaveOccurred())
-
- // Add finalizers
- controller.addMachineFinalizers(context.TODO(), machine)
-
- // Fetch the latest machine version
- machine, err = controller.controlMachineClient.Machines(objMeta.Namespace).Get(context.TODO(), action.machine, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
-
- if data.action.forceDeleteLabelPresent {
- // Add labels for force deletion
- clone := machine.DeepCopy()
- clone.Labels["force-deletion"] = "True"
- machine, err = controller.controlMachineClient.Machines(objMeta.Namespace).Update(context.TODO(), clone, metav1.UpdateOptions{})
- Expect(err).ToNot(HaveOccurred())
- }
-
- if data.action.fakeMachineStatus != nil {
- clone := machine.DeepCopy()
- clone.Status = *data.action.fakeMachineStatus
- machine, err = controller.controlMachineClient.Machines(objMeta.Namespace).UpdateStatus(context.TODO(), clone, metav1.UpdateOptions{})
- Expect(err).ToNot(HaveOccurred())
- }
-
- if data.action.nodeRecentlyNotReady != nil {
- node, nodeErr := controller.targetCoreClient.CoreV1().Nodes().Get(context.TODO(), machine.Labels[v1alpha1.NodeLabelKey], metav1.GetOptions{})
- Expect(nodeErr).To(Not(HaveOccurred()))
- clone := node.DeepCopy()
- newNodeCondition := corev1.NodeCondition{
- Type: v1.NodeReady,
- Status: corev1.ConditionUnknown,
- }
-
- if *data.action.nodeRecentlyNotReady {
- newNodeCondition.LastTransitionTime = metav1.Time{Time: time.Now()}
- } else {
- newNodeCondition.LastTransitionTime = metav1.Time{Time: time.Now().Add(-time.Hour)}
- }
-
- clone.Status.Conditions = []corev1.NodeCondition{newNodeCondition}
- _, updateErr := controller.targetCoreClient.CoreV1().Nodes().UpdateStatus(context.TODO(), clone, metav1.UpdateOptions{})
- Expect(updateErr).To(BeNil())
- }
-
- if data.setup.fakeResourceActions != nil {
- trackers.TargetCore.SetFakeResourceActions(data.setup.fakeResourceActions, math.MaxInt32)
- }
-
- // Deletion of machine is triggered
- err = controller.machineDelete(context.TODO(), machine, fakeDriver)
- if data.expect.errOccurred {
- Expect(err).To(HaveOccurred())
- } else {
- Expect(err).ToNot(HaveOccurred())
- }
-
- node, nodeErr := controller.targetCoreClient.CoreV1().Nodes().Get(context.TODO(), machine.Labels[v1alpha1.NodeLabelKey], metav1.GetOptions{})
- machine, machineErr := controller.controlMachineClient.Machines(machine.Namespace).Get(context.TODO(), machine.Name, metav1.GetOptions{})
-
- if data.expect.machineDeleted {
- Expect(machineErr).To(HaveOccurred())
- } else {
- Expect(machineErr).ToNot(HaveOccurred())
- Expect(machine).ToNot(BeNil())
- }
-
- if data.expect.nodeDeleted {
- Expect(nodeErr).To(HaveOccurred())
- } else {
- Expect(nodeErr).ToNot(HaveOccurred())
- Expect(node).ToNot(BeNil())
- }
- },
- Entry("Simple machine deletion", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- },
- expect: expect{
- errOccurred: false,
- machineDeleted: true,
- nodeDeleted: true,
- },
- }),
- Entry("Allow proper deletion of the machine object when providerID is missing but actual VM still exists in cloud", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- //fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- fakeDriverGetVMs: func() (driver.VMs, error) {
- return map[string]string{"fakeID-0": "machine-0"}, nil
- },
- },
- expect: expect{
- errOccurred: false,
- machineDeleted: true,
- nodeDeleted: true,
- },
- }),
- Entry("Machine deletion when drain fails", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- fakeResourceActions: &customfake.ResourceActions{
- Node: customfake.Actions{
- Update: "Failed to update nodes",
- },
- },
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- },
- expect: expect{
- errOccurred: true,
- machineDeleted: false,
- nodeDeleted: false,
- },
- }),
- Entry("Machine force deletion label is present", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- forceDeleteLabelPresent: true,
- },
- expect: expect{
- errOccurred: false,
- machineDeleted: true,
- nodeDeleted: true,
- },
- }),
- Entry("Machine force deletion label is present and when drain call fails (APIServer call fails)", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- fakeResourceActions: &customfake.ResourceActions{
- Node: customfake.Actions{
- Update: "Failed to update nodes",
- },
- },
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- forceDeleteLabelPresent: true,
- },
- expect: expect{
- errOccurred: false,
- machineDeleted: true,
- nodeDeleted: true,
- },
- }),
- Entry("Machine deletion when timeout occurred", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- fakeMachineStatus: &machinev1.MachineStatus{
- LastOperation: machinev1.LastOperation{
- Description: "Deleting machine from cloud provider",
- State: v1alpha1.MachineStateProcessing,
- Type: v1alpha1.MachineOperationDelete,
- LastUpdateTime: metav1.Now(),
- },
- CurrentStatus: machinev1.CurrentStatus{
- Phase: v1alpha1.MachineTerminating,
- TimeoutActive: false,
- // Updating last update time to 30 minutes before now
- LastUpdateTime: metav1.NewTime(time.Now().Add(-30 * time.Minute)),
- },
- },
- },
- expect: expect{
- errOccurred: false,
- machineDeleted: true,
- nodeDeleted: true,
- },
- }),
- Entry("Machine deletion when last drain failed", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- fakeMachineStatus: &machinev1.MachineStatus{
- LastOperation: machinev1.LastOperation{
- Description: "Drain failed - for random reason",
- State: v1alpha1.MachineStateFailed,
- Type: v1alpha1.MachineOperationDelete,
- LastUpdateTime: metav1.Now(),
- },
- CurrentStatus: machinev1.CurrentStatus{
- Phase: v1alpha1.MachineTerminating,
- TimeoutActive: false,
- LastUpdateTime: metav1.NewTime(time.Now().Add(-2 * time.Minute)),
- },
- },
- },
- expect: expect{
- errOccurred: false,
- machineDeleted: true,
- nodeDeleted: true,
- },
- }),
- Entry("Machine deletion when last drain failed and current drain call also fails (APIServer call fails)", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- fakeResourceActions: &customfake.ResourceActions{
- Node: customfake.Actions{
- Update: "Failed to update nodes",
- },
- },
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- fakeMachineStatus: &machinev1.MachineStatus{
- LastOperation: machinev1.LastOperation{
- Description: "Drain failed - for random reason",
- State: v1alpha1.MachineStateFailed,
- Type: v1alpha1.MachineOperationDelete,
- LastUpdateTime: metav1.Now(),
- },
- CurrentStatus: machinev1.CurrentStatus{
- Phase: v1alpha1.MachineTerminating,
- TimeoutActive: false,
- LastUpdateTime: metav1.NewTime(time.Now().Add(-2 * time.Minute)),
- },
- },
- },
- expect: expect{
- errOccurred: true,
- machineDeleted: false,
- nodeDeleted: false,
- },
- }),
- Entry("Machine force deletion if underlying Node is NotReady for a long time", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- nodeRecentlyNotReady: func() *bool { ret := false; return &ret }(),
- },
- expect: expect{
- errOccurred: false,
- machineDeleted: true,
- nodeDeleted: true,
- },
- }),
- Entry("Machine do not force deletion if underlying Node is NotReady for a small period of time, a Machine deletion fails, since kubelet fails to evict Pods", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- fakeResourceActions: &customfake.ResourceActions{
- Node: customfake.Actions{
- Update: "Failed to update nodes",
- },
- },
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "fakeNode-0",
- fakeError: nil,
- nodeRecentlyNotReady: func() *bool { ret := true; return &ret }(),
- },
- expect: expect{
- errOccurred: true,
- machineDeleted: false,
- nodeDeleted: false,
- },
- }),
- Entry("Allow machine object deletion where nodeName doesn't exist", &data{
- setup: setup{
- secrets: []*corev1.Secret{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- },
- aws: []*machinev1.AWSMachineClass{
- {
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.AWSMachineClassSpec{
- SecretRef: newSecretReference(objMeta, 0),
- },
- },
- },
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "machine-0",
- },
- },
- }, nil, nil, nil, nil),
- },
- action: action{
- machine: "machine-0",
- fakeProviderID: "fakeID-0",
- fakeNodeName: "", //NodeName is set to emptyString
- fakeError: nil,
- },
- expect: expect{
- errOccurred: false,
- machineDeleted: true,
- nodeDeleted: false,
- },
- }),
- )
- })
-
- Describe("#checkMachineTimeout", func() {
- type setup struct {
- machines []*machinev1.Machine
- }
- type action struct {
- machine string
- }
- type expect struct {
- machine *machinev1.Machine
- err bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
- objMeta := &metav1.ObjectMeta{
- GenerateName: "machine",
- Namespace: "test",
- }
-
- machineName := "machine-0"
- timeOutOccurred := -21 * time.Minute
- timeOutNotOccurred := -5 * time.Minute
- creationTimeOut := 20 * time.Minute
- healthTimeOut := 10 * time.Minute
-
- DescribeTable("##Machine Timeout Scenarios",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineObjects := []runtime.Object{}
- for _, o := range data.setup.machines {
- machineObjects = append(machineObjects, o)
- }
-
- coreObjects := []runtime.Object{}
-
- controller, trackers := createController(stop, objMeta.Namespace, machineObjects, nil, coreObjects)
- defer trackers.Stop()
- waitForCacheSync(stop, controller)
-
- action := data.action
- machine, err := controller.controlMachineClient.Machines(objMeta.Namespace).Get(context.TODO(), action.machine, metav1.GetOptions{})
- //Expect(err).ToNot(HaveOccurred())
-
- controller.checkMachineTimeout(context.TODO(), machine)
-
- actual, err := controller.controlMachineClient.Machines(machine.Namespace).Get(context.TODO(), machine.Name, metav1.GetOptions{})
- Expect(err).To(BeNil())
- Expect(actual.Status.CurrentStatus.Phase).To(Equal(data.expect.machine.Status.CurrentStatus.Phase))
- Expect(actual.Status.CurrentStatus.TimeoutActive).To(Equal(data.expect.machine.Status.CurrentStatus.TimeoutActive))
- Expect(actual.Status.LastOperation.Description).To(Equal(data.expect.machine.Status.LastOperation.Description))
- Expect(actual.Status.LastOperation.State).To(Equal(data.expect.machine.Status.LastOperation.State))
- Expect(actual.Status.LastOperation.Type).To(Equal(data.expect.machine.Status.LastOperation.Type))
- },
- Entry("Machine is still running", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineRunning,
- TimeoutActive: false,
- LastUpdateTime: metav1.NewTime(time.Now().Add(timeOutNotOccurred)),
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf("Machine % successfully joined the cluster", machineName),
- State: machinev1.MachineStateSuccessful,
- Type: machinev1.MachineOperationCreate,
- LastUpdateTime: metav1.NewTime(time.Now().Add(timeOutNotOccurred)),
- },
- }, nil, nil, nil),
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineRunning,
- TimeoutActive: false,
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf("Machine % successfully joined the cluster", machineName),
- State: machinev1.MachineStateSuccessful,
- Type: machinev1.MachineOperationCreate,
- },
- }, nil, nil, nil),
- },
- }),
- Entry("Machine creation has still not timed out", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineUnknown,
- TimeoutActive: true,
- LastUpdateTime: metav1.NewTime(time.Now().Add(timeOutNotOccurred)),
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf("Machine %s is unhealthy - changing MachineState to Unknown", machineName),
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationCreate,
- LastUpdateTime: metav1.NewTime(time.Now().Add(timeOutNotOccurred)),
- },
- }, nil, nil, nil),
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineUnknown,
- TimeoutActive: true,
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf("Machine %s is unhealthy - changing MachineState to Unknown", machineName),
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationCreate,
- },
- }, nil, nil, nil),
- },
- }),
- Entry("Machine creation has timed out", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachinePending,
- TimeoutActive: true,
- LastUpdateTime: metav1.NewTime(time.Now().Add(timeOutOccurred)),
- },
- LastOperation: machinev1.LastOperation{
- Description: "Creating machine on cloud provider",
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationCreate,
- LastUpdateTime: metav1.NewTime(time.Now().Add(timeOutOccurred)),
- },
- }, nil, nil, nil),
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineFailed,
- TimeoutActive: false,
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf(
- "Machine %s failed to join the cluster in %s minutes.",
- machineName,
- creationTimeOut,
- ),
- State: machinev1.MachineStateFailed,
- Type: machinev1.MachineOperationCreate,
- },
- }, nil, nil, nil),
- },
- }),
- Entry("Machine health has timed out", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineUnknown,
- TimeoutActive: true,
- LastUpdateTime: metav1.NewTime(time.Now().Add(timeOutOccurred)),
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf("Machine %s is unhealthy - changing MachineState to Unknown", machineName),
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationHealthCheck,
- LastUpdateTime: metav1.NewTime(time.Now().Add(timeOutOccurred)),
- },
- }, nil, nil, nil),
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineFailed,
- TimeoutActive: false,
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf(
- "Machine %s is not healthy since %s minutes. Changing status to failed. Node Conditions: %+v",
- machineName,
- healthTimeOut,
- []corev1.NodeCondition{},
- ),
- State: machinev1.MachineStateFailed,
- Type: machinev1.MachineOperationHealthCheck,
- },
- }, nil, nil, nil),
- },
- }),
- )
- })
-
- Describe("#updateMachineState", func() {
- type setup struct {
- machines []*machinev1.Machine
- nodes []*corev1.Node
- }
- type action struct {
- machine string
- }
- type expect struct {
- machine *machinev1.Machine
- err bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
- objMeta := &metav1.ObjectMeta{
- GenerateName: "machine",
- // using default namespace for non-namespaced objects
- // as our current fake client is with the assumption
- // that all objects are namespaced
- Namespace: "test",
- }
-
- machineName := "machine-0"
-
- DescribeTable("##Different machine state update scenarios",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineObjects := []runtime.Object{}
- for _, o := range data.setup.machines {
- machineObjects = append(machineObjects, o)
- }
-
- coreObjects := []runtime.Object{}
- for _, o := range data.setup.nodes {
- coreObjects = append(coreObjects, o)
- }
-
- controller, trackers := createController(stop, objMeta.Namespace, machineObjects, nil, coreObjects)
- defer trackers.Stop()
- waitForCacheSync(stop, controller)
-
- action := data.action
- machine, err := controller.controlMachineClient.Machines(objMeta.Namespace).Get(context.TODO(), action.machine, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
-
- controller.updateMachineState(context.TODO(), machine)
- node, _ := controller.targetCoreClient.CoreV1().Nodes().Get(context.TODO(), "machine-0", metav1.GetOptions{})
- klog.Error(node)
-
- actual, err := controller.controlMachineClient.Machines(objMeta.Namespace).Get(context.TODO(), action.machine, metav1.GetOptions{})
-
- Expect(err).To(BeNil())
- Expect(actual.Name).To(Equal(data.expect.machine.Name))
- Expect(actual.Status.CurrentStatus.Phase).To(Equal(data.expect.machine.Status.CurrentStatus.Phase))
- Expect(actual.Status.CurrentStatus.TimeoutActive).To(Equal(data.expect.machine.Status.CurrentStatus.TimeoutActive))
- Expect(actual.Status.LastOperation.State).To(Equal(data.expect.machine.Status.LastOperation.State))
- Expect(actual.Status.LastOperation.Type).To(Equal(data.expect.machine.Status.LastOperation.Type))
- Expect(actual.Status.LastOperation.Description).To(Equal(data.expect.machine.Status.LastOperation.Description))
-
- if data.expect.machine.Labels != nil {
- if _, ok := data.expect.machine.Labels[v1alpha1.NodeLabelKey]; ok {
- Expect(actual.Labels[v1alpha1.NodeLabelKey]).To(Equal(data.expect.machine.Labels[v1alpha1.NodeLabelKey]))
- }
- }
-
- for i := range actual.Status.Conditions {
- Expect(actual.Status.Conditions[i].Type).To(Equal(data.expect.machine.Status.Conditions[i].Type))
- Expect(actual.Status.Conditions[i].Status).To(Equal(data.expect.machine.Status.Conditions[i].Status))
- Expect(actual.Status.Conditions[i].Reason).To(Equal(data.expect.machine.Status.Conditions[i].Reason))
- Expect(actual.Status.Conditions[i].Message).To(Equal(data.expect.machine.Status.Conditions[i].Message))
- }
- },
- Entry("Machine does not have a node backing", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{}, nil, nil, nil),
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{}, nil, nil, nil),
- },
- }),
- Entry("Node object backing machine not found and machine conditions are empty", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{}, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "dummy-node"}),
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{}, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "dummy-node"}),
- },
- }),
- Entry("Machine is running but node object is lost", &data{
- setup: setup{
- machines: newMachines(
- 1,
- &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- },
- &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineRunning,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf("Machine % successfully joined the cluster", machineName),
- State: machinev1.MachineStateSuccessful,
- Type: machinev1.MachineOperationCreate,
- LastUpdateTime: metav1.Now(),
- },
- Conditions: []corev1.NodeCondition{
- {
- Message: "kubelet is posting ready status",
- Reason: "KubeletReady",
- Status: "True",
- Type: "Ready",
- },
- },
- }, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "dummy-node"}),
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineUnknown,
- TimeoutActive: true,
- LastUpdateTime: metav1.Now(),
- },
- LastOperation: machinev1.LastOperation{
- Description: fmt.Sprintf(
- "Node object went missing. Machine %s is unhealthy - changing MachineState to Unknown",
- machineName,
- ),
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationHealthCheck,
- LastUpdateTime: metav1.Now(),
- },
- Conditions: []corev1.NodeCondition{
- {
- Message: "kubelet is posting ready status",
- Reason: "KubeletReady",
- Status: "True",
- Type: "Ready",
- },
- },
- }, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "dummy-node"}),
- },
- }),
- Entry("Machine and node both are present and kubelet ready status is updated", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachinePending,
- TimeoutActive: true,
- LastUpdateTime: metav1.Now(),
- },
- LastOperation: machinev1.LastOperation{
- Description: "Creating machine on cloud provider",
- State: machinev1.MachineStateProcessing,
- Type: machinev1.MachineOperationCreate,
- LastUpdateTime: metav1.Now(),
- },
- Conditions: []corev1.NodeCondition{
- {
- Message: "kubelet is not ready",
- Reason: "KubeletReady",
- Status: "False",
- Type: "Ready",
- },
- },
- }, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "node-0"}),
- nodes: []*corev1.Node{
- {
- TypeMeta: metav1.TypeMeta{
- Kind: "Node",
- APIVersion: "v1",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "node-0",
- },
- Status: corev1.NodeStatus{
- Conditions: []corev1.NodeCondition{
- {
- Message: "kubelet is posting ready status",
- Reason: "KubeletReady",
- Status: "True",
- Type: "Ready",
- },
- },
- },
- },
- },
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- }, &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{
- Phase: machinev1.MachineRunning,
- TimeoutActive: false,
- LastUpdateTime: metav1.Now(),
- },
- LastOperation: machinev1.LastOperation{
- Description: "Machine machine-0 successfully joined the cluster",
- State: machinev1.MachineStateSuccessful,
- Type: machinev1.MachineOperationCreate,
- LastUpdateTime: metav1.Now(),
- },
- Conditions: []corev1.NodeCondition{
- {
- Message: "kubelet is posting ready status",
- Reason: "KubeletReady",
- Status: "True",
- Type: "Ready",
- },
- },
- }, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "node-0"}),
- },
- }),
- Entry("Machine object does not have node label set and node exists then it should adopt node using providerID", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- ProviderID: "aws//fakeID",
- },
- }, &machinev1.MachineStatus{}, nil, nil, nil),
- nodes: []*corev1.Node{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: "node-0",
- },
- Spec: corev1.NodeSpec{
- ProviderID: "aws//fakeID-0",
- },
- },
- },
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine-0",
- },
- }, &machinev1.MachineStatus{}, nil, nil, map[string]string{v1alpha1.NodeLabelKey: "node-0"}),
- },
- }),
- Entry("Machine object does not have node label set and node exists (without providerID) then it should not adopt node using providerID", &data{
- setup: setup{
- machines: newMachines(1, &machinev1.MachineTemplateSpec{
- ObjectMeta: *newObjectMeta(objMeta, 0),
- Spec: machinev1.MachineSpec{
- ProviderID: "aws//fakeID",
- },
- }, &machinev1.MachineStatus{}, nil, nil, nil),
- nodes: []*corev1.Node{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: "node-0",
- },
- Spec: corev1.NodeSpec{
- ProviderID: "",
- },
- },
- },
- },
- action: action{
- machine: machineName,
- },
- expect: expect{
- machine: newMachine(&machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Name: "machine-0",
- },
- }, nil, nil, nil, nil,
- ),
- },
- }),
- )
- })
-
-})
diff --git a/pkg/controller/machine_util.go b/pkg/controller/machine_util.go
deleted file mode 100644
index 8ea82feb1..000000000
--- a/pkg/controller/machine_util.go
+++ /dev/null
@@ -1,591 +0,0 @@
-/*
-Copyright 2016 The Kubernetes Authors.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-This file was copied and modified from the kubernetes/kubernetes project
-https://github.com/kubernetes/kubernetes/release-1.8/pkg/controller/deployment/util/pod_util.go
-
-Modifications Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "encoding/json"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- "github.com/gardener/machine-controller-manager/pkg/util/nodeops"
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/klog/v2"
-
- machineapi "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- v1alpha1client "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/typed/machine/v1alpha1"
- v1alpha1listers "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
- v1 "k8s.io/api/core/v1"
- errorsutil "k8s.io/apimachinery/pkg/util/errors"
- "k8s.io/client-go/util/retry"
-)
-
-const (
- // LastAppliedALTAnnotation contains the last configuration of annotations, labels & taints applied on the node object
- LastAppliedALTAnnotation = "node.machine.sapcloud.io/last-applied-anno-labels-taints"
- // NodeTerminationCondition describes nodes that are terminating
- NodeTerminationCondition = "Termination"
- // NodeUnhealthy is a node termination reason for failed machines
- NodeUnhealthy = "Unhealthy"
- // NodeScaledDown is a node termination reason for healthy deleted machines
- NodeScaledDown = "ScaleDown"
-)
-
-var (
- // emptyMap is a dummy emptyMap to compare with
- emptyMap = make(map[string]string)
-)
-
-// TODO: use client library instead when it starts to support update retries
-//
-// see https://github.com/kubernetes/kubernetes/issues/21479
-type updateMachineFunc func(machine *v1alpha1.Machine) error
-
-// UpdateMachineWithRetries updates a machine with given applyUpdate function. Note that machine not found error is ignored.
-// The returned bool value can be used to tell if the machine is actually updated.
-func UpdateMachineWithRetries(ctx context.Context, machineClient v1alpha1client.MachineInterface, machineLister v1alpha1listers.MachineLister, namespace, name string, applyUpdate updateMachineFunc) (*v1alpha1.Machine, error) {
- var machine *v1alpha1.Machine
-
- retryErr := retry.RetryOnConflict(retry.DefaultBackoff, func() error {
- var err error
- machine, err = machineLister.Machines(namespace).Get(name)
- if err != nil {
- return err
- }
- machine = machine.DeepCopy()
- // Apply the update, then attempt to push it to the apiserver.
- if applyErr := applyUpdate(machine); applyErr != nil {
- return applyErr
- }
- machine, err = machineClient.Update(ctx, machine, metav1.UpdateOptions{})
- return err
- })
-
- // Ignore the precondition violated error, this machine is already updated
- // with the desired label.
- if retryErr == errorsutil.ErrPreconditionViolated {
- klog.V(4).Infof("Machine %s precondition doesn't hold, skip updating it.", name)
- retryErr = nil
- }
-
- return machine, retryErr
-}
-
-func (c *controller) validateMachineClass(classSpec *v1alpha1.ClassSpec) (interface{}, map[string][]byte, error) {
-
- var MachineClass interface{}
- var secretData map[string][]byte
-
- switch classSpec.Kind {
- case AWSMachineClassKind:
- AWSMachineClass, err := c.awsMachineClassLister.AWSMachineClasses(c.namespace).Get(classSpec.Name)
- if err != nil {
- klog.V(2).Infof("AWSMachineClass %q/%q not found. Skipping. %v", c.namespace, classSpec.Name, err)
- return MachineClass, nil, err
- }
- MachineClass = AWSMachineClass
-
- // Validate AWSMachineClass
- internalAWSMachineClass := &machineapi.AWSMachineClass{}
- err = c.internalExternalScheme.Convert(AWSMachineClass, internalAWSMachineClass, nil)
- if err != nil {
- klog.V(2).Info("Error in scheme conversion")
- return MachineClass, nil, err
- }
-
- validationerr := validation.ValidateAWSMachineClass(internalAWSMachineClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.V(2).Infof("Validation of AWSMachineClass failed %s", validationerr.ToAggregate().Error())
- return MachineClass, nil, nil
- }
-
- // Get secret data
- secretData, err = c.getSecretData(AWSMachineClass.Name, AWSMachineClass.Spec.SecretRef, AWSMachineClass.Spec.CredentialsSecretRef)
- if err != nil {
- klog.V(2).Infof("Could not compute secret data: %+v", err)
- return MachineClass, nil, err
- }
-
- case AzureMachineClassKind:
- AzureMachineClass, err := c.azureMachineClassLister.AzureMachineClasses(c.namespace).Get(classSpec.Name)
- if err != nil {
- klog.V(2).Infof("AzureMachineClass %q not found. Skipping. %v", classSpec.Name, err)
- return MachineClass, nil, err
- }
- MachineClass = AzureMachineClass
-
- // Validate AzureMachineClass
- internalAzureMachineClass := &machineapi.AzureMachineClass{}
- err = c.internalExternalScheme.Convert(AzureMachineClass, internalAzureMachineClass, nil)
- if err != nil {
- klog.V(2).Info("Error in scheme conversion")
- return MachineClass, nil, err
- }
-
- validationerr := validation.ValidateAzureMachineClass(internalAzureMachineClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.V(2).Infof("Validation of AzureMachineClass failed %s", validationerr.ToAggregate().Error())
- return MachineClass, nil, nil
- }
-
- // Get secret data
- secretData, err = c.getSecretData(AzureMachineClass.Name, AzureMachineClass.Spec.SecretRef, AzureMachineClass.Spec.CredentialsSecretRef)
- if err != nil {
- klog.V(2).Infof("Could not compute secret data: %+v", err)
- return MachineClass, nil, err
- }
-
- case GCPMachineClassKind:
- GCPMachineClass, err := c.gcpMachineClassLister.GCPMachineClasses(c.namespace).Get(classSpec.Name)
- if err != nil {
- klog.V(2).Infof("GCPMachineClass %q not found. Skipping. %v", classSpec.Name, err)
- return MachineClass, nil, err
- }
- MachineClass = GCPMachineClass
-
- // Validate GCPMachineClass
- internalGCPMachineClass := &machineapi.GCPMachineClass{}
- err = c.internalExternalScheme.Convert(GCPMachineClass, internalGCPMachineClass, nil)
- if err != nil {
- klog.V(2).Info("Error in scheme conversion")
- return MachineClass, nil, err
- }
-
- validationerr := validation.ValidateGCPMachineClass(internalGCPMachineClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.V(2).Infof("Validation of GCPMachineClass failed %s", validationerr.ToAggregate().Error())
- return MachineClass, nil, nil
- }
-
- // Get secret data
- secretData, err = c.getSecretData(GCPMachineClass.Name, GCPMachineClass.Spec.SecretRef, GCPMachineClass.Spec.CredentialsSecretRef)
- if err != nil {
- klog.V(2).Infof("Could not compute secret data: %+v", err)
- return MachineClass, nil, err
- }
- case OpenStackMachineClassKind:
- OpenStackMachineClass, err := c.openStackMachineClassLister.OpenStackMachineClasses(c.namespace).Get(classSpec.Name)
- if err != nil {
- klog.V(2).Infof("OpenStackMachineClass %q not found. Skipping. %v", classSpec.Name, err)
- return MachineClass, nil, err
- }
- MachineClass = OpenStackMachineClass
-
- // Validate OpenStackMachineClass
- internalOpenStackMachineClass := &machineapi.OpenStackMachineClass{}
- err = c.internalExternalScheme.Convert(OpenStackMachineClass, internalOpenStackMachineClass, nil)
- if err != nil {
- klog.V(2).Info("Error in scheme conversion")
- return MachineClass, nil, err
- }
-
- validationerr := validation.ValidateOpenStackMachineClass(internalOpenStackMachineClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.V(2).Infof("Validation of OpenStackMachineClass failed %s", validationerr.ToAggregate().Error())
- return MachineClass, nil, nil
- }
-
- // Get secret data
- secretData, err = c.getSecretData(OpenStackMachineClass.Name, OpenStackMachineClass.Spec.SecretRef, OpenStackMachineClass.Spec.CredentialsSecretRef)
- if err != nil {
- klog.V(2).Infof("Could not compute secret data: %+v", err)
- return MachineClass, nil, err
- }
-
- case AlicloudMachineClassKind:
- AlicloudMachineClass, err := c.alicloudMachineClassLister.AlicloudMachineClasses(c.namespace).Get(classSpec.Name)
- if err != nil {
- klog.V(2).Infof("AlicloudMachineClass %q/%q not found. Skipping. %v", c.namespace, classSpec.Name, err)
- return MachineClass, nil, err
- }
- MachineClass = AlicloudMachineClass
-
- // Validate AlicloudMachineClass
- internalAlicloudMachineClass := &machineapi.AlicloudMachineClass{}
- err = c.internalExternalScheme.Convert(AlicloudMachineClass, internalAlicloudMachineClass, nil)
- if err != nil {
- klog.V(2).Info("Error in scheme conversion")
- return MachineClass, nil, err
- }
-
- validationerr := validation.ValidateAlicloudMachineClass(internalAlicloudMachineClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.V(2).Infof("Validation of AlicloudMachineClass failed %s", validationerr.ToAggregate().Error())
- return MachineClass, nil, nil
- }
-
- // Get secret data
- secretData, err = c.getSecretData(AlicloudMachineClass.Name, AlicloudMachineClass.Spec.SecretRef, AlicloudMachineClass.Spec.CredentialsSecretRef)
- if err != nil {
- klog.V(2).Infof("Could not compute secret data: %+v", err)
- return MachineClass, nil, err
- }
-
- case PacketMachineClassKind:
- PacketMachineClass, err := c.packetMachineClassLister.PacketMachineClasses(c.namespace).Get(classSpec.Name)
- if err != nil {
- klog.V(2).Infof("PacketMachineClass %q/%q not found. Skipping. %v", c.namespace, classSpec.Name, err)
- return MachineClass, nil, err
- }
- MachineClass = PacketMachineClass
-
- // Validate AlicloudMachineClass
- internalPacketMachineClass := &machineapi.PacketMachineClass{}
- err = c.internalExternalScheme.Convert(PacketMachineClass, internalPacketMachineClass, nil)
- if err != nil {
- klog.V(2).Info("Error in scheme conversion")
- return MachineClass, nil, err
- }
-
- validationerr := validation.ValidatePacketMachineClass(internalPacketMachineClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.V(2).Infof("Validation of PacketMachineClass failed %s", validationerr.ToAggregate().Error())
- return MachineClass, nil, nil
- }
-
- // Get secret data
- secretData, err = c.getSecretData(PacketMachineClass.Name, PacketMachineClass.Spec.SecretRef, PacketMachineClass.Spec.CredentialsSecretRef)
- if err != nil {
- klog.V(2).Infof("Could not compute secret data: %+v", err)
- return MachineClass, nil, err
- }
-
- default:
- klog.V(2).Infof("ClassKind %q not found. Machine maybe be processed by external controller", classSpec.Kind)
- }
-
- return MachineClass, secretData, nil
-}
-
-// nodeConditionsHaveChanged compares two node statuses to see if any of the statuses have changed
-func nodeConditionsHaveChanged(machineConditions []v1.NodeCondition, nodeConditions []v1.NodeCondition) bool {
-
- if len(machineConditions) != len(nodeConditions) {
- return true
- }
-
- for i := range nodeConditions {
- if nodeConditions[i].Status != machineConditions[i].Status {
- return true
- }
- }
-
- return false
-}
-
-// syncMachineNodeTemplate syncs nodeTemplates between machine and corresponding node-object.
-// It ensures, that any nodeTemplate element available on Machine should be available on node-object.
-// Although there could be more elements already available on node-object which will not be touched.
-func (c *controller) syncMachineNodeTemplates(ctx context.Context, machine *v1alpha1.Machine) error {
- var (
- initializedNodeAnnotation = false
- lastAppliedALT v1alpha1.NodeTemplateSpec
- currentlyAppliedALTJSONByte []byte
- )
-
- node, err := c.nodeLister.Get(machine.Labels[v1alpha1.NodeLabelKey])
- if err != nil || node == nil {
- klog.Errorf("Error: Could not get the node-object or node-object is missing - err: %q", err)
- // Dont return error so that other steps can be executed.
- return nil
- }
- nodeCopy := node.DeepCopy()
-
- // Initialize node annotations if empty
- if nodeCopy.Annotations == nil {
- nodeCopy.Annotations = make(map[string]string)
- initializedNodeAnnotation = true
- }
-
- // Extracts the last applied annotations to lastAppliedLabels
- lastAppliedALTJSONString, exists := node.Annotations[LastAppliedALTAnnotation]
- if exists {
- err = json.Unmarshal([]byte(lastAppliedALTJSONString), &lastAppliedALT)
- if err != nil {
- klog.Errorf("Error occurred while syncing node annotations, labels & taints: %s", err)
- return err
- }
- }
-
- annotationsChanged := SyncMachineAnnotations(machine, nodeCopy, lastAppliedALT.Annotations)
- labelsChanged := SyncMachineLabels(machine, nodeCopy, lastAppliedALT.Labels)
- taintsChanged := SyncMachineTaints(machine, nodeCopy, lastAppliedALT.Spec.Taints)
-
- // Update node-object with latest nodeTemplate elements if elements have changed.
- if initializedNodeAnnotation || labelsChanged || annotationsChanged || taintsChanged {
-
- klog.V(2).Infof(
- "Updating machine annotations:%v, labels:%v, taints:%v for machine: %q",
- annotationsChanged,
- labelsChanged,
- taintsChanged,
- machine.Name,
- )
-
- // Update the LastAppliedALTAnnotation
- lastAppliedALT = machine.Spec.NodeTemplateSpec
- currentlyAppliedALTJSONByte, err = json.Marshal(lastAppliedALT)
- if err != nil {
- klog.Errorf("Error occurred while syncing node annotations, labels & taints: %s", err)
- return err
- }
- nodeCopy.Annotations[LastAppliedALTAnnotation] = string(currentlyAppliedALTJSONByte)
-
- _, err := c.targetCoreClient.CoreV1().Nodes().Update(ctx, nodeCopy, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
- }
- return nil
-}
-
-// SyncMachineAnnotations syncs the annotations of the machine with node-objects.
-// It returns true if update is needed else false.
-func SyncMachineAnnotations(
- machine *v1alpha1.Machine,
- node *v1.Node,
- lastAppliedAnnotations map[string]string,
-) bool {
- toBeUpdated := false
- mAnnotations, nAnnotations := machine.Spec.NodeTemplateSpec.Annotations, node.Annotations
-
- // Initialize node annotations if nil
- if nAnnotations == nil {
- nAnnotations = make(map[string]string)
- node.Annotations = nAnnotations
- }
- // Intialize machine annotations to empty map if nil
- if mAnnotations == nil {
- mAnnotations = emptyMap
- }
-
- // Delete any annotation that existed in the past but has been deleted now
- for lastAppliedAnnotationKey := range lastAppliedAnnotations {
- if _, exists := mAnnotations[lastAppliedAnnotationKey]; !exists {
- delete(nAnnotations, lastAppliedAnnotationKey)
- toBeUpdated = true
- }
- }
-
- // Add/Update any key that doesn't exist or whose value as changed
- for mKey, mValue := range mAnnotations {
- if nValue, exists := nAnnotations[mKey]; !exists || mValue != nValue {
- nAnnotations[mKey] = mValue
- toBeUpdated = true
- }
- }
-
- return toBeUpdated
-}
-
-// SyncMachineLabels syncs the labels of the machine with node-objects.
-// It returns true if update is needed else false.
-func SyncMachineLabels(
- machine *v1alpha1.Machine,
- node *v1.Node,
- lastAppliedLabels map[string]string,
-) bool {
- toBeUpdated := false
- mLabels, nLabels := machine.Spec.NodeTemplateSpec.Labels, node.Labels
-
- // Initialize node labels if nil
- if nLabels == nil {
- nLabels = make(map[string]string)
- node.Labels = nLabels
- }
- // Intialize machine labels to empty map if nil
- if mLabels == nil {
- mLabels = emptyMap
- }
-
- // Delete any labels that existed in the past but has been deleted now
- for lastAppliedLabelKey := range lastAppliedLabels {
- if _, exists := mLabels[lastAppliedLabelKey]; !exists {
- delete(nLabels, lastAppliedLabelKey)
- toBeUpdated = true
- }
- }
-
- // Add/Update any key that doesn't exist or whose value as changed
- for mKey, mValue := range mLabels {
- if nValue, exists := nLabels[mKey]; !exists || mValue != nValue {
- nLabels[mKey] = mValue
- toBeUpdated = true
- }
- }
-
- return toBeUpdated
-}
-
-type taintKeyEffect struct {
- // Required. The taint key to be applied to a node.
- Key string
- // Valid effects are NoSchedule, PreferNoSchedule and NoExecute.
- Effect v1.TaintEffect
-}
-
-// SyncMachineTaints syncs the taints of the machine with node-objects.
-// It returns true if update is needed else false.
-func SyncMachineTaints(
- machine *v1alpha1.Machine,
- node *v1.Node,
- lastAppliedTaints []v1.Taint,
-) bool {
- toBeUpdated := false
- mTaints, nTaints := machine.Spec.NodeTemplateSpec.Spec.Taints, node.Spec.Taints
- mTaintsMap := make(map[taintKeyEffect]*v1.Taint)
- nTaintsMap := make(map[taintKeyEffect]*v1.Taint)
-
- // Convert the slice of taints to map of taint [key, effect] = Taint
- // Helps with indexed searching
- for i := range mTaints {
- mTaint := &mTaints[i]
- taintKE := taintKeyEffect{
- Key: mTaint.Key,
- Effect: mTaint.Effect,
- }
- mTaintsMap[taintKE] = mTaint
- }
- for i := range nTaints {
- nTaint := &nTaints[i]
- taintKE := taintKeyEffect{
- Key: nTaint.Key,
- Effect: nTaint.Effect,
- }
- nTaintsMap[taintKE] = nTaint
- }
-
- // Delete taints that existed on the machine object in the last update but deleted now
- for _, lastAppliedTaint := range lastAppliedTaints {
-
- lastAppliedKE := taintKeyEffect{
- Key: lastAppliedTaint.Key,
- Effect: lastAppliedTaint.Effect,
- }
-
- if _, exists := mTaintsMap[lastAppliedKE]; !exists {
- delete(nTaintsMap, lastAppliedKE)
- toBeUpdated = true
- }
- }
-
- // Add any taints that exists in the machine object but not on the node object
- for mKE, mV := range mTaintsMap {
- if nV, exists := nTaintsMap[mKE]; !exists || *nV != *mV {
- nTaintsMap[mKE] = mV
- toBeUpdated = true
- }
- }
-
- if toBeUpdated {
- // Convert the map of taints to slice of taints
- nTaints = make([]v1.Taint, len(nTaintsMap))
- i := 0
- for _, nV := range nTaintsMap {
- nTaints[i] = *nV
- i++
- }
- node.Spec.Taints = nTaints
- }
-
- return toBeUpdated
-}
-
-func (c *controller) UpdateNodeTerminationCondition(ctx context.Context, machine *v1alpha1.Machine) error {
- if machine.Status.CurrentStatus.Phase == "" {
- return nil
- }
-
- nodeName := machine.Labels[v1alpha1.NodeLabelKey]
- terminationCondition := v1.NodeCondition{
- Type: NodeTerminationCondition,
- Status: v1.ConditionTrue,
- LastHeartbeatTime: metav1.Now(),
- LastTransitionTime: metav1.Now(),
- }
-
- // check if condition already exists
- cond, err := nodeops.GetNodeCondition(ctx, c.targetCoreClient, nodeName, NodeTerminationCondition)
- if err != nil {
- if apierrors.IsNotFound(err) {
- return nil
- }
- return err
- }
-
- if cond != nil && machine.Status.CurrentStatus.Phase == v1alpha1.MachineTerminating {
- // do not consider machine terminating phase if node already terminating
- terminationCondition.Reason = cond.Reason
- terminationCondition.Message = cond.Message
- } else {
- setTerminationReasonByPhase(machine.Status.CurrentStatus.Phase, &terminationCondition)
- }
-
- err = nodeops.AddOrUpdateConditionsOnNode(ctx, c.targetCoreClient, nodeName, terminationCondition)
- if apierrors.IsNotFound(err) {
- return nil
- }
- return err
-}
-
-func (c *controller) getSecretData(machineClassName string, secretRefs ...*v1.SecretReference) (map[string][]byte, error) {
- var secretData map[string][]byte
-
- for _, secretRef := range secretRefs {
- if secretRef == nil {
- continue
- }
-
- secret, err := c.getSecret(secretRef, machineClassName)
- if err != nil {
- klog.V(2).Infof("Secret reference %s/%s not found", secretRef.Namespace, secretRef.Name)
- return nil, err
- }
- secretData = mergeDataMaps(secretData, secret.Data)
- }
-
- return secretData, nil
-}
-
-func setTerminationReasonByPhase(phase v1alpha1.MachinePhase, terminationCondition *v1.NodeCondition) {
- if phase == v1alpha1.MachineFailed { // if failed, terminated due to health
- terminationCondition.Reason = NodeUnhealthy
- terminationCondition.Message = "Machine Controller is terminating failed machine"
- } else { // in all other cases (except for already terminating): assume scale down
- terminationCondition.Reason = NodeScaledDown
- terminationCondition.Message = "Machine Controller is scaling down machine"
- }
-}
-
-func mergeDataMaps(in map[string][]byte, maps ...map[string][]byte) map[string][]byte {
- out := make(map[string][]byte)
-
- for _, m := range append([]map[string][]byte{in}, maps...) {
- for k, v := range m {
- out[k] = v
- }
- }
-
- return out
-}
diff --git a/pkg/controller/machine_util_test.go b/pkg/controller/machine_util_test.go
deleted file mode 100644
index 5f93d247e..000000000
--- a/pkg/controller/machine_util_test.go
+++ /dev/null
@@ -1,2154 +0,0 @@
-/*
-Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package controller
-
-import (
- "context"
- "encoding/json"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- machinev1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/ginkgo/extensions/table"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
- "k8s.io/klog/v2"
-)
-
-var _ = Describe("machine_util", func() {
-
- Describe("#syncMachineNodeTemplates", func() {
-
- type setup struct {
- machine *machinev1.Machine
- }
- type action struct {
- node *corev1.Node
- }
- type expect struct {
- node *corev1.Node
- err bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- controlObjects := []runtime.Object{}
- coreObjects := []runtime.Object{}
-
- machineObject := data.setup.machine
-
- nodeObject := data.action.node
- coreObjects = append(coreObjects, nodeObject)
- controlObjects = append(controlObjects, machineObject)
-
- c, trackers := createController(stop, testNamespace, controlObjects, nil, coreObjects)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- err := c.syncMachineNodeTemplates(context.TODO(), machineObject)
-
- waitForCacheSync(stop, c)
-
- if !data.expect.err {
- Expect(err).To(BeNil())
- } else {
- Expect(err).To(HaveOccurred())
- }
-
- //updatedNodeObject, _ := c.nodeLister.Get(nodeObject.Name)
- updatedNodeObject, _ := c.targetCoreClient.CoreV1().Nodes().Get(context.TODO(), nodeObject.Name, metav1.GetOptions{})
-
- if data.expect.node != nil {
- Expect(updatedNodeObject.Spec.Taints).Should(ConsistOf(data.expect.node.Spec.Taints))
- Expect(updatedNodeObject.Labels).Should(Equal(data.expect.node.Labels))
-
- // ignore LastAppliedALTAnnotataion
- delete(updatedNodeObject.Annotations, LastAppliedALTAnnotation)
- Expect(updatedNodeObject.Annotations).Should(Equal(data.expect.node.Annotations))
- }
- },
-
- Entry("when nodeTemplate is not updated in node-object", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "test-machine-class",
- },
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- },
- Annotations: map[string]string{
- "anno1": "anno1",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"annotations\":{\"anno1\":\"anno1\"}}}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{{
- Key: "key1",
- Value: "value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- &machinev1.MachineStatus{},
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Namespace: testNamespace,
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- err: false,
- },
- }),
-
- Entry("when nodeTemplate is updated in node-object", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "test-machine-class",
- },
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- },
- Annotations: map[string]string{
- "anno1": "anno1",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\"},\"annotations\":{\"anno1\":\"anno1\"}}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- &machinev1.MachineStatus{},
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{},
- },
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- },
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- err: false,
- },
- }),
-
- Entry("when node object does not exist", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "test-machine-class",
- },
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- },
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- &machinev1.MachineStatus{},
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{},
- },
- expect: expect{
- node: &corev1.Node{},
- err: false, // we should not return error if node-object does not exist to ensure rest of the steps are then executed.
- },
- }),
-
- Entry("Multiple taints with same key and value added to taint", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- Class: machinev1.ClassSpec{
- Kind: "AWSMachineClass",
- Name: "test-machine-class",
- },
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- },
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoExecute",
- },
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- &machinev1.MachineStatus{},
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\"},\"annotations\":{\"anno1\":\"anno1\"}}}",
- },
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{},
- },
- },
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Namespace: testNamespace,
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoExecute",
- },
- {
- Key: "key1",
- Value: "value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- err: false,
- },
- }),
- )
-
- })
-
- Describe("#SyncMachineLabels", func() {
-
- type setup struct{}
- type action struct {
- node *corev1.Node
- machine *machinev1.Machine
- }
- type expect struct {
- node *corev1.Node
- labelsChanged bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- c, trackers := createController(stop, testNamespace, nil, nil, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- testNode := data.action.node
- testMachine := data.action.machine
- expectedNode := data.expect.node
-
- var lastAppliedALT v1alpha1.NodeTemplateSpec
- lastAppliedALTJSONString, exists := testNode.Annotations[LastAppliedALTAnnotation]
- if exists {
- err := json.Unmarshal([]byte(lastAppliedALTJSONString), &lastAppliedALT)
- if err != nil {
- klog.Errorf("Error occurred while syncing node annotations, labels & taints: %s", err)
- }
- }
-
- labelsChanged := SyncMachineLabels(testMachine, testNode, lastAppliedALT.Labels)
-
- waitForCacheSync(stop, c)
-
- Expect(testNode.Labels).Should(Equal(expectedNode.Labels))
- Expect(labelsChanged).To(Equal(data.expect.labelsChanged))
- },
-
- Entry("when labels have not been updated", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- },
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- },
- labelsChanged: false,
- },
- }),
-
- Entry("when labels values are updated ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- },
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "valueChanged",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "valueChanged",
- },
- },
- },
- labelsChanged: true,
- },
- }),
-
- Entry("when new label keys are added ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- },
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- "key2": "value2",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- "key2": "value2",
- },
- },
- },
- labelsChanged: true,
- },
- }),
-
- Entry("when label is deleted from machine object", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- "key2": "value2",
- },
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\", \"key2\":\"value2\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- },
- labelsChanged: true,
- },
- }),
-
- Entry("when labels values are updated manually on node object", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value2",
- },
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- },
- labelsChanged: true,
- },
- }),
-
- Entry("when new labels are added on node-object ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- "keyNew": "valueNew",
- },
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- "keyNew": "valueNew",
- },
- },
- },
- labelsChanged: false,
- },
- }),
-
- Entry("when existing labels are deleted from node-object ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{},
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"labels\":{\"key1\":\"value1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "key1": "value1",
- "key2": "value2",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Labels: map[string]string{
- "key1": "value1",
- "key2": "value2",
- },
- },
- },
- labelsChanged: true,
- },
- }),
- )
-
- })
-
- Describe("#SyncMachineAnnotations", func() {
-
- type setup struct{}
- type action struct {
- node *corev1.Node
- machine *machinev1.Machine
- }
- type expect struct {
- node *corev1.Node
- annotationsChanged bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- c, trackers := createController(stop, testNamespace, nil, nil, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- testNode := data.action.node
- testMachine := data.action.machine
- expectedNode := data.expect.node
-
- var lastAppliedALT v1alpha1.NodeTemplateSpec
- lastAppliedALTJSONString, exists := testNode.Annotations[LastAppliedALTAnnotation]
- if exists {
- err := json.Unmarshal([]byte(lastAppliedALTJSONString), &lastAppliedALT)
- if err != nil {
- klog.Errorf("Error occurred while syncing node annotations, labels & taints: %s", err)
- }
- }
-
- annotationsChanged := SyncMachineAnnotations(testMachine, testNode, lastAppliedALT.Annotations)
-
- waitForCacheSync(stop, c)
-
- // ignore LastAppliedALTAnnotation for comparison
- delete(testNode.Annotations, LastAppliedALTAnnotation)
- Expect(testNode.Annotations).Should(Equal(expectedNode.Annotations))
- Expect(annotationsChanged).To(Equal(data.expect.annotationsChanged))
- },
-
- Entry("when annotations have not been updated", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"annotations\":{\"anno1\":\"anno1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- },
- annotationsChanged: false,
- },
- }),
-
- Entry("when annotations values are updated ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"annotations\":{\"anno1\":\"anno1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- "anno1": "annoChanged",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "annoChanged",
- },
- },
- },
- annotationsChanged: true,
- },
- }),
-
- Entry("when new annotation keys are added ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"annotations\":{\"anno1\":\"anno1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- "anno1": "anno1",
- "anno2": "anno2",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- "anno2": "anno2",
- },
- },
- },
- annotationsChanged: true,
- },
- }),
-
- Entry("when annotations are deleted ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- "anno2": "anno2",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"annotations\":{\"anno1\":\"anno1\", \"anno2\":\"anno2\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{},
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- },
- annotationsChanged: true,
- },
- }),
-
- Entry("when annotations values are updated manually on node object", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno2",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"annotations\":{\"anno1\":\"anno1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- },
- annotationsChanged: true,
- },
- }),
-
- Entry("when new annotations are added on node-objects.", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- "annoNew": "annoNew",
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"annotations\":{\"anno1\":\"anno1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- "annoNew": "annoNew",
- },
- },
- },
- annotationsChanged: false,
- },
- }),
-
- Entry("when existing annotations are deleted from node-objects. ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null,\"annotations\":{\"anno1\":\"anno1\"}}}",
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Annotations: map[string]string{
- "anno1": "anno1",
- "anno2": "anno2",
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- "anno2": "anno2",
- },
- },
- },
- annotationsChanged: true,
- },
- }),
- )
-
- })
-
- Describe("#SyncMachineTaints", func() {
-
- type setup struct{}
- type action struct {
- node *corev1.Node
- machine *machinev1.Machine
- }
- type expect struct {
- node *corev1.Node
- taintsChanged bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- c, trackers := createController(stop, testNamespace, nil, nil, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- testNode := data.action.node
- testMachine := data.action.machine
- expectedNode := data.expect.node
-
- var lastAppliedALT v1alpha1.NodeTemplateSpec
- lastAppliedALTJSONString, exists := testNode.Annotations[LastAppliedALTAnnotation]
- if exists {
- err := json.Unmarshal([]byte(lastAppliedALTJSONString), &lastAppliedALT)
- if err != nil {
- klog.Errorf("Error occurred while syncing node annotations, labels & taints: %s", err)
- }
- }
-
- taintsChanged := SyncMachineTaints(testMachine, testNode, lastAppliedALT.Spec.Taints)
-
- waitForCacheSync(stop, c)
-
- Expect(testNode.Spec.Taints).Should(ConsistOf(expectedNode.Spec.Taints))
- Expect(taintsChanged).To(Equal(data.expect.taintsChanged))
- },
-
- Entry("when taints have not been updated", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null},\"spec\":{\"taints\":[{\"key\":\"Key1\",\"value\":\"Value1\",\"effect\":\"NoSchedule\"}]}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- taintsChanged: false,
- },
- }),
-
- Entry("when taints values are updated ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null},\"spec\":{\"taints\":[{\"key\":\"Key1\",\"value\":\"OldValue\",\"effect\":\"NoSchedule\"}]}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "OldValue",
- Effect: "NoSchedule",
- },
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "NewValue",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "NewValue",
- Effect: "NoSchedule",
- },
- },
- },
- },
- taintsChanged: true,
- },
- }),
-
- Entry("when new taints are added ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null},\"spec\":{\"taints\":[{\"key\":\"Key1\",\"value\":\"Value1\",\"effect\":\"NoSchedule\"}]}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "Key2",
- Value: "Value2",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "Key2",
- Value: "Value2",
- Effect: "NoSchedule",
- },
- },
- },
- },
- taintsChanged: true,
- },
- }),
-
- Entry("when taints are deleted ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null},\"spec\":{\"taints\":[{\"key\":\"Key1\",\"value\":\"Value1\",\"effect\":\"NoSchedule\"},{\"key\":\"Key2\",\"value\":\"Value2\",\"effect\":\"NoSchedule\"}]}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "Key2",
- Value: "Value2",
- Effect: "NoSchedule",
- },
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- taintsChanged: true,
- },
- }),
-
- Entry("when node taint value is overwritten manually & new taint was added with same key & value but different effect", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null},\"spec\":{\"taints\":[{\"key\":\"Key1\",\"value\":\"Value1\",\"effect\":\"NoSchedule\"}]}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value2",
- Effect: "NoSchedule",
- },
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoExecute",
- },
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoExecute",
- },
- },
- },
- },
- taintsChanged: true,
- },
- }),
-
- Entry("when new taints are added on node-object ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null},\"spec\":{\"taints\":[{\"key\":\"Key1\",\"value\":\"Value1\",\"effect\":\"NoSchedule\"}]}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "KeyNew",
- Value: "ValueNew",
- Effect: "NoSchedule",
- },
- },
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "KeyNew",
- Value: "ValueNew",
- Effect: "NoSchedule",
- },
- },
- },
- },
- taintsChanged: false,
- },
- }),
-
- Entry("when existing taints are deleted from node-objects ", &data{
- setup: setup{},
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- LastAppliedALTAnnotation: "{\"metadata\":{\"creationTimestamp\":null},\"spec\":{\"taints\":[{\"key\":\"Key1\",\"value\":\"Value1\",\"effect\":\"NoSchedule\"}]}}",
- },
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{},
- },
- },
- machine: newMachine(
- &machinev1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{
- Labels: map[string]string{
- "test-label": "test-label",
- },
- },
- Spec: machinev1.MachineSpec{
- NodeTemplateSpec: machinev1.NodeTemplateSpec{
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "Key2",
- Value: "Value2",
- Effect: "NoSchedule",
- },
- },
- },
- },
- },
- },
- nil, nil, nil, nil),
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{
- Taints: []corev1.Taint{
- {
- Key: "Key1",
- Value: "Value1",
- Effect: "NoSchedule",
- },
- {
- Key: "Key2",
- Value: "Value2",
- Effect: "NoSchedule",
- },
- },
- },
- },
- taintsChanged: true,
- },
- }),
- )
-
- })
-
- Describe("#UpdateNodeTerminationCondition", func() {
-
- type setup struct {
- machine *machinev1.Machine
- }
- type action struct {
- node *corev1.Node
- }
- type expect struct {
- node *corev1.Node
- err bool
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
-
- DescribeTable("##table",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- controlObjects := []runtime.Object{}
- coreObjects := []runtime.Object{}
-
- machineObject := data.setup.machine
-
- nodeObject := data.action.node
- coreObjects = append(coreObjects, nodeObject)
- controlObjects = append(controlObjects, machineObject)
-
- c, trackers := createController(stop, testNamespace, controlObjects, nil, coreObjects)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- err := c.UpdateNodeTerminationCondition(context.TODO(), machineObject)
-
- waitForCacheSync(stop, c)
-
- if !data.expect.err {
- Expect(err).To(BeNil())
- } else {
- Expect(err).To(HaveOccurred())
- }
-
- updatedNodeObject, _ := c.targetCoreClient.CoreV1().Nodes().Get(context.TODO(), nodeObject.Name, metav1.GetOptions{})
-
- if data.expect.node != nil {
- conditions := data.expect.node.Status.Conditions
- if len(conditions) > 0 {
- Expect(updatedNodeObject.Status.Conditions[0].Type).Should(Equal(data.expect.node.Status.Conditions[0].Type))
- Expect(updatedNodeObject.Status.Conditions[0].Status).Should(Equal(data.expect.node.Status.Conditions[0].Status))
- Expect(updatedNodeObject.Status.Conditions[0].Reason).Should(Equal(data.expect.node.Status.Conditions[0].Reason))
- }
- }
- },
-
- Entry("when machine phase is failed", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{},
- &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{Phase: MachineFailed},
- },
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Spec: corev1.NodeSpec{},
- },
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Status: corev1.NodeStatus{
- Conditions: []corev1.NodeCondition{
- {Type: NodeTerminationCondition, Status: corev1.ConditionTrue, Reason: NodeUnhealthy},
- }},
- },
- err: false,
- },
- }),
-
- Entry("when machine phase is running", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{},
- &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{Phase: MachineRunning},
- },
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Spec: corev1.NodeSpec{},
- },
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Status: corev1.NodeStatus{
- Conditions: []corev1.NodeCondition{
- {Type: NodeTerminationCondition, Status: corev1.ConditionTrue, Reason: NodeScaledDown},
- }},
- },
- err: false,
- },
- }),
-
- Entry("when machine phase is terminating", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{},
- &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{Phase: MachineTerminating},
- },
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Spec: corev1.NodeSpec{},
- },
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Status: corev1.NodeStatus{
- Conditions: []corev1.NodeCondition{
- {Type: NodeTerminationCondition, Status: corev1.ConditionTrue, Reason: NodeScaledDown},
- }},
- },
- err: false,
- },
- }),
-
- Entry("when machine phase is terminating and condition already exists", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{},
- &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{Phase: MachineTerminating},
- },
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Spec: corev1.NodeSpec{},
- Status: corev1.NodeStatus{
- Conditions: []corev1.NodeCondition{
- {Type: NodeTerminationCondition, Status: corev1.ConditionTrue, Reason: NodeUnhealthy},
- }},
- },
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{
- "anno1": "anno1",
- },
- },
- Status: corev1.NodeStatus{
- Conditions: []corev1.NodeCondition{
- {Type: NodeTerminationCondition, Status: corev1.ConditionTrue, Reason: NodeUnhealthy},
- }},
- },
- err: false,
- },
- }),
-
- Entry("when phase changes and condition already exists", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{},
- &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{Phase: MachineFailed},
- },
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- },
- Spec: corev1.NodeSpec{},
- Status: corev1.NodeStatus{
- Conditions: []corev1.NodeCondition{
- {Type: NodeTerminationCondition, Status: corev1.ConditionTrue, Reason: NodeScaledDown},
- }},
- },
- },
- expect: expect{
- node: &corev1.Node{
- TypeMeta: metav1.TypeMeta{
- APIVersion: "v1",
- Kind: "Node",
- },
- ObjectMeta: metav1.ObjectMeta{
- Name: "test-node-0",
- Annotations: map[string]string{},
- },
- Status: corev1.NodeStatus{
- Conditions: []corev1.NodeCondition{
- {Type: NodeTerminationCondition, Status: corev1.ConditionTrue, Reason: NodeUnhealthy},
- }},
- },
- err: false,
- },
- }),
-
- Entry("when node object does not exist", &data{
- setup: setup{
- machine: newMachine(
- &machinev1.MachineTemplateSpec{},
- &machinev1.MachineStatus{
- CurrentStatus: machinev1.CurrentStatus{Phase: MachineTerminating},
- },
- nil, nil, map[string]string{v1alpha1.NodeLabelKey: "test-node-0"}),
- },
- action: action{
- node: &corev1.Node{},
- },
- expect: expect{
- node: &corev1.Node{},
- err: false, // we should not return error if node-object does not exist to ensure rest of the steps are then executed.
- },
- }),
- )
-
- })
-
-})
diff --git a/pkg/controller/machineclass_util.go b/pkg/controller/machineclass_util.go
deleted file mode 100644
index 315c92f18..000000000
--- a/pkg/controller/machineclass_util.go
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "k8s.io/apimachinery/pkg/labels"
-)
-
-func (c *controller) findMachineDeploymentsForClass(kind, name string) ([]*v1alpha1.MachineDeployment, error) {
- machineDeployments, err := c.machineDeploymentLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.MachineDeployment
- for _, machineDeployment := range machineDeployments {
- if machineDeployment.Spec.Template.Spec.Class.Kind == kind && machineDeployment.Spec.Template.Spec.Class.Name == name {
- filtered = append(filtered, machineDeployment)
- }
- }
- return filtered, nil
-}
-
-func (c *controller) findMachineSetsForClass(kind, name string) ([]*v1alpha1.MachineSet, error) {
- machineSets, err := c.machineSetLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.MachineSet
- for _, machineSet := range machineSets {
- if machineSet.Spec.Template.Spec.Class.Kind == kind && machineSet.Spec.Template.Spec.Class.Name == name {
- filtered = append(filtered, machineSet)
- }
- }
- return filtered, nil
-}
-
-func (c *controller) findMachinesForClass(kind, name string) ([]*v1alpha1.Machine, error) {
- machines, err := c.machineLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.Machine
- for _, machine := range machines {
- if machine.Spec.Class.Kind == kind && machine.Spec.Class.Name == name {
- filtered = append(filtered, machine)
- }
- }
- return filtered, nil
-}
diff --git a/pkg/controller/machineset.go b/pkg/controller/machineset.go
index 499095be2..3f0692d72 100644
--- a/pkg/controller/machineset.go
+++ b/pkg/controller/machineset.go
@@ -26,6 +26,11 @@ import (
"context"
"errors"
"fmt"
+ v1alpha1client "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/typed/machine/v1alpha1"
+ v1alpha1listers "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
+ apiequality "k8s.io/apimachinery/pkg/api/equality"
+ errorsutil "k8s.io/apimachinery/pkg/util/errors"
+ "k8s.io/client-go/util/retry"
"reflect"
"sort"
"sync"
@@ -754,3 +759,84 @@ func (c *controller) updateMachineSetFinalizers(ctx context.Context, machineSet
klog.Warning(fmt.Sprintf("Updating machineset %q failed at time %q with err: %q, requeuing", machineSet.Name, time.Now(), err.Error()))
return err
}
+
+func (c *controller) updateMachineStatus(
+ ctx context.Context,
+ machine *v1alpha1.Machine,
+ lastOperation v1alpha1.LastOperation,
+ currentStatus v1alpha1.CurrentStatus,
+) (*v1alpha1.Machine, error) {
+ // Get the latest version of the machine so that we can avoid conflicts
+ latestMachine, err := c.controlMachineClient.Machines(machine.Namespace).Get(ctx, machine.Name, metav1.GetOptions{})
+ if err != nil {
+ return nil, err
+ }
+ clone := latestMachine.DeepCopy()
+
+ clone.Status.LastOperation = lastOperation
+ clone.Status.CurrentStatus = currentStatus
+ if isMachineStatusEqual(clone.Status, machine.Status) {
+ klog.V(3).Infof("Not updating the status of the machine object %q , as it is already same", clone.Name)
+ return machine, nil
+ }
+
+ clone, err = c.controlMachineClient.Machines(clone.Namespace).UpdateStatus(ctx, clone, metav1.UpdateOptions{})
+ if err != nil {
+ // Keep retrying until update goes through
+ klog.V(3).Infof("Warning: Updated failed, retrying, error: %q", err)
+ return c.updateMachineStatus(ctx, machine, lastOperation, currentStatus)
+ }
+ return clone, nil
+}
+
+// isMachineStatusEqual checks if the status of 2 machines is same or not.
+func isMachineStatusEqual(s1, s2 v1alpha1.MachineStatus) bool {
+ tolerateTimeDiff := 30 * time.Minute
+ s1Copy, s2Copy := s1.DeepCopy(), s2.DeepCopy()
+ s1Copy.LastOperation.Description, s2Copy.LastOperation.Description = "", ""
+
+ if (s1Copy.LastOperation.LastUpdateTime.Time.Before(time.Now().Add(tolerateTimeDiff * -1))) || (s2Copy.LastOperation.LastUpdateTime.Time.Before(time.Now().Add(tolerateTimeDiff * -1))) {
+ return false
+ }
+ s1Copy.LastOperation.LastUpdateTime, s2Copy.LastOperation.LastUpdateTime = metav1.Time{}, metav1.Time{}
+
+ if (s1Copy.CurrentStatus.LastUpdateTime.Time.Before(time.Now().Add(tolerateTimeDiff * -1))) || (s2Copy.CurrentStatus.LastUpdateTime.Time.Before(time.Now().Add(tolerateTimeDiff * -1))) {
+ return false
+ }
+ s1Copy.CurrentStatus.LastUpdateTime, s2Copy.CurrentStatus.LastUpdateTime = metav1.Time{}, metav1.Time{}
+
+ return apiequality.Semantic.DeepEqual(s1Copy.LastOperation, s2Copy.LastOperation) && apiequality.Semantic.DeepEqual(s1Copy.CurrentStatus, s2Copy.CurrentStatus)
+}
+
+// see https://github.com/kubernetes/kubernetes/issues/21479
+type updateMachineFunc func(machine *v1alpha1.Machine) error
+
+// UpdateMachineWithRetries updates a machine with given applyUpdate function. Note that machine not found error is ignored.
+// The returned bool value can be used to tell if the machine is actually updated.
+func UpdateMachineWithRetries(ctx context.Context, machineClient v1alpha1client.MachineInterface, machineLister v1alpha1listers.MachineLister, namespace, name string, applyUpdate updateMachineFunc) (*v1alpha1.Machine, error) {
+ var machine *v1alpha1.Machine
+
+ retryErr := retry.RetryOnConflict(retry.DefaultBackoff, func() error {
+ var err error
+ machine, err = machineLister.Machines(namespace).Get(name)
+ if err != nil {
+ return err
+ }
+ machine = machine.DeepCopy()
+ // Apply the update, then attempt to push it to the apiserver.
+ if applyErr := applyUpdate(machine); applyErr != nil {
+ return applyErr
+ }
+ machine, err = machineClient.Update(ctx, machine, metav1.UpdateOptions{})
+ return err
+ })
+
+ // Ignore the precondition violated error, this machine is already updated
+ // with the desired label.
+ if retryErr == errorsutil.ErrPreconditionViolated {
+ klog.V(4).Infof("Machine %s precondition doesn't hold, skip updating it.", name)
+ retryErr = nil
+ }
+
+ return machine, retryErr
+}
diff --git a/pkg/controller/metrics.go b/pkg/controller/metrics.go
index b0bee33b5..1190e6a83 100644
--- a/pkg/controller/metrics.go
+++ b/pkg/controller/metrics.go
@@ -23,7 +23,6 @@ import (
v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
"github.com/gardener/machine-controller-manager/pkg/metrics"
"github.com/prometheus/client_golang/prometheus"
- v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/labels"
)
@@ -237,97 +236,8 @@ func (c *controller) CollectMachineSetMetrics(ch chan<- prometheus.Metric) {
}
}
-// CollectMachines is method to collect Machine related metrics.
-func (c *controller) CollectMachineMetrics(ch chan<- prometheus.Metric) {
- // Collect the count of machines managed by the mcm.
- machineList, err := c.machineLister.Machines(c.namespace).List(labels.Everything())
- if err != nil {
- metrics.ScrapeFailedCounter.With(prometheus.Labels{"kind": "Machine-count"}).Inc()
- return
- }
-
- for _, machine := range machineList {
- mMeta := machine.ObjectMeta
- mSpec := machine.Spec
-
- metrics.MachineInfo.With(prometheus.Labels{
- "name": mMeta.Name,
- "namespace": mMeta.Namespace,
- "createdAt": strconv.FormatInt(mMeta.GetCreationTimestamp().Time.Unix(), 10),
- "spec_provider_id": mSpec.ProviderID,
- "spec_class_api_group": mSpec.Class.APIGroup,
- "spec_class_kind": mSpec.Class.Kind,
- "spec_class_name": mSpec.Class.Name}).Set(float64(1))
-
- for _, condition := range machine.Status.Conditions {
- var status float64
- switch condition.Status {
- case v1.ConditionTrue:
- status = 1
- case v1.ConditionFalse:
- status = 0
- case v1.ConditionUnknown:
- status = 2
- }
-
- metrics.MachineStatusCondition.With(prometheus.Labels{
- "name": mMeta.Name,
- "namespace": mMeta.Namespace,
- "condition": string(condition.Type),
- }).Set(status)
- }
-
- var phase float64
- switch machine.Status.CurrentStatus.Phase {
- case v1alpha1.MachinePending:
- phase = -2
- case v1alpha1.MachineAvailable:
- phase = -1
- case v1alpha1.MachineRunning:
- phase = 0
- case v1alpha1.MachineTerminating:
- phase = 1
- case v1alpha1.MachineUnknown:
- phase = 2
- case v1alpha1.MachineFailed:
- phase = 3
- case v1alpha1.MachineCrashLoopBackOff:
- phase = 4
- }
- metrics.MachineCSPhase.With(prometheus.Labels{
- "name": mMeta.Name,
- "namespace": mMeta.Namespace,
- }).Set(phase)
-
- }
-
- metric, err := prometheus.NewConstMetric(metrics.MachineCountDesc, prometheus.GaugeValue, float64(len(machineList)))
- if err != nil {
- metrics.ScrapeFailedCounter.With(prometheus.Labels{"kind": "Machine-count"}).Inc()
- return
- }
- ch <- metric
-
-}
-
-// CollectMachines is method to collect Machine related metrics.
-func (c *controller) CollectMachineControllerFrozenStatus(ch chan<- prometheus.Metric) {
- var frozenStatus float64
- if c.safetyOptions.MachineControllerFrozen {
- frozenStatus = 1
- }
- metric, err := prometheus.NewConstMetric(metrics.MachineControllerFrozenDesc, prometheus.GaugeValue, frozenStatus)
- if err != nil {
- metrics.ScrapeFailedCounter.With(prometheus.Labels{"kind": "Machine-count"}).Inc()
- return
- }
- ch <- metric
-}
-
// Collect is method required to implement the prometheus.Collect interface.
func (c *controller) Collect(ch chan<- prometheus.Metric) {
- c.CollectMachineMetrics(ch)
c.CollectMachineSetMetrics(ch)
c.CollectMachineDeploymentMetrics(ch)
- c.CollectMachineControllerFrozenStatus(ch)
}
diff --git a/pkg/controller/node.go b/pkg/controller/node.go
deleted file mode 100644
index 77fd14b8e..000000000
--- a/pkg/controller/node.go
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- v1 "k8s.io/api/core/v1"
- "k8s.io/klog/v2"
-
- "k8s.io/client-go/tools/cache"
-
- apierrors "k8s.io/apimachinery/pkg/api/errors"
-)
-
-func (c *controller) nodeAdd(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
- c.nodeQueue.Add(key)
-}
-
-func (c *controller) nodeUpdate(oldObj, newObj interface{}) {
- c.nodeAdd(newObj)
-}
-
-func (c *controller) nodeDelete(obj interface{}) {
- node, ok := obj.(*v1.Node)
- if node == nil || !ok {
- return
- }
-
-}
-
-// Not being used at the moment, saving it for a future use case.
-func (c *controller) reconcileClusterNodeKey(key string) error {
- node, err := c.nodeLister.Get(key)
- if apierrors.IsNotFound(err) {
- return nil
- }
- if err != nil {
- klog.Errorf("ClusterNode %q: Unable to retrieve object from store: %v", key, err)
- return err
- }
-
- return c.reconcileClusterNode(node)
-}
-
-func (c *controller) reconcileClusterNode(node *v1.Node) error {
- return nil
-}
diff --git a/pkg/controller/openstackmachineclass.go b/pkg/controller/openstackmachineclass.go
deleted file mode 100644
index 3f2ed5bf7..000000000
--- a/pkg/controller/openstackmachineclass.go
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "fmt"
- "time"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/tools/cache"
-
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
-)
-
-// OpenStackMachineClassKind is used to identify the machineClassKind as OpenStack
-const OpenStackMachineClassKind = "OpenStackMachineClass"
-
-func (c *controller) machineDeploymentToOpenStackMachineClassDelete(obj interface{}) {
- machineDeployment, ok := obj.(*v1alpha1.MachineDeployment)
- if machineDeployment == nil || !ok {
- return
- }
- if machineDeployment.Spec.Template.Spec.Class.Kind == OpenStackMachineClassKind {
- c.openStackMachineClassQueue.Add(machineDeployment.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineSetToOpenStackMachineClassDelete(obj interface{}) {
- machineSet, ok := obj.(*v1alpha1.MachineSet)
- if machineSet == nil || !ok {
- return
- }
- if machineSet.Spec.Template.Spec.Class.Kind == OpenStackMachineClassKind {
- c.openStackMachineClassQueue.Add(machineSet.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToOpenStackMachineClassAdd(obj interface{}) {
- machine, ok := obj.(*v1alpha1.Machine)
- if machine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", obj)
- return
- }
- if machine.Spec.Class.Kind == OpenStackMachineClassKind {
- c.openStackMachineClassQueue.Add(machine.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToOpenStackMachineClassUpdate(oldObj, newObj interface{}) {
- oldMachine, ok := oldObj.(*v1alpha1.Machine)
- if oldMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", oldObj)
- return
- }
- newMachine, ok := newObj.(*v1alpha1.Machine)
- if newMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", newObj)
- return
- }
-
- if oldMachine.Spec.Class.Kind == newMachine.Spec.Class.Kind {
- if newMachine.Spec.Class.Kind == OpenStackMachineClassKind {
- // Both old and new machine refer to the same machineClass object
- // And the correct kind so enqueuing only one of them.
- c.openStackMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- } else {
- // If both are pointing to different machineClasses
- // we might have to enqueue both.
- if oldMachine.Spec.Class.Kind == OpenStackMachineClassKind {
- c.openStackMachineClassQueue.Add(oldMachine.Spec.Class.Name)
- }
- if newMachine.Spec.Class.Kind == OpenStackMachineClassKind {
- c.openStackMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- }
-}
-
-func (c *controller) machineToOpenStackMachineClassDelete(obj interface{}) {
- c.machineToOpenStackMachineClassAdd(obj)
-}
-
-func (c *controller) openStackMachineClassAdd(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
- c.openStackMachineClassQueue.Add(key)
-}
-
-func (c *controller) openStackMachineClassUpdate(oldObj, newObj interface{}) {
- old, ok := oldObj.(*v1alpha1.OpenStackMachineClass)
- if old == nil || !ok {
- return
- }
- new, ok := newObj.(*v1alpha1.OpenStackMachineClass)
- if new == nil || !ok {
- return
- }
-
- c.openStackMachineClassAdd(newObj)
-}
-
-func (c *controller) openStackMachineClassDelete(obj interface{}) {
- c.openStackMachineClassAdd(obj)
-}
-
-// reconcileClusterOpenStackMachineClassKey reconciles an OpenStackMachineClass due to controller resync
-// or an event on the openStackMachineClass.
-func (c *controller) reconcileClusterOpenStackMachineClassKey(key string) error {
- ctx := context.Background()
- _, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return err
- }
-
- class, err := c.openStackMachineClassLister.OpenStackMachineClasses(c.namespace).Get(name)
- if errors.IsNotFound(err) {
- klog.V(4).Infof("%s %q: Not doing work because it has been deleted", OpenStackMachineClassKind, key)
- return nil
- }
- if err != nil {
- klog.V(4).Infof("%s %q: Unable to retrieve object from store: %v", OpenStackMachineClassKind, key, err)
- return err
- }
-
- err = c.reconcileClusterOpenStackMachineClass(ctx, class)
- if err != nil {
- c.enqueueOpenStackMachineClassAfter(class, 10*time.Second)
- } else {
- // Re-enqueue periodically to avoid missing of events
- // TODO: Infuture to get ride of this logic
- c.enqueueOpenStackMachineClassAfter(class, 10*time.Minute)
- }
-
- return nil
-}
-
-func (c *controller) reconcileClusterOpenStackMachineClass(ctx context.Context, class *v1alpha1.OpenStackMachineClass) error {
- klog.V(4).Info("Start Reconciling OpenStackmachineclass: ", class.Name)
- defer klog.V(4).Info("Stop Reconciling OpenStackmachineclass: ", class.Name)
-
- internalClass := &machine.OpenStackMachineClass{}
- err := c.internalExternalScheme.Convert(class, internalClass, nil)
- if err != nil {
- return err
- }
-
- validationerr := validation.ValidateOpenStackMachineClass(internalClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.Errorf("Validation of %s failed %s", OpenStackMachineClassKind, validationerr.ToAggregate().Error())
- return nil
- }
-
- // Add finalizer to avoid losing machineClass object
- if class.DeletionTimestamp == nil {
- err := c.addOpenStackMachineClassFinalizers(ctx, class)
- if err != nil {
- return err
- }
- }
-
- machines, err := c.findMachinesForClass(OpenStackMachineClassKind, class.Name)
- if err != nil {
- return err
- }
-
- if class.DeletionTimestamp == nil {
- // If deletion timestamp doesn't exist
- _, annotationPresent := class.Annotations[machineutils.MigratedMachineClass]
-
- if c.deleteMigratedMachineClass && annotationPresent && len(machines) == 0 {
- // If controller has deleteMigratedMachineClass flag set
- // and the migratedMachineClass annotation is set
- err = c.controlMachineClient.OpenStackMachineClasses(class.Namespace).Delete(ctx, class.Name, metav1.DeleteOptions{})
- if err != nil {
- return err
- }
- return fmt.Errorf("Retry deletion as deletion timestamp is now set")
- }
-
- return nil
- }
-
- if len(machines) > 0 {
- // machines are still referring the machine class, please wait before deletion
- klog.V(3).Infof("Cannot remove finalizer on %s because still (%d) machines are referencing it", class.Name, len(machines))
-
- for _, machine := range machines {
- c.addMachine(machine)
- }
-
- return fmt.Errorf("Retry as machine objects are still referring the machineclass")
- }
-
- return c.deleteOpenStackMachineClassFinalizers(ctx, class)
-}
-
-/*
- SECTION
- Manipulate Finalizers
-*/
-
-func (c *controller) addOpenStackMachineClassFinalizers(ctx context.Context, class *v1alpha1.OpenStackMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- finalizers.Insert(DeleteFinalizerName)
- return c.updateOpenStackMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) deleteOpenStackMachineClassFinalizers(ctx context.Context, class *v1alpha1.OpenStackMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- finalizers.Delete(DeleteFinalizerName)
- return c.updateOpenStackMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) updateOpenStackMachineClassFinalizers(ctx context.Context, class *v1alpha1.OpenStackMachineClass, finalizers []string) error {
- // Get the latest version of the class so that we can avoid conflicts
- class, err := c.controlMachineClient.OpenStackMachineClasses(class.Namespace).Get(ctx, class.Name, metav1.GetOptions{})
- if err != nil {
- return err
- }
-
- clone := class.DeepCopy()
- clone.Finalizers = finalizers
- _, err = c.controlMachineClient.OpenStackMachineClasses(class.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warning("Updating OpenStackMachineClass failed, retrying. ", class.Name, err)
- return err
- }
- klog.V(3).Infof("Successfully added/removed finalizer on the openstackmachineclass %q", class.Name)
- return err
-}
-
-func (c *controller) enqueueOpenStackMachineClassAfter(obj interface{}, after time.Duration) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- return
- }
- c.openStackMachineClassQueue.AddAfter(key, after)
-}
diff --git a/pkg/controller/packetcloudmachineclass.go b/pkg/controller/packetcloudmachineclass.go
deleted file mode 100644
index 77a8b90c4..000000000
--- a/pkg/controller/packetcloudmachineclass.go
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "fmt"
- "time"
-
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/tools/cache"
-
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/validation"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
-)
-
-// PacketMachineClassKind is used to identify the machineClassKind as Packet
-const PacketMachineClassKind = "PacketMachineClass"
-
-func (c *controller) machineDeploymentToPacketMachineClassDelete(obj interface{}) {
- machineDeployment, ok := obj.(*v1alpha1.MachineDeployment)
- if machineDeployment == nil || !ok {
- return
- }
- if machineDeployment.Spec.Template.Spec.Class.Kind == PacketMachineClassKind {
- c.packetMachineClassQueue.Add(machineDeployment.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineSetToPacketMachineClassDelete(obj interface{}) {
- machineSet, ok := obj.(*v1alpha1.MachineSet)
- if machineSet == nil || !ok {
- return
- }
- if machineSet.Spec.Template.Spec.Class.Kind == PacketMachineClassKind {
- c.packetMachineClassQueue.Add(machineSet.Spec.Template.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToPacketMachineClassAdd(obj interface{}) {
- machine, ok := obj.(*v1alpha1.Machine)
- if machine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", obj)
- return
- }
- if machine.Spec.Class.Kind == PacketMachineClassKind {
- c.packetMachineClassQueue.Add(machine.Spec.Class.Name)
- }
-}
-
-func (c *controller) machineToPacketMachineClassUpdate(oldObj, newObj interface{}) {
- oldMachine, ok := oldObj.(*v1alpha1.Machine)
- if oldMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", oldObj)
- return
- }
- newMachine, ok := newObj.(*v1alpha1.Machine)
- if newMachine == nil || !ok {
- klog.Warningf("Couldn't get machine from object: %+v", newObj)
- return
- }
-
- if oldMachine.Spec.Class.Kind == newMachine.Spec.Class.Kind {
- if newMachine.Spec.Class.Kind == PacketMachineClassKind {
- // Both old and new machine refer to the same machineClass object
- // And the correct kind so enqueuing only one of them.
- c.packetMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- } else {
- // If both are pointing to different machineClasses
- // we might have to enqueue both.
- if oldMachine.Spec.Class.Kind == PacketMachineClassKind {
- c.packetMachineClassQueue.Add(oldMachine.Spec.Class.Name)
- }
- if newMachine.Spec.Class.Kind == PacketMachineClassKind {
- c.packetMachineClassQueue.Add(newMachine.Spec.Class.Name)
- }
- }
-}
-
-func (c *controller) machineToPacketMachineClassDelete(obj interface{}) {
- c.machineToPacketMachineClassAdd(obj)
-}
-
-func (c *controller) packetMachineClassAdd(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
- c.packetMachineClassQueue.Add(key)
-}
-
-func (c *controller) packetMachineClassUpdate(oldObj, newObj interface{}) {
- old, ok := oldObj.(*v1alpha1.PacketMachineClass)
- if old == nil || !ok {
- return
- }
- new, ok := newObj.(*v1alpha1.PacketMachineClass)
- if new == nil || !ok {
- return
- }
-
- c.packetMachineClassAdd(newObj)
-}
-
-func (c *controller) packetMachineClassDelete(obj interface{}) {
- c.packetMachineClassAdd(obj)
-}
-
-// reconcileClusterPacketMachineClassKey reconciles a PacketMachineClass due to controller resync
-// or an event on the packetMachineClass.
-func (c *controller) reconcileClusterPacketMachineClassKey(key string) error {
- ctx := context.Background()
- _, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return err
- }
-
- class, err := c.packetMachineClassLister.PacketMachineClasses(c.namespace).Get(name)
- if errors.IsNotFound(err) {
- klog.Infof("%s %q: Not doing work because it has been deleted", PacketMachineClassKind, key)
- return nil
- }
- if err != nil {
- klog.Infof("%s %q: Unable to retrieve object from store: %v", PacketMachineClassKind, key, err)
- return err
- }
-
- err = c.reconcileClusterPacketMachineClass(ctx, class)
- if err != nil {
- c.enqueuePacketMachineClassAfter(class, 10*time.Second)
- } else {
- // Re-enqueue periodically to avoid missing of events
- // TODO: Infuture to get ride of this logic
- c.enqueuePacketMachineClassAfter(class, 10*time.Minute)
- }
-
- return nil
-}
-
-func (c *controller) reconcileClusterPacketMachineClass(ctx context.Context, class *v1alpha1.PacketMachineClass) error {
- klog.V(4).Info("Start Reconciling Packetmachineclass: ", class.Name)
- defer klog.V(4).Info("Stop Reconciling Packetmachineclass: ", class.Name)
-
- internalClass := &machine.PacketMachineClass{}
- err := c.internalExternalScheme.Convert(class, internalClass, nil)
- if err != nil {
- return err
- }
-
- validationerr := validation.ValidatePacketMachineClass(internalClass)
- if validationerr.ToAggregate() != nil && len(validationerr.ToAggregate().Errors()) > 0 {
- klog.Errorf("Validation of %s failed %s", PacketMachineClassKind, validationerr.ToAggregate().Error())
- return nil
- }
-
- // Add finalizer to avoid losing machineClass object
- if class.DeletionTimestamp == nil {
- err = c.addPacketMachineClassFinalizers(ctx, class)
- if err != nil {
- return err
- }
- }
-
- machines, err := c.findMachinesForClass(PacketMachineClassKind, class.Name)
- if err != nil {
- return err
- }
-
- if class.DeletionTimestamp == nil {
- // If deletion timestamp doesn't exist
- _, annotationPresent := class.Annotations[machineutils.MigratedMachineClass]
-
- if c.deleteMigratedMachineClass && annotationPresent && len(machines) == 0 {
- // If controller has deleteMigratedMachineClass flag set
- // and the migratedMachineClass annotation is set
- err = c.controlMachineClient.PacketMachineClasses(class.Namespace).Delete(ctx, class.Name, metav1.DeleteOptions{})
- if err != nil {
- return err
- }
- return fmt.Errorf("Retry deletion as deletion timestamp is now set")
- }
-
- return nil
- }
-
- if len(machines) > 0 {
- // machines are still referring the machine class, please wait before deletion
- klog.V(3).Infof("Cannot remove finalizer on %s because still (%d) machines are referencing it", class.Name, len(machines))
-
- for _, machine := range machines {
- c.addMachine(machine)
- }
-
- return fmt.Errorf("Retry as machine objects are still referring the machineclass")
- }
-
- return c.deletePacketMachineClassFinalizers(ctx, class)
-}
-
-/*
- SECTION
- Manipulate Finalizers
-*/
-
-func (c *controller) addPacketMachineClassFinalizers(ctx context.Context, class *v1alpha1.PacketMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- finalizers.Insert(DeleteFinalizerName)
- return c.updatePacketMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) deletePacketMachineClassFinalizers(ctx context.Context, class *v1alpha1.PacketMachineClass) error {
- clone := class.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- finalizers.Delete(DeleteFinalizerName)
- return c.updatePacketMachineClassFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) updatePacketMachineClassFinalizers(ctx context.Context, class *v1alpha1.PacketMachineClass, finalizers []string) error {
- // Get the latest version of the class so that we can avoid conflicts
- class, err := c.controlMachineClient.PacketMachineClasses(class.Namespace).Get(ctx, class.Name, metav1.GetOptions{})
- if err != nil {
- return err
- }
-
- clone := class.DeepCopy()
- clone.Finalizers = finalizers
- _, err = c.controlMachineClient.PacketMachineClasses(class.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- klog.Warning("Updating PacketMachineClass failed, retrying. ", class.Name, err)
- return err
- }
- klog.V(3).Infof("Successfully added/removed finalizer on the packetmachineclass %q", class.Name)
- return err
-}
-
-func (c *controller) enqueuePacketMachineClassAfter(obj interface{}, after time.Duration) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- return
- }
- c.openStackMachineClassQueue.AddAfter(key, after)
-}
diff --git a/pkg/controller/secret.go b/pkg/controller/secret.go
deleted file mode 100644
index d4e94aace..000000000
--- a/pkg/controller/secret.go
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "time"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- corev1 "k8s.io/api/core/v1"
- apiequality "k8s.io/apimachinery/pkg/api/equality"
- "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/client-go/tools/cache"
- "k8s.io/client-go/util/workqueue"
- "k8s.io/klog/v2"
-)
-
-// reconcileClusterSecretKey reconciles a secret due to controller resync
-// or an event on the secret
-func (c *controller) reconcileClusterSecretKey(key string) error {
- ctx := context.Background()
- namespace, name, err := cache.SplitMetaNamespaceKey(key)
- if err != nil {
- return err
- } else if c.namespace != namespace {
- // Secret exists outside of controller namespace
- return nil
- }
-
- secret, err := c.secretLister.Secrets(c.namespace).Get(name)
- if errors.IsNotFound(err) {
- klog.V(4).Infof("%q: Not doing work because it has been deleted", key)
- return nil
- } else if err != nil {
- klog.V(4).Infof("%q: Unable to retrieve object from store: %v", key, err)
- return err
- }
-
- return c.reconcileClusterSecret(ctx, secret)
-}
-
-// reconcileClusterSecret manipulates finalizers based on
-// machineClass references
-func (c *controller) reconcileClusterSecret(ctx context.Context, secret *corev1.Secret) error {
- startTime := time.Now()
-
- klog.V(4).Infof("Start syncing %q", secret.Name)
- defer func() {
- c.enqueueSecretAfter(secret, 10*time.Minute)
- klog.V(4).Infof("Finished syncing %q (%v)", secret.Name, time.Since(startTime))
- }()
-
- // Check if machineClasses are referring to this secret
- exists, err := c.existsMachineClassForSecret(secret.Name)
- if err != nil {
- return err
- }
-
- if exists {
- // If one or more machineClasses refer this, add finalizer (if it doesn't exist)
- err = c.addSecretFinalizers(ctx, secret)
- if err != nil {
- return err
- }
- } else {
- if finalizers := sets.NewString(secret.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- // Finalizer doesn't exist, simply return nil
- return nil
- }
- err = c.deleteSecretFinalizers(ctx, secret)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-/*
- SECTION
- Manipulate Finalizers
-*/
-
-func (c *controller) addSecretFinalizers(ctx context.Context, secret *corev1.Secret) error {
- clone := secret.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); !finalizers.Has(DeleteFinalizerName) {
- finalizers.Insert(DeleteFinalizerName)
- return c.updateSecretFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) deleteSecretFinalizers(ctx context.Context, secret *corev1.Secret) error {
- clone := secret.DeepCopy()
-
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(DeleteFinalizerName) {
- finalizers.Delete(DeleteFinalizerName)
- return c.updateSecretFinalizers(ctx, clone, finalizers.List())
- }
- return nil
-}
-
-func (c *controller) updateSecretFinalizers(ctx context.Context, secret *corev1.Secret, finalizers []string) error {
- // Get the latest version of the secret so that we can avoid conflicts
- secret, err := c.controlCoreClient.CoreV1().Secrets(secret.Namespace).Get(ctx, secret.Name, metav1.GetOptions{})
- if err != nil {
- return err
- }
-
- clone := secret.DeepCopy()
- clone.Finalizers = finalizers
- _, err = c.controlCoreClient.CoreV1().Secrets(clone.Namespace).Update(ctx, clone, metav1.UpdateOptions{})
-
- if err != nil {
- klog.Warning("Updating secret finalizers failed, retrying", secret.Name, err)
- return err
- }
- klog.V(3).Infof("Successfully added/removed finalizer on the secret %q", secret.Name)
- return err
-}
-
-/*
- SECTION
- Event handlers
-*/
-
-func (c *controller) secretAdd(obj interface{}) {
- key, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)
- if err != nil {
- klog.Errorf("Couldn't get key for object %+v: %v", obj, err)
- return
- }
- c.secretQueue.Add(key)
-}
-
-func (c *controller) secretDelete(obj interface{}) {
- c.secretAdd(obj)
-}
-
-func (c *controller) enqueueSecretAfter(obj interface{}, after time.Duration) {
- key, err := cache.MetaNamespaceKeyFunc(obj)
- if err != nil {
- return
- }
- c.secretQueue.AddAfter(key, after)
-}
-
-func enqueueSecretForReferences(queue workqueue.RateLimitingInterface, secretRefs ...*corev1.SecretReference) {
- for _, secretRef := range secretRefs {
- if secretRef != nil {
- queue.Add(secretRef.Namespace + "/" + secretRef.Name)
- }
- }
-}
-
-func enqueueSecretForReferenceIfChanged(queue workqueue.RateLimitingInterface, oldSecretRef, newSecretRef *corev1.SecretReference) {
- if !apiequality.Semantic.DeepEqual(oldSecretRef, newSecretRef) {
- if oldSecretRef != nil {
- queue.Add(oldSecretRef.Namespace + "/" + oldSecretRef.Name)
- }
- if newSecretRef != nil {
- queue.Add(newSecretRef.Namespace + "/" + newSecretRef.Name)
- }
- }
-}
-
-func (c *controller) openStackMachineClassToSecretAdd(obj interface{}) {
- machineClass, ok := obj.(*v1alpha1.OpenStackMachineClass)
- if machineClass == nil || !ok {
- return
- }
- enqueueSecretForReferences(c.secretQueue, machineClass.Spec.SecretRef, machineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) openStackMachineClassToSecretUpdate(oldObj interface{}, newObj interface{}) {
- oldMachineClass, ok := oldObj.(*v1alpha1.OpenStackMachineClass)
- if oldMachineClass == nil || !ok {
- return
- }
- newMachineClass, ok := newObj.(*v1alpha1.OpenStackMachineClass)
- if newMachineClass == nil || !ok {
- return
- }
-
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.SecretRef, newMachineClass.Spec.SecretRef)
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.CredentialsSecretRef, newMachineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) openStackMachineClassToSecretDelete(obj interface{}) {
- c.openStackMachineClassToSecretAdd(obj)
-}
-
-func (c *controller) gcpMachineClassToSecretAdd(obj interface{}) {
- machineClass, ok := obj.(*v1alpha1.GCPMachineClass)
- if machineClass == nil || !ok {
- return
- }
-
- enqueueSecretForReferences(c.secretQueue, machineClass.Spec.SecretRef, machineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) gcpMachineClassToSecretUpdate(oldObj interface{}, newObj interface{}) {
- oldMachineClass, ok := oldObj.(*v1alpha1.GCPMachineClass)
- if oldMachineClass == nil || !ok {
- return
- }
- newMachineClass, ok := newObj.(*v1alpha1.GCPMachineClass)
- if newMachineClass == nil || !ok {
- return
- }
-
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.SecretRef, newMachineClass.Spec.SecretRef)
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.CredentialsSecretRef, newMachineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) gcpMachineClassToSecretDelete(obj interface{}) {
- c.gcpMachineClassToSecretAdd(obj)
-}
-
-func (c *controller) azureMachineClassToSecretAdd(obj interface{}) {
- machineClass, ok := obj.(*v1alpha1.AzureMachineClass)
- if machineClass == nil || !ok {
- return
- }
- enqueueSecretForReferences(c.secretQueue, machineClass.Spec.SecretRef, machineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) azureMachineClassToSecretUpdate(oldObj interface{}, newObj interface{}) {
- oldMachineClass, ok := oldObj.(*v1alpha1.AzureMachineClass)
- if oldMachineClass == nil || !ok {
- return
- }
- newMachineClass, ok := newObj.(*v1alpha1.AzureMachineClass)
- if newMachineClass == nil || !ok {
- return
- }
-
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.SecretRef, newMachineClass.Spec.SecretRef)
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.CredentialsSecretRef, newMachineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) azureMachineClassToSecretDelete(obj interface{}) {
- c.azureMachineClassToSecretAdd(obj)
-}
-
-func (c *controller) alicloudMachineClassToSecretAdd(obj interface{}) {
- machineClass, ok := obj.(*v1alpha1.AlicloudMachineClass)
- if machineClass == nil || !ok {
- return
- }
- enqueueSecretForReferences(c.secretQueue, machineClass.Spec.SecretRef, machineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) alicloudMachineClassToSecretUpdate(oldObj interface{}, newObj interface{}) {
- oldMachineClass, ok := oldObj.(*v1alpha1.AlicloudMachineClass)
- if oldMachineClass == nil || !ok {
- return
- }
- newMachineClass, ok := newObj.(*v1alpha1.AlicloudMachineClass)
- if newMachineClass == nil || !ok {
- return
- }
-
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.SecretRef, newMachineClass.Spec.SecretRef)
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.CredentialsSecretRef, newMachineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) alicloudMachineClassToSecretDelete(obj interface{}) {
- c.alicloudMachineClassToSecretAdd(obj)
-}
-
-func (c *controller) awsMachineClassToSecretAdd(obj interface{}) {
- machineClass, ok := obj.(*v1alpha1.AWSMachineClass)
- if machineClass == nil || !ok {
- return
- }
- enqueueSecretForReferences(c.secretQueue, machineClass.Spec.SecretRef, machineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) awsMachineClassToSecretUpdate(oldObj interface{}, newObj interface{}) {
- oldMachineClass, ok := oldObj.(*v1alpha1.AWSMachineClass)
- if oldMachineClass == nil || !ok {
- return
- }
- newMachineClass, ok := newObj.(*v1alpha1.AWSMachineClass)
- if newMachineClass == nil || !ok {
- return
- }
-
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.SecretRef, newMachineClass.Spec.SecretRef)
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.CredentialsSecretRef, newMachineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) awsMachineClassToSecretDelete(obj interface{}) {
- c.awsMachineClassToSecretAdd(obj)
-}
-
-func (c *controller) packetMachineClassToSecretAdd(obj interface{}) {
- machineClass, ok := obj.(*v1alpha1.PacketMachineClass)
- if machineClass == nil || !ok {
- return
- }
- enqueueSecretForReferences(c.secretQueue, machineClass.Spec.SecretRef, machineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) packetMachineClassToSecretUpdate(oldObj interface{}, newObj interface{}) {
- oldMachineClass, ok := oldObj.(*v1alpha1.PacketMachineClass)
- if oldMachineClass == nil || !ok {
- return
- }
- newMachineClass, ok := newObj.(*v1alpha1.PacketMachineClass)
- if newMachineClass == nil || !ok {
- return
- }
-
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.SecretRef, newMachineClass.Spec.SecretRef)
- enqueueSecretForReferenceIfChanged(c.secretQueue, oldMachineClass.Spec.CredentialsSecretRef, newMachineClass.Spec.CredentialsSecretRef)
-}
-
-func (c *controller) packetMachineClassToSecretDelete(obj interface{}) {
- c.packetMachineClassToSecretAdd(obj)
-}
diff --git a/pkg/controller/secret_test.go b/pkg/controller/secret_test.go
deleted file mode 100644
index 55ca8d1bb..000000000
--- a/pkg/controller/secret_test.go
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package controller
-
-import (
- "context"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- corev1 "k8s.io/api/core/v1"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-var _ = Describe("secret", func() {
-
- //TODO: This method has dependency on generic-machineclass. Implement later.
- Describe("#reconcileClusterSecret", func() {})
-
- Describe("#addSecretFinalizers", func() {
- var (
- testSecret *corev1.Secret
- )
-
- BeforeEach(func() {
- testSecret = &corev1.Secret{
- ObjectMeta: metav1.ObjectMeta{
- Name: "Secret-test",
- Namespace: testNamespace,
- },
- }
- })
-
- // Testcase: It should add finalizer on Secret.
- It("should add finalizer on Secret.", func() {
- stop := make(chan struct{})
- defer close(stop)
-
- objects := []runtime.Object{}
- objects = append(objects, testSecret)
- c, trackers := createController(stop, testNamespace, nil, objects, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- c.addSecretFinalizers(context.TODO(), testSecret)
-
- waitForCacheSync(stop, c)
- expectedSecret, _ := c.controlCoreClient.CoreV1().Secrets(testSecret.Namespace).Get(context.TODO(), testSecret.Name, metav1.GetOptions{})
-
- Expect(expectedSecret.Finalizers).To(HaveLen(1))
- Expect(expectedSecret.Finalizers).To(ContainElement(DeleteFinalizerName))
- })
- })
-
- Describe("#deleteSecretFinalizers", func() {
- var (
- testSecret *corev1.Secret
- finalizers []string
- )
-
- BeforeEach(func() {
- testSecret = &corev1.Secret{
- ObjectMeta: metav1.ObjectMeta{
- Name: "Secret-test",
- Namespace: testNamespace,
- },
- }
- finalizers = []string{DeleteFinalizerName}
- })
-
- // Testcase: It should delete the finalizer from Secret.
- It("should delete the finalizer from Secret.", func() {
- stop := make(chan struct{})
- defer close(stop)
-
- objects := []runtime.Object{}
- objects = append(objects, testSecret)
- c, trackers := createController(stop, testNamespace, nil, objects, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- testSecret, _ := c.controlCoreClient.CoreV1().Secrets(testSecret.Namespace).Get(context.TODO(), testSecret.Name, metav1.GetOptions{})
-
- testSecret.Finalizers = finalizers
- Expect(testSecret.Finalizers).Should(Not(BeEmpty()))
-
- c.deleteSecretFinalizers(context.TODO(), testSecret)
-
- waitForCacheSync(stop, c)
-
- expectedSecret, _ := c.controlCoreClient.CoreV1().Secrets(testSecret.Namespace).Get(context.TODO(), testSecret.Name, metav1.GetOptions{})
-
- Expect(expectedSecret.Finalizers).Should(HaveLen(0))
- })
- })
-
- Describe("#updateSecretFinalizers", func() {
- var (
- testSecret *corev1.Secret
- finalizers []string
- )
-
- BeforeEach(func() {
- testSecret = &corev1.Secret{
- ObjectMeta: metav1.ObjectMeta{
- Name: "Secret-test",
- Namespace: testNamespace,
- },
- }
-
- finalizers = []string{"finalizer1", "finalizer2"}
- })
-
- // Testcase: It should update the finalizer on Secret.
- It("should update the finalizer on Secret.", func() {
- stop := make(chan struct{})
- defer close(stop)
-
- objects := []runtime.Object{}
- objects = append(objects, testSecret)
- c, trackers := createController(stop, testNamespace, nil, objects, nil)
- defer trackers.Stop()
- waitForCacheSync(stop, c)
-
- c.updateSecretFinalizers(context.TODO(), testSecret, finalizers)
-
- waitForCacheSync(stop, c)
-
- testSecret, _ := c.controlCoreClient.CoreV1().Secrets(testSecret.Namespace).Get(context.TODO(), testSecret.Name, metav1.GetOptions{})
-
- Expect(testSecret.Finalizers).To(Equal(finalizers))
- })
- })
-})
diff --git a/pkg/controller/secret_util.go b/pkg/controller/secret_util.go
deleted file mode 100644
index 60e884cc9..000000000
--- a/pkg/controller/secret_util.go
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "k8s.io/apimachinery/pkg/labels"
-)
-
-// existsMachineClassForSecret checks for any machineClass
-// referring to the passed secret object
-func (c *controller) existsMachineClassForSecret(name string) (bool, error) {
- openStackMachineClasses, err := c.findOpenStackMachineClassForSecret(name)
- if err != nil {
- return false, err
- }
-
- gcpMachineClasses, err := c.findGCPMachineClassForSecret(name)
- if err != nil {
- return false, err
- }
-
- azureMachineClasses, err := c.findAzureMachineClassForSecret(name)
- if err != nil {
- return false, err
- }
-
- awsMachineClasses, err := c.findAWSMachineClassForSecret(name)
- if err != nil {
- return false, err
- }
-
- alicloudMachineClasses, err := c.findAlicloudMachineClassForSecret(name)
- if err != nil {
- return false, err
- }
-
- packetMachineClasses, err := c.findPacketMachineClassForSecret(name)
- if err != nil {
- return false, err
- }
-
- if len(openStackMachineClasses) == 0 &&
- len(gcpMachineClasses) == 0 &&
- len(azureMachineClasses) == 0 &&
- len(packetMachineClasses) == 0 &&
- len(alicloudMachineClasses) == 0 &&
- len(awsMachineClasses) == 0 {
- return false, nil
- }
-
- return true, nil
-}
-
-// findOpenStackMachineClassForSecret returns the set of
-// openStackMachineClasses referring to the passed secret
-func (c *controller) findOpenStackMachineClassForSecret(name string) ([]*v1alpha1.OpenStackMachineClass, error) {
- machineClasses, err := c.openStackMachineClassLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.OpenStackMachineClass
- for _, machineClass := range machineClasses {
- if (machineClass.Spec.SecretRef != nil && machineClass.Spec.SecretRef.Name == name) ||
- (machineClass.Spec.CredentialsSecretRef != nil && machineClass.Spec.CredentialsSecretRef.Name == name) {
- filtered = append(filtered, machineClass)
- }
- }
- return filtered, nil
-}
-
-// findGCPClassForSecret returns the set of
-// GCPMachineClasses referring to the passed secret
-func (c *controller) findGCPMachineClassForSecret(name string) ([]*v1alpha1.GCPMachineClass, error) {
- machineClasses, err := c.gcpMachineClassLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.GCPMachineClass
- for _, machineClass := range machineClasses {
- if (machineClass.Spec.SecretRef != nil && machineClass.Spec.SecretRef.Name == name) ||
- (machineClass.Spec.CredentialsSecretRef != nil && machineClass.Spec.CredentialsSecretRef.Name == name) {
- filtered = append(filtered, machineClass)
- }
- }
- return filtered, nil
-}
-
-// findAzureClassForSecret returns the set of
-// AzureMachineClasses referring to the passed secret
-func (c *controller) findAzureMachineClassForSecret(name string) ([]*v1alpha1.AzureMachineClass, error) {
- machineClasses, err := c.azureMachineClassLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.AzureMachineClass
- for _, machineClass := range machineClasses {
- if (machineClass.Spec.SecretRef != nil && machineClass.Spec.SecretRef.Name == name) ||
- (machineClass.Spec.CredentialsSecretRef != nil && machineClass.Spec.CredentialsSecretRef.Name == name) {
- filtered = append(filtered, machineClass)
- }
- }
- return filtered, nil
-}
-
-// findAlicloudClassForSecret returns the set of
-// AlicloudMachineClasses referring to the passed secret
-func (c *controller) findAlicloudMachineClassForSecret(name string) ([]*v1alpha1.AlicloudMachineClass, error) {
- machineClasses, err := c.alicloudMachineClassLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.AlicloudMachineClass
- for _, machineClass := range machineClasses {
- if (machineClass.Spec.SecretRef != nil && machineClass.Spec.SecretRef.Name == name) ||
- (machineClass.Spec.CredentialsSecretRef != nil && machineClass.Spec.CredentialsSecretRef.Name == name) {
- filtered = append(filtered, machineClass)
- }
- }
- return filtered, nil
-}
-
-// findAWSClassForSecret returns the set of
-// AWSMachineClasses referring to the passed secret
-func (c *controller) findAWSMachineClassForSecret(name string) ([]*v1alpha1.AWSMachineClass, error) {
- machineClasses, err := c.awsMachineClassLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.AWSMachineClass
- for _, machineClass := range machineClasses {
- if (machineClass.Spec.SecretRef != nil && machineClass.Spec.SecretRef.Name == name) ||
- (machineClass.Spec.CredentialsSecretRef != nil && machineClass.Spec.CredentialsSecretRef.Name == name) {
- filtered = append(filtered, machineClass)
- }
- }
- return filtered, nil
-}
-
-// findPacketClassForSecret returns the set of
-// PacketMachineClasses referring to the passed secret
-func (c *controller) findPacketMachineClassForSecret(name string) ([]*v1alpha1.PacketMachineClass, error) {
- machineClasses, err := c.packetMachineClassLister.List(labels.Everything())
- if err != nil {
- return nil, err
- }
- var filtered []*v1alpha1.PacketMachineClass
- for _, machineClass := range machineClasses {
- if (machineClass.Spec.SecretRef != nil && machineClass.Spec.SecretRef.Name == name) ||
- (machineClass.Spec.CredentialsSecretRef != nil && machineClass.Spec.CredentialsSecretRef.Name == name) {
- filtered = append(filtered, machineClass)
- }
- }
- return filtered, nil
-}
diff --git a/pkg/driver/driver.go b/pkg/driver/driver.go
deleted file mode 100644
index 0d1dbe7a4..000000000
--- a/pkg/driver/driver.go
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package driver contains the cloud provider specific implementations to manage machines
-package driver
-
-import (
- "strings"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
-
- corev1 "k8s.io/api/core/v1"
-)
-
-// Driver is the common interface for creation/deletion of the VMs over different cloud-providers.
-type Driver interface {
- Create() (string, string, error)
- Delete(string) error
- GetExisting() (string, error)
- GetVMs(string) (VMs, error)
- GetVolNames([]corev1.PersistentVolumeSpec) ([]string, error)
- GetUserData() string
- SetUserData(string)
-}
-
-// VMs maintains a list of VM returned by the provider
-// Key refers to the machine-id on the cloud provider
-// value refers to the machine-name of the machine object
-type VMs map[string]string
-
-// NewDriver creates a new driver object based on the classKind
-func NewDriver(machineID string, secretData map[string][]byte, classKind string, machineClass interface{}, machineName string) Driver {
-
- switch classKind {
- case "OpenStackMachineClass":
- return &OpenStackDriver{
- OpenStackMachineClass: machineClass.(*v1alpha1.OpenStackMachineClass),
- CredentialsData: secretData,
- UserData: string(secretData["userData"]),
- MachineID: machineID,
- MachineName: machineName,
- }
-
- case "AWSMachineClass":
- return &AWSDriver{
- AWSMachineClass: machineClass.(*v1alpha1.AWSMachineClass),
- CredentialsData: secretData,
- UserData: string(secretData["userData"]),
- MachineID: machineID,
- MachineName: machineName,
- }
-
- case "AzureMachineClass":
- return &AzureDriver{
- AzureMachineClass: machineClass.(*v1alpha1.AzureMachineClass),
- CredentialsData: secretData,
- UserData: string(secretData["userData"]),
- MachineID: machineID,
- MachineName: machineName,
- }
-
- case "GCPMachineClass":
- return &GCPDriver{
- GCPMachineClass: machineClass.(*v1alpha1.GCPMachineClass),
- CredentialsData: secretData,
- UserData: string(secretData["userData"]),
- MachineID: machineID,
- MachineName: machineName,
- }
-
- case "AlicloudMachineClass":
- return &AlicloudDriver{
- AlicloudMachineClass: machineClass.(*v1alpha1.AlicloudMachineClass),
- CredentialsData: secretData,
- UserData: string(secretData["userData"]),
- MachineID: machineID,
- MachineName: machineName,
- }
- case "PacketMachineClass":
- return &PacketDriver{
- PacketMachineClass: machineClass.(*v1alpha1.PacketMachineClass),
- CredentialsData: secretData,
- UserData: string(secretData["userData"]),
- MachineID: machineID,
- MachineName: machineName,
- }
- }
-
- return NewFakeDriver(
- func() (string, string, error) {
- fakeVMs["fake"] = "fake_ip"
- return "fake", "fake_ip", nil
- },
- func(machineID string, machineName string) error {
- fakeVMs[machineID] = machineName
- return nil
- },
- func(machineID string) error {
- // delete(fakeVMs, "fake")
- delete(fakeVMs, machineID)
- return nil
- },
- func() (string, error) {
- return "", nil
- },
- func() (VMs, error) {
- return fakeVMs, nil
- },
- func([]corev1.PersistentVolumeSpec) ([]string, error) {
- return []string{}, nil
- },
- func() string {
- return ""
- },
- func(string) {
- return
- },
- )
-}
-
-// ExtractCredentialsFromData extracts and trims a value from the given data map. The first key that exists is being
-// returned, otherwise, the next key is tried, etc. If no key exists then an empty string is returned.
-func ExtractCredentialsFromData(data map[string][]byte, keys ...string) string {
- for _, key := range keys {
- if val, ok := data[key]; ok {
- return strings.TrimSpace(string(val))
- }
- }
- return ""
-}
diff --git a/pkg/driver/driver_alicloud.go b/pkg/driver/driver_alicloud.go
deleted file mode 100644
index 122d75e2c..000000000
--- a/pkg/driver/driver_alicloud.go
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package driver contains the cloud provider specific implementations to manage machines
-package driver
-
-import (
- "encoding/base64"
- "errors"
- "fmt"
- "strconv"
- "strings"
-
- "github.com/prometheus/client_golang/prometheus"
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/metrics"
- corev1 "k8s.io/api/core/v1"
-
- "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests"
- "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils"
- "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
-)
-
-const (
- // alicloudDriverName is the name of the CSI driver for Alibaba Cloud
- alicloudDriverName = "diskplugin.csi.alibabacloud.com"
-)
-
-// AlicloudDriver is the driver struct for holding Alicloud machine information
-type AlicloudDriver struct {
- AlicloudMachineClass *v1alpha1.AlicloudMachineClass
- CredentialsData map[string][]byte
- UserData string
- MachineID string
- MachineName string
-}
-
-// Create is used to create a VM
-func (c *AlicloudDriver) Create() (string, string, error) {
- client, err := c.getEcsClient()
- if err != nil {
- return "", "", err
- }
-
- request := ecs.CreateRunInstancesRequest()
- //request.DryRun = requests.NewBoolean(true)
-
- request.ImageId = c.AlicloudMachineClass.Spec.ImageID
- request.InstanceType = c.AlicloudMachineClass.Spec.InstanceType
- request.RegionId = c.AlicloudMachineClass.Spec.Region
- request.ZoneId = c.AlicloudMachineClass.Spec.ZoneID
- request.SecurityGroupId = c.AlicloudMachineClass.Spec.SecurityGroupID
- request.VSwitchId = c.AlicloudMachineClass.Spec.VSwitchID
- request.PrivateIpAddress = c.AlicloudMachineClass.Spec.PrivateIPAddress
- request.InstanceChargeType = c.AlicloudMachineClass.Spec.InstanceChargeType
- request.InternetChargeType = c.AlicloudMachineClass.Spec.InternetChargeType
- request.SpotStrategy = c.AlicloudMachineClass.Spec.SpotStrategy
- request.IoOptimized = c.AlicloudMachineClass.Spec.IoOptimized
- request.KeyPairName = c.AlicloudMachineClass.Spec.KeyPairName
-
- if c.AlicloudMachineClass.Spec.InternetMaxBandwidthIn != nil {
- request.InternetMaxBandwidthIn = requests.NewInteger(*c.AlicloudMachineClass.Spec.InternetMaxBandwidthIn)
- }
-
- if c.AlicloudMachineClass.Spec.InternetMaxBandwidthOut != nil {
- request.InternetMaxBandwidthOut = requests.NewInteger(*c.AlicloudMachineClass.Spec.InternetMaxBandwidthOut)
- }
-
- if c.AlicloudMachineClass.Spec.DataDisks != nil && len(c.AlicloudMachineClass.Spec.DataDisks) > 0 {
- dataDiskRequests := c.generateDataDiskRequests(c.AlicloudMachineClass.Spec.DataDisks)
- request.DataDisk = &dataDiskRequests
- }
-
- if c.AlicloudMachineClass.Spec.SystemDisk != nil {
- request.SystemDiskCategory = c.AlicloudMachineClass.Spec.SystemDisk.Category
- request.SystemDiskSize = fmt.Sprintf("%d", c.AlicloudMachineClass.Spec.SystemDisk.Size)
- }
-
- tags, err := c.toInstanceTags(c.AlicloudMachineClass.Spec.Tags)
- if err != nil {
- return "", "", err
- }
- request.Tag = &tags
- request.InstanceName = c.MachineName
- request.ClientToken = utils.GetUUIDV4()
- request.UserData = base64.StdEncoding.EncodeToString([]byte(c.UserData))
-
- response, err := client.RunInstances(request)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "alicloud", "service": "ecs"}).Inc()
- return "", "", err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "alicloud", "service": "ecs"}).Inc()
-
- instanceID := response.InstanceIdSets.InstanceIdSet[0]
- machineID := c.encodeMachineID(c.AlicloudMachineClass.Spec.Region, instanceID)
-
- // Hostname can't be fetched immediately from Alicloud API.
- // Even using DescribeInstances by Instance ID, it will return empty.
- // However, for Alicloud hostname, it can be transformed by Instance ID by default
- // Please be noted that returned node name should be in LOWER case
- return machineID, strings.ToLower(c.idToName(instanceID)), nil
-}
-
-func (c *AlicloudDriver) generateDataDiskRequests(disks []v1alpha1.AlicloudDataDisk) []ecs.RunInstancesDataDisk {
- var dataDiskRequests []ecs.RunInstancesDataDisk
- for _, disk := range disks {
-
- dataDiskRequest := ecs.RunInstancesDataDisk{
- Category: disk.Category,
- Encrypted: strconv.FormatBool(disk.Encrypted),
- DiskName: fmt.Sprintf("%s-%s-data-disk", c.MachineName, disk.Name),
- Description: disk.Description,
- Size: fmt.Sprintf("%d", disk.Size),
- }
-
- if disk.DeleteWithInstance != nil {
- dataDiskRequest.DeleteWithInstance = strconv.FormatBool(*disk.DeleteWithInstance)
- } else {
- dataDiskRequest.DeleteWithInstance = strconv.FormatBool(true)
- }
-
- if disk.Category == "DiskEphemeralSSD" {
- dataDiskRequest.DeleteWithInstance = ""
- }
-
- dataDiskRequests = append(dataDiskRequests, dataDiskRequest)
- }
- return dataDiskRequests
-}
-
-// Delete method is used to delete an alicloud machine
-func (c *AlicloudDriver) Delete(machineID string) error {
- result, err := c.getVMDetails(machineID)
- if err != nil {
- return err
- } else if len(result) == 0 {
- // No running instance exists with the given machineID
- klog.V(2).Infof("No VM matching the machineID found on the provider %q", machineID)
- return nil
- }
-
- if result[0].Status != "Running" && result[0].Status != "Stopped" {
- return errors.New("ec2 instance not in running/stopped state")
- }
-
- instanceID := c.decodeMachineID(machineID)
-
- client, err := c.getEcsClient()
- if err != nil {
- return err
- }
-
- err = c.deleteInstance(client, instanceID)
- return err
-}
-
-func (c *AlicloudDriver) deleteInstance(client *ecs.Client, machineID string) error {
- request := ecs.CreateDeleteInstanceRequest()
- request.InstanceId = machineID
- request.Force = requests.NewBoolean(true)
-
- _, err := client.DeleteInstance(request)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "alicloud", "service": "ecs"}).Inc()
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "alicloud", "service": "ecs"}).Inc()
- return err
-}
-
-// GetExisting method is used to get machineID for existing Alicloud machine
-func (c *AlicloudDriver) GetExisting() (string, error) {
- return c.MachineID, nil
-}
-
-func (c *AlicloudDriver) getVMDetails(machineID string) ([]ecs.Instance, error) {
- client, err := c.getEcsClient()
- if err != nil {
- return nil, err
- }
-
- request := ecs.CreateDescribeInstancesRequest()
-
- if machineID != "" {
- machineID = c.decodeMachineID(machineID)
- request.InstanceIds = "[\"" + machineID + "\"]"
- } else {
- searchClusterName := ""
- searchNodeRole := ""
- searchClusterNameValue := ""
- searchNodeRoleValue := ""
-
- for k, v := range c.AlicloudMachineClass.Spec.Tags {
- if strings.Contains(k, "kubernetes.io/cluster/") {
- searchClusterName = k
- searchClusterNameValue = v
- } else if strings.Contains(k, "kubernetes.io/role/") {
- searchNodeRole = k
- searchNodeRoleValue = v
- }
- }
-
- if searchClusterName == "" || searchNodeRole == "" {
- return nil, fmt.Errorf("Can't find VMs with none of machineID/Tag[kubernetes.io/cluster/*]/Tag[kubernetes.io/role/*]")
- }
-
- request.Tag = &[]ecs.DescribeInstancesTag{
- {Key: searchClusterName, Value: searchClusterNameValue},
- {Key: searchNodeRole, Value: searchNodeRoleValue},
- }
- }
-
- response, err := client.DescribeInstances(request)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "alicloud", "service": "ecs"}).Inc()
- return nil, err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "alicloud", "service": "ecs"}).Inc()
-
- return response.Instances.Instance, nil
-}
-
-// GetVMs returns a VM matching the machineID
-// If machineID is an empty string then it returns all matching instances
-func (c *AlicloudDriver) GetVMs(machineID string) (VMs, error) {
- listOfVMs := make(map[string]string)
-
- instances, err := c.getVMDetails(machineID)
- if err != nil {
- return nil, err
- }
-
- for _, instance := range instances {
- machineName := instance.InstanceName
- listOfVMs[c.encodeMachineID(c.AlicloudMachineClass.Spec.Region, instance.InstanceId)] = machineName
- }
-
- return listOfVMs, nil
-}
-
-func (c *AlicloudDriver) encodeMachineID(region, machineID string) string {
- return fmt.Sprintf("%s.%s", region, machineID)
-}
-
-func (c *AlicloudDriver) decodeMachineID(id string) string {
- splitProviderID := strings.Split(id, ".")
- return splitProviderID[len(splitProviderID)-1]
-}
-
-func (c *AlicloudDriver) getEcsClient() (*ecs.Client, error) {
- accessKeyID := ExtractCredentialsFromData(c.CredentialsData, v1alpha1.AlicloudAccessKeyID, v1alpha1.AlicloudAlternativeAccessKeyID)
- accessKeySecret := ExtractCredentialsFromData(c.CredentialsData, v1alpha1.AlicloudAccessKeySecret, v1alpha1.AlicloudAlternativeAccessKeySecret)
- region := c.AlicloudMachineClass.Spec.Region
-
- var ecsClient *ecs.Client
- var err error
- if accessKeyID != "" && accessKeySecret != "" && region != "" {
- ecsClient, err = ecs.NewClientWithAccessKey(region, accessKeyID, accessKeySecret)
- } else {
- err = errors.New("alicloudAccessKeyID or alicloudAccessKeySecret can't be empty")
- }
- return ecsClient, err
-}
-
-// Host name in Alicloud has relationship with Instance ID
-// i-uf69zddmom11ci7est12 => iZuf69zddmom11ci7est12Z
-func (c *AlicloudDriver) idToName(instanceID string) string {
- return strings.Replace(instanceID, "-", "Z", 1) + "Z"
-}
-
-func (c *AlicloudDriver) toInstanceTags(tags map[string]string) ([]ecs.RunInstancesTag, error) {
- result := []ecs.RunInstancesTag{{}, {}}
- hasCluster := false
- hasRole := false
-
- for k, v := range tags {
- if strings.Contains(k, "kubernetes.io/cluster/") {
- hasCluster = true
- result[0].Key = k
- result[0].Value = v
- } else if strings.Contains(k, "kubernetes.io/role/") {
- hasRole = true
- result[1].Key = k
- result[1].Value = v
- } else {
- result = append(result, ecs.RunInstancesTag{Key: k, Value: v})
- }
- }
-
- if !hasCluster || !hasRole {
- err := fmt.Errorf("Tags should at least contains 2 keys, which are prefixed with kubernetes.io/cluster and kubernetes.io/role")
- return nil, err
- }
-
- return result, nil
-}
-
-// GetVolNames parses volume names from pv specs
-func (c *AlicloudDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error) {
- names := []string{}
- for i := range specs {
- spec := &specs[i]
- if spec.FlexVolume != nil && spec.FlexVolume.Options != nil {
- if name, ok := spec.FlexVolume.Options["volumeId"]; ok {
- names = append(names, name)
- }
- } else if spec.CSI != nil && spec.CSI.Driver == alicloudDriverName && spec.CSI.VolumeHandle != "" {
- names = append(names, spec.CSI.VolumeHandle)
- }
- }
- return names, nil
-}
-
-// GetUserData return the used data whit which the VM will be booted
-func (c *AlicloudDriver) GetUserData() string {
- return c.UserData
-}
-
-// SetUserData set the used data whit which the VM will be booted
-func (c *AlicloudDriver) SetUserData(userData string) {
- c.UserData = userData
-}
diff --git a/pkg/driver/driver_alicloud_test.go b/pkg/driver/driver_alicloud_test.go
deleted file mode 100644
index 8e4219247..000000000
--- a/pkg/driver/driver_alicloud_test.go
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package driver
-
-import (
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- "strconv"
-
- "github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
-)
-
-var _ = Describe("Driver AliCloud", func() {
- Context("Generate Instance Tags", func() {
-
- It("Should maintain order of cluster and worker tags", func() {
- tags := map[string]string{
- "kubernetes.io/cluster/ali-test": "1",
- "kubernetes.io/role/worker": "1",
- "taga": "tagvala",
- "tagb": "tagvalb",
- "tagc": "tagvalc",
- }
- c := &AlicloudDriver{}
- res, err := c.toInstanceTags(tags)
- expected := []ecs.RunInstancesTag{
- {
- Key: "kubernetes.io/cluster/ali-test",
- Value: "1",
- },
- {
- Key: "kubernetes.io/role/worker",
- Value: "1",
- },
- {
- Key: "taga",
- Value: "tagvala",
- },
- {
- Key: "tagb",
- Value: "tagvalb",
- },
- {
- Key: "tagc",
- Value: "tagvalc",
- },
- }
- Expect(err).ToNot(HaveOccurred())
- Expect(res[0:2]).To(Equal(expected[0:2]))
- Expect(res[2:5]).To(ConsistOf(expected[2:5]))
- })
-
- It("Should fail if no cluster tags", func() {
- tags := map[string]string{
- "kubernetes.io/role/worker": "1",
- "taga": "tagvala",
- "tagb": "tagvalb",
- "tagc": "tagvalc",
- }
- c := &AlicloudDriver{}
- _, err := c.toInstanceTags(tags)
- Expect(err).To(HaveOccurred())
- })
-
- It("should order cluster and worker tags", func() {
- tags := map[string]string{
- "taga": "tagvala",
- "tagb": "tagvalb",
- "kubernetes.io/cluster/ali-test": "1",
- "kubernetes.io/role/worker": "1",
- "tagc": "tagvalc",
- }
- c := &AlicloudDriver{}
- res, err := c.toInstanceTags(tags)
-
- expected := []ecs.RunInstancesTag{
- {
- Key: "kubernetes.io/cluster/ali-test",
- Value: "1",
- },
- {
- Key: "kubernetes.io/role/worker",
- Value: "1",
- },
- {
- Key: "taga",
- Value: "tagvala",
- },
- {
- Key: "tagb",
- Value: "tagvalb",
- },
- {
- Key: "tagc",
- Value: "tagvalc",
- },
- }
- Expect(err).ToNot(HaveOccurred())
- Expect(res[0:2]).To(Equal(expected[0:2]))
- Expect(res[2:5]).To(ConsistOf(expected[2:5]))
- })
-
- It("Should generate name from ID", func() {
- id := "i-uf69zddmom11ci7est12"
- expectedName := "iZuf69zddmom11ci7est12Z"
- c := &AlicloudDriver{}
- res := c.idToName(id)
- Expect(res).To(Equal(expectedName))
- })
-
- })
-
- Context("Generate Data Disk Requests", func() {
-
- It("should generate multiple data disk requests", func() {
- c := &AlicloudDriver{}
- c.MachineName = "machinename"
- vol1delete := true
- vol2delete := false
- dataDisks := []v1alpha1.AlicloudDataDisk{
- {
- Name: "dd1",
- Category: "cloud_efficiency",
- Description: "this is a disk",
- DeleteWithInstance: &vol1delete,
- Encrypted: true,
- Size: 100,
- },
- {
- Name: "dd2",
- Category: "cloud_ssd",
- Description: "this is also a disk",
- DeleteWithInstance: &vol2delete,
- Encrypted: false,
- Size: 50,
- },
- }
-
- generatedDataDisksRequests := c.generateDataDiskRequests(dataDisks)
- expectedDataDiskRequests := []ecs.RunInstancesDataDisk{
- {
- Size: "100",
- Category: "cloud_efficiency",
- Encrypted: strconv.FormatBool(true),
- DiskName: "machinename-dd1-data-disk",
- Description: "this is a disk",
- DeleteWithInstance: strconv.FormatBool(true),
- },
- {
- Size: "50",
- Category: "cloud_ssd",
- Encrypted: strconv.FormatBool(false),
- DiskName: "machinename-dd2-data-disk",
- Description: "this is also a disk",
- DeleteWithInstance: strconv.FormatBool(false),
- },
- }
-
- Expect(generatedDataDisksRequests).To(Equal(expectedDataDiskRequests))
- })
-
- It("should not encrypt and delete with instance by default", func() {
- c := &AlicloudDriver{}
- c.MachineName = "machinename"
- dataDisks := []v1alpha1.AlicloudDataDisk{
- {
- Name: "dd1",
- Category: "cloud_efficiency",
- Description: "this is a disk",
- Size: 100,
- },
- }
-
- generatedDataDisksRequests := c.generateDataDiskRequests(dataDisks)
- expectedDataDiskRequests := []ecs.RunInstancesDataDisk{
- {
- Size: "100",
- Category: "cloud_efficiency",
- Encrypted: strconv.FormatBool(false),
- DiskName: "machinename-dd1-data-disk",
- Description: "this is a disk",
- DeleteWithInstance: strconv.FormatBool(true),
- },
- }
-
- Expect(generatedDataDisksRequests).To(Equal(expectedDataDiskRequests))
- })
- })
-})
diff --git a/pkg/driver/driver_aws.go b/pkg/driver/driver_aws.go
deleted file mode 100644
index 8392b25e7..000000000
--- a/pkg/driver/driver_aws.go
+++ /dev/null
@@ -1,557 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package driver contains the cloud provider specific implementations to manage machines
-package driver
-
-import (
- "encoding/base64"
- "errors"
- "fmt"
- "net/url"
- "regexp"
- "strings"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/metrics"
- "github.com/prometheus/client_golang/prometheus"
- corev1 "k8s.io/api/core/v1"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/aws/credentials"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/service/ec2"
- "k8s.io/klog/v2"
-)
-
-const (
- // awsEBSDriverName is the name of the CSI driver for EBS
- awsEBSDriverName = "ebs.csi.aws.com"
-
- resourceTypeInstance = "instance"
- resourceTypeVolume = "volume"
-)
-
-// AWSDriver is the driver struct for holding AWS machine information
-type AWSDriver struct {
- AWSMachineClass *v1alpha1.AWSMachineClass
- CredentialsData map[string][]byte
- UserData string
- MachineID string
- MachineName string
-}
-
-// NewAWSDriver returns an empty AWSDriver object
-func NewAWSDriver(create func() (string, error), delete func() error, existing func() (string, error)) Driver {
- return &AWSDriver{}
-}
-
-// Create method is used to create a AWS machine
-func (d *AWSDriver) Create() (string, string, error) {
- svc, err := d.createSVC()
- if err != nil {
- return "Error", "Error", err
- }
-
- UserDataEnc := base64.StdEncoding.EncodeToString([]byte(d.UserData))
-
- var imageIds []*string
- imageID := aws.String(d.AWSMachineClass.Spec.AMI)
- imageIds = append(imageIds, imageID)
-
- describeImagesRequest := ec2.DescribeImagesInput{
- ImageIds: imageIds,
- }
- output, err := svc.DescribeImages(&describeImagesRequest)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
- return "Error", "Error", err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
-
- if len(output.Images) < 1 {
- return "Error", "Error", fmt.Errorf("Image %s not found", *imageID)
- }
-
- blkDeviceMappings, err := d.generateBlockDevices(d.AWSMachineClass.Spec.BlockDevices, output.Images[0].RootDeviceName)
- if err != nil {
- return "Error", "Error", err
- }
-
- tagInstance, err := d.generateTags(d.AWSMachineClass.Spec.Tags, resourceTypeInstance)
- if err != nil {
- return "Error", "Error", err
- }
-
- tagVolume, err := d.generateTags(d.AWSMachineClass.Spec.Tags, resourceTypeVolume)
- if err != nil {
- return "Error", "Error", err
- }
-
- var networkInterfaceSpecs []*ec2.InstanceNetworkInterfaceSpecification
- for i, netIf := range d.AWSMachineClass.Spec.NetworkInterfaces {
- spec := &ec2.InstanceNetworkInterfaceSpecification{
- Groups: aws.StringSlice(netIf.SecurityGroupIDs),
- DeviceIndex: aws.Int64(int64(i)),
- AssociatePublicIpAddress: netIf.AssociatePublicIPAddress,
- DeleteOnTermination: netIf.DeleteOnTermination,
- Description: netIf.Description,
- SubnetId: aws.String(netIf.SubnetID),
- }
-
- if netIf.DeleteOnTermination == nil {
- spec.DeleteOnTermination = aws.Bool(true)
- }
-
- networkInterfaceSpecs = append(networkInterfaceSpecs, spec)
- }
-
- // Specify the details of the machine
- inputConfig := ec2.RunInstancesInput{
- ImageId: aws.String(d.AWSMachineClass.Spec.AMI),
- InstanceType: aws.String(d.AWSMachineClass.Spec.MachineType),
- MinCount: aws.Int64(1),
- MaxCount: aws.Int64(1),
- UserData: &UserDataEnc,
- KeyName: aws.String(d.AWSMachineClass.Spec.KeyName),
- NetworkInterfaces: networkInterfaceSpecs,
- IamInstanceProfile: &ec2.IamInstanceProfileSpecification{
- Name: &(d.AWSMachineClass.Spec.IAM.Name),
- },
- BlockDeviceMappings: blkDeviceMappings,
- TagSpecifications: []*ec2.TagSpecification{tagInstance, tagVolume},
- }
-
- if d.AWSMachineClass.Spec.SpotPrice != nil {
- inputConfig.InstanceMarketOptions = &ec2.InstanceMarketOptionsRequest{
- MarketType: aws.String(ec2.MarketTypeSpot),
- SpotOptions: &ec2.SpotMarketOptions{
- SpotInstanceType: aws.String(ec2.SpotInstanceTypeOneTime),
- },
- }
-
- if *d.AWSMachineClass.Spec.SpotPrice != "" {
- inputConfig.InstanceMarketOptions.SpotOptions.MaxPrice = d.AWSMachineClass.Spec.SpotPrice
- }
- }
-
- runResult, err := svc.RunInstances(&inputConfig)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
- return "Error", "Error", err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
-
- return d.encodeMachineID(d.AWSMachineClass.Spec.Region, *runResult.Instances[0].InstanceId), *runResult.Instances[0].PrivateDnsName, nil
-}
-
-func (d *AWSDriver) generateTags(tags map[string]string, resourceType string) (*ec2.TagSpecification, error) {
-
- // Add tags to the created machine
- tagList := []*ec2.Tag{}
- for idx, element := range tags {
- if idx == "Name" {
- // Name tag cannot be set, as its used to identify backing machine object
- continue
- }
- newTag := ec2.Tag{
- Key: aws.String(idx),
- Value: aws.String(element),
- }
- tagList = append(tagList, &newTag)
- }
- nameTag := ec2.Tag{
- Key: aws.String("Name"),
- Value: aws.String(d.MachineName),
- }
- tagList = append(tagList, &nameTag)
-
- tagInstance := &ec2.TagSpecification{
- ResourceType: aws.String(resourceType),
- Tags: tagList,
- }
- return tagInstance, nil
-}
-
-func (d *AWSDriver) generateBlockDevices(blockDevices []v1alpha1.AWSBlockDeviceMappingSpec, rootDeviceName *string) ([]*ec2.BlockDeviceMapping, error) {
-
- var blkDeviceMappings []*ec2.BlockDeviceMapping
- // if blockDevices is empty, AWS will automatically create a root partition
- for _, disk := range blockDevices {
-
- deviceName := disk.DeviceName
- if disk.DeviceName == "/root" || len(blockDevices) == 1 {
- deviceName = *rootDeviceName
- }
- deleteOnTermination := disk.Ebs.DeleteOnTermination
- volumeSize := disk.Ebs.VolumeSize
- volumeType := disk.Ebs.VolumeType
- encrypted := disk.Ebs.Encrypted
- snapshotID := disk.Ebs.SnapshotID
-
- blkDeviceMapping := ec2.BlockDeviceMapping{
- DeviceName: aws.String(deviceName),
- Ebs: &ec2.EbsBlockDevice{
- Encrypted: aws.Bool(encrypted),
- VolumeSize: aws.Int64(volumeSize),
- VolumeType: aws.String(volumeType),
- },
- }
- if deleteOnTermination != nil {
- blkDeviceMapping.Ebs.DeleteOnTermination = deleteOnTermination
- }
-
- if volumeType == "io1" {
- blkDeviceMapping.Ebs.Iops = aws.Int64(disk.Ebs.Iops)
- }
-
- if snapshotID != nil {
- blkDeviceMapping.Ebs.SnapshotId = snapshotID
- }
- blkDeviceMappings = append(blkDeviceMappings, &blkDeviceMapping)
- }
-
- return blkDeviceMappings, nil
-}
-
-// checkBlockDevices returns instanceBlockDevices whose DeleteOnTermination
-// field is nil on machineAPIs and resets the values to true,
-// to allow deletion on termination of instance
-func (d *AWSDriver) checkBlockDevices(instanceID string, rootDeviceName *string) ([]*ec2.InstanceBlockDeviceMappingSpecification, error) {
- blockDevices := d.AWSMachineClass.Spec.BlockDevices
- var instanceBlkDeviceMappings []*ec2.InstanceBlockDeviceMappingSpecification
-
- for _, disk := range d.AWSMachineClass.Spec.BlockDevices {
-
- deviceName := disk.DeviceName
- if disk.DeviceName == "/root" || len(blockDevices) == 1 {
- deviceName = *rootDeviceName
- }
-
- deleteOnTermination := disk.Ebs.DeleteOnTermination
-
- if deleteOnTermination == nil {
- blkDeviceMapping := ec2.InstanceBlockDeviceMappingSpecification{
- DeviceName: aws.String(deviceName),
- Ebs: &ec2.EbsInstanceBlockDeviceSpecification{
- DeleteOnTermination: aws.Bool(true),
- },
- }
- instanceBlkDeviceMappings = append(instanceBlkDeviceMappings, &blkDeviceMapping)
- }
-
- }
-
- return instanceBlkDeviceMappings, nil
-}
-
-// Delete method is used to delete a AWS machine
-func (d *AWSDriver) Delete(machineID string) error {
- var imageIds []*string
- imageID := aws.String(d.AWSMachineClass.Spec.AMI)
- imageIds = append(imageIds, imageID)
-
- result, err := d.GetVMs(machineID)
- if err != nil {
- return err
- } else if len(result) == 0 {
- // No running instance exists with the given machine-ID
- klog.V(2).Infof("No VM matching the machine-ID found on the provider %q", machineID)
- return nil
- }
-
- instanceID := d.decodeMachineID(machineID)
- svc, err := d.createSVC()
- if err != nil {
- return err
- }
-
- describeImagesRequest := ec2.DescribeImagesInput{
- ImageIds: imageIds,
- }
- describeImageOutput, err := svc.DescribeImages(&describeImagesRequest)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
- return err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
-
- if len(describeImageOutput.Images) < 1 {
- // Disk image not found at provider
- klog.Warningf("Disk image %s not found at provider for machineID %q", *imageID, machineID)
- } else {
- // returns instanceBlockDevices whose DeleteOnTermination field is nil on machineAPIs
- instanceBlkDeviceMappings, err := d.checkBlockDevices(instanceID, describeImageOutput.Images[0].RootDeviceName)
- if err != nil {
- klog.Errorf("Could not Default deletionOnTermination while terminating machine: %s", err.Error())
- }
-
- // Default deletionOnTermination to true when unset on API field
- if err == nil && len(instanceBlkDeviceMappings) > 0 {
- input := &ec2.ModifyInstanceAttributeInput{
- InstanceId: aws.String(instanceID),
- BlockDeviceMappings: instanceBlkDeviceMappings,
- }
- _, err = svc.ModifyInstanceAttribute(input)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
- klog.Warningf("Couldn't complete modify instance with machineID %q. Error: %s. Continuing machine deletion", machineID, err.Error())
- } else {
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
- klog.V(2).Infof("Successfully defaulted deletionOnTermination to true for disks (with nil pointer) for machineID: %q", machineID)
- }
- }
- }
-
- // Terminate instance call
- input := &ec2.TerminateInstancesInput{
- InstanceIds: []*string{
- aws.String(instanceID),
- },
- DryRun: aws.Bool(true),
- }
- _, err = svc.TerminateInstances(input)
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
- awsErr, ok := err.(awserr.Error)
- if ok && awsErr.Code() == "DryRunOperation" {
- input.DryRun = aws.Bool(false)
- output, err := svc.TerminateInstances(input)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
- klog.Errorf("Could not terminate machine: %s", err.Error())
- return err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
-
- vmState := output.TerminatingInstances[0]
- //klog.Info(vmState.PreviousState, vmState.CurrentState)
-
- if *vmState.CurrentState.Name == "shutting-down" ||
- *vmState.CurrentState.Name == "terminated" {
- return nil
- }
-
- err = errors.New("Machine already terminated")
- }
-
- klog.Errorf("Could not terminate machine: %s", err.Error())
- return err
-}
-
-// GetExisting method is used to get machineID for existing AWS machine
-func (d *AWSDriver) GetExisting() (string, error) {
- return d.MachineID, nil
-}
-
-// GetVMs returns a VM matching the machineID
-// If machineID is an empty string then it returns all matching instances
-func (d *AWSDriver) GetVMs(machineID string) (VMs, error) {
- listOfVMs := make(map[string]string)
-
- clusterName := ""
- nodeRole := ""
-
- for key := range d.AWSMachineClass.Spec.Tags {
- if strings.Contains(key, "kubernetes.io/cluster/") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes.io/role/") {
- nodeRole = key
- }
- }
-
- if clusterName == "" || nodeRole == "" {
- return listOfVMs, nil
- }
-
- svc, err := d.createSVC()
- if err != nil {
- return listOfVMs, err
- }
-
- input := ec2.DescribeInstancesInput{
- Filters: []*ec2.Filter{
- {
- Name: aws.String("tag-key"),
- Values: []*string{
- &clusterName,
- },
- },
- {
- Name: aws.String("tag-key"),
- Values: []*string{
- &nodeRole,
- },
- },
- {
- Name: aws.String("instance-state-name"),
- Values: []*string{
- aws.String("pending"),
- aws.String("running"),
- aws.String("stopping"),
- aws.String("stopped"),
- },
- },
- },
- }
-
- // When targeting particular VM
- if machineID != "" {
- machineID = d.decodeMachineID(machineID)
- instanceFilter := &ec2.Filter{
- Name: aws.String("instance-id"),
- Values: []*string{
- &machineID,
- },
- }
- input.Filters = append(input.Filters, instanceFilter)
- }
-
- runResult, err := svc.DescribeInstances(&input)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
- klog.Errorf("AWS driver is returning error while describe instances request is sent: %s", err)
- return listOfVMs, err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "aws", "service": "ecs"}).Inc()
-
- for _, reservation := range runResult.Reservations {
- for _, instance := range reservation.Instances {
-
- machineName := ""
- for _, tag := range instance.Tags {
- if *tag.Key == "Name" {
- machineName = *tag.Value
- break
- }
- }
- listOfVMs[d.encodeMachineID(d.AWSMachineClass.Spec.Region, *instance.InstanceId)] = machineName
- }
- }
-
- return listOfVMs, nil
-}
-
-// Helper function to create SVC
-func (d *AWSDriver) createSVC() (*ec2.EC2, error) {
- var (
- config = &aws.Config{
- Region: aws.String(d.AWSMachineClass.Spec.Region),
- }
-
- accessKeyID = ExtractCredentialsFromData(d.CredentialsData, v1alpha1.AWSAccessKeyID, v1alpha1.AWSAlternativeAccessKeyID)
- secretAccessKey = ExtractCredentialsFromData(d.CredentialsData, v1alpha1.AWSSecretAccessKey, v1alpha1.AWSAlternativeSecretAccessKey)
- )
-
- if accessKeyID != "" && secretAccessKey != "" {
- config.Credentials = credentials.NewStaticCredentialsFromCreds(credentials.Value{
- AccessKeyID: accessKeyID,
- SecretAccessKey: secretAccessKey,
- })
- }
-
- s, err := session.NewSession(config)
- if err != nil {
- return nil, err
- }
-
- return ec2.New(s), nil
-}
-
-func (d *AWSDriver) encodeMachineID(region, machineID string) string {
- return fmt.Sprintf("aws:///%s/%s", region, machineID)
-}
-
-func (d *AWSDriver) decodeMachineID(id string) string {
- splitProviderID := strings.Split(id, "/")
- return splitProviderID[len(splitProviderID)-1]
-}
-
-// GetVolNames parses volume names from pv specs
-func (d *AWSDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error) {
- names := []string{}
- for i := range specs {
- spec := &specs[i]
- if spec.AWSElasticBlockStore != nil {
- name, err := kubernetesVolumeIDToEBSVolumeID(spec.AWSElasticBlockStore.VolumeID)
- if err != nil {
- klog.Errorf("Failed to translate Kubernetes volume ID '%s' to EBS volume ID: %v", spec.AWSElasticBlockStore.VolumeID, err)
- continue
- }
-
- names = append(names, name)
- } else if spec.CSI != nil && spec.CSI.Driver == awsEBSDriverName && spec.CSI.VolumeHandle != "" {
- name := spec.CSI.VolumeHandle
- names = append(names, name)
- }
- }
- return names, nil
-}
-
-// GetUserData return the used data whit which the VM will be booted
-func (d *AWSDriver) GetUserData() string {
- return d.UserData
-}
-
-// SetUserData set the used data whit which the VM will be booted
-func (d *AWSDriver) SetUserData(userData string) {
- d.UserData = userData
-}
-
-// awsVolumeRegMatch represents Regex Match for AWS volume.
-var awsVolumeRegMatch = regexp.MustCompile("^vol-[^/]*$")
-
-// kubernetesVolumeIDToEBSVolumeID translates Kubernetes volume ID to EBS volume ID
-// KubernetsVolumeID forms:
-// - aws:///
-// - aws:///
-// -
-//
-// EBS Volume ID form:
-// - vol-
-func kubernetesVolumeIDToEBSVolumeID(kubernetesID string) (string, error) {
- // name looks like aws://availability-zone/awsVolumeId
-
- // The original idea of the URL-style name was to put the AZ into the
- // host, so we could find the AZ immediately from the name without
- // querying the API. But it turns out we don't actually need it for
- // multi-AZ clusters, as we put the AZ into the labels on the PV instead.
- // However, if in future we want to support multi-AZ cluster
- // volume-awareness without using PersistentVolumes, we likely will
- // want the AZ in the host.
- if !strings.HasPrefix(kubernetesID, "aws://") {
- // Assume a bare aws volume id (vol-1234...)
- return kubernetesID, nil
- }
- url, err := url.Parse(kubernetesID)
- if err != nil {
- return "", fmt.Errorf("invalid disk name (%s): %v", kubernetesID, err)
- }
- if url.Scheme != "aws" {
- return "", fmt.Errorf("invalid scheme for AWS volume (%s)", kubernetesID)
- }
-
- awsID := url.Path
- awsID = strings.Trim(awsID, "/")
-
- // We sanity check the resulting volume; the two known formats are
- // vol-12345678 and vol-12345678abcdef01
- if !awsVolumeRegMatch.MatchString(awsID) {
- return "", fmt.Errorf("invalid format for AWS volume (%s)", kubernetesID)
- }
-
- return awsID, nil
-}
diff --git a/pkg/driver/driver_aws_test.go b/pkg/driver/driver_aws_test.go
deleted file mode 100644
index af42beeed..000000000
--- a/pkg/driver/driver_aws_test.go
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package driver
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/ec2"
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- corev1 "k8s.io/api/core/v1"
-)
-
-var _ = Describe("Driver AWS", func() {
-
- Context("#generateTags", func() {
-
- It("should convert multiples tags successfully", func() {
- awsDriver := &AWSDriver{
- AWSMachineClass: &v1alpha1.AWSMachineClass{},
- CredentialsData: map[string][]byte{},
- UserData: "dXNlciBkYXRhCg==",
- MachineID: "ami-99fn8a892f94e765a",
- MachineName: "machine-name",
- }
- tags := map[string]string{
- "tag-1": "value-tag-1",
- "tag-2": "value-tag-2",
- "tag-3": "value-tag-3",
- }
-
- tagsGenerated, err := awsDriver.generateTags(tags, resourceTypeInstance)
- expectedTags := &ec2.TagSpecification{
- ResourceType: aws.String("instance"),
- Tags: []*ec2.Tag{
- {
- Key: aws.String("tag-1"),
- Value: aws.String("value-tag-1"),
- },
- {
- Key: aws.String("tag-2"),
- Value: aws.String("value-tag-2"),
- },
- {
- Key: aws.String("tag-3"),
- Value: aws.String("value-tag-3"),
- },
- {
- Key: aws.String("Name"),
- Value: aws.String("machine-name"),
- },
- },
- }
-
- Expect(tagsGenerated.ResourceType).To(Equal(expectedTags.ResourceType))
- Expect(tagsGenerated.Tags).To(ConsistOf(expectedTags.Tags))
- Expect(err).ToNot(HaveOccurred())
- })
-
- It("should convert zero tags successfully", func() {
- awsDriver := &AWSDriver{}
- tags := map[string]string{}
-
- tagsGenerated, err := awsDriver.generateTags(tags, resourceTypeInstance)
- expectedTags := &ec2.TagSpecification{
- ResourceType: aws.String("instance"),
- Tags: []*ec2.Tag{
- {
- Key: aws.String("Name"),
- Value: aws.String(""),
- },
- },
- }
-
- Expect(tagsGenerated).To(Equal(expectedTags))
- Expect(err).ToNot(HaveOccurred())
- })
- })
-
- Context("#generateBlockDevices", func() {
-
- It("should convert multiples blockDevices successfully", func() {
- awsDriver := &AWSDriver{}
- disks := []v1alpha1.AWSBlockDeviceMappingSpec{
- {
- DeviceName: "/root",
- Ebs: v1alpha1.AWSEbsBlockDeviceSpec{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: false,
- VolumeSize: 32,
- VolumeType: "gp2",
- },
- },
- {
- DeviceName: "/dev/xvdg",
- Ebs: v1alpha1.AWSEbsBlockDeviceSpec{
- DeleteOnTermination: aws.Bool(false),
- Encrypted: true,
- Iops: 100,
- VolumeSize: 64,
- VolumeType: "io1",
- },
- },
- }
-
- rootDevice := aws.String("/dev/sda")
- disksGenerated, err := awsDriver.generateBlockDevices(disks, rootDevice)
- expectedDisks := []*ec2.BlockDeviceMapping{
- {
- DeviceName: aws.String("/dev/sda"),
- Ebs: &ec2.EbsBlockDevice{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: aws.Bool(false),
- VolumeSize: aws.Int64(32),
- Iops: nil,
- VolumeType: aws.String("gp2"),
- },
- },
- {
- DeviceName: aws.String("/dev/xvdg"),
- Ebs: &ec2.EbsBlockDevice{
- DeleteOnTermination: aws.Bool(false),
- Encrypted: aws.Bool(true),
- VolumeSize: aws.Int64(64),
- Iops: aws.Int64(100),
- VolumeType: aws.String("io1"),
- },
- },
- }
-
- Expect(disksGenerated).To(Equal(expectedDisks))
- Expect(err).ToNot(HaveOccurred())
- })
-
- It("should convert single blockDevices without deviceName successfully", func() {
- awsDriver := &AWSDriver{}
- disks := []v1alpha1.AWSBlockDeviceMappingSpec{
- {
- Ebs: v1alpha1.AWSEbsBlockDeviceSpec{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: false,
- VolumeSize: 32,
- VolumeType: "gp2",
- },
- },
- }
-
- rootDevice := aws.String("/dev/sda")
- disksGenerated, err := awsDriver.generateBlockDevices(disks, rootDevice)
- expectedDisks := []*ec2.BlockDeviceMapping{
- {
- DeviceName: aws.String("/dev/sda"),
- Ebs: &ec2.EbsBlockDevice{
- DeleteOnTermination: aws.Bool(true),
- Encrypted: aws.Bool(false),
- VolumeSize: aws.Int64(32),
- Iops: nil,
- VolumeType: aws.String("gp2"),
- },
- },
- }
-
- Expect(disksGenerated).To(Equal(expectedDisks))
- Expect(err).ToNot(HaveOccurred())
- })
-
- It("should convert zero blockDevices successfully", func() {
- awsDriver := &AWSDriver{}
- disks := []v1alpha1.AWSBlockDeviceMappingSpec{}
-
- rootDevice := aws.String("/dev/sda")
- disksGenerated, err := awsDriver.generateBlockDevices(disks, rootDevice)
- var expectedDisks []*ec2.BlockDeviceMapping
-
- Expect(disksGenerated).To(Equal(expectedDisks))
- Expect(err).ToNot(HaveOccurred())
- })
-
- It("should not encrypt blockDevices by default", func() {
- awsDriver := &AWSDriver{}
- disks := []v1alpha1.AWSBlockDeviceMappingSpec{
- {
- Ebs: v1alpha1.AWSEbsBlockDeviceSpec{
- VolumeSize: 32,
- VolumeType: "gp2",
- },
- },
- }
-
- rootDevice := aws.String("/dev/sda")
- disksGenerated, err := awsDriver.generateBlockDevices(disks, rootDevice)
- expectedDisks := []*ec2.BlockDeviceMapping{
- {
- DeviceName: aws.String("/dev/sda"),
- Ebs: &ec2.EbsBlockDevice{
- Encrypted: aws.Bool(false),
- VolumeSize: aws.Int64(32),
- Iops: nil,
- VolumeType: aws.String("gp2"),
- },
- },
- }
-
- Expect(disksGenerated).To(Equal(expectedDisks))
- Expect(err).ToNot(HaveOccurred())
- })
- })
-
- Context("#GetVolNames", func() {
- var hostPathPVSpec = corev1.PersistentVolumeSpec{
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- HostPath: &corev1.HostPathVolumeSource{
- Path: "/mnt/data",
- },
- },
- }
-
- It("should handle in-tree PV (with .spec.awsElasticBlockStore)", func() {
- driver := &AWSDriver{}
- pvs := []corev1.PersistentVolumeSpec{
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- AWSElasticBlockStore: &corev1.AWSElasticBlockStoreVolumeSource{
- VolumeID: "aws://eu-west-1a/vol-1234",
- },
- },
- },
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- AWSElasticBlockStore: &corev1.AWSElasticBlockStoreVolumeSource{
- VolumeID: "aws:///vol-2345",
- },
- },
- },
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- AWSElasticBlockStore: &corev1.AWSElasticBlockStoreVolumeSource{
- VolumeID: "vol-3456",
- },
- },
- },
- hostPathPVSpec,
- }
-
- actual, err := driver.GetVolNames(pvs)
- Expect(err).ToNot(HaveOccurred())
- Expect(actual).To(Equal([]string{"vol-1234", "vol-2345", "vol-3456"}))
- })
-
- It("should handle out-of-tree PV (with .spec.csi.volumeHandle)", func() {
- driver := &AWSDriver{}
- pvs := []corev1.PersistentVolumeSpec{
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- Driver: "io.kubernetes.storage.mock",
- VolumeHandle: "vol-2345",
- },
- },
- },
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- Driver: "ebs.csi.aws.com",
- VolumeHandle: "vol-1234",
- },
- },
- },
- hostPathPVSpec,
- }
-
- actual, err := driver.GetVolNames(pvs)
- Expect(err).ToNot(HaveOccurred())
- Expect(actual).To(Equal([]string{"vol-1234"}))
- })
- })
-})
diff --git a/pkg/driver/driver_azure.go b/pkg/driver/driver_azure.go
deleted file mode 100644
index 39ac7b71a..000000000
--- a/pkg/driver/driver_azure.go
+++ /dev/null
@@ -1,1354 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package driver contains the cloud provider specific implementations to manage machines
-package driver
-
-import (
- "context"
- "encoding/base64"
- "fmt"
- "strconv"
- "strings"
- "sync"
- "time"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/metrics"
- backoff "github.com/gardener/machine-controller-manager/pkg/util/backoff"
- "github.com/prometheus/client_golang/prometheus"
- corev1 "k8s.io/api/core/v1"
-
- "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
- "github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering"
- "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-11-01/network"
- "github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2019-05-01/resources"
-
- "github.com/Azure/go-autorest/autorest"
- "github.com/Azure/go-autorest/autorest/adal"
- "github.com/Azure/go-autorest/autorest/azure"
- "github.com/Azure/go-autorest/autorest/to"
- "k8s.io/klog/v2"
-)
-
-const (
- // azureDiskDriverName is the name of the CSI driver for Azure Disk
- azureDiskDriverName = "disk.csi.azure.com"
-)
-
-// AzureDriver is the driver struct for holding azure machine information
-type AzureDriver struct {
- AzureMachineClass *v1alpha1.AzureMachineClass
- CredentialsData map[string][]byte
- UserData string
- MachineID string
- MachineName string
-}
-
-func (d *AzureDriver) getNICParameters(vmName string, subnet *network.Subnet) network.Interface {
-
- var (
- nicName = dependencyNameFromVMName(vmName, nicSuffix)
- location = d.AzureMachineClass.Spec.Location
- enableIPForwarding = true
- )
-
- // Add tags to the machine resources
- tagList := map[string]*string{}
- for idx, element := range d.AzureMachineClass.Spec.Tags {
- tagList[idx] = to.StringPtr(element)
- }
-
- NICParameters := network.Interface{
- Name: &nicName,
- Location: &location,
- InterfacePropertiesFormat: &network.InterfacePropertiesFormat{
- IPConfigurations: &[]network.InterfaceIPConfiguration{
- {
- Name: &nicName,
- InterfaceIPConfigurationPropertiesFormat: &network.InterfaceIPConfigurationPropertiesFormat{
- PrivateIPAllocationMethod: network.Dynamic,
- Subnet: subnet,
- },
- },
- },
- EnableIPForwarding: &enableIPForwarding,
- EnableAcceleratedNetworking: d.AzureMachineClass.Spec.Properties.NetworkProfile.AcceleratedNetworking,
- },
- Tags: tagList,
- }
-
- return NICParameters
-}
-
-func (d *AzureDriver) getVMParameters(vmName string, image *compute.VirtualMachineImage, networkInterfaceReferenceID string) compute.VirtualMachine {
- var (
- diskName = dependencyNameFromVMName(vmName, diskSuffix)
- UserDataEnc = base64.StdEncoding.EncodeToString([]byte(d.UserData))
- location = d.AzureMachineClass.Spec.Location
- )
-
- // Add tags to the machine resources
- tagList := map[string]*string{}
- for idx, element := range d.AzureMachineClass.Spec.Tags {
- tagList[idx] = to.StringPtr(element)
- }
-
- imageReference := getImageReference(d)
-
- var plan *compute.Plan
- if image != nil && image.Plan != nil {
- // If image.Plan exists, create a plan object and attach it to the VM
- klog.V(2).Infof("Creating a plan object and attaching it to the VM - %q", vmName)
- plan = &compute.Plan{
- Name: image.VirtualMachineImageProperties.Plan.Name,
- Product: image.VirtualMachineImageProperties.Plan.Product,
- Publisher: image.VirtualMachineImageProperties.Plan.Publisher,
- }
- }
-
- VMParameters := compute.VirtualMachine{
- Name: &vmName,
- Plan: plan,
- Location: &location,
- VirtualMachineProperties: &compute.VirtualMachineProperties{
- HardwareProfile: &compute.HardwareProfile{
- VMSize: compute.VirtualMachineSizeTypes(d.AzureMachineClass.Spec.Properties.HardwareProfile.VMSize),
- },
- StorageProfile: &compute.StorageProfile{
- ImageReference: &imageReference,
- OsDisk: &compute.OSDisk{
- Name: &diskName,
- Caching: compute.CachingTypes(d.AzureMachineClass.Spec.Properties.StorageProfile.OsDisk.Caching),
- ManagedDisk: &compute.ManagedDiskParameters{
- StorageAccountType: compute.StorageAccountTypes(d.AzureMachineClass.Spec.Properties.StorageProfile.OsDisk.ManagedDisk.StorageAccountType),
- },
- DiskSizeGB: &d.AzureMachineClass.Spec.Properties.StorageProfile.OsDisk.DiskSizeGB,
- CreateOption: compute.DiskCreateOptionTypes(d.AzureMachineClass.Spec.Properties.StorageProfile.OsDisk.CreateOption),
- },
- },
- OsProfile: &compute.OSProfile{
- ComputerName: &vmName,
- AdminUsername: &d.AzureMachineClass.Spec.Properties.OsProfile.AdminUsername,
- CustomData: &UserDataEnc,
- LinuxConfiguration: &compute.LinuxConfiguration{
- DisablePasswordAuthentication: &d.AzureMachineClass.Spec.Properties.OsProfile.LinuxConfiguration.DisablePasswordAuthentication,
- SSH: &compute.SSHConfiguration{
- PublicKeys: &[]compute.SSHPublicKey{
- {
- Path: &d.AzureMachineClass.Spec.Properties.OsProfile.LinuxConfiguration.SSH.PublicKeys.Path,
- KeyData: &d.AzureMachineClass.Spec.Properties.OsProfile.LinuxConfiguration.SSH.PublicKeys.KeyData,
- },
- },
- },
- },
- },
- NetworkProfile: &compute.NetworkProfile{
- NetworkInterfaces: &[]compute.NetworkInterfaceReference{
- {
- ID: &networkInterfaceReferenceID,
- NetworkInterfaceReferenceProperties: &compute.NetworkInterfaceReferenceProperties{
- Primary: to.BoolPtr(true),
- },
- },
- },
- },
- },
- Tags: tagList,
- }
-
- if d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks != nil && len(d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks) > 0 {
- dataDisks := d.generateDataDisks(vmName, d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks)
- VMParameters.StorageProfile.DataDisks = &dataDisks
- }
-
- if d.AzureMachineClass.Spec.Properties.Zone != nil {
- VMParameters.Zones = &[]string{strconv.Itoa(*d.AzureMachineClass.Spec.Properties.Zone)}
- }
-
- // DEPRECATED: This will be removed in future in favour of the machineSet field which has a type for AvailabilitySet.
- if d.AzureMachineClass.Spec.Properties.AvailabilitySet != nil {
- VMParameters.VirtualMachineProperties.AvailabilitySet = &compute.SubResource{
- ID: &d.AzureMachineClass.Spec.Properties.AvailabilitySet.ID,
- }
- }
-
- if d.AzureMachineClass.Spec.Properties.MachineSet != nil {
- switch d.AzureMachineClass.Spec.Properties.MachineSet.Kind {
- case machine.MachineSetKindVMO:
- VMParameters.VirtualMachineProperties.VirtualMachineScaleSet = &compute.SubResource{
- ID: &d.AzureMachineClass.Spec.Properties.MachineSet.ID,
- }
- case machine.MachineSetKindAvailabilitySet:
- VMParameters.VirtualMachineProperties.AvailabilitySet = &compute.SubResource{
- ID: &d.AzureMachineClass.Spec.Properties.MachineSet.ID,
- }
- }
- }
-
- if d.AzureMachineClass.Spec.Properties.IdentityID != nil && *d.AzureMachineClass.Spec.Properties.IdentityID != "" {
- VMParameters.Identity = &compute.VirtualMachineIdentity{
- Type: compute.ResourceIdentityTypeUserAssigned,
- UserAssignedIdentities: map[string]*compute.VirtualMachineIdentityUserAssignedIdentitiesValue{
- *d.AzureMachineClass.Spec.Properties.IdentityID: {},
- },
- }
- }
-
- return VMParameters
-}
-
-func getImageReference(d *AzureDriver) compute.ImageReference {
- imageRefClass := d.AzureMachineClass.Spec.Properties.StorageProfile.ImageReference
- if imageRefClass.ID != "" {
- return compute.ImageReference{
- ID: &imageRefClass.ID,
- }
- }
-
- splits := strings.Split(*imageRefClass.URN, ":")
- publisher := splits[0]
- offer := splits[1]
- sku := splits[2]
- version := splits[3]
- return compute.ImageReference{
- Publisher: &publisher,
- Offer: &offer,
- Sku: &sku,
- Version: &version,
- }
-}
-
-func (d *AzureDriver) generateDataDisks(vmName string, azureDataDisks []v1alpha1.AzureDataDisk) []compute.DataDisk {
- var dataDisks []compute.DataDisk
- for i, azureDataDisk := range azureDataDisks {
-
- var dataDiskLun *int32
- if azureDataDisk.Lun != nil {
- dataDiskLun = azureDataDisk.Lun
- } else {
- lun := int32(i)
- dataDiskLun = &lun
- }
-
- dataDiskName := dependencyNameFromVMNameAndDependency(getAzureDataDiskPrefix(azureDataDisk.Name, dataDiskLun), vmName, dataDiskSuffix)
-
- var caching compute.CachingTypes
- if azureDataDisk.Caching != "" {
- caching = compute.CachingTypes(azureDataDisk.Caching)
- } else {
- caching = compute.CachingTypesNone
- }
-
- dataDiskSize := azureDataDisk.DiskSizeGB
-
- dataDisk := compute.DataDisk{
- Lun: dataDiskLun,
- Name: &dataDiskName,
- Caching: caching,
- ManagedDisk: &compute.ManagedDiskParameters{
- StorageAccountType: compute.StorageAccountTypes(azureDataDisk.StorageAccountType),
- },
- DiskSizeGB: &dataDiskSize,
- CreateOption: compute.DiskCreateOptionTypesEmpty,
- }
- dataDisks = append(dataDisks, dataDisk)
- }
- return dataDisks
-}
-
-// Create method is used to create an azure machine
-func (d *AzureDriver) Create() (string, string, error) {
- var (
- vmName = strings.ToLower(d.MachineName)
- location = d.AzureMachineClass.Spec.Location
- )
-
- _, err := d.createVMNicDisk()
- if err != nil {
- return "Error", "Error", err
- }
-
- return encodeMachineID(location, vmName), vmName, nil
-}
-
-// Delete method is used to delete an azure machine
-func (d *AzureDriver) Delete(machineID string) error {
- clients, err := d.setup()
- if err != nil {
- return err
- }
-
- var (
- ctx = context.Background()
- vmName = decodeMachineID(machineID)
- nicName = dependencyNameFromVMName(vmName, nicSuffix)
- diskName = dependencyNameFromVMName(vmName, diskSuffix)
- resourceGroupName = d.AzureMachineClass.Spec.ResourceGroup
- )
-
- // Check if the underlying resource group still exists, if not skip the deletion as all resources are gone.
- if _, err := clients.group.Get(ctx, resourceGroupName); err != nil {
- if notFound(err) {
- return nil
- }
- return err
- }
-
- var dataDiskNames []string
- if d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks != nil && len(d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks) > 0 {
- dataDiskNames = getAzureDataDiskNames(d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks, vmName, dataDiskSuffix)
- }
-
- if err := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames); err != nil {
- return err
- }
-
- orphanNicChecker := func() error {
- return retry(func() error {
- return clients.checkOrphanNics(ctx, resourceGroupName, vmName)
- }, 3, time.Second*30)
- }
- orphanDiskChecker := func() error {
- return retry(func() error {
- return clients.checkOrphanDisks(ctx, resourceGroupName, vmName)
- }, 3, time.Second*30)
- }
- orphanCheckers := []func() error{orphanNicChecker, orphanDiskChecker}
- return runInParallel(orphanCheckers)
-}
-
-// GetExisting method is used to fetch the machineID for an azure machine
-func (d *AzureDriver) GetExisting() (string, error) {
- return d.MachineID, nil
-}
-
-// GetVMs returns a list of VM or VM resources
-// Azure earlier treated all VM resources (instance, NIC, Disks)
-// as a single resource and atomically created/deleted them in the driver interface.
-// This caused issues when the controller crashes, during deletions. To fix this,
-// now GetVMs interface checks for all resources instead of just VMs.
-func (d *AzureDriver) GetVMs(machineID string) (result VMs, err error) {
- result = make(VMs)
-
- mergeIntoResult := func(source VMs) {
- for k, v := range source {
- result[k] = v
- }
- }
-
- clients, err := d.setup()
- if err != nil {
- return
- }
-
- var (
- ctx = context.Background()
- resourceGroupName = d.AzureMachineClass.Spec.ResourceGroup
- location = d.AzureMachineClass.Spec.Location
- tags = d.AzureMachineClass.Spec.Tags
- )
-
- listOfVMs, err := clients.getRelevantVMs(ctx, machineID, resourceGroupName, location, tags)
- if err != nil {
- return
- }
- mergeIntoResult(listOfVMs)
-
- listOfVMsByNIC, err := clients.getRelevantNICs(ctx, machineID, resourceGroupName, location, tags)
- if err != nil {
- return
- }
- mergeIntoResult(listOfVMsByNIC)
-
- listOfVMsByDisk, err := clients.getRelevantDisks(ctx, machineID, resourceGroupName, location, tags)
- if err != nil {
- return
- }
- mergeIntoResult(listOfVMsByDisk)
-
- return
-}
-
-// GetUserData return the user data with which the VM will be booted
-func (d *AzureDriver) GetUserData() string {
- return d.UserData
-}
-
-// SetUserData set the used data whit which the VM will be booted
-func (d *AzureDriver) SetUserData(userData string) {
- d.UserData = userData
-}
-
-func (d *AzureDriver) setup() (*azureDriverClients, error) {
- var (
- subscriptionID = ExtractCredentialsFromData(d.CredentialsData, v1alpha1.AzureSubscriptionID, v1alpha1.AzureAlternativeSubscriptionID)
- tenantID = ExtractCredentialsFromData(d.CredentialsData, v1alpha1.AzureTenantID, v1alpha1.AzureAlternativeTenantID)
- clientID = ExtractCredentialsFromData(d.CredentialsData, v1alpha1.AzureClientID, v1alpha1.AzureAlternativeClientID)
- clientSecret = ExtractCredentialsFromData(d.CredentialsData, v1alpha1.AzureClientSecret, v1alpha1.AzureAlternativeClientSecret)
- env = azure.PublicCloud
- )
- return newClients(subscriptionID, tenantID, clientID, clientSecret, env)
-}
-
-type azureDriverClients struct {
- subnet network.SubnetsClient
- nic network.InterfacesClient
- vm compute.VirtualMachinesClient
- disk compute.DisksClient
- deployments resources.DeploymentsClient
- group resources.GroupsClient
- images compute.VirtualMachineImagesClient
- marketplace marketplaceordering.MarketplaceAgreementsClient
-}
-
-type azureTags map[string]string
-
-func newClients(subscriptionID, tenantID, clientID, clientSecret string, env azure.Environment) (*azureDriverClients, error) {
- oauthConfig, err := adal.NewOAuthConfig(env.ActiveDirectoryEndpoint, tenantID)
- if err != nil {
- return nil, err
- }
-
- spToken, err := adal.NewServicePrincipalToken(*oauthConfig, clientID, clientSecret, env.ResourceManagerEndpoint)
- if err != nil {
- return nil, err
- }
-
- authorizer := autorest.NewBearerAuthorizer(spToken)
-
- subnetClient := network.NewSubnetsClient(subscriptionID)
- subnetClient.Authorizer = authorizer
-
- interfacesClient := network.NewInterfacesClient(subscriptionID)
- interfacesClient.Authorizer = authorizer
-
- vmClient := compute.NewVirtualMachinesClient(subscriptionID)
- vmClient.Authorizer = authorizer
-
- vmImagesClient := compute.NewVirtualMachineImagesClient(subscriptionID)
- vmImagesClient.Authorizer = authorizer
-
- diskClient := compute.NewDisksClient(subscriptionID)
- diskClient.Authorizer = authorizer
-
- groupClient := resources.NewGroupsClient(subscriptionID)
- groupClient.Authorizer = authorizer
-
- deploymentsClient := resources.NewDeploymentsClient(subscriptionID)
- deploymentsClient.Authorizer = authorizer
-
- marketplaceClient := marketplaceordering.NewMarketplaceAgreementsClient(subscriptionID)
- marketplaceClient.Authorizer = authorizer
-
- return &azureDriverClients{subnet: subnetClient, nic: interfacesClient, vm: vmClient, disk: diskClient, deployments: deploymentsClient, images: vmImagesClient, group: groupClient, marketplace: marketplaceClient}, nil
-}
-
-func (d *AzureDriver) createVMNicDisk() (*compute.VirtualMachine, error) {
-
- var (
- ctx = context.Background()
- vmName = strings.ToLower(d.MachineName)
- resourceGroupName = d.AzureMachineClass.Spec.ResourceGroup
- vnetName = d.AzureMachineClass.Spec.SubnetInfo.VnetName
- vnetResourceGroup = resourceGroupName
- subnetName = d.AzureMachineClass.Spec.SubnetInfo.SubnetName
- nicName = dependencyNameFromVMName(vmName, nicSuffix)
- diskName = dependencyNameFromVMName(vmName, diskSuffix)
- vmImageRef *compute.VirtualMachineImage
- )
-
- clients, err := d.setup()
- if err != nil {
- return nil, err
- }
-
- // Check if the machine should assigned to a vnet in a different resource group.
- if d.AzureMachineClass.Spec.SubnetInfo.VnetResourceGroup != nil {
- vnetResourceGroup = *d.AzureMachineClass.Spec.SubnetInfo.VnetResourceGroup
- }
-
- var dataDiskNames []string
- if d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks != nil && len(d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks) > 0 {
- dataDiskNames = getAzureDataDiskNames(d.AzureMachineClass.Spec.Properties.StorageProfile.DataDisks, vmName, dataDiskSuffix)
- }
-
- /*
- Subnet fetching
- */
- klog.V(3).Infof("Fetching subnet details for VM %q", vmName)
- // Getting the subnet object for subnetName
- subnet, err := clients.subnet.Get(
- ctx,
- vnetResourceGroup,
- vnetName,
- subnetName,
- "",
- )
- if err != nil {
- return nil, onARMAPIErrorFail(prometheusServiceSubnet, err, "Subnet.Get failed for %s due to %s", subnetName, err)
- }
- onARMAPISuccess(prometheusServiceSubnet, "subnet.Get")
-
- NIC, err := clients.nic.Get(ctx, resourceGroupName, nicName, "")
- if err != nil {
- if isResourceNotFoundError(err) {
- /*
- NIC creation
- Fetching NIC with matching name failed, hence create a new one.
- */
-
- // Creating NICParameters for new NIC creation request
- NICParameters := d.getNICParameters(vmName, &subnet)
-
- // NIC creation request
- klog.V(3).Infof("NIC creation started for %q", nicName)
- NICFuture, err := clients.nic.CreateOrUpdate(ctx, resourceGroupName, *NICParameters.Name, NICParameters)
- if err != nil {
- // Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceNIC, err, "NIC.CreateOrUpdate failed for %s", *NICParameters.Name)
- }
-
- // Wait until NIC is created
- err = NICFuture.WaitForCompletionRef(ctx, clients.nic.Client)
- if err != nil {
- // Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceNIC, err, "NIC.WaitForCompletionRef failed for %s", *NICParameters.Name)
- }
- onARMAPISuccess(prometheusServiceNIC, "NIC.CreateOrUpdate")
-
- // Fetch NIC details
- NIC, err = NICFuture.Result(clients.nic)
- if err != nil {
- // Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, err
- }
- klog.V(3).Infof("NIC creation was successful for %q", nicName)
- } else {
- // Get on NIC returns a non 404 error. Exiting creation with the error.
-
- // Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceNIC, err, "NIC.Get failed for %s", nicName)
- }
- } else {
- klog.V(3).Infof("Found existing NIC with matching name, hence adopting NIC with name %q", nicName)
- }
-
- /*
- VM creation
- */
- imageRefClass := d.AzureMachineClass.Spec.Properties.StorageProfile.ImageReference
- // if ID is not set the image is referenced using a URN
- if imageRefClass.ID == "" {
-
- imageReference := getImageReference(d)
- vmImage, err := clients.images.Get(
- ctx,
- d.AzureMachineClass.Spec.Location,
- *imageReference.Publisher,
- *imageReference.Offer,
- *imageReference.Sku,
- *imageReference.Version)
-
- if err != nil {
- //Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceVM, err, "VirtualMachineImagesClient.Get failed for %s", d.AzureMachineClass.Name)
- }
-
- if vmImage.Plan != nil {
- // If VMImage.Plan exists, check if agreement is accepted and if not accept it for the subscription
-
- agreement, err := clients.marketplace.Get(
- ctx,
- *vmImage.Plan.Publisher,
- *vmImage.Plan.Product,
- *vmImage.Plan.Name,
- )
-
- if err != nil {
- //Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceVM, err, "MarketplaceAgreementsClient.Get failed for %s", d.AzureMachineClass.Name)
- }
-
- if agreement.Accepted == nil || *agreement.Accepted == false {
- // Need to accept the terms at least once for the subscription
- klog.V(2).Info("Accepting terms for subscription to make use of the plan")
-
- agreement.Accepted = to.BoolPtr(true)
- _, err = clients.marketplace.Create(
- ctx,
- *vmImage.Plan.Publisher,
- *vmImage.Plan.Product,
- *vmImage.Plan.Name,
- agreement,
- )
-
- if err != nil {
- //Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceVM, err, "MarketplaceAgreementsClient.Create failed for %s", d.AzureMachineClass.Name)
- }
- }
- }
-
- vmImageRef = &vmImage
- }
-
- // Creating VMParameters for new VM creation request
- VMParameters := d.getVMParameters(vmName, vmImageRef, *NIC.ID)
-
- // VM creation request
- klog.V(3).Infof("VM creation began for %q", vmName)
- VMFuture, err := clients.vm.CreateOrUpdate(ctx, resourceGroupName, *VMParameters.Name, VMParameters)
- if err != nil {
- //Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceVM, err, "VM.CreateOrUpdate failed for %s", *VMParameters.Name)
- }
-
- // Wait until VM is created
- klog.V(3).Infof("Waiting for VM create call completion for %q", vmName)
- err = VMFuture.WaitForCompletionRef(ctx, clients.vm.Client)
- if err != nil {
- // Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceVM, err, "VM.WaitForCompletionRef failed for %s", *VMParameters.Name)
- }
-
- // Fetch VM details
- VM, err := VMFuture.Result(clients.vm)
- if err != nil {
- // Since machine creation failed, delete any infra resources created
- deleteErr := clients.deleteVMNicDisks(ctx, resourceGroupName, vmName, nicName, diskName, dataDiskNames)
- if deleteErr != nil {
- klog.Errorf("Error occurred during resource clean up: %s", deleteErr)
- }
-
- return nil, onARMAPIErrorFail(prometheusServiceVM, err, "VMFuture.Result failed for %s", *VMParameters.Name)
- }
- onARMAPISuccess(prometheusServiceVM, "VM.CreateOrUpdate")
- klog.V(3).Infof("VM has been created succesfully for %q", vmName)
-
- return &VM, nil
-}
-
-func (clients *azureDriverClients) getAllVMs(ctx context.Context, resourceGroupName string) ([]compute.VirtualMachine, error) {
- var items []compute.VirtualMachine
- result, err := clients.vm.List(ctx, resourceGroupName)
- if err != nil {
- return items, onARMAPIErrorFail(prometheusServiceVM, err, "vm.List")
- }
- items = append(items, result.Values()...)
- for result.NotDone() {
- err = result.NextWithContext(ctx)
- if err != nil {
- return items, onARMAPIErrorFail(prometheusServiceVM, err, "vm.List")
- }
- items = append(items, result.Values()...)
- }
- onARMAPISuccess(prometheusServiceVM, "vm.List")
- return items, nil
-}
-
-func (clients *azureDriverClients) getAllNICs(ctx context.Context, resourceGroupName string) ([]network.Interface, error) {
- var items []network.Interface
- result, err := clients.nic.List(ctx, resourceGroupName)
- if err != nil {
- return items, onARMAPIErrorFail(prometheusServiceNIC, err, "nic.List")
- }
- items = append(items, result.Values()...)
- for result.NotDone() {
- err = result.NextWithContext(ctx)
- if err != nil {
- return items, onARMAPIErrorFail(prometheusServiceNIC, err, "nic.List")
- }
- items = append(items, result.Values()...)
- }
- onARMAPISuccess(prometheusServiceNIC, "nic.List")
- return items, nil
-}
-
-func (clients *azureDriverClients) getAllDisks(ctx context.Context, resourceGroupName string) ([]compute.Disk, error) {
- var items []compute.Disk
- result, err := clients.disk.ListByResourceGroup(ctx, resourceGroupName)
- if err != nil {
- return items, onARMAPIErrorFail(prometheusServiceDisk, err, "disk.ListByResourceGroup")
- }
- items = append(items, result.Values()...)
- for result.NotDone() {
- err = result.NextWithContext(ctx)
- if err != nil {
- return items, onARMAPIErrorFail(prometheusServiceDisk, err, "disk.ListByResourceGroup")
- }
- items = append(items, result.Values()...)
- }
- onARMAPISuccess(prometheusServiceDisk, "disk.ListByResourceGroup")
- return items, nil
-}
-
-// getRelevantVMs is a helper method used to list actual vm instances
-func (clients *azureDriverClients) getRelevantVMs(ctx context.Context, machineID string, resourceGroupName string, location string, tags azureTags) (VMs, error) {
- var (
- listOfVMs = make(VMs)
- searchClusterName = ""
- searchNodeRole = ""
- )
-
- for key := range tags {
- if strings.Contains(key, "kubernetes.io-cluster-") {
- searchClusterName = key
- } else if strings.Contains(key, "kubernetes.io-role-") {
- searchNodeRole = key
- }
- }
-
- if searchClusterName == "" ||
- searchNodeRole == "" ||
- resourceGroupName == "" {
- return listOfVMs, nil
- }
-
- machines, err := clients.getAllVMs(ctx, resourceGroupName)
- if err != nil {
- return listOfVMs, err
- }
-
- if len(machines) > 0 {
- for _, server := range machines {
- if !verifyAzureTags(server.Tags, searchClusterName, searchNodeRole) {
- klog.V(2).Infof("%q VM found, but not verified with tags %s and %s", *server.Name, searchClusterName, searchNodeRole)
- continue
- }
-
- instanceID := encodeMachineID(location, *server.Name)
-
- if machineID == "" {
- listOfVMs[instanceID] = *server.Name
- } else if machineID == instanceID {
- listOfVMs[instanceID] = *server.Name
- klog.V(3).Infof("Found machine with name: %q", *server.Name)
- break
- }
- }
- }
-
- return listOfVMs, nil
-}
-
-// getRelevantNICs is helper method used to list NICs
-func (clients *azureDriverClients) getRelevantNICs(ctx context.Context, machineID string, resourceGroupName string, location string, tags azureTags) (VMs, error) {
- var (
- listOfVMs = make(VMs)
- searchClusterName = ""
- searchNodeRole = ""
- )
-
- for key := range tags {
- if strings.Contains(key, "kubernetes.io-cluster-") {
- searchClusterName = key
- } else if strings.Contains(key, "kubernetes.io-role-") {
- searchNodeRole = key
- }
- }
-
- if searchClusterName == "" || searchNodeRole == "" || resourceGroupName == "" {
- return listOfVMs, nil
- }
-
- interfaces, err := clients.getAllNICs(ctx, resourceGroupName)
- if err != nil {
- return listOfVMs, err
- }
-
- if len(interfaces) > 0 {
- for _, nic := range interfaces {
- isNic, machineName := vmNameFromDependencyName(*nic.Name, nicSuffix)
- if !isNic {
- continue
- }
-
- if !verifyAzureTags(nic.Tags, searchClusterName, searchNodeRole) {
- klog.V(2).Infof("%q NIC found, but not verified with tags %s and %s", *nic.Name, searchClusterName, searchNodeRole)
- continue
- }
-
- instanceID := encodeMachineID(location, machineName)
-
- if machineID == "" {
- listOfVMs[instanceID] = machineName
- } else if machineID == instanceID {
- listOfVMs[instanceID] = machineName
- klog.V(3).Infof("Found nic with name %q, hence appending machine %q", *nic.Name, machineName)
- break
- }
-
- }
- }
-
- return listOfVMs, nil
-}
-
-// getRelevantDisks is a helper method used to list disks
-func (clients *azureDriverClients) getRelevantDisks(ctx context.Context, machineID string, resourceGroupName string, location string, tags azureTags) (VMs, error) {
- var (
- listOfVMs = make(VMs)
- searchClusterName = ""
- searchNodeRole = ""
- )
-
- for key := range tags {
- if strings.Contains(key, "kubernetes.io-cluster-") {
- searchClusterName = key
- } else if strings.Contains(key, "kubernetes.io-role-") {
- searchNodeRole = key
- }
- }
-
- if searchClusterName == "" ||
- searchNodeRole == "" ||
- resourceGroupName == "" {
- return listOfVMs, nil
- }
-
- disks, err := clients.getAllDisks(ctx, resourceGroupName)
- if err != nil {
- return listOfVMs, err
- }
-
- if len(disks) > 0 {
- for _, disk := range disks {
- if disk.OsType != "" {
- isDisk, machineName := vmNameFromDependencyName(*disk.Name, diskSuffix)
- if !isDisk {
- continue
- }
-
- if !verifyAzureTags(disk.Tags, searchClusterName, searchNodeRole) {
- klog.V(2).Infof("%q Disk found, but not verified with tags %s and %s", *disk.Name, searchClusterName, searchNodeRole)
- continue
- }
-
- instanceID := encodeMachineID(location, machineName)
-
- if machineID == "" {
- listOfVMs[instanceID] = machineName
- } else if machineID == instanceID {
- listOfVMs[instanceID] = machineName
- klog.V(3).Infof("Found disk with name %q, hence appending machine %q", *disk.Name, machineName)
- break
- }
- }
- }
- }
-
- return listOfVMs, nil
-}
-
-func (clients *azureDriverClients) fetchAttachedVMfromNIC(ctx context.Context, resourceGroupName, nicName string) (string, error) {
- nic, err := clients.nic.Get(ctx, resourceGroupName, nicName, "")
- if err != nil {
- return "", err
- }
- if nic.VirtualMachine == nil {
- return "", nil
- }
- return *nic.VirtualMachine.ID, nil
-}
-
-func (clients *azureDriverClients) fetchAttachedVMfromDisk(ctx context.Context, resourceGroupName, diskName string) (string, error) {
- disk, err := clients.disk.Get(ctx, resourceGroupName, diskName)
- if err != nil {
- return "", err
- }
- if disk.ManagedBy == nil {
- return "", nil
- }
- return *disk.ManagedBy, nil
-}
-
-func (clients *azureDriverClients) deleteVMNicDisks(ctx context.Context, resourceGroupName string, VMName string, nicName string, diskName string, dataDiskNames []string) error {
-
- // We try to fetch the VM, detach its data disks and finally delete it
- if vm, vmErr := clients.vm.Get(ctx, resourceGroupName, VMName, ""); vmErr == nil {
-
- clients.waitForDataDiskDetachment(ctx, resourceGroupName, vm)
- if deleteErr := clients.deleteVM(ctx, resourceGroupName, VMName); deleteErr != nil {
- return deleteErr
- }
-
- onARMAPISuccess(prometheusServiceVM, "VM Get was successful for %s", *vm.Name)
- } else if !notFound(vmErr) {
- // If some other error occurred, which is not 404 Not Found (the VM doesn't exist) then bubble up
- return onARMAPIErrorFail(prometheusServiceVM, vmErr, "vm.Get")
- }
-
- // Fetch the NIC and deleted it
- nicDeleter := func() error {
- if vmHoldingNic, err := clients.fetchAttachedVMfromNIC(ctx, resourceGroupName, nicName); err != nil {
- if notFound(err) {
- // Resource doesn't exist, no need to delete
- return nil
- }
- return err
- } else if vmHoldingNic != "" {
- return fmt.Errorf("Cannot delete NIC %s because it is attached to VM %s", nicName, vmHoldingNic)
- }
-
- return clients.deleteNIC(ctx, resourceGroupName, nicName)
- }
-
- // Fetch the system disk and delete it
- diskDeleter := clients.getDeleterForDisk(ctx, resourceGroupName, diskName)
-
- deleters := []func() error{nicDeleter, diskDeleter}
-
- if dataDiskNames != nil {
- for _, dataDiskName := range dataDiskNames {
- dataDiskDeleter := clients.getDeleterForDisk(ctx, resourceGroupName, dataDiskName)
- deleters = append(deleters, dataDiskDeleter)
- }
- }
-
- return runInParallel(deleters)
-}
-
-func (clients *azureDriverClients) getDeleterForDisk(ctx context.Context, resourceGroupName string, diskName string) func() error {
- return func() error {
- if vmHoldingDisk, err := clients.fetchAttachedVMfromDisk(ctx, resourceGroupName, diskName); err != nil {
- if notFound(err) {
- // Resource doesn't exist, no need to delete
- return nil
- }
- return err
- } else if vmHoldingDisk != "" {
- return fmt.Errorf("Cannot delete disk %s because it is attached to VM %s", diskName, vmHoldingDisk)
- }
-
- return clients.deleteDisk(ctx, resourceGroupName, diskName)
- }
-}
-
-// waitForDataDiskDetachment waits for data disks to be detached
-func (clients *azureDriverClients) waitForDataDiskDetachment(ctx context.Context, resourceGroupName string, vm compute.VirtualMachine) error {
- klog.V(2).Infof("Data disk detachment began for %q", *vm.Name)
- defer klog.V(2).Infof("Data disk detached for %q", *vm.Name)
-
- if len(*vm.StorageProfile.DataDisks) > 0 {
- // There are disks attached hence need to detach them
- vm.StorageProfile.DataDisks = &[]compute.DataDisk{}
-
- future, err := clients.vm.CreateOrUpdate(ctx, resourceGroupName, *vm.Name, vm)
- if err != nil {
- return onARMAPIErrorFail(prometheusServiceVM, err, "Failed to CreateOrUpdate. Error Message - %s", err)
- }
- err = future.WaitForCompletionRef(ctx, clients.vm.Client)
- if err != nil {
- return onARMAPIErrorFail(prometheusServiceVM, err, "Failed to CreateOrUpdate. Error Message - %s", err)
- }
- onARMAPISuccess(prometheusServiceVM, "VM CreateOrUpdate was successful for %s", *vm.Name)
- }
-
- return nil
-}
-
-func (clients *azureDriverClients) deleteVM(ctx context.Context, resourceGroupName string, vmName string) error {
- klog.V(2).Infof("VM deletion has began for %q", vmName)
- defer klog.V(2).Infof("VM deleted for %q", vmName)
-
- future, err := clients.vm.Delete(ctx, resourceGroupName, vmName)
- if err != nil {
- return onARMAPIErrorFail(prometheusServiceVM, err, "vm.Delete")
- }
- err = future.WaitForCompletionRef(ctx, clients.vm.Client)
- if err != nil {
- return onARMAPIErrorFail(prometheusServiceVM, err, "vm.Delete")
- }
- onARMAPISuccess(prometheusServiceVM, "VM deletion was successful for %s", vmName)
- return nil
-}
-
-func (clients *azureDriverClients) checkOrphanNics(ctx context.Context, resourceGroupName, vmName string) error {
- klog.V(2).Infof("Check for NIC leftovers belonging to deleted machine %q", vmName)
- nicResults, err := clients.nic.List(ctx, resourceGroupName)
- if err != nil {
- return err
- }
- for _, nic := range nicResults.Values() {
- if nic.Name == nil || !strings.Contains(*nic.Name, vmName) {
- continue
- }
- klog.V(2).Infof("Found orphan NIC %q belonging to deleted machine %q", *nic.Name, vmName)
- if err := clients.deleteNIC(ctx, resourceGroupName, *nic.Name); err != nil && !notFound(err) {
- return err
- }
- }
- return nil
-}
-
-func (clients *azureDriverClients) checkOrphanDisks(ctx context.Context, resourceGroupName, vmName string) error {
- klog.V(2).Infof("Check for disk leftovers belonging to deleted machine %q", vmName)
- diskResults, err := clients.disk.ListByResourceGroup(ctx, resourceGroupName)
- if err != nil {
- return err
- }
- for _, disk := range diskResults.Values() {
- if disk.Name == nil || !strings.Contains(*disk.Name, vmName) {
- continue
- }
- klog.V(2).Infof("Found orphan disk %q belonging to deleted machine %q", *disk.Name, vmName)
- if err := clients.deleteDisk(ctx, resourceGroupName, *disk.Name); err != nil && !notFound(err) {
- return err
- }
- }
- return nil
-}
-
-func (clients *azureDriverClients) checkNICStatus(ctx context.Context, resourceGroupName string, nicName string, shouldExist bool) func() error {
- return func() error {
- nic, err := clients.nic.Get(ctx, resourceGroupName, nicName, "")
-
- // Case-1: If NIC should exist, check below if condition
- if shouldExist {
- if err == nil && nic.ID != nil {
- // NIC found
- return nil
- }
-
- klog.V(4).Infof("NIC %q not found", nicName)
- return fmt.Errorf("NIC %q not found", nicName)
- }
-
- // Case-2: If NIC should not exist, check below condition
- if err != nil && isResourceNotFoundError(err) {
- // NIC not found, hence deletion is successful
- return nil
- }
-
- klog.V(4).Infof("NIC %q found", nicName)
- return fmt.Errorf("NIC %q found", nicName)
- }
-}
-
-func (clients *azureDriverClients) deleteNIC(ctx context.Context, resourceGroupName string, nicName string) error {
- const (
- intialInterval = 10 * time.Second
- maxInterval = 2 * time.Minute
- maxElapsedTime = 10 * time.Minute
- nicDeletionTimeout = 10 * time.Minute
- )
-
- klog.V(2).Infof("NIC delete started for %q", nicName)
- defer klog.V(2).Infof("NIC deleted for %q", nicName)
-
- nicDeletionCtx, cancel := context.WithTimeout(ctx, nicDeletionTimeout)
- defer cancel()
-
- future, err := clients.nic.Delete(nicDeletionCtx, resourceGroupName, nicName)
- if err != nil {
- return onARMAPIErrorFail(prometheusServiceNIC, err, "nic.Delete")
- }
-
- err = future.WaitForCompletionRef(nicDeletionCtx, clients.nic.Client)
- if err != nil {
- return onARMAPIErrorFail(prometheusServiceNIC, err, "nic.Delete")
- }
-
- err = backoff.WaitUntil(
- nicDeletionCtx,
- intialInterval,
- maxInterval,
- maxElapsedTime,
- clients.checkNICStatus(nicDeletionCtx, resourceGroupName, nicName, false),
- )
- if err != nil {
- return onARMAPIErrorFail(prometheusServiceNIC, err, "nic.Delete")
- }
-
- onARMAPISuccess(prometheusServiceNIC, "NIC deletion was successful for %s", nicName)
- return nil
-}
-
-func (clients *azureDriverClients) deleteDisk(ctx context.Context, resourceGroupName string, diskName string) error {
- klog.V(2).Infof("Disk delete started for %q", diskName)
- defer klog.V(2).Infof("Disk deleted for %q", diskName)
-
- future, err := clients.disk.Delete(ctx, resourceGroupName, diskName)
- if err != nil {
- return onARMAPIErrorFail(prometheusServiceDisk, err, "disk.Delete")
- }
- if err = future.WaitForCompletionRef(ctx, clients.disk.Client); err != nil {
- return onARMAPIErrorFail(prometheusServiceDisk, err, "disk.Delete")
- }
- onARMAPISuccess(prometheusServiceDisk, "Disk deletion was successful for %s", diskName)
- return nil
-}
-
-func onARMAPISuccess(prometheusService string, format string, v ...interface{}) {
- prometheusSuccess(prometheusService)
-}
-
-func onARMAPIErrorFail(prometheusService string, err error, format string, v ...interface{}) error {
- prometheusFail(prometheusService)
- return onErrorFail(err, format, v...)
-}
-
-func notFound(err error) bool {
- isDetailedError, _, detailedError := retrieveRequestID(err)
- return isDetailedError && detailedError.Response.StatusCode == 404
-}
-
-func retrieveRequestID(err error) (bool, string, *autorest.DetailedError) {
- switch err.(type) {
- case autorest.DetailedError:
- detailedErr := autorest.DetailedError(err.(autorest.DetailedError))
- if detailedErr.Response != nil {
- requestID := strings.Join(detailedErr.Response.Header["X-Ms-Request-Id"], "")
- return true, requestID, &detailedErr
- }
- return false, "", nil
- default:
- return false, "", nil
- }
-}
-
-// onErrorFail prints a failure message and exits the program if err is not nil.
-func onErrorFail(err error, format string, v ...interface{}) error {
- if err != nil {
- message := fmt.Sprintf(format, v...)
- if hasRequestID, requestID, detailedErr := retrieveRequestID(err); hasRequestID {
- klog.Errorf("Azure ARM API call with x-ms-request-id=%s failed. %s: %s\n", requestID, message, *detailedErr)
- } else {
- klog.Errorf("%s: %s\n", message, err)
- }
- }
- return err
-}
-
-func runInParallel(funcs []func() error) error {
- //
- // Execute multiple functions (which return an error) as go functions concurrently.
- //
- var wg sync.WaitGroup
- wg.Add(len(funcs))
-
- errors := make([]error, len(funcs))
- for i, funOuter := range funcs {
- go func(results []error, idx int, funInner func() error) {
- defer wg.Done()
- if funInner == nil {
- results[idx] = fmt.Errorf("Received nil function")
- return
- }
- err := funInner()
- results[idx] = err
- }(errors, i, funOuter)
- }
-
- wg.Wait()
-
- var trimmedErrorMessages []string
- for _, e := range errors {
- if e != nil {
- trimmedErrorMessages = append(trimmedErrorMessages, e.Error())
- }
- }
- if len(trimmedErrorMessages) > 0 {
- return fmt.Errorf(strings.Join(trimmedErrorMessages, "\n"))
- }
- return nil
-}
-
-func encodeMachineID(location, vmName string) string {
- return fmt.Sprintf("azure:///%s/%s", location, vmName)
-}
-
-func decodeMachineID(id string) string {
- splitProviderID := strings.Split(id, "/")
- return splitProviderID[len(splitProviderID)-1]
-}
-
-const (
- nicSuffix = "-nic"
- diskSuffix = "-os-disk"
- dataDiskSuffix = "-data-disk"
-)
-
-func getAzureDataDiskNames(azureDataDisks []v1alpha1.AzureDataDisk, vmname, suffix string) []string {
- azureDataDiskNames := make([]string, len(azureDataDisks))
- for i, disk := range azureDataDisks {
- var diskLun *int32
- if disk.Lun != nil {
- diskLun = disk.Lun
- } else {
- lun := int32(i)
- diskLun = &lun
- }
- azureDataDiskNames[i] = dependencyNameFromVMNameAndDependency(getAzureDataDiskPrefix(disk.Name, diskLun), vmname, suffix)
- }
- return azureDataDiskNames
-}
-
-func getAzureDataDiskPrefix(name string, lun *int32) string {
- if name != "" {
- return fmt.Sprintf("%s-%d", name, *lun)
- }
- return fmt.Sprintf("%d", *lun)
-}
-
-func dependencyNameFromVMNameAndDependency(dependency, vmName, suffix string) string {
- return vmName + "-" + dependency + suffix
-}
-
-func dependencyNameFromVMName(vmName, suffix string) string {
- return vmName + suffix
-}
-
-func vmNameFromDependencyName(dependencyName, suffix string) (hasProperSuffix bool, vmName string) {
- if strings.HasSuffix(dependencyName, suffix) {
- hasProperSuffix = true
- vmName = dependencyName[:len(dependencyName)-len(suffix)]
- } else {
- hasProperSuffix = false
- vmName = ""
- }
- return
-}
-
-const (
- prometheusServiceSubnet = "subnet"
- prometheusServiceVM = "virtual_machine"
- prometheusServiceNIC = "network_interfaces"
- prometheusServiceDisk = "disks"
-)
-
-func prometheusSuccess(service string) {
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "azure", "service": service}).Inc()
-}
-
-func prometheusFail(service string) {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "azure", "service": service}).Inc()
-}
-
-// GetVolNames parses volume names from pv specs
-func (d *AzureDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error) {
- names := []string{}
- for i := range specs {
- spec := &specs[i]
- if spec.AzureDisk != nil {
- name := spec.AzureDisk.DiskName
- names = append(names, name)
- } else if spec.CSI != nil && spec.CSI.Driver == azureDiskDriverName && spec.CSI.VolumeHandle != "" {
- name := spec.CSI.VolumeHandle
- names = append(names, name)
- }
- }
- return names, nil
-}
-
-func retry(fn func() error, retries int, delay time.Duration) error {
- var retryCount = 0
- for {
- err := fn()
- if err == nil {
- return nil
- }
- retryCount++
- if retryCount == retries {
- return fmt.Errorf("max amount of retries reached (%s)", err.Error())
- }
- time.Sleep(delay)
- }
-}
-
-func verifyAzureTags(tags map[string]*string, clusterNameTag, nodeRoleTag string) bool {
- if tags == nil {
- return false
- }
-
- var clusterNameMatched, nodeRoleMatched bool
- for key := range tags {
- if strings.Contains(key, clusterNameTag) {
- clusterNameMatched = true
- }
- if strings.Contains(key, nodeRoleTag) {
- nodeRoleMatched = true
- }
- }
- if !clusterNameMatched || !nodeRoleMatched {
- return false
- }
-
- return true
-}
-
-// isResourceNotFoundError returns true when resource is not found at provider
-func isResourceNotFoundError(err error) bool {
- const (
- resourceNotFoundStatusCode = "404"
- )
-
- if e, ok := err.(autorest.DetailedError); ok {
- statusCode := fmt.Sprintf("%v", e.StatusCode)
- if statusCode == resourceNotFoundStatusCode {
- return true
- }
- }
-
- return false
-}
diff --git a/pkg/driver/driver_azure_test.go b/pkg/driver/driver_azure_test.go
deleted file mode 100644
index ea755d134..000000000
--- a/pkg/driver/driver_azure_test.go
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package driver
-
-import (
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
-
- "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
-)
-
-var _ = Describe("Driver Azure", func() {
-
- Context("#generateDataDisks", func() {
-
- It("should convert multiple dataDisks successfully", func() {
- azureDriver := &AzureDriver{}
- vmName := "vm"
- lun1 := int32(1)
- lun2 := int32(2)
- size1 := int32(10)
- size2 := int32(100)
- expectedName1 := "vm-sdb-1-data-disk"
- expectedName2 := "vm-sdc-2-data-disk"
- disks := []v1alpha1.AzureDataDisk{
- {
- Name: "sdb",
- Caching: "None",
- StorageAccountType: "Premium_LRS",
- DiskSizeGB: size1,
- Lun: &lun1,
- },
- {
- Name: "sdc",
- Caching: "None",
- StorageAccountType: "Standard_LRS",
- DiskSizeGB: size2,
- Lun: &lun2,
- },
- }
-
- disksGenerated := azureDriver.generateDataDisks(vmName, disks)
- expectedDisks := []compute.DataDisk{
- {
- Lun: &lun1,
- Name: &expectedName1,
- Caching: compute.CachingTypes("None"),
- ManagedDisk: &compute.ManagedDiskParameters{
- StorageAccountType: compute.StorageAccountTypes("Premium_LRS"),
- },
- DiskSizeGB: &size1,
- CreateOption: compute.DiskCreateOptionTypes("Empty"),
- },
- {
- Lun: &lun2,
- Name: &expectedName2,
- Caching: compute.CachingTypes("None"),
- ManagedDisk: &compute.ManagedDiskParameters{
- StorageAccountType: compute.StorageAccountTypes("Standard_LRS"),
- },
- DiskSizeGB: &size2,
- CreateOption: compute.DiskCreateOptionTypes("Empty"),
- },
- }
-
- Expect(disksGenerated).To(Equal(expectedDisks))
- })
-
- It("should convert multiple dataDisks successfully with default caching and luns", func() {
- azureDriver := &AzureDriver{}
- vmName := "vm"
- lun1 := int32(0)
- lun2 := int32(1)
- lun3 := int32(42)
- size1 := int32(10)
- size2 := int32(100)
- expectedName1 := "vm-sdb-0-data-disk"
- expectedName2 := "vm-1-data-disk"
- expectedName3 := "vm-sdc-42-data-disk"
- disks := []v1alpha1.AzureDataDisk{
- {
- Name: "sdb",
- StorageAccountType: "Premium_LRS",
- DiskSizeGB: size1,
- },
- {
- StorageAccountType: "Standard_LRS",
- DiskSizeGB: size2,
- },
- {
- Lun: &lun3,
- Name: "sdc",
- StorageAccountType: "Standard_LRS",
- DiskSizeGB: size2,
- },
- }
-
- disksGenerated := azureDriver.generateDataDisks(vmName, disks)
- expectedDisks := []compute.DataDisk{
- {
- Lun: &lun1,
- Name: &expectedName1,
- Caching: compute.CachingTypes("None"),
- ManagedDisk: &compute.ManagedDiskParameters{
- StorageAccountType: compute.StorageAccountTypes("Premium_LRS"),
- },
- DiskSizeGB: &size1,
- CreateOption: compute.DiskCreateOptionTypes("Empty"),
- },
- {
- Lun: &lun2,
- Name: &expectedName2,
- Caching: compute.CachingTypes("None"),
- ManagedDisk: &compute.ManagedDiskParameters{
- StorageAccountType: compute.StorageAccountTypes("Standard_LRS"),
- },
- DiskSizeGB: &size2,
- CreateOption: compute.DiskCreateOptionTypes("Empty"),
- },
- {
- Lun: &lun3,
- Name: &expectedName3,
- Caching: compute.CachingTypes("None"),
- ManagedDisk: &compute.ManagedDiskParameters{
- StorageAccountType: compute.StorageAccountTypes("Standard_LRS"),
- },
- DiskSizeGB: &size2,
- CreateOption: compute.DiskCreateOptionTypes("Empty"),
- },
- }
-
- Expect(disksGenerated).To(Equal(expectedDisks))
- })
- })
-
- Context("#GetVolNames", func() {
- var hostPathPVSpec = corev1.PersistentVolumeSpec{
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- HostPath: &corev1.HostPathVolumeSource{
- Path: "/mnt/data",
- },
- },
- }
-
- It("should handle in-tree PV (with .spec.azureDisk)", func() {
- driver := &AzureDriver{}
- pvs := []corev1.PersistentVolumeSpec{
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- AzureDisk: &corev1.AzureDiskVolumeSource{
- DiskName: "disk-1",
- },
- },
- },
- hostPathPVSpec,
- }
-
- actual, err := driver.GetVolNames(pvs)
- Expect(err).ToNot(HaveOccurred())
- Expect(actual).To(Equal([]string{"disk-1"}))
- })
-
- It("should handle out-of-tree PV (with .spec.csi.volumeHandle)", func() {
- driver := &AzureDriver{}
- pvs := []corev1.PersistentVolumeSpec{
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- Driver: "io.kubernetes.storage.mock",
- VolumeHandle: "vol-2",
- },
- },
- },
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- Driver: "disk.csi.azure.com",
- VolumeHandle: "vol-1",
- },
- },
- },
- hostPathPVSpec,
- }
-
- actual, err := driver.GetVolNames(pvs)
- Expect(err).ToNot(HaveOccurred())
- Expect(actual).To(Equal([]string{"vol-1"}))
- })
- })
-})
diff --git a/pkg/driver/driver_fake.go b/pkg/driver/driver_fake.go
deleted file mode 100644
index 5c2099a52..000000000
--- a/pkg/driver/driver_fake.go
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package driver contains the cloud provider specific implementations to manage machines
-package driver
-
-import corev1 "k8s.io/api/core/v1"
-
-// fakeVMs keep a list of actively using fake machines for test purposes
-var fakeVMs = make(VMs)
-
-// FakeDriver is a fake driver returned when none of the actual drivers match
-type FakeDriver struct {
- create func() (string, string, error)
- add func(string, string) error
- delete func(string) error
- existing func() (string, error)
- getVMs func() (VMs, error)
- getVolNames func([]corev1.PersistentVolumeSpec) ([]string, error)
- getUserData func() string
- setUserData func(string)
-}
-
-// NewFakeDriver returns a new fakedriver object
-func NewFakeDriver(
- create func() (string, string, error),
- add func(string, string) error,
- delete func(string) error,
- existing func() (string, error),
- getVMs func() (VMs, error),
- getVolNames func([]corev1.PersistentVolumeSpec) ([]string, error),
- getUserData func() string,
- setUserData func(string),
-) Driver {
- return &FakeDriver{
- create: create,
- add: add,
- delete: delete,
- existing: existing,
- getVMs: getVMs,
- getVolNames: getVolNames,
- getUserData: getUserData,
- setUserData: setUserData,
- }
-}
-
-// Create returns a newly created fake driver
-func (d *FakeDriver) Create() (string, string, error) {
- return d.create()
-}
-
-// Add add a newly created machine to the fakeVMs list
-func (d *FakeDriver) Add(machineID string, machineName string) error {
- return d.add(machineID, machineName)
-}
-
-// Delete deletes a fake driver
-func (d *FakeDriver) Delete(machineID string) error {
- return d.delete(machineID)
-}
-
-// GetExisting returns the existing fake driver
-func (d *FakeDriver) GetExisting() (string, error) {
- return d.existing()
-}
-
-// GetVMs returns a list of VMs
-func (d *FakeDriver) GetVMs(name string) (VMs, error) {
- return d.getVMs()
-}
-
-// GetVolNames parses volume names from pv specs
-func (d *FakeDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error) {
- volNames := []string{}
- return volNames, nil
-}
-
-// GetUserData return the used data whit which the VM will be booted
-func (d *FakeDriver) GetUserData() string {
- return ""
-}
-
-// SetUserData set the used data whit which the VM will be booted
-func (d *FakeDriver) SetUserData(userData string) {
- return
-}
diff --git a/pkg/driver/driver_gcp.go b/pkg/driver/driver_gcp.go
deleted file mode 100644
index 4f11de56e..000000000
--- a/pkg/driver/driver_gcp.go
+++ /dev/null
@@ -1,397 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package driver contains the cloud provider specific implementations to manage machines
-package driver
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "net/http"
- "strings"
- "time"
-
- "github.com/prometheus/client_golang/prometheus"
- "golang.org/x/oauth2"
- "golang.org/x/oauth2/google"
- "google.golang.org/api/compute/v1"
- "google.golang.org/api/googleapi"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/apimachinery/pkg/util/wait"
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/metrics"
-)
-
-const (
- // gcePDDriverName is the name of the CSI driver for GCE PD
- gcePDDriverName = "pd.csi.storage.gke.io"
-)
-
-// GCPDriver is the driver struct for holding GCP machine information
-type GCPDriver struct {
- GCPMachineClass *v1alpha1.GCPMachineClass
- CredentialsData map[string][]byte
- UserData string
- MachineID string
- MachineName string
-}
-
-// Create method is used to create a GCP machine
-func (d *GCPDriver) Create() (string, string, error) {
- ctx, computeService, err := d.createComputeService()
- if err != nil {
- return "Error", "Error", err
- }
-
- project, err := extractProject(d.CredentialsData)
- if err != nil {
- return "Error", "Error", err
- }
-
- var (
- zone = d.GCPMachineClass.Spec.Zone
-
- instance = &compute.Instance{
- CanIpForward: d.GCPMachineClass.Spec.CanIpForward,
- DeletionProtection: d.GCPMachineClass.Spec.DeletionProtection,
- Labels: d.GCPMachineClass.Spec.Labels,
- MachineType: fmt.Sprintf("zones/%s/machineTypes/%s", zone, d.GCPMachineClass.Spec.MachineType),
- Name: d.MachineName,
- Scheduling: &compute.Scheduling{
- AutomaticRestart: &d.GCPMachineClass.Spec.Scheduling.AutomaticRestart,
- OnHostMaintenance: d.GCPMachineClass.Spec.Scheduling.OnHostMaintenance,
- Preemptible: d.GCPMachineClass.Spec.Scheduling.Preemptible,
- },
- Tags: &compute.Tags{
- Items: d.GCPMachineClass.Spec.Tags,
- },
- }
- )
-
- if d.GCPMachineClass.Spec.Description != nil {
- instance.Description = *d.GCPMachineClass.Spec.Description
- }
-
- var disks = []*compute.AttachedDisk{}
- for _, disk := range d.GCPMachineClass.Spec.Disks {
- var attachedDisk compute.AttachedDisk
- autoDelete := false
- if disk.AutoDelete == nil || *disk.AutoDelete == true {
- autoDelete = true
- }
- if disk.Type == "SCRATCH" {
- attachedDisk = compute.AttachedDisk{
- AutoDelete: autoDelete,
- Type: disk.Type,
- Interface: disk.Interface,
- InitializeParams: &compute.AttachedDiskInitializeParams{
- DiskType: fmt.Sprintf("zones/%s/diskTypes/%s", zone, "local-ssd"),
- },
- }
- } else {
- attachedDisk = compute.AttachedDisk{
- AutoDelete: autoDelete,
- Boot: disk.Boot,
- InitializeParams: &compute.AttachedDiskInitializeParams{
- DiskSizeGb: disk.SizeGb,
- DiskType: fmt.Sprintf("zones/%s/diskTypes/%s", zone, disk.Type),
- Labels: disk.Labels,
- SourceImage: disk.Image,
- },
- }
- }
- disks = append(disks, &attachedDisk)
- }
- instance.Disks = disks
-
- var metadataItems = []*compute.MetadataItems{}
- metadataItems = append(metadataItems, d.getUserData())
-
- for _, metadata := range d.GCPMachineClass.Spec.Metadata {
- metadataItems = append(metadataItems, &compute.MetadataItems{
- Key: metadata.Key,
- Value: metadata.Value,
- })
- }
- instance.Metadata = &compute.Metadata{
- Items: metadataItems,
- }
-
- var networkInterfaces = []*compute.NetworkInterface{}
- for _, nic := range d.GCPMachineClass.Spec.NetworkInterfaces {
- computeNIC := &compute.NetworkInterface{}
-
- if nic.DisableExternalIP == false {
- // When DisableExternalIP is false, implies Attach an external IP to VM
- computeNIC.AccessConfigs = []*compute.AccessConfig{{}}
- }
- if len(nic.Network) != 0 {
- computeNIC.Network = fmt.Sprintf("projects/%s/global/networks/%s", project, nic.Network)
- }
- if len(nic.Subnetwork) != 0 {
- computeNIC.Subnetwork = fmt.Sprintf("regions/%s/subnetworks/%s", d.GCPMachineClass.Spec.Region, nic.Subnetwork)
- }
- networkInterfaces = append(networkInterfaces, computeNIC)
- }
- instance.NetworkInterfaces = networkInterfaces
-
- var serviceAccounts = []*compute.ServiceAccount{}
- for _, sa := range d.GCPMachineClass.Spec.ServiceAccounts {
- serviceAccounts = append(serviceAccounts, &compute.ServiceAccount{
- Email: sa.Email,
- Scopes: sa.Scopes,
- })
- }
- instance.ServiceAccounts = serviceAccounts
-
- operation, err := computeService.Instances.Insert(project, zone, instance).Context(ctx).Do()
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "gcp", "service": "compute"}).Inc()
- return "Error", "Error", err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "gcp", "service": "compute"}).Inc()
-
- if err := waitUntilOperationCompleted(computeService, project, zone, operation.Name); err != nil {
- return "Error", "Error", err
- }
-
- return d.encodeMachineID(project, zone, d.MachineName), d.MachineName, nil
-}
-
-// Delete method is used to delete a GCP machine
-func (d *GCPDriver) Delete(machineID string) error {
-
- result, err := d.GetVMs(machineID)
- if err != nil {
- return err
- } else if len(result) == 0 {
- // No running instance exists with the given machine-ID
- klog.V(2).Infof("No VM matching the machine-ID found on the provider %q", machineID)
- return nil
- }
-
- ctx, computeService, err := d.createComputeService()
- if err != nil {
- klog.Error(err)
- return err
- }
-
- project, zone, name, err := d.decodeMachineID(machineID)
- if err != nil {
- klog.Error(err)
- return err
- }
-
- operation, err := computeService.Instances.Delete(project, zone, name).Context(ctx).Do()
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "gcp", "service": "compute"}).Inc()
- if ae, ok := err.(*googleapi.Error); ok && ae.Code == http.StatusNotFound {
- return nil
- }
- klog.Error(err)
- return err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "gcp", "service": "compute"}).Inc()
-
- return waitUntilOperationCompleted(computeService, project, zone, operation.Name)
-}
-
-func (d *GCPDriver) getUserData() *compute.MetadataItems {
- if strings.HasPrefix(d.UserData, "#cloud-config") {
- return &compute.MetadataItems{
- Key: "user-data",
- Value: &d.UserData,
- }
- }
-
- return &compute.MetadataItems{
- Key: "startup-script",
- Value: &d.UserData,
- }
-}
-
-// GetExisting method is used to get machineID for existing GCP machine
-func (d *GCPDriver) GetExisting() (string, error) {
- return d.MachineID, nil
-}
-
-// GetVMs returns a list of VMs
-func (d *GCPDriver) GetVMs(machineID string) (VMs, error) {
- listOfVMs := make(map[string]string)
-
- searchClusterName := ""
- searchNodeRole := ""
-
- for _, key := range d.GCPMachineClass.Spec.Tags {
- if strings.Contains(key, "kubernetes-io-cluster-") {
- searchClusterName = key
- } else if strings.Contains(key, "kubernetes-io-role-") {
- searchNodeRole = key
- }
- }
-
- if searchClusterName == "" || searchNodeRole == "" {
- return listOfVMs, nil
- }
-
- ctx, computeService, err := d.createComputeService()
- if err != nil {
- klog.Error(err)
- return listOfVMs, err
- }
-
- project, err := extractProject(d.CredentialsData)
- if err != nil {
- klog.Error(err)
- return listOfVMs, err
- }
-
- zone := d.GCPMachineClass.Spec.Zone
-
- req := computeService.Instances.List(project, zone)
- if err := req.Pages(ctx, func(page *compute.InstanceList) error {
- for _, server := range page.Items {
- clusterName := ""
- nodeRole := ""
-
- for _, key := range server.Tags.Items {
- if strings.Contains(key, "kubernetes-io-cluster-") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes-io-role-") {
- nodeRole = key
- }
- }
-
- if clusterName == searchClusterName && nodeRole == searchNodeRole {
- instanceID := d.encodeMachineID(project, zone, server.Name)
-
- if machineID == "" {
- listOfVMs[instanceID] = server.Name
- } else if machineID == instanceID {
- listOfVMs[instanceID] = server.Name
- klog.V(3).Infof("Found machine with name: %q", server.Name)
- break
- }
- }
- }
- return nil
- }); err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "gcp", "service": "compute"}).Inc()
- klog.Error(err)
- return listOfVMs, err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "gcp", "service": "compute"}).Inc()
-
- return listOfVMs, nil
-}
-
-func (d *GCPDriver) createComputeService() (context.Context, *compute.Service, error) {
- ctx := context.Background()
- serviceAccountJSON := ExtractCredentialsFromData(d.CredentialsData, v1alpha1.GCPServiceAccountJSON, v1alpha1.GCPAlternativeServiceAccountJSON)
-
- jwt, err := google.JWTConfigFromJSON([]byte(serviceAccountJSON), compute.CloudPlatformScope)
- if err != nil {
- return nil, nil, err
- }
-
- oauthClient := oauth2.NewClient(ctx, jwt.TokenSource(ctx))
- computeService, err := compute.New(oauthClient)
- if err != nil {
- return nil, nil, err
- }
-
- return ctx, computeService, nil
-}
-
-func waitUntilOperationCompleted(computeService *compute.Service, project, zone, operationName string) error {
- return wait.Poll(5*time.Second, 300*time.Second, func() (bool, error) {
- op, err := computeService.ZoneOperations.Get(project, zone, operationName).Do()
- if err != nil {
- return false, err
- }
- klog.V(3).Infof("Waiting for operation to be completed... (status: %s)", op.Status)
- if op.Status == "DONE" {
- if op.Error == nil {
- return true, nil
- }
- var err []error
- for _, opErr := range op.Error.Errors {
- err = append(err, fmt.Errorf("%s", *opErr))
- }
- return false, fmt.Errorf("The following errors occurred: %+v", err)
- }
- return false, nil
- })
-}
-
-func (d *GCPDriver) encodeMachineID(project, zone, name string) string {
- return fmt.Sprintf("gce:///%s/%s/%s", project, zone, name)
-}
-
-func (d *GCPDriver) decodeMachineID(id string) (string, string, string, error) {
- gceSplit := strings.Split(id, "gce:///")
- if len(gceSplit) != 2 {
- return "", "", "", fmt.Errorf("Invalid format of machine id: %s", id)
- }
-
- gce := strings.Split(gceSplit[1], "/")
- if len(gce) != 3 {
- return "", "", "", fmt.Errorf("Invalid format of machine id: %s", id)
- }
-
- return gce[0], gce[1], gce[2], nil
-}
-
-func extractProject(credentialsData map[string][]byte) (string, error) {
- serviceAccountJSON := ExtractCredentialsFromData(credentialsData, v1alpha1.GCPServiceAccountJSON, v1alpha1.GCPAlternativeServiceAccountJSON)
-
- var j struct {
- Project string `json:"project_id"`
- }
- if err := json.Unmarshal([]byte(serviceAccountJSON), &j); err != nil {
- return "Error", err
- }
- return j.Project, nil
-}
-
-// GetVolNames parses volume names from pv specs
-func (d *GCPDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error) {
- names := []string{}
- for i := range specs {
- spec := &specs[i]
- if spec.GCEPersistentDisk != nil {
- name := spec.GCEPersistentDisk.PDName
- names = append(names, name)
- } else if spec.CSI != nil && spec.CSI.Driver == gcePDDriverName && spec.CSI.VolumeHandle != "" {
- name := spec.CSI.VolumeHandle
- names = append(names, name)
- }
- }
- return names, nil
-}
-
-// GetUserData return the used data whit which the VM will be booted
-func (d *GCPDriver) GetUserData() string {
- return d.UserData
-}
-
-// SetUserData set the used data whit which the VM will be booted
-func (d *GCPDriver) SetUserData(userData string) {
- d.UserData = userData
-}
diff --git a/pkg/driver/driver_gcp_test.go b/pkg/driver/driver_gcp_test.go
deleted file mode 100644
index e416f8914..000000000
--- a/pkg/driver/driver_gcp_test.go
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package driver
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
-)
-
-var _ = Describe("Driver GCP", func() {
- Context("#GetVolNames", func() {
- var hostPathPVSpec = corev1.PersistentVolumeSpec{
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- HostPath: &corev1.HostPathVolumeSource{
- Path: "/mnt/data",
- },
- },
- }
-
- It("should handle in-tree PV (with .spec.gcePersistentDisk)", func() {
- driver := &GCPDriver{}
- pvs := []corev1.PersistentVolumeSpec{
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- GCEPersistentDisk: &corev1.GCEPersistentDiskVolumeSource{
- PDName: "vol-1",
- },
- },
- },
- hostPathPVSpec,
- }
-
- actual, err := driver.GetVolNames(pvs)
- Expect(err).ToNot(HaveOccurred())
- Expect(actual).To(Equal([]string{"vol-1"}))
- })
-
- It("should handle out-of-tree PV (with .spec.csi.volumeHandle)", func() {
- driver := &GCPDriver{}
- pvs := []corev1.PersistentVolumeSpec{
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- Driver: "io.kubernetes.storage.mock",
- VolumeHandle: "vol-2",
- },
- },
- },
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- Driver: "pd.csi.storage.gke.io",
- VolumeHandle: "vol-1",
- },
- },
- },
- hostPathPVSpec,
- }
-
- actual, err := driver.GetVolNames(pvs)
- Expect(err).ToNot(HaveOccurred())
- Expect(actual).To(Equal([]string{"vol-1"}))
- })
- })
-})
diff --git a/pkg/driver/driver_openstack.go b/pkg/driver/driver_openstack.go
deleted file mode 100644
index 79c91d55a..000000000
--- a/pkg/driver/driver_openstack.go
+++ /dev/null
@@ -1,728 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package driver contains the cloud provider specific implementations to manage machines
-package driver
-
-import (
- "crypto/tls"
- "crypto/x509"
- "fmt"
- "net/http"
- "runtime"
- "strings"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/metrics"
- "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/security/groups"
- "github.com/gophercloud/gophercloud/openstack/networking/v2/networks"
- "github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
- "github.com/prometheus/client_golang/prometheus"
- corev1 "k8s.io/api/core/v1"
- "k8s.io/klog/v2"
-
- "github.com/gophercloud/gophercloud"
- "github.com/gophercloud/gophercloud/openstack"
- "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
- "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs"
- "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/schedulerhints"
- "github.com/gophercloud/gophercloud/openstack/compute/v2/images"
- "github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
- "github.com/gophercloud/gophercloud/openstack/networking/v2/ports"
- "github.com/gophercloud/gophercloud/pagination"
- "github.com/gophercloud/utils/client"
- "github.com/gophercloud/utils/openstack/clientconfig"
-)
-
-const (
- // CinderDriverName is the name of the CSI driver for Cinder
- cinderDriverName = "cinder.csi.openstack.org"
-)
-
-type logger struct{}
-
-func (l logger) Printf(format string, args ...interface{}) {
- debugger := klog.V(6).Enabled()
-
- // extra check in case, when verbosity has been changed dynamically
- if debugger {
- var skip int
- var found bool
- var gc = "/github.com/gophercloud/gophercloud"
-
- // detect the depth of the actual function, which calls gophercloud code
- // 10 is the common depth from the logger to "github.com/gophercloud/gophercloud"
- for i := 10; i <= 20; i++ {
- if _, file, _, ok := runtime.Caller(i); ok && !found && strings.Contains(file, gc) {
- found = true
- continue
- } else if ok && found && !strings.Contains(file, gc) {
- skip = i
- break
- } else if !ok {
- break
- }
- }
-
- for _, v := range strings.Split(fmt.Sprintf(format, args...), "\n") {
- klog.InfoDepth(skip, v)
- }
- }
-}
-
-// OpenStackDriver is the driver struct for holding OS machine information
-type OpenStackDriver struct {
- OpenStackMachineClass *v1alpha1.OpenStackMachineClass
- CredentialsData map[string][]byte
- UserData string
- MachineID string
- MachineName string
-}
-
-// deleteOnFail method is used to delete the VM, which was created with an error
-func (d *OpenStackDriver) deleteOnFail(err error) error {
- // this method is called after the d.MachineID has been set
- if e := d.Delete(d.MachineID); e != nil {
- return fmt.Errorf("Error deleting machine %s (%s) after unsuccessful create attempt: %s", d.MachineID, e.Error(), err.Error())
- }
- return err
-}
-
-// Create method is used to create an OS machine
-func (d *OpenStackDriver) Create() (string, string, error) {
-
- client, err := d.createNovaClient()
- if err != nil {
- return "", "", err
- }
-
- flavorName := d.OpenStackMachineClass.Spec.FlavorName
- keyName := d.OpenStackMachineClass.Spec.KeyName
- imageName := d.OpenStackMachineClass.Spec.ImageName
- imageID := d.OpenStackMachineClass.Spec.ImageID
- networkID := d.OpenStackMachineClass.Spec.NetworkID
- subnetID := d.OpenStackMachineClass.Spec.SubnetID
- specNetworks := d.OpenStackMachineClass.Spec.Networks
- securityGroups := d.OpenStackMachineClass.Spec.SecurityGroups
- availabilityZone := d.OpenStackMachineClass.Spec.AvailabilityZone
- metadata := d.OpenStackMachineClass.Spec.Tags
- podNetworkCidr := d.OpenStackMachineClass.Spec.PodNetworkCidr
- rootDiskSize := d.OpenStackMachineClass.Spec.RootDiskSize
- useConfigDrive := d.OpenStackMachineClass.Spec.UseConfigDrive
-
- var createOpts servers.CreateOptsBuilder
- var imageRef string
-
- // use imageID if provided, otherwise try to resolve the imageName to an imageID
- if imageID != "" {
- imageRef = imageID
- } else {
- imageRef, err = d.recentImageIDFromName(client, imageName)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
- return "", "", fmt.Errorf("failed to get image id for image name %s: %s", imageName, err)
- }
- }
-
- nwClient, err := d.createNeutronClient()
- if err != nil {
- return "", "", d.deleteOnFail(err)
- }
-
- var serverNetworks []servers.Network
- var podNetworkIds = make(map[string]struct{})
-
- // network port allocation in existing network if a networkID is specified
- if len(networkID) > 0 {
- klog.V(3).Infof("existing network %q specified, need to pre-allocate ports ", networkID)
-
- // create port in given subnet
- if subnetID != nil && len(*subnetID) > 0 {
- if _, err := subnets.Get(nwClient, *subnetID).Extract(); err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- return "", "", fmt.Errorf("failed to get subnet information for subnetID %s: %s", *subnetID, err)
- }
-
- klog.V(3).Infof("creating port in subnet %s", *subnetID)
-
- var securityGroupIDs []string
- for _, securityGroup := range securityGroups {
- securityGroupID, err := groups.IDFromName(nwClient, securityGroup)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- return "", "", fmt.Errorf("failed to get ID for security group %q: %s", securityGroup, err)
- }
- securityGroupIDs = append(securityGroupIDs, securityGroupID)
- }
-
- port, err := ports.Create(nwClient, &ports.CreateOpts{
- Name: d.MachineName,
- NetworkID: networkID,
- FixedIPs: []ports.IP{{SubnetID: *subnetID}},
- AllowedAddressPairs: []ports.AddressPair{{IPAddress: podNetworkCidr}},
- SecurityGroups: &securityGroupIDs,
- }).Extract()
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- return "", "", fmt.Errorf("failed to create port in subnet with subnetID %s: %s", *subnetID, err)
- }
-
- klog.V(3).Infof("port with ID %s successfully created", port.ID)
-
- serverNetworks = append(serverNetworks, servers.Network{UUID: networkID, Port: port.ID})
- } else {
- serverNetworks = append(serverNetworks, servers.Network{UUID: networkID})
- }
- podNetworkIds[networkID] = struct{}{}
-
- } else {
- for _, network := range specNetworks {
- var resolvedNetworkID string
- if len(network.Id) > 0 {
- resolvedNetworkID = networkID
- } else {
- resolvedNetworkID, err = networks.IDFromName(nwClient, network.Name)
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- return "", "", fmt.Errorf("failed to get uuid for network name %q: %s", network.Name, err)
- }
- }
- serverNetworks = append(serverNetworks, servers.Network{UUID: resolvedNetworkID})
- if network.PodNetwork {
- podNetworkIds[resolvedNetworkID] = struct{}{}
- }
- }
- }
-
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
-
- createOpts = &servers.CreateOpts{
- ServiceClient: client,
- Name: d.MachineName,
- FlavorName: flavorName,
- ImageRef: imageRef,
- Networks: serverNetworks,
- SecurityGroups: securityGroups,
- Metadata: metadata,
- UserData: []byte(d.UserData),
- AvailabilityZone: availabilityZone,
- ConfigDrive: useConfigDrive,
- }
-
- createOpts = &keypairs.CreateOptsExt{
- CreateOptsBuilder: createOpts,
- KeyName: keyName,
- }
-
- if d.OpenStackMachineClass.Spec.ServerGroupID != nil {
- hints := schedulerhints.SchedulerHints{
- Group: *d.OpenStackMachineClass.Spec.ServerGroupID,
- }
- createOpts = schedulerhints.CreateOptsExt{
- CreateOptsBuilder: createOpts,
- SchedulerHints: hints,
- }
- }
-
- if rootDiskSize > 0 {
- blockDevices, err := resourceInstanceBlockDevicesV2(rootDiskSize, imageRef)
- if err != nil {
- return "", "", err
- }
-
- createOpts = &bootfromvolume.CreateOptsExt{
- CreateOptsBuilder: createOpts,
- BlockDevice: blockDevices,
- }
- }
-
- klog.V(3).Infof("creating machine")
-
- var server *servers.Server
- // If a custom block_device (root disk size is provided) we need to boot from volume
- if rootDiskSize > 0 {
- server, err = bootfromvolume.Create(client, createOpts).Extract()
- } else {
- server, err = servers.Create(client, createOpts).Extract()
- }
-
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
- return "", "", fmt.Errorf("error creating the server: %s", err)
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
-
- d.MachineID = d.encodeMachineID(d.OpenStackMachineClass.Spec.Region, server.ID)
-
- err = waitForStatus(client, server.ID, []string{"BUILD"}, []string{"ACTIVE"}, 600)
- if err != nil {
- return "", "", d.deleteOnFail(fmt.Errorf("error waiting for the %q server status: %s", server.ID, err))
- }
-
- listOpts := &ports.ListOpts{
- DeviceID: server.ID,
- }
-
- allPages, err := ports.List(nwClient, listOpts).AllPages()
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- return "", "", d.deleteOnFail(fmt.Errorf("failed to get ports: %s", err))
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
-
- allPorts, err := ports.ExtractPorts(allPages)
- if err != nil {
- return "", "", d.deleteOnFail(fmt.Errorf("failed to extract ports: %s", err))
- }
-
- if len(allPorts) == 0 {
- return "", "", d.deleteOnFail(fmt.Errorf("got an empty port list for server ID %s", server.ID))
- }
-
- for _, port := range allPorts {
- for id := range podNetworkIds {
- if port.NetworkID == id {
- _, err := ports.Update(nwClient, port.ID, ports.UpdateOpts{
- AllowedAddressPairs: &[]ports.AddressPair{{IPAddress: podNetworkCidr}},
- }).Extract()
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- return "", "", d.deleteOnFail(fmt.Errorf("failed to update allowed address pair for port ID %s: %s", port.ID, err))
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- }
- }
- }
-
- return d.MachineID, d.MachineName, nil
-}
-
-// Delete method is used to delete an OS machine
-func (d *OpenStackDriver) Delete(machineID string) error {
- res, err := d.GetVMs(machineID)
- if err != nil {
- return err
- } else if len(res) > 0 {
- instanceID := d.decodeMachineID(machineID)
- client, err := d.createNovaClient()
- if err != nil {
- return err
- }
-
- err = servers.Delete(client, instanceID).ExtractErr()
- if err != nil && !isNotFoundError(err) {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
- klog.Errorf("Failed to delete machine with ID: %s", machineID)
-
- return err
- }
-
- // waiting for the machine to be deleted to release consumed quota resources, 5 minutes should be enough
- err = waitForStatus(client, machineID, nil, []string{"DELETED", "SOFT_DELETED"}, 300)
- if err != nil {
- return fmt.Errorf("error waiting for the %q server to be deleted: %s", machineID, err)
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
- klog.V(3).Infof("Deleted machine with ID: %s", machineID)
-
- } else {
- // No running instance exists with the given machine-ID
- klog.V(2).Infof("No VM matching the machine-ID found on the provider %q", machineID)
- }
-
- if err = d.deletePort(); err != nil {
- return err
- }
-
- return nil
-}
-
-// GetExisting method is used to get machineID for existing OS machine
-func (d *OpenStackDriver) GetExisting() (string, error) {
- return d.MachineID, nil
-}
-
-// GetVMs returns a VM matching the machineID
-// If machineID is an empty string then it returns all matching instances
-func (d *OpenStackDriver) GetVMs(machineID string) (VMs, error) {
- listOfVMs := make(map[string]string)
-
- searchClusterName := ""
- searchNodeRole := ""
-
- for key := range d.OpenStackMachineClass.Spec.Tags {
- if strings.Contains(key, "kubernetes.io-cluster-") {
- searchClusterName = key
- } else if strings.Contains(key, "kubernetes.io-role-") {
- searchNodeRole = key
- }
- }
-
- if searchClusterName == "" || searchNodeRole == "" {
- return listOfVMs, nil
- }
-
- client, err := d.createNovaClient()
- if err != nil {
- klog.Errorf("Could not connect to NovaClient. Error Message - %s", err)
- return listOfVMs, err
- }
-
- // Retrieve a pager (i.e. a paginated collection)
- pager := servers.List(client, servers.ListOpts{})
- if pager.Err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
- klog.Errorf("Could not list instances. Error Message - %s", err)
- return listOfVMs, err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
-
- // Define an anonymous function to be executed on each page's iteration
- err = pager.EachPage(func(page pagination.Page) (bool, error) {
- serverList, err := servers.ExtractServers(page)
-
- for _, server := range serverList {
-
- clusterName := ""
- nodeRole := ""
-
- for key := range server.Metadata {
- if strings.Contains(key, "kubernetes.io-cluster-") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes.io-role-") {
- nodeRole = key
- }
- }
-
- if clusterName == searchClusterName && nodeRole == searchNodeRole {
- instanceID := d.encodeMachineID(d.OpenStackMachineClass.Spec.Region, server.ID)
-
- if machineID == "" {
- listOfVMs[instanceID] = server.Name
- } else if machineID == instanceID {
- listOfVMs[instanceID] = server.Name
- klog.V(3).Infof("Found machine with name: %q", server.Name)
- break
- }
- }
-
- }
- return true, err
- })
-
- return listOfVMs, err
-}
-
-// createNovaClient is used to create a Nova client
-func (d *OpenStackDriver) createNovaClient() (*gophercloud.ServiceClient, error) {
-
- region := d.OpenStackMachineClass.Spec.Region
-
- client, err := d.createOpenStackClient()
- if err != nil {
- return nil, err
- }
-
- return openstack.NewComputeV2(client, gophercloud.EndpointOpts{
- Region: strings.TrimSpace(region),
- Availability: gophercloud.AvailabilityPublic,
- })
-}
-
-// createOpenStackClient creates and authenticates a base OpenStack client
-func (d *OpenStackDriver) createOpenStackClient() (*gophercloud.ProviderClient, error) {
- config := &tls.Config{}
-
- authURL, ok := d.CredentialsData[v1alpha1.OpenStackAuthURL]
- if !ok {
- return nil, fmt.Errorf("missing %s in secret", v1alpha1.OpenStackAuthURL)
- }
- username, ok := d.CredentialsData[v1alpha1.OpenStackUsername]
- if !ok {
- return nil, fmt.Errorf("missing %s in secret", v1alpha1.OpenStackUsername)
- }
- password, ok := d.CredentialsData[v1alpha1.OpenStackPassword]
- if !ok {
- return nil, fmt.Errorf("missing %s in secret", v1alpha1.OpenStackPassword)
- }
-
- // optional OS_USER_DOMAIN_NAME
- userDomainName := d.CredentialsData[v1alpha1.OpenStackUserDomainName]
- // optional OS_USER_DOMAIN_ID
- userDomainID := d.CredentialsData[v1alpha1.OpenStackUserDomainID]
-
- domainName, ok := d.CredentialsData[v1alpha1.OpenStackDomainName]
- domainID, ok2 := d.CredentialsData[v1alpha1.OpenStackDomainID]
- if !ok && !ok2 {
- return nil, fmt.Errorf("missing %s or %s in secret", v1alpha1.OpenStackDomainName, v1alpha1.OpenStackDomainID)
- }
- tenantName, ok := d.CredentialsData[v1alpha1.OpenStackTenantName]
- tenantID, ok2 := d.CredentialsData[v1alpha1.OpenStackTenantID]
- if !ok && !ok2 {
- return nil, fmt.Errorf("missing %s or %s in secret", v1alpha1.OpenStackTenantName, v1alpha1.OpenStackTenantID)
- }
-
- caCert, ok := d.CredentialsData[v1alpha1.OpenStackCACert]
- if !ok {
- caCert = nil
- }
-
- insecure, ok := d.CredentialsData[v1alpha1.OpenStackInsecure]
- if ok && strings.TrimSpace(string(insecure)) == "true" {
- config.InsecureSkipVerify = true
- }
-
- if caCert != nil {
- caCertPool := x509.NewCertPool()
- caCertPool.AppendCertsFromPEM([]byte(caCert))
- config.RootCAs = caCertPool
- }
-
- clientCert, ok := d.CredentialsData[v1alpha1.OpenStackClientCert]
- if ok {
- clientKey, ok := d.CredentialsData[v1alpha1.OpenStackClientKey]
- if ok {
- cert, err := tls.X509KeyPair([]byte(clientCert), []byte(clientKey))
- if err != nil {
- return nil, err
- }
- config.Certificates = []tls.Certificate{cert}
- config.BuildNameToCertificate()
- } else {
- return nil, fmt.Errorf("%s missing in secret", v1alpha1.OpenStackClientKey)
- }
- }
-
- clientOpts := new(clientconfig.ClientOpts)
- authInfo := &clientconfig.AuthInfo{
- AuthURL: strings.TrimSpace(string(authURL)),
- Username: strings.TrimSpace(string(username)),
- Password: strings.TrimSpace(string(password)),
- DomainName: strings.TrimSpace(string(domainName)),
- DomainID: strings.TrimSpace(string(domainID)),
- ProjectName: strings.TrimSpace(string(tenantName)),
- ProjectID: strings.TrimSpace(string(tenantID)),
- UserDomainName: strings.TrimSpace(string(userDomainName)),
- UserDomainID: strings.TrimSpace(string(userDomainID)),
- }
- clientOpts.AuthInfo = authInfo
-
- ao, err := clientconfig.AuthOptions(clientOpts)
- if err != nil {
- return nil, fmt.Errorf("failed to create client auth options: %+v", err)
- }
-
- provider, err := openstack.NewClient(ao.IdentityEndpoint)
- if err != nil {
- return nil, err
- }
-
- // Set UserAgent
- provider.UserAgent.Prepend("Machine Controller 08/15")
-
- transport := &http.Transport{Proxy: http.ProxyFromEnvironment, TLSClientConfig: config}
- provider.HTTPClient = http.Client{
- Transport: transport,
- }
-
- if klog.V(6).Enabled() {
- provider.HTTPClient.Transport = &client.RoundTripper{
- Rt: provider.HTTPClient.Transport,
- Logger: &logger{},
- }
- }
-
- err = openstack.Authenticate(provider, *ao)
- if err != nil {
- return nil, err
- }
-
- return provider, nil
-}
-
-// createNeutronClient is used to create a Neutron client
-func (d *OpenStackDriver) createNeutronClient() (*gophercloud.ServiceClient, error) {
-
- region := d.OpenStackMachineClass.Spec.Region
-
- client, err := d.createOpenStackClient()
- if err != nil {
- return nil, err
- }
-
- return openstack.NewNetworkV2(client, gophercloud.EndpointOpts{
- Region: strings.TrimSpace(region),
- Availability: gophercloud.AvailabilityPublic,
- })
-}
-
-func (d *OpenStackDriver) encodeMachineID(region string, machineID string) string {
- return fmt.Sprintf("openstack:///%s/%s", region, machineID)
-}
-
-func (d *OpenStackDriver) decodeMachineID(id string) string {
- splitProviderID := strings.Split(id, "/")
- return splitProviderID[len(splitProviderID)-1]
-}
-
-func (d *OpenStackDriver) recentImageIDFromName(client *gophercloud.ServiceClient, imageName string) (string, error) {
- allPages, err := images.ListDetail(client, nil).AllPages()
- if err != nil {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
- return "", err
- }
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "nova"}).Inc()
- all, err := images.ExtractImages(allPages)
- if err != nil {
- return "", err
- }
- for _, f := range all {
- if f.Name == imageName {
- return f.ID, nil
- }
- }
- return "", fmt.Errorf("could not find an image id for image name %s", imageName)
-}
-
-// GetVolNames parses volume names from pv specs
-func (d *OpenStackDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error) {
- names := []string{}
- for i := range specs {
- spec := &specs[i]
- if spec.Cinder != nil {
- name := spec.Cinder.VolumeID
- names = append(names, name)
- } else if spec.CSI != nil && spec.CSI.Driver == cinderDriverName && spec.CSI.VolumeHandle != "" {
- name := spec.CSI.VolumeHandle
- names = append(names, name)
- }
- }
- return names, nil
-}
-
-// GetUserData return the used data whit which the VM will be booted
-func (d *OpenStackDriver) GetUserData() string {
- return d.UserData
-}
-
-// SetUserData set the used data whit which the VM will be booted
-func (d *OpenStackDriver) SetUserData(userData string) {
- d.UserData = userData
-}
-
-// deletePort method is used to delete a dedicated port, if subnet is specified for machine
-func (d *OpenStackDriver) deletePort() error {
-
- if d.OpenStackMachineClass.Spec.SubnetID != nil && len(*d.OpenStackMachineClass.Spec.SubnetID) > 0 {
- nwClient, err := d.createNeutronClient()
- if err != nil {
- return err
- }
-
- portID, err := ports.IDFromName(nwClient, d.MachineName)
- if err != nil {
- if isNotFoundError(err) {
- klog.V(3).Infof("port with name %q was not found", d.MachineName)
- return nil
- }
-
- return fmt.Errorf("error deleting port with name %q: %s", d.MachineName, err)
- }
-
- klog.V(3).Infof("deleting port with ID %s", portID)
-
- err = ports.Delete(nwClient, portID).ExtractErr()
- if err != nil && !isNotFoundError(err) {
- metrics.APIFailedRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- klog.Errorf("Failed to delete port with ID: %s", portID)
-
- return err
- }
-
- metrics.APIRequestCount.With(prometheus.Labels{"provider": "openstack", "service": "neutron"}).Inc()
- klog.V(3).Infof("Deleted port with ID: %s", portID)
- }
-
- return nil
-}
-
-// isNotFoundError checks, if an error returned by gophercloud is 404 like
-func isNotFoundError(err error) bool {
- if err == nil {
- return false
- }
- if _, ok := err.(gophercloud.ErrDefault404); ok {
- return true
- }
- if _, ok := err.(gophercloud.Err404er); ok {
- return true
- }
- if _, ok := err.(gophercloud.ErrResourceNotFound); ok {
- return true
- }
- return false
-}
-
-func waitForStatus(c *gophercloud.ServiceClient, id string, pending []string, target []string, secs int) error {
- return gophercloud.WaitFor(secs, func() (bool, error) {
- current, err := servers.Get(c, id).Extract()
- if err != nil {
- if _, ok := err.(gophercloud.ErrDefault404); ok && strSliceContains(target, "DELETED") {
- return true, nil
- }
- return false, err
- }
-
- if strSliceContains(target, current.Status) {
- return true, nil
- }
-
- // if there is no pending statuses defined or current status is in the pending list, then continue polling
- if len(pending) == 0 || strSliceContains(pending, current.Status) {
- return false, nil
- }
-
- retErr := fmt.Errorf("unexpected status %q, wanted target %q", current.Status, strings.Join(target, ", "))
- if current.Status == "ERROR" {
- retErr = fmt.Errorf("%s, fault: %+v", retErr, current.Fault)
- }
-
- return false, retErr
- })
-}
-
-func strSliceContains(haystack []string, needle string) bool {
- for _, s := range haystack {
- if s == needle {
- return true
- }
- }
- return false
-}
-
-func resourceInstanceBlockDevicesV2(rootDiskSize int, imageID string) ([]bootfromvolume.BlockDevice, error) {
- blockDeviceOpts := make([]bootfromvolume.BlockDevice, 1)
- blockDeviceOpts[0] = bootfromvolume.BlockDevice{
- UUID: imageID,
- VolumeSize: rootDiskSize,
- BootIndex: 0,
- DeleteOnTermination: true,
- SourceType: "image",
- DestinationType: "volume",
- }
- klog.V(2).Infof("[DEBUG] Block Device Options: %+v", blockDeviceOpts)
- return blockDeviceOpts, nil
-}
diff --git a/pkg/driver/driver_openstack_test.go b/pkg/driver/driver_openstack_test.go
deleted file mode 100644
index 5ac8e0cd1..000000000
--- a/pkg/driver/driver_openstack_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package driver
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- corev1 "k8s.io/api/core/v1"
-)
-
-var _ = Describe("Driver Openstack", func() {
-
- Context("#GetVolNames", func() {
- var hostPathPVSpec = corev1.PersistentVolumeSpec{
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- HostPath: &corev1.HostPathVolumeSource{
- Path: "/mnt/data",
- },
- },
- }
-
- It("should handle in-tree PV (with .spec.cinder)", func() {
- driver := &OpenStackDriver{}
- pvs := []corev1.PersistentVolumeSpec{
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- Cinder: &corev1.CinderPersistentVolumeSource{
- VolumeID: "a5ebd05f-934f-480d-b06f-41b372ed631e",
- },
- },
- },
- hostPathPVSpec,
- }
-
- actual, err := driver.GetVolNames(pvs)
- Expect(err).ToNot(HaveOccurred())
- Expect(actual).To(Equal([]string{"a5ebd05f-934f-480d-b06f-41b372ed631e"}))
- })
-
- It("should handle out-of-tree PV (with .spec.csi.volumeHandle)", func() {
- driver := &OpenStackDriver{}
- pvs := []corev1.PersistentVolumeSpec{
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- Driver: "io.kubernetes.storage.mock",
- VolumeHandle: "vol-2",
- },
- },
- },
- {
- PersistentVolumeSource: corev1.PersistentVolumeSource{
- CSI: &corev1.CSIPersistentVolumeSource{
- Driver: "cinder.csi.openstack.org",
- VolumeHandle: "a5ebd05f-934f-480d-b06f-41b372ed631e",
- },
- },
- },
- hostPathPVSpec,
- }
-
- actual, err := driver.GetVolNames(pvs)
- Expect(err).ToNot(HaveOccurred())
- Expect(actual).To(Equal([]string{"a5ebd05f-934f-480d-b06f-41b372ed631e"}))
- })
- })
-})
diff --git a/pkg/driver/driver_packet.go b/pkg/driver/driver_packet.go
deleted file mode 100644
index 41d66728f..000000000
--- a/pkg/driver/driver_packet.go
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-// Package driver contains the cloud provider specific implementations to manage machines
-package driver
-
-import (
- "fmt"
- "strings"
-
- v1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- corev1 "k8s.io/api/core/v1"
-
- "github.com/packethost/packngo"
- "k8s.io/klog/v2"
-)
-
-// PacketDriver is the driver struct for holding Packet machine information
-type PacketDriver struct {
- PacketMachineClass *v1alpha1.PacketMachineClass
- CredentialsData map[string][]byte
- UserData string
- MachineID string
- MachineName string
-}
-
-// NewPacketDriver returns an empty PacketDriver object
-func NewPacketDriver(create func() (string, error), delete func() error, existing func() (string, error)) Driver {
- return &PacketDriver{}
-}
-
-// Create method is used to create a Packet machine
-func (d *PacketDriver) Create() (string, string, error) {
-
- svc := d.createSVC()
- if svc == nil {
- return "", "", fmt.Errorf("nil Packet service returned")
- }
- // packet tags are strings only
- createRequest := &packngo.DeviceCreateRequest{
- Hostname: d.MachineName,
- UserData: d.UserData,
- Plan: d.PacketMachineClass.Spec.MachineType,
- ProjectID: d.PacketMachineClass.Spec.ProjectID,
- BillingCycle: d.PacketMachineClass.Spec.BillingCycle,
- Facility: d.PacketMachineClass.Spec.Facility,
- OS: d.PacketMachineClass.Spec.OS,
- ProjectSSHKeys: d.PacketMachineClass.Spec.SSHKeys,
- Tags: d.PacketMachineClass.Spec.Tags,
- }
-
- device, _, err := svc.Devices.Create(createRequest)
- if err != nil {
- klog.Errorf("Could not create machine: %v", err)
- return "", "", err
- }
- return d.encodeMachineID(device.Facility.ID, device.ID), device.Hostname, nil
-}
-
-// Delete method is used to delete a Packet machine
-func (d *PacketDriver) Delete(machineID string) error {
-
- svc := d.createSVC()
- if svc == nil {
- return fmt.Errorf("nil Packet service returned")
- }
- instanceID := d.decodeMachineID(machineID)
- resp, err := svc.Devices.Delete(instanceID)
- if err != nil {
- if resp.StatusCode == 404 {
- klog.V(2).Infof("No machine matching the machine-ID found on the provider %q", machineID)
- return nil
- }
- klog.Errorf("Could not terminate machine %s: %v", machineID, err)
- return err
- }
- return nil
-}
-
-// GetExisting method is used to get machineID for existing Packet machine
-func (d *PacketDriver) GetExisting() (string, error) {
- return d.MachineID, nil
-}
-
-// GetVMs returns a machine matching the machineID
-// If machineID is an empty string then it returns all matching instances
-func (d *PacketDriver) GetVMs(machineID string) (VMs, error) {
- listOfVMs := make(map[string]string)
-
- clusterName := ""
- nodeRole := ""
-
- for _, key := range d.PacketMachineClass.Spec.Tags {
- if strings.Contains(key, "kubernetes.io/cluster/") {
- clusterName = key
- } else if strings.Contains(key, "kubernetes.io/role/") {
- nodeRole = key
- }
- }
-
- if clusterName == "" || nodeRole == "" {
- return listOfVMs, nil
- }
-
- svc := d.createSVC()
- if svc == nil {
- return nil, fmt.Errorf("nil Packet service returned")
- }
- if machineID == "" {
- devices, _, err := svc.Devices.List(d.PacketMachineClass.Spec.ProjectID, &packngo.ListOptions{})
- if err != nil {
- klog.Errorf("Could not list devices for project %s: %v", d.PacketMachineClass.Spec.ProjectID, err)
- return nil, err
- }
- for _, d := range devices {
- matchedCluster := false
- matchedRole := false
- for _, tag := range d.Tags {
- switch tag {
- case clusterName:
- matchedCluster = true
- case nodeRole:
- matchedRole = true
- }
- }
- if matchedCluster && matchedRole {
- listOfVMs[d.ID] = d.Hostname
- }
- }
- } else {
- machineID = d.decodeMachineID(machineID)
- device, _, err := svc.Devices.Get(machineID, &packngo.GetOptions{})
- if err != nil {
- klog.Errorf("Could not get device %s: %v", machineID, err)
- return nil, err
- }
- listOfVMs[machineID] = device.Hostname
- }
- return listOfVMs, nil
-}
-
-// Helper function to create SVC
-func (d *PacketDriver) createSVC() *packngo.Client {
-
- token := strings.TrimSpace(string(d.CredentialsData[v1alpha1.PacketAPIKey]))
-
- if token != "" {
- return packngo.NewClientWithAuth("gardener", token, nil)
- }
-
- return nil
-}
-
-func (d *PacketDriver) encodeMachineID(facility, machineID string) string {
- return fmt.Sprintf("packet:///%s/%s", facility, machineID)
-}
-
-func (d *PacketDriver) decodeMachineID(id string) string {
- splitProviderID := strings.Split(id, "/")
- return splitProviderID[len(splitProviderID)-1]
-}
-
-// GetVolNames parses volume names from pv specs
-func (d *PacketDriver) GetVolNames(specs []corev1.PersistentVolumeSpec) ([]string, error) {
- names := []string{}
- return names, fmt.Errorf("Not implemented yet")
-}
-
-// GetUserData return the used data whit which the VM will be booted
-func (d *PacketDriver) GetUserData() string {
- return d.UserData
-}
-
-// SetUserData set the used data whit which the VM will be booted
-func (d *PacketDriver) SetUserData(userData string) {
- d.UserData = userData
-}
diff --git a/pkg/driver/driver_suite_test.go b/pkg/driver/driver_suite_test.go
deleted file mode 100644
index 37a3def50..000000000
--- a/pkg/driver/driver_suite_test.go
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
-Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package driver
-
-import (
- "testing"
-)
-import . "github.com/onsi/ginkgo"
-import . "github.com/onsi/gomega"
-
-func TestDriverSuite(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "Driver Suite")
-}
diff --git a/pkg/driver/driver_test.go b/pkg/driver/driver_test.go
deleted file mode 100644
index 5c3b72a3f..000000000
--- a/pkg/driver/driver_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package driver_test
-
-import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-
- . "github.com/gardener/machine-controller-manager/pkg/driver"
-)
-
-var _ = Describe("Driver", func() {
- Describe("#ExtractCredentialsFromData", func() {
- It("should return an empty string because data map is nil", func() {
- Expect(ExtractCredentialsFromData(nil, "foo", "bar")).To(BeEmpty())
- })
-
- It("should return an empty string because data map is empty", func() {
- Expect(ExtractCredentialsFromData(map[string][]byte{}, "foo", "bar")).To(BeEmpty())
- })
-
- It("should return an empty string because no keys provided", func() {
- Expect(ExtractCredentialsFromData(map[string][]byte{"foo": []byte("bar")})).To(BeEmpty())
- })
-
- It("should return the value of the first matching key", func() {
- Expect(ExtractCredentialsFromData(map[string][]byte{"foo": []byte(" bar")}, "foo", "bar")).To(Equal("bar"))
- })
-
- It("should return the value of the first matching key", func() {
- Expect(ExtractCredentialsFromData(map[string][]byte{"foo": []byte(` bar
-`)}, "bar", "foo")).To(Equal("bar"))
- })
- })
-})
diff --git a/pkg/openapi/openapi_generated.go b/pkg/openapi/openapi_generated.go
index 4f56923b7..cc87eb595 100644
--- a/pkg/openapi/openapi_generated.go
+++ b/pkg/openapi/openapi_generated.go
@@ -32,81 +32,34 @@ import (
func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition {
return map[string]common.OpenAPIDefinition{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSBlockDeviceMappingSpec": schema_pkg_apis_machine_v1alpha1_AWSBlockDeviceMappingSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSEbsBlockDeviceSpec": schema_pkg_apis_machine_v1alpha1_AWSEbsBlockDeviceSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSIAMProfileSpec": schema_pkg_apis_machine_v1alpha1_AWSIAMProfileSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClass": schema_pkg_apis_machine_v1alpha1_AWSMachineClass(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClassList": schema_pkg_apis_machine_v1alpha1_AWSMachineClassList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClassSpec": schema_pkg_apis_machine_v1alpha1_AWSMachineClassSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSNetworkInterfaceSpec": schema_pkg_apis_machine_v1alpha1_AWSNetworkInterfaceSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudDataDisk": schema_pkg_apis_machine_v1alpha1_AlicloudDataDisk(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudMachineClass": schema_pkg_apis_machine_v1alpha1_AlicloudMachineClass(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudMachineClassList": schema_pkg_apis_machine_v1alpha1_AlicloudMachineClassList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudMachineClassSpec": schema_pkg_apis_machine_v1alpha1_AlicloudMachineClassSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudSystemDisk": schema_pkg_apis_machine_v1alpha1_AlicloudSystemDisk(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureDataDisk": schema_pkg_apis_machine_v1alpha1_AzureDataDisk(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureHardwareProfile": schema_pkg_apis_machine_v1alpha1_AzureHardwareProfile(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureImageReference": schema_pkg_apis_machine_v1alpha1_AzureImageReference(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureLinuxConfiguration": schema_pkg_apis_machine_v1alpha1_AzureLinuxConfiguration(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineClass": schema_pkg_apis_machine_v1alpha1_AzureMachineClass(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineClassList": schema_pkg_apis_machine_v1alpha1_AzureMachineClassList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineClassSpec": schema_pkg_apis_machine_v1alpha1_AzureMachineClassSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineSetConfig": schema_pkg_apis_machine_v1alpha1_AzureMachineSetConfig(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureManagedDiskParameters": schema_pkg_apis_machine_v1alpha1_AzureManagedDiskParameters(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkInterfaceReference": schema_pkg_apis_machine_v1alpha1_AzureNetworkInterfaceReference(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkInterfaceReferenceProperties": schema_pkg_apis_machine_v1alpha1_AzureNetworkInterfaceReferenceProperties(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkProfile": schema_pkg_apis_machine_v1alpha1_AzureNetworkProfile(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureOSDisk": schema_pkg_apis_machine_v1alpha1_AzureOSDisk(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureOSProfile": schema_pkg_apis_machine_v1alpha1_AzureOSProfile(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSSHConfiguration": schema_pkg_apis_machine_v1alpha1_AzureSSHConfiguration(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSSHPublicKey": schema_pkg_apis_machine_v1alpha1_AzureSSHPublicKey(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureStorageProfile": schema_pkg_apis_machine_v1alpha1_AzureStorageProfile(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSubResource": schema_pkg_apis_machine_v1alpha1_AzureSubResource(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSubnetInfo": schema_pkg_apis_machine_v1alpha1_AzureSubnetInfo(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureVirtualMachineProperties": schema_pkg_apis_machine_v1alpha1_AzureVirtualMachineProperties(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec": schema_pkg_apis_machine_v1alpha1_ClassSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus": schema_pkg_apis_machine_v1alpha1_CurrentStatus(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPDisk": schema_pkg_apis_machine_v1alpha1_GCPDisk(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMachineClass": schema_pkg_apis_machine_v1alpha1_GCPMachineClass(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMachineClassList": schema_pkg_apis_machine_v1alpha1_GCPMachineClassList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMachineClassSpec": schema_pkg_apis_machine_v1alpha1_GCPMachineClassSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMetadata": schema_pkg_apis_machine_v1alpha1_GCPMetadata(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPNetworkInterface": schema_pkg_apis_machine_v1alpha1_GCPNetworkInterface(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPScheduling": schema_pkg_apis_machine_v1alpha1_GCPScheduling(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPServiceAccount": schema_pkg_apis_machine_v1alpha1_GCPServiceAccount(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation": schema_pkg_apis_machine_v1alpha1_LastOperation(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.Machine": schema_pkg_apis_machine_v1alpha1_Machine(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineClass": schema_pkg_apis_machine_v1alpha1_MachineClass(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineClassList": schema_pkg_apis_machine_v1alpha1_MachineClassList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineConfiguration": schema_pkg_apis_machine_v1alpha1_MachineConfiguration(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment": schema_pkg_apis_machine_v1alpha1_MachineDeployment(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition": schema_pkg_apis_machine_v1alpha1_MachineDeploymentCondition(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentList": schema_pkg_apis_machine_v1alpha1_MachineDeploymentList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec": schema_pkg_apis_machine_v1alpha1_MachineDeploymentSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus": schema_pkg_apis_machine_v1alpha1_MachineDeploymentStatus(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy": schema_pkg_apis_machine_v1alpha1_MachineDeploymentStrategy(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineList": schema_pkg_apis_machine_v1alpha1_MachineList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSet": schema_pkg_apis_machine_v1alpha1_MachineSet(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetCondition": schema_pkg_apis_machine_v1alpha1_MachineSetCondition(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetList": schema_pkg_apis_machine_v1alpha1_MachineSetList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec": schema_pkg_apis_machine_v1alpha1_MachineSetSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus": schema_pkg_apis_machine_v1alpha1_MachineSetStatus(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec": schema_pkg_apis_machine_v1alpha1_MachineSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus": schema_pkg_apis_machine_v1alpha1_MachineStatus(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary": schema_pkg_apis_machine_v1alpha1_MachineSummary(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec": schema_pkg_apis_machine_v1alpha1_MachineTemplateSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplate": schema_pkg_apis_machine_v1alpha1_NodeTemplate(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplateSpec": schema_pkg_apis_machine_v1alpha1_NodeTemplateSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackMachineClass": schema_pkg_apis_machine_v1alpha1_OpenStackMachineClass(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackMachineClassList": schema_pkg_apis_machine_v1alpha1_OpenStackMachineClassList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackMachineClassSpec": schema_pkg_apis_machine_v1alpha1_OpenStackMachineClassSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackNetwork": schema_pkg_apis_machine_v1alpha1_OpenStackNetwork(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.PacketMachineClass": schema_pkg_apis_machine_v1alpha1_PacketMachineClass(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.PacketMachineClassList": schema_pkg_apis_machine_v1alpha1_PacketMachineClassList(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.PacketMachineClassSpec": schema_pkg_apis_machine_v1alpha1_PacketMachineClassSpec(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig": schema_pkg_apis_machine_v1alpha1_RollbackConfig(ref),
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment": schema_pkg_apis_machine_v1alpha1_RollingUpdateMachineDeployment(ref),
- "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource": schema_k8sio_api_core_v1_AWSElasticBlockStoreVolumeSource(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec": schema_pkg_apis_machine_v1alpha1_ClassSpec(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus": schema_pkg_apis_machine_v1alpha1_CurrentStatus(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation": schema_pkg_apis_machine_v1alpha1_LastOperation(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.Machine": schema_pkg_apis_machine_v1alpha1_Machine(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineClass": schema_pkg_apis_machine_v1alpha1_MachineClass(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineClassList": schema_pkg_apis_machine_v1alpha1_MachineClassList(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineConfiguration": schema_pkg_apis_machine_v1alpha1_MachineConfiguration(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment": schema_pkg_apis_machine_v1alpha1_MachineDeployment(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition": schema_pkg_apis_machine_v1alpha1_MachineDeploymentCondition(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentList": schema_pkg_apis_machine_v1alpha1_MachineDeploymentList(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec": schema_pkg_apis_machine_v1alpha1_MachineDeploymentSpec(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus": schema_pkg_apis_machine_v1alpha1_MachineDeploymentStatus(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy": schema_pkg_apis_machine_v1alpha1_MachineDeploymentStrategy(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineList": schema_pkg_apis_machine_v1alpha1_MachineList(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSet": schema_pkg_apis_machine_v1alpha1_MachineSet(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetCondition": schema_pkg_apis_machine_v1alpha1_MachineSetCondition(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetList": schema_pkg_apis_machine_v1alpha1_MachineSetList(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec": schema_pkg_apis_machine_v1alpha1_MachineSetSpec(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus": schema_pkg_apis_machine_v1alpha1_MachineSetStatus(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec": schema_pkg_apis_machine_v1alpha1_MachineSpec(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus": schema_pkg_apis_machine_v1alpha1_MachineStatus(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary": schema_pkg_apis_machine_v1alpha1_MachineSummary(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec": schema_pkg_apis_machine_v1alpha1_MachineTemplateSpec(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplate": schema_pkg_apis_machine_v1alpha1_NodeTemplate(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplateSpec": schema_pkg_apis_machine_v1alpha1_NodeTemplateSpec(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig": schema_pkg_apis_machine_v1alpha1_RollbackConfig(ref),
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment": schema_pkg_apis_machine_v1alpha1_RollingUpdateMachineDeployment(ref),
+ "k8s.io/api/core/v1.AWSElasticBlockStoreVolumeSource": schema_k8sio_api_core_v1_AWSElasticBlockStoreVolumeSource(ref),
"k8s.io/api/core/v1.Affinity": schema_k8sio_api_core_v1_Affinity(ref),
"k8s.io/api/core/v1.AttachedVolume": schema_k8sio_api_core_v1_AttachedVolume(ref),
"k8s.io/api/core/v1.AvoidPods": schema_k8sio_api_core_v1_AvoidPods(ref),
@@ -369,36 +322,30 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
}
}
-func schema_pkg_apis_machine_v1alpha1_AWSBlockDeviceMappingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_ClassSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
+ Description: "ClassSpec is the class specification of machine",
+ Type: []string{"object"},
Properties: map[string]spec.Schema{
- "deviceName": {
+ "apiGroup": {
SchemaProps: spec.SchemaProps{
- Description: "The device name exposed to the machine (for example, /dev/sdh or xvdh).",
+ Description: "API group to which it belongs",
Type: []string{"string"},
Format: "",
},
},
- "ebs": {
- SchemaProps: spec.SchemaProps{
- Description: "Parameters used to automatically set up EBS volumes when the machine is launched.",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSEbsBlockDeviceSpec"),
- },
- },
- "noDevice": {
+ "kind": {
SchemaProps: spec.SchemaProps{
- Description: "Suppresses the specified device included in the block device mapping of the AMI.",
+ Description: "Kind for machine class",
Type: []string{"string"},
Format: "",
},
},
- "virtualName": {
+ "name": {
SchemaProps: spec.SchemaProps{
- Description: "The virtual device name (ephemeralN). Machine store volumes are numbered starting from 0. An machine type with 2 available machine store volumes can specify mappings for ephemeral0 and ephemeral1.The number of available machine store volumes depends on the machine type. After you connect to the machine, you must mount the volume.\n\nConstraints: For M3 machines, you must specify machine store volumes in the block device mapping for the machine. When you launch an M3 machine, we ignore any machine store volumes specified in the block device mapping for the AMI.",
+ Description: "Name of machine class",
Type: []string{"string"},
Format: "",
},
@@ -406,63 +353,74 @@ func schema_pkg_apis_machine_v1alpha1_AWSBlockDeviceMappingSpec(ref common.Refer
},
},
},
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSEbsBlockDeviceSpec"},
}
}
-func schema_pkg_apis_machine_v1alpha1_AWSEbsBlockDeviceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_CurrentStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "Describes a block device for an EBS volume. Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/EbsBlockDevice",
+ Description: "CurrentStatus contains information about the current status of Machine.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "deleteOnTermination": {
+ "phase": {
SchemaProps: spec.SchemaProps{
- Description: "Indicates whether the EBS volume is deleted on machine termination.",
- Type: []string{"boolean"},
- Format: "",
+ Type: []string{"string"},
+ Format: "",
},
},
- "encrypted": {
+ "timeoutActive": {
SchemaProps: spec.SchemaProps{
- Description: "Indicates whether the EBS volume is encrypted. Encrypted Amazon EBS volumes may only be attached to machines that support Amazon EBS encryption.",
- Type: []string{"boolean"},
- Format: "",
+ Type: []string{"boolean"},
+ Format: "",
},
},
- "iops": {
+ "lastUpdateTime": {
SchemaProps: spec.SchemaProps{
- Description: "The number of I/O operations per second (IOPS) that the volume supports. For io1, this represents the number of IOPS that are provisioned for the volume. For gp2, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. For more information about General Purpose SSD baseline performance, I/O credits, and bursting, see Amazon EBS Volume Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) in the Amazon Elastic Compute Cloud User Guide.\n\nConstraint: Range is 100-20000 IOPS for io1 volumes and 100-10000 IOPS for gp2 volumes.\n\nCondition: This parameter is required for requests to create io1 volumes; it is not used in requests to create gp2, st1, sc1, or standard volumes.",
- Type: []string{"integer"},
- Format: "int64",
+ Description: "Last update time of current status",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
- "kmsKeyID": {
+ },
+ },
+ },
+ Dependencies: []string{
+ "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
+ }
+}
+
+func schema_pkg_apis_machine_v1alpha1_LastOperation(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "LastOperation suggests the last operation performed on the object",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "description": {
SchemaProps: spec.SchemaProps{
- Description: "Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed CMK under which the EBS volume is encrypted.\n\nThis parameter is only supported on BlockDeviceMapping objects called by RunInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RunInstances.html), RequestSpotFleet (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotFleet.html), and RequestSpotInstances (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestSpotInstances.html).",
+ Description: "Description of the current operation",
Type: []string{"string"},
Format: "",
},
},
- "snapshotID": {
+ "lastUpdateTime": {
SchemaProps: spec.SchemaProps{
- Description: "The ID of the snapshot.",
- Type: []string{"string"},
- Format: "",
+ Description: "Last update time of current operation",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
- "volumeSize": {
+ "state": {
SchemaProps: spec.SchemaProps{
- Description: "The size of the volume, in GiB.\n\nConstraints: 1-16384 for General Purpose SSD (gp2), 4-16384 for Provisioned IOPS SSD (io1), 500-16384 for Throughput Optimized HDD (st1), 500-16384 for Cold HDD (sc1), and 1-1024 for Magnetic (standard) volumes. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.\n\nDefault: If you're creating the volume from a snapshot and don't specify a volume size, the default is the snapshot size.",
- Type: []string{"integer"},
- Format: "int64",
+ Description: "State of operation",
+ Type: []string{"string"},
+ Format: "",
},
},
- "volumeType": {
+ "type": {
SchemaProps: spec.SchemaProps{
- Description: "The volume type: gp2, io1, st1, sc1, or standard.\n\nDefault: standard",
+ Description: "Type of operation",
Type: []string{"string"},
Format: "",
},
@@ -470,49 +428,68 @@ func schema_pkg_apis_machine_v1alpha1_AWSEbsBlockDeviceSpec(ref common.Reference
},
},
},
+ Dependencies: []string{
+ "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
-func schema_pkg_apis_machine_v1alpha1_AWSIAMProfileSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_Machine(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "Describes an IAM machine profile.",
+ Description: "Machine is the representation of a physical or virtual machine.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "arn": {
+ "metadata": {
+ SchemaProps: spec.SchemaProps{
+ Description: "ObjectMeta for machine object",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ },
+ },
+ "kind": {
SchemaProps: spec.SchemaProps{
- Description: "The Amazon Resource Name (ARN) of the machine profile.",
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
Type: []string{"string"},
Format: "",
},
},
- "name": {
+ "apiVersion": {
SchemaProps: spec.SchemaProps{
- Description: "The name of the machine profile.",
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
+ "spec": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Spec contains the specification of the machine",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec"),
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Status contains fields depicting the status",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus"),
+ },
+ },
},
},
},
+ Dependencies: []string{
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
-func schema_pkg_apis_machine_v1alpha1_AWSMachineClass(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineClass(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "AWSMachineClass TODO",
+ Description: "MachineClass can be used to templatize and re-use provider configuration across multiple Machines / MachineSets / MachineDeployments.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
- },
- },
"kind": {
SchemaProps: spec.SchemaProps{
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
@@ -527,25 +504,58 @@ func schema_pkg_apis_machine_v1alpha1_AWSMachineClass(ref common.ReferenceCallba
Format: "",
},
},
- "spec": {
+ "metadata": {
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClassSpec"),
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ },
+ },
+ "nodeTemplate": {
+ SchemaProps: spec.SchemaProps{
+ Description: "NodeTemplate contains subfields to track all node resources and other node info required to scale nodegroup from zero",
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplate"),
+ },
+ },
+ "credentialsSecretRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "CredentialsSecretRef can optionally store the credentials (in this case the SecretRef does not need to store them). This might be useful if multiple machine classes with the same credentials but different user-datas are used.",
+ Ref: ref("k8s.io/api/core/v1.SecretReference"),
+ },
+ },
+ "providerSpec": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Provider-specific configuration to use during node creation.",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"),
+ },
+ },
+ "provider": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Provider is the combination of name and location of cloud-specific drivers.",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "secretRef": {
+ SchemaProps: spec.SchemaProps{
+ Description: "SecretRef stores the necessary secrets such as credentials or userdata.",
+ Ref: ref("k8s.io/api/core/v1.SecretReference"),
},
},
},
+ Required: []string{"providerSpec"},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClassSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplate", "k8s.io/api/core/v1.SecretReference", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"},
}
}
-func schema_pkg_apis_machine_v1alpha1_AWSMachineClassList(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineClassList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "AWSMachineClassList is a collection of AWSMachineClasses.",
+ Description: "MachineClassList contains a list of MachineClasses",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
@@ -575,284 +585,183 @@ func schema_pkg_apis_machine_v1alpha1_AWSMachineClassList(ref common.ReferenceCa
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClass"),
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineClass"),
},
},
},
},
},
},
+ Required: []string{"items"},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSMachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
-func schema_pkg_apis_machine_v1alpha1_AWSMachineClassSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineConfiguration(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "AWSMachineClassSpec is the specification of a AWSMachineClass.",
+ Description: "MachineConfiguration describes the configurations useful for the machine-controller.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "ami": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "region": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "blockDevices": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSBlockDeviceMappingSpec"),
- },
- },
- },
- },
- },
- "ebsOptimized": {
+ "drainTimeout": {
SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
+ Description: "MachineDraintimeout is the timeout after which machine is forcefully deleted.",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
},
},
- "iam": {
+ "healthTimeout": {
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSIAMProfileSpec"),
+ Description: "MachineHealthTimeout is the timeout after which machine is declared unhealhty/failed.",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
},
},
- "machineType": {
+ "creationTimeout": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "MachineCreationTimeout is the timeout after which machinie creation is declared failed.",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
},
},
- "keyName": {
+ "maxEvictRetries": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "MaxEvictRetries is the number of retries that will be attempted while draining the node.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "monitoring": {
+ "nodeConditions": {
SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
+ Description: "NodeConditions are the set of conditions if set to true for MachineHealthTimeOut, machine will be declared failed.",
+ Type: []string{"string"},
+ Format: "",
},
},
- "networkInterfaces": {
+ },
+ },
+ },
+ Dependencies: []string{
+ "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"},
+ }
+}
+
+func schema_pkg_apis_machine_v1alpha1_MachineDeployment(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "MachineDeployment enables declarative updates for machines and MachineSets.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "kind": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSNetworkInterfaceSpec"),
- },
- },
- },
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
},
},
- "tags": {
+ "apiVersion": {
SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- AdditionalProperties: &spec.SchemaOrBool{
- Allows: true,
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
},
},
- "spotPrice": {
+ "metadata": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "Standard object metadata.",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
- "secretRef": {
+ "spec": {
SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
+ Description: "Specification of the desired behavior of the MachineDeployment.",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec"),
},
},
- "credentialsSecretRef": {
+ "status": {
SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
+ Description: "Most recently observed status of the MachineDeployment.",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus"),
},
},
},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSBlockDeviceMappingSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSIAMProfileSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AWSNetworkInterfaceSpec", "k8s.io/api/core/v1.SecretReference"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
-func schema_pkg_apis_machine_v1alpha1_AWSNetworkInterfaceSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineDeploymentCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "Describes a network interface. Please also see https://docs.aws.amazon.com/goto/WebAPI/ec2-2016-11-15/MachineAWSNetworkInterfaceSpecification",
+ Description: "MachineDeploymentCondition describes the state of a MachineDeployment at a certain point.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "associatePublicIPAddress": {
- SchemaProps: spec.SchemaProps{
- Description: "Indicates whether to assign a public IPv4 address to an machine you launch in a VPC. The public IP address can only be assigned to a network interface for eth0, and can only be assigned to a new network interface, not an existing one. You cannot specify more than one network interface in the request. If launching into a default subnet, the default value is true.",
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "deleteOnTermination": {
- SchemaProps: spec.SchemaProps{
- Description: "If set to true, the interface is deleted when the machine is terminated. You can specify true only if creating a new network interface when launching an machine.",
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "description": {
+ "type": {
SchemaProps: spec.SchemaProps{
- Description: "The description of the network interface. Applies only if creating a network interface when launching an machine.",
+ Description: "Type of MachineDeployment condition.",
+ Default: "",
Type: []string{"string"},
Format: "",
},
},
- "securityGroupIDs": {
- SchemaProps: spec.SchemaProps{
- Description: "The IDs of the security groups for the network interface. Applies only if creating a network interface when launching an machine.",
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- "subnetID": {
+ "status": {
SchemaProps: spec.SchemaProps{
- Description: "The ID of the subnet associated with the network string. Applies only if creating a network interface when launching an machine.",
+ Description: "Status of the condition, one of True, False, Unknown.",
+ Default: "",
Type: []string{"string"},
Format: "",
},
},
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AlicloudDataDisk(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "name": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "category": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "description": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "encrypted": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "deleteWithInstance": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "size": {
+ "lastUpdateTime": {
SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
+ Description: "The last time this condition was updated.",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AlicloudMachineClass(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AlicloudMachineClass TODO",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "metadata": {
+ "lastTransitionTime": {
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ Description: "Last time the condition transitioned from one status to another.",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
},
},
- "kind": {
+ "reason": {
SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Description: "The reason for the condition's last transition.",
Type: []string{"string"},
Format: "",
},
},
- "apiVersion": {
+ "message": {
SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Description: "A human readable message indicating details about the transition.",
Type: []string{"string"},
Format: "",
},
},
- "spec": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudMachineClassSpec"),
- },
- },
},
+ Required: []string{"type", "status"},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudMachineClassSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
-func schema_pkg_apis_machine_v1alpha1_AlicloudMachineClassList(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineDeploymentList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "AlicloudMachineClassList is a collection of AlicloudMachineClasses.",
+ Description: "MachineDeploymentList is a list of MachineDeployments.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
@@ -871,2595 +780,297 @@ func schema_pkg_apis_machine_v1alpha1_AlicloudMachineClassList(ref common.Refere
},
"metadata": {
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
+ Description: "Standard list metadata.",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
"items": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
+ Description: "Items is the list of MachineDeployments.",
+ Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudMachineClass"),
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment"),
},
},
},
},
},
},
+ Required: []string{"items"},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudMachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
-func schema_pkg_apis_machine_v1alpha1_AlicloudMachineClassSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineDeploymentSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "AlicloudMachineClassSpec is the specification of a AlicloudMachineClass.",
+ Description: "MachineDeploymentSpec is the specification of the desired behavior of the MachineDeployment.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "imageID": {
+ "replicas": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Description: "Number of desired machines. This is a pointer to distinguish between explicit zero and not specified. Defaults to 0.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "instanceType": {
+ "selector": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Description: "Label selector for machines. Existing MachineSets whose machines are selected by this will be the ones affected by this MachineDeployment.",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
- "region": {
+ "template": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Description: "Template describes the machines that will be created.",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec"),
},
},
- "zoneID": {
+ "strategy": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-patch-strategy": "retainKeys",
+ },
+ },
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "The MachineDeployment strategy to use to replace existing machines with new ones.",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy"),
},
},
- "securityGroupID": {
+ "minReadySeconds": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "Minimum number of seconds for which a newly created machine should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (machine will be considered available as soon as it is ready)",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "vSwitchID": {
+ "revisionHistoryLimit": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Description: "The number of old MachineSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "privateIPAddress": {
+ "paused": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "Indicates that the MachineDeployment is paused and will not be processed by the MachineDeployment controller.",
+ Type: []string{"boolean"},
+ Format: "",
},
},
- "systemDisk": {
+ "rollbackTo": {
SchemaProps: spec.SchemaProps{
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudSystemDisk"),
+ Description: "DEPRECATED. The config this MachineDeployment is rolling back to. Will be cleared after rollback is done.",
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig"),
},
},
- "dataDisks": {
+ "progressDeadlineSeconds": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudDataDisk"),
- },
- },
- },
+ Description: "The maximum time in seconds for a MachineDeployment to make progress before it is considered to be failed. The MachineDeployment controller will continue to process failed MachineDeployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the MachineDeployment status. Note that progress will not be estimated during the time a MachineDeployment is paused. This is not set by default, which is treated as infinite deadline.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "instanceChargeType": {
+ },
+ Required: []string{"template"},
+ },
+ },
+ Dependencies: []string{
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
+ }
+}
+
+func schema_pkg_apis_machine_v1alpha1_MachineDeploymentStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "MachineDeploymentStatus is the most recently observed status of the MachineDeployment.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "observedGeneration": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "The generation observed by the MachineDeployment controller.",
+ Type: []string{"integer"},
+ Format: "int64",
},
},
- "internetChargeType": {
+ "replicas": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "Total number of non-terminated machines targeted by this MachineDeployment (their labels match the selector).",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "internetMaxBandwidthIn": {
+ "updatedReplicas": {
SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
+ Description: "Total number of non-terminated machines targeted by this MachineDeployment that have the desired template spec.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "internetMaxBandwidthOut": {
+ "readyReplicas": {
SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
+ Description: "Total number of ready machines targeted by this MachineDeployment.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "spotStrategy": {
+ "availableReplicas": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "Total number of available machines (ready for at least minReadySeconds) targeted by this MachineDeployment.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "IoOptimized": {
+ "unavailableReplicas": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "Total number of unavailable machines targeted by this MachineDeployment. This is the total number of machines that are still required for the MachineDeployment to have 100% available capacity. They may either be machines that are running but not yet available or machines that still have not been created.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "tags": {
+ "conditions": {
+ VendorExtensible: spec.VendorExtensible{
+ Extensions: spec.Extensions{
+ "x-kubernetes-patch-merge-key": "type",
+ "x-kubernetes-patch-strategy": "merge",
+ },
+ },
SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- AdditionalProperties: &spec.SchemaOrBool{
- Allows: true,
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- "keyPairName": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "secretRef": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
- },
- },
- "credentialsSecretRef": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
- },
- },
- },
- Required: []string{"imageID", "instanceType", "region", "vSwitchID", "keyPairName"},
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudDataDisk", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AlicloudSystemDisk", "k8s.io/api/core/v1.SecretReference"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AlicloudSystemDisk(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AlicloudSystemDisk describes SystemDisk for Alicloud.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "category": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "size": {
- SchemaProps: spec.SchemaProps{
- Default: 0,
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- },
- Required: []string{"category", "size"},
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureDataDisk(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "name": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "lun": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "caching": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "storageAccountType": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "diskSizeGB": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureHardwareProfile(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureHardwareProfile is specifies the hardware settings for the virtual machine. Refer github.com/Azure/azure-sdk-for-go/arm/compute/models.go for VMSizes",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "vmSize": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureImageReference(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureImageReference is specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "id": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "urn": {
- SchemaProps: spec.SchemaProps{
- Description: "Uniform Resource Name of the OS image to be used , it has the format 'publisher:offer:sku:version'",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureLinuxConfiguration(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureLinuxConfiguration is specifies the Linux operating system settings on the virtual machine.
For a list of supported Linux distributions, see [Linux on Azure-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-endorsed-distros?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json)
For running non-endorsed distributions, see [Information for Non-Endorsed Distributions](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-linux-create-upload-generic?toc=%2fazure%2fvirtual-machines%2flinux%2ftoc.json).",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "disablePasswordAuthentication": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "ssh": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSSHConfiguration"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSSHConfiguration"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureMachineClass(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureMachineClass TODO",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
- },
- },
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "spec": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineClassSpec"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineClassSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureMachineClassList(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureMachineClassList is a collection of AzureMachineClasses.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
- },
- },
- "items": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineClass"),
- },
- },
- },
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureMachineClassSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureMachineClassSpec is the specification of a AzureMachineClass.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "location": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "tags": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- AdditionalProperties: &spec.SchemaOrBool{
- Allows: true,
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- "properties": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureVirtualMachineProperties"),
- },
- },
- "resourceGroup": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "subnetInfo": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSubnetInfo"),
- },
- },
- "secretRef": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
- },
- },
- "credentialsSecretRef": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSubnetInfo", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureVirtualMachineProperties", "k8s.io/api/core/v1.SecretReference"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureMachineSetConfig(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureMachineSetConfig contains the information about the machine set",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "id": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "kind": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- Required: []string{"id", "kind"},
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureManagedDiskParameters(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureManagedDiskParameters is the parameters of a managed disk.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "id": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "storageAccountType": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureNetworkInterfaceReference(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureNetworkInterfaceReference is describes a network interface reference.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "id": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "properties": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkInterfaceReferenceProperties"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkInterfaceReferenceProperties"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureNetworkInterfaceReferenceProperties(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureNetworkInterfaceReferenceProperties is describes a network interface reference properties.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "primary": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureNetworkProfile(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureNetworkProfile is specifies the network interfaces of the virtual machine.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "networkInterfaces": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkInterfaceReference"),
- },
- },
- "acceleratedNetworking": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkInterfaceReference"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureOSDisk(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureOSDisk is specifies information about the operating system disk used by the virtual machine.
For more information about disks, see [About disks and VHDs for Azure virtual machines](https://docs.microsoft.com/azure/virtual-machines/virtual-machines-windows-about-disks-vhds?toc=%2fazure%2fvirtual-machines%2fwindows%2ftoc.json).",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "name": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "caching": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "managedDisk": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureManagedDiskParameters"),
- },
- },
- "diskSizeGB": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "createOption": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureManagedDiskParameters"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureOSProfile(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureOSProfile is specifies the operating system settings for the virtual machine.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "computerName": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "adminUsername": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "adminPassword": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "customData": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "linuxConfiguration": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureLinuxConfiguration"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureLinuxConfiguration"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureSSHConfiguration(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureSSHConfiguration is SSH configuration for Linux based VMs running on Azure",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "publicKeys": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSSHPublicKey"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSSHPublicKey"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureSSHPublicKey(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureSSHPublicKey is contains information about SSH certificate public key and the path on the Linux VM where the public key is placed.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "path": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "keyData": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureStorageProfile(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureStorageProfile is specifies the storage settings for the virtual machine disks.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "imageReference": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureImageReference"),
- },
- },
- "osDisk": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureOSDisk"),
- },
- },
- "dataDisks": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureDataDisk"),
- },
- },
- },
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureDataDisk", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureImageReference", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureOSDisk"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureSubResource(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureSubResource is the Sub Resource definition.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "id": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureSubnetInfo(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureSubnetInfo is the information containing the subnet details",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "vnetName": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "vnetResourceGroup": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "subnetName": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_AzureVirtualMachineProperties(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "AzureVirtualMachineProperties is describes the properties of a Virtual Machine.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "hardwareProfile": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureHardwareProfile"),
- },
- },
- "storageProfile": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureStorageProfile"),
- },
- },
- "osProfile": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureOSProfile"),
- },
- },
- "networkProfile": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkProfile"),
- },
- },
- "availabilitySet": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSubResource"),
- },
- },
- "identityID": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "zone": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "machineSet": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineSetConfig"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureHardwareProfile", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureMachineSetConfig", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureNetworkProfile", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureOSProfile", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureStorageProfile", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.AzureSubResource"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_ClassSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "ClassSpec is the class specification of machine",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "apiGroup": {
- SchemaProps: spec.SchemaProps{
- Description: "API group to which it belongs",
- Type: []string{"string"},
- Format: "",
- },
- },
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind for machine class",
- Type: []string{"string"},
- Format: "",
- },
- },
- "name": {
- SchemaProps: spec.SchemaProps{
- Description: "Name of machine class",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_CurrentStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "CurrentStatus contains information about the current status of Machine.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "phase": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "timeoutActive": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "lastUpdateTime": {
- SchemaProps: spec.SchemaProps{
- Description: "Last update time of current status",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_GCPDisk(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "GCPDisk describes disks for GCP.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "autoDelete": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "boot": {
- SchemaProps: spec.SchemaProps{
- Default: false,
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "sizeGb": {
- SchemaProps: spec.SchemaProps{
- Default: 0,
- Type: []string{"integer"},
- Format: "int64",
- },
- },
- "type": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "interface": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "image": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "labels": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- AdditionalProperties: &spec.SchemaOrBool{
- Allows: true,
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- },
- Required: []string{"autoDelete", "boot", "sizeGb", "type", "interface", "image", "labels"},
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_GCPMachineClass(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "GCPMachineClass TODO",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
- },
- },
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "spec": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMachineClassSpec"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMachineClassSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_GCPMachineClassList(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "GCPMachineClassList is a collection of GCPMachineClasses.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
- },
- },
- "items": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMachineClass"),
- },
- },
- },
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_GCPMachineClassSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "GCPMachineClassSpec is the specification of a GCPMachineClass.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "canIpForward": {
- SchemaProps: spec.SchemaProps{
- Default: false,
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "deletionProtection": {
- SchemaProps: spec.SchemaProps{
- Default: false,
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "description": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "disks": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPDisk"),
- },
- },
- },
- },
- },
- "labels": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- AdditionalProperties: &spec.SchemaOrBool{
- Allows: true,
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- "machineType": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMetadata"),
- },
- },
- },
- },
- },
- "networkInterfaces": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPNetworkInterface"),
- },
- },
- },
- },
- },
- "scheduling": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPScheduling"),
- },
- },
- "secretRef": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
- },
- },
- "credentialsSecretRef": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
- },
- },
- "serviceAccounts": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPServiceAccount"),
- },
- },
- },
- },
- },
- "tags": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- "region": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "zone": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- Required: []string{"canIpForward", "deletionProtection", "machineType", "scheduling", "serviceAccounts", "region", "zone"},
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPDisk", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPMetadata", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPNetworkInterface", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPScheduling", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.GCPServiceAccount", "k8s.io/api/core/v1.SecretReference"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_GCPMetadata(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "GCPMetadata describes metadata for GCP.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "key": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "value": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- Required: []string{"key", "value"},
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_GCPNetworkInterface(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "GCPNetworkInterface describes network interfaces for GCP",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "disableExternalIP": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "network": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- "subnetwork": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_GCPScheduling(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "GCPScheduling describes scheduling configuration for GCP.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "automaticRestart": {
- SchemaProps: spec.SchemaProps{
- Default: false,
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "onHostMaintenance": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "preemptible": {
- SchemaProps: spec.SchemaProps{
- Default: false,
- Type: []string{"boolean"},
- Format: "",
- },
- },
- },
- Required: []string{"automaticRestart", "onHostMaintenance", "preemptible"},
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_GCPServiceAccount(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "GCPServiceAccount describes service accounts for GCP.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "email": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "scopes": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- },
- Required: []string{"email", "scopes"},
- },
- },
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_LastOperation(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "LastOperation suggests the last operation performed on the object",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "description": {
- SchemaProps: spec.SchemaProps{
- Description: "Description of the current operation",
- Type: []string{"string"},
- Format: "",
- },
- },
- "lastUpdateTime": {
- SchemaProps: spec.SchemaProps{
- Description: "Last update time of current operation",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
- },
- },
- "state": {
- SchemaProps: spec.SchemaProps{
- Description: "State of operation",
- Type: []string{"string"},
- Format: "",
- },
- },
- "type": {
- SchemaProps: spec.SchemaProps{
- Description: "Type of operation",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- Dependencies: []string{
- "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_Machine(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "Machine is the representation of a physical or virtual machine.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Description: "ObjectMeta for machine object",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
- },
- },
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "spec": {
- SchemaProps: spec.SchemaProps{
- Description: "Spec contains the specification of the machine",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec"),
- },
- },
- "status": {
- SchemaProps: spec.SchemaProps{
- Description: "Status contains fields depicting the status",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineClass(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineClass can be used to templatize and re-use provider configuration across multiple Machines / MachineSets / MachineDeployments.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
- },
- },
- "nodeTemplate": {
- SchemaProps: spec.SchemaProps{
- Description: "NodeTemplate contains subfields to track all node resources and other node info required to scale nodegroup from zero",
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplate"),
- },
- },
- "credentialsSecretRef": {
- SchemaProps: spec.SchemaProps{
- Description: "CredentialsSecretRef can optionally store the credentials (in this case the SecretRef does not need to store them). This might be useful if multiple machine classes with the same credentials but different user-datas are used.",
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
- },
- },
- "providerSpec": {
- SchemaProps: spec.SchemaProps{
- Description: "Provider-specific configuration to use during node creation.",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/runtime.RawExtension"),
- },
- },
- "provider": {
- SchemaProps: spec.SchemaProps{
- Description: "Provider is the combination of name and location of cloud-specific drivers.",
- Type: []string{"string"},
- Format: "",
- },
- },
- "secretRef": {
- SchemaProps: spec.SchemaProps{
- Description: "SecretRef stores the necessary secrets such as credentials or userdata.",
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
- },
- },
- },
- Required: []string{"providerSpec"},
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplate", "k8s.io/api/core/v1.SecretReference", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "k8s.io/apimachinery/pkg/runtime.RawExtension"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineClassList(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineClassList contains a list of MachineClasses",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
- },
- },
- "items": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineClass"),
- },
- },
- },
- },
- },
- },
- Required: []string{"items"},
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineConfiguration(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineConfiguration describes the configurations useful for the machine-controller.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "drainTimeout": {
- SchemaProps: spec.SchemaProps{
- Description: "MachineDraintimeout is the timeout after which machine is forcefully deleted.",
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
- },
- },
- "healthTimeout": {
- SchemaProps: spec.SchemaProps{
- Description: "MachineHealthTimeout is the timeout after which machine is declared unhealhty/failed.",
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
- },
- },
- "creationTimeout": {
- SchemaProps: spec.SchemaProps{
- Description: "MachineCreationTimeout is the timeout after which machinie creation is declared failed.",
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
- },
- },
- "maxEvictRetries": {
- SchemaProps: spec.SchemaProps{
- Description: "MaxEvictRetries is the number of retries that will be attempted while draining the node.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "nodeConditions": {
- SchemaProps: spec.SchemaProps{
- Description: "NodeConditions are the set of conditions if set to true for MachineHealthTimeOut, machine will be declared failed.",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- Dependencies: []string{
- "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineDeployment(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineDeployment enables declarative updates for machines and MachineSets.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Description: "Standard object metadata.",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
- },
- },
- "spec": {
- SchemaProps: spec.SchemaProps{
- Description: "Specification of the desired behavior of the MachineDeployment.",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec"),
- },
- },
- "status": {
- SchemaProps: spec.SchemaProps{
- Description: "Most recently observed status of the MachineDeployment.",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineDeploymentCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineDeploymentCondition describes the state of a MachineDeployment at a certain point.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "type": {
- SchemaProps: spec.SchemaProps{
- Description: "Type of MachineDeployment condition.",
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "status": {
- SchemaProps: spec.SchemaProps{
- Description: "Status of the condition, one of True, False, Unknown.",
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "lastUpdateTime": {
- SchemaProps: spec.SchemaProps{
- Description: "The last time this condition was updated.",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
- },
- },
- "lastTransitionTime": {
- SchemaProps: spec.SchemaProps{
- Description: "Last time the condition transitioned from one status to another.",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
- },
- },
- "reason": {
- SchemaProps: spec.SchemaProps{
- Description: "The reason for the condition's last transition.",
- Type: []string{"string"},
- Format: "",
- },
- },
- "message": {
- SchemaProps: spec.SchemaProps{
- Description: "A human readable message indicating details about the transition.",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- Required: []string{"type", "status"},
- },
- },
- Dependencies: []string{
- "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineDeploymentList(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineDeploymentList is a list of MachineDeployments.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Description: "Standard list metadata.",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
- },
- },
- "items": {
- SchemaProps: spec.SchemaProps{
- Description: "Items is the list of MachineDeployments.",
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment"),
- },
- },
- },
- },
- },
- },
- Required: []string{"items"},
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeployment", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineDeploymentSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineDeploymentSpec is the specification of the desired behavior of the MachineDeployment.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "replicas": {
- SchemaProps: spec.SchemaProps{
- Description: "Number of desired machines. This is a pointer to distinguish between explicit zero and not specified. Defaults to 0.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "selector": {
- SchemaProps: spec.SchemaProps{
- Description: "Label selector for machines. Existing MachineSets whose machines are selected by this will be the ones affected by this MachineDeployment.",
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
- },
- },
- "template": {
- SchemaProps: spec.SchemaProps{
- Description: "Template describes the machines that will be created.",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec"),
- },
- },
- "strategy": {
- VendorExtensible: spec.VendorExtensible{
- Extensions: spec.Extensions{
- "x-kubernetes-patch-strategy": "retainKeys",
- },
- },
- SchemaProps: spec.SchemaProps{
- Description: "The MachineDeployment strategy to use to replace existing machines with new ones.",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy"),
- },
- },
- "minReadySeconds": {
- SchemaProps: spec.SchemaProps{
- Description: "Minimum number of seconds for which a newly created machine should be ready without any of its container crashing, for it to be considered available. Defaults to 0 (machine will be considered available as soon as it is ready)",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "revisionHistoryLimit": {
- SchemaProps: spec.SchemaProps{
- Description: "The number of old MachineSets to retain to allow rollback. This is a pointer to distinguish between explicit zero and not specified.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "paused": {
- SchemaProps: spec.SchemaProps{
- Description: "Indicates that the MachineDeployment is paused and will not be processed by the MachineDeployment controller.",
- Type: []string{"boolean"},
- Format: "",
- },
- },
- "rollbackTo": {
- SchemaProps: spec.SchemaProps{
- Description: "DEPRECATED. The config this MachineDeployment is rolling back to. Will be cleared after rollback is done.",
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig"),
- },
- },
- "progressDeadlineSeconds": {
- SchemaProps: spec.SchemaProps{
- Description: "The maximum time in seconds for a MachineDeployment to make progress before it is considered to be failed. The MachineDeployment controller will continue to process failed MachineDeployments and a condition with a ProgressDeadlineExceeded reason will be surfaced in the MachineDeployment status. Note that progress will not be estimated during the time a MachineDeployment is paused. This is not set by default.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- },
- Required: []string{"template"},
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentStrategy", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollbackConfig", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineDeploymentStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineDeploymentStatus is the most recently observed status of the MachineDeployment.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "observedGeneration": {
- SchemaProps: spec.SchemaProps{
- Description: "The generation observed by the MachineDeployment controller.",
- Type: []string{"integer"},
- Format: "int64",
- },
- },
- "replicas": {
- SchemaProps: spec.SchemaProps{
- Description: "Total number of non-terminated machines targeted by this MachineDeployment (their labels match the selector).",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "updatedReplicas": {
- SchemaProps: spec.SchemaProps{
- Description: "Total number of non-terminated machines targeted by this MachineDeployment that have the desired template spec.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "readyReplicas": {
- SchemaProps: spec.SchemaProps{
- Description: "Total number of ready machines targeted by this MachineDeployment.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "availableReplicas": {
- SchemaProps: spec.SchemaProps{
- Description: "Total number of available machines (ready for at least minReadySeconds) targeted by this MachineDeployment.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "unavailableReplicas": {
- SchemaProps: spec.SchemaProps{
- Description: "Total number of unavailable machines targeted by this MachineDeployment. This is the total number of machines that are still required for the MachineDeployment to have 100% available capacity. They may either be machines that are running but not yet available or machines that still have not been created.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "conditions": {
- VendorExtensible: spec.VendorExtensible{
- Extensions: spec.Extensions{
- "x-kubernetes-patch-merge-key": "type",
- "x-kubernetes-patch-strategy": "merge",
- },
- },
- SchemaProps: spec.SchemaProps{
- Description: "Represents the latest available observations of a MachineDeployment's current state.",
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition"),
- },
- },
- },
- },
- },
- "collisionCount": {
- SchemaProps: spec.SchemaProps{
- Description: "Count of hash collisions for the MachineDeployment. The MachineDeployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest MachineSet.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "failedMachines": {
- SchemaProps: spec.SchemaProps{
- Description: "FailedMachines has summary of machines on which lastOperation Failed",
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary"),
- },
- },
- },
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineDeploymentStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineDeploymentStrategy describes how to replace existing machines with new ones.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "type": {
- SchemaProps: spec.SchemaProps{
- Description: "Type of MachineDeployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.",
- Type: []string{"string"},
- Format: "",
- },
- },
- "rollingUpdate": {
- SchemaProps: spec.SchemaProps{
- Description: "Rolling update config params. Present only if MachineDeploymentStrategyType = RollingUpdate.",
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineList(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineList is a collection of Machines.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Description: "TypeMeta for MachineList object",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
- },
- },
- "items": {
- SchemaProps: spec.SchemaProps{
- Description: "Items contains the list of machines",
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.Machine"),
- },
- },
- },
- },
- },
- },
- Required: []string{"items"},
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.Machine", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineSet(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineSet TODO",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
- },
- },
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "spec": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec"),
- },
- },
- "status": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus"),
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineSetCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineSetCondition describes the state of a machine set at a certain point.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "type": {
- SchemaProps: spec.SchemaProps{
- Description: "Type of machine set condition.",
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "status": {
- SchemaProps: spec.SchemaProps{
- Description: "Status of the condition, one of True, False, Unknown.",
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "lastTransitionTime": {
- SchemaProps: spec.SchemaProps{
- Description: "The last time the condition transitioned from one status to another.",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
- },
- },
- "reason": {
- SchemaProps: spec.SchemaProps{
- Description: "The reason for the condition's last transition.",
- Type: []string{"string"},
- Format: "",
- },
- },
- "message": {
- SchemaProps: spec.SchemaProps{
- Description: "A human readable message indicating details about the transition.",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- Required: []string{"type", "status"},
- },
- },
- Dependencies: []string{
- "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineSetList(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineSetList is a collection of MachineSet.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
- },
- },
- "items": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSet"),
- },
- },
- },
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineSetSpec is the specification of a MachineSet.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "replicas": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "selector": {
- SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
- },
- },
- "machineClass": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec"),
- },
- },
- "template": {
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec"),
- },
- },
- "minReadySeconds": {
- SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineSetStatus holds the most recently observed status of MachineSet.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "replicas": {
- SchemaProps: spec.SchemaProps{
- Description: "Replicas is the number of actual replicas.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "fullyLabeledReplicas": {
- SchemaProps: spec.SchemaProps{
- Description: "The number of pods that have labels matching the labels of the pod template of the replicaset.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "readyReplicas": {
- SchemaProps: spec.SchemaProps{
- Description: "The number of ready replicas for this replica set.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "availableReplicas": {
- SchemaProps: spec.SchemaProps{
- Description: "The number of available replicas (ready for at least minReadySeconds) for this replica set.",
- Type: []string{"integer"},
- Format: "int32",
- },
- },
- "observedGeneration": {
- SchemaProps: spec.SchemaProps{
- Description: "ObservedGeneration is the most recent generation observed by the controller.",
- Type: []string{"integer"},
- Format: "int64",
- },
- },
- "machineSetCondition": {
- SchemaProps: spec.SchemaProps{
- Description: "Represents the latest available observations of a replica set's current state.",
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetCondition"),
- },
- },
- },
- },
- },
- "lastOperation": {
- SchemaProps: spec.SchemaProps{
- Description: "LastOperation performed",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"),
- },
- },
- "failedMachines": {
- SchemaProps: spec.SchemaProps{
- Description: "FailedMachines has summary of machines on which lastOperation Failed",
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
+ Description: "Represents the latest available observations of a MachineDeployment's current state.",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary"),
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition"),
},
},
},
},
},
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetCondition", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineSpec is the specification of a Machine.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "class": {
- SchemaProps: spec.SchemaProps{
- Description: "Class contains the machineclass attributes of a machine",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec"),
- },
- },
- "providerID": {
- SchemaProps: spec.SchemaProps{
- Description: "ProviderID represents the provider's unique ID given to a machine",
- Type: []string{"string"},
- Format: "",
- },
- },
- "nodeTemplate": {
- SchemaProps: spec.SchemaProps{
- Description: "NodeTemplateSpec describes the data a node should have when created from a template",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplateSpec"),
- },
- },
- "drainTimeout": {
- SchemaProps: spec.SchemaProps{
- Description: "MachineDraintimeout is the timeout after which machine is forcefully deleted.",
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
- },
- },
- "healthTimeout": {
- SchemaProps: spec.SchemaProps{
- Description: "MachineHealthTimeout is the timeout after which machine is declared unhealhty/failed.",
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
- },
- },
- "creationTimeout": {
- SchemaProps: spec.SchemaProps{
- Description: "MachineCreationTimeout is the timeout after which machinie creation is declared failed.",
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
- },
- },
- "maxEvictRetries": {
+ "collisionCount": {
SchemaProps: spec.SchemaProps{
- Description: "MaxEvictRetries is the number of retries that will be attempted while draining the node.",
+ Description: "Count of hash collisions for the MachineDeployment. The MachineDeployment controller uses this field as a collision avoidance mechanism when it needs to create the name for the newest MachineSet.",
Type: []string{"integer"},
Format: "int32",
},
},
- "nodeConditions": {
- SchemaProps: spec.SchemaProps{
- Description: "NodeConditions are the set of conditions if set to true for MachineHealthTimeOut, machine will be declared failed.",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineStatus holds the most recently observed status of Machine.",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "conditions": {
+ "failedMachines": {
SchemaProps: spec.SchemaProps{
- Description: "Conditions of this machine, same as node",
+ Description: "FailedMachines has summary of machines on which lastOperation Failed",
Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/api/core/v1.NodeCondition"),
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary"),
},
},
},
},
},
- "lastOperation": {
- SchemaProps: spec.SchemaProps{
- Description: "Last operation refers to the status of the last operation performed",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"),
- },
- },
- "currentStatus": {
- SchemaProps: spec.SchemaProps{
- Description: "Current status of the machine object",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus"),
- },
- },
- "lastKnownState": {
- SchemaProps: spec.SchemaProps{
- Description: "LastKnownState can store details of the last known state of the VM by the plugins. It can be used by future operation calls to determine current infrastucture state",
- Type: []string{"string"},
- Format: "",
- },
- },
},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation", "k8s.io/api/core/v1.NodeCondition"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineDeploymentCondition", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary"},
}
}
-func schema_pkg_apis_machine_v1alpha1_MachineSummary(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineDeploymentStrategy(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "MachineSummary store the summary of machine.",
+ Description: "MachineDeploymentStrategy describes how to replace existing machines with new ones.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "name": {
- SchemaProps: spec.SchemaProps{
- Description: "Name of the machine object",
- Type: []string{"string"},
- Format: "",
- },
- },
- "providerID": {
- SchemaProps: spec.SchemaProps{
- Description: "ProviderID represents the provider's unique ID given to a machine",
- Type: []string{"string"},
- Format: "",
- },
- },
- "lastOperation": {
- SchemaProps: spec.SchemaProps{
- Description: "Last operation refers to the status of the last operation performed",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"),
- },
- },
- "ownerRef": {
+ "type": {
SchemaProps: spec.SchemaProps{
- Description: "OwnerRef",
+ Description: "Type of MachineDeployment. Can be \"Recreate\" or \"RollingUpdate\". Default is RollingUpdate.",
Type: []string{"string"},
Format: "",
},
},
- },
- },
- },
- Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"},
- }
-}
-
-func schema_pkg_apis_machine_v1alpha1_MachineTemplateSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
- return common.OpenAPIDefinition{
- Schema: spec.Schema{
- SchemaProps: spec.SchemaProps{
- Description: "MachineTemplateSpec describes the data a machine should have when created from a template",
- Type: []string{"object"},
- Properties: map[string]spec.Schema{
- "metadata": {
- SchemaProps: spec.SchemaProps{
- Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
- },
- },
- "spec": {
+ "rollingUpdate": {
SchemaProps: spec.SchemaProps{
- Description: "Specification of the desired behavior of the machine. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status",
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec"),
+ Description: "Rolling update config params. Present only if MachineDeploymentStrategyType = RollingUpdate.",
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment"),
},
},
},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.RollingUpdateMachineDeployment"},
}
}
-func schema_pkg_apis_machine_v1alpha1_NodeTemplate(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "NodeTemplate contains subfields to track all node resources and other node info required to scale nodegroup from zero",
+ Description: "MachineList is a collection of Machines.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "capacity": {
+ "kind": {
SchemaProps: spec.SchemaProps{
- Description: "Capacity contains subfields to track all node resources required to scale nodegroup from zero",
- Type: []string{"object"},
- AdditionalProperties: &spec.SchemaOrBool{
- Allows: true,
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
- },
- },
- },
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
},
},
- "instanceType": {
+ "apiVersion": {
SchemaProps: spec.SchemaProps{
- Description: "Instance type of the node belonging to nodeGroup",
- Default: "",
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
Type: []string{"string"},
Format: "",
},
},
- "region": {
+ "metadata": {
SchemaProps: spec.SchemaProps{
- Description: "Region of the expected node belonging to nodeGroup",
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Description: "TypeMeta for MachineList object",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
},
},
- "zone": {
+ "items": {
SchemaProps: spec.SchemaProps{
- Description: "Zone of the expected node belonging to nodeGroup",
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Description: "Items contains the list of machines",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.Machine"),
+ },
+ },
+ },
},
},
},
- Required: []string{"capacity", "instanceType", "region", "zone"},
+ Required: []string{"items"},
},
},
Dependencies: []string{
- "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.Machine", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
-func schema_pkg_apis_machine_v1alpha1_NodeTemplateSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineSet(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "NodeTemplateSpec describes the data a node should have when created from a template",
+ Description: "MachineSet TODO",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"metadata": {
@@ -3468,67 +1079,98 @@ func schema_pkg_apis_machine_v1alpha1_NodeTemplateSpec(ref common.ReferenceCallb
Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
+ "kind": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
+ "apiVersion": {
+ SchemaProps: spec.SchemaProps{
+ Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Type: []string{"string"},
+ Format: "",
+ },
+ },
"spec": {
SchemaProps: spec.SchemaProps{
- Description: "NodeSpec describes the attributes that a node is created with.",
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/api/core/v1.NodeSpec"),
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec"),
+ },
+ },
+ "status": {
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus"),
},
},
},
},
},
Dependencies: []string{
- "k8s.io/api/core/v1.NodeSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
-func schema_pkg_apis_machine_v1alpha1_OpenStackMachineClass(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineSetCondition(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "OpenStackMachineClass TODO",
+ Description: "MachineSetCondition describes the state of a machine set at a certain point.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "metadata": {
+ "type": {
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ Description: "Type of machine set condition.",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
},
},
- "kind": {
+ "status": {
SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Description: "Status of the condition, one of True, False, Unknown.",
+ Default: "",
Type: []string{"string"},
Format: "",
},
},
- "apiVersion": {
+ "lastTransitionTime": {
SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
+ Description: "The last time the condition transitioned from one status to another.",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Time"),
+ },
+ },
+ "reason": {
+ SchemaProps: spec.SchemaProps{
+ Description: "The reason for the condition's last transition.",
Type: []string{"string"},
Format: "",
},
},
- "spec": {
+ "message": {
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackMachineClassSpec"),
+ Description: "A human readable message indicating details about the transition.",
+ Type: []string{"string"},
+ Format: "",
},
},
},
+ Required: []string{"type", "status"},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackMachineClassSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ "k8s.io/apimachinery/pkg/apis/meta/v1.Time"},
}
}
-func schema_pkg_apis_machine_v1alpha1_OpenStackMachineClassList(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineSetList(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "OpenStackMachineClassList is a collection of OpenStackMachineClasses.",
+ Description: "MachineSetList is a collection of MachineSet.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
"kind": {
@@ -3558,7 +1200,7 @@ func schema_pkg_apis_machine_v1alpha1_OpenStackMachineClassList(ref common.Refer
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackMachineClass"),
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSet"),
},
},
},
@@ -3568,378 +1210,409 @@ func schema_pkg_apis_machine_v1alpha1_OpenStackMachineClassList(ref common.Refer
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackMachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSet", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
}
}
-func schema_pkg_apis_machine_v1alpha1_OpenStackMachineClassSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineSetSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "OpenStackMachineClassSpec is the specification of a OpenStackMachineClass.",
+ Description: "MachineSetSpec is the specification of a MachineSet.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "imageID": {
+ "replicas": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "imageName": {
+ "selector": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"),
},
},
- "region": {
+ "machineClass": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec"),
},
},
- "availabilityZone": {
+ "template": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec"),
},
},
- "flavorName": {
+ "minReadySeconds": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Type: []string{"integer"},
+ Format: "int32",
+ },
+ },
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.LabelSelector"},
+ }
+}
+
+func schema_pkg_apis_machine_v1alpha1_MachineSetStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "MachineSetStatus holds the most recently observed status of MachineSet.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "replicas": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Replicas is the number of actual replicas.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "keyName": {
+ "fullyLabeledReplicas": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Description: "The number of pods that have labels matching the labels of the pod template of the replicaset.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "securityGroups": {
+ "readyReplicas": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
+ Description: "The number of ready replicas for this replica set.",
+ Type: []string{"integer"},
+ Format: "int32",
+ },
+ },
+ "availableReplicas": {
+ SchemaProps: spec.SchemaProps{
+ Description: "The number of available replicas (ready for at least minReadySeconds) for this replica set.",
+ Type: []string{"integer"},
+ Format: "int32",
+ },
+ },
+ "observedGeneration": {
+ SchemaProps: spec.SchemaProps{
+ Description: "ObservedGeneration is the most recent generation observed by the controller.",
+ Type: []string{"integer"},
+ Format: "int64",
+ },
+ },
+ "machineSetCondition": {
+ SchemaProps: spec.SchemaProps{
+ Description: "Represents the latest available observations of a replica set's current state.",
+ Type: []string{"array"},
Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetCondition"),
},
},
},
},
},
- "tags": {
+ "lastOperation": {
SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
- AdditionalProperties: &spec.SchemaOrBool{
- Allows: true,
+ Description: "LastOperation performed",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"),
+ },
+ },
+ "failedMachines": {
+ SchemaProps: spec.SchemaProps{
+ Description: "FailedMachines has summary of machines on which lastOperation Failed",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary"),
},
},
},
},
},
- "networkID": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "networks": {
+ },
+ },
+ },
+ Dependencies: []string{
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSetCondition", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSummary"},
+ }
+}
+
+func schema_pkg_apis_machine_v1alpha1_MachineSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "MachineSpec is the specification of a Machine.",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "class": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackNetwork"),
- },
- },
- },
+ Description: "Class contains the machineclass attributes of a machine",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec"),
},
},
- "subnetID": {
+ "providerID": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "ProviderID represents the provider's unique ID given to a machine",
+ Type: []string{"string"},
+ Format: "",
},
},
- "secretRef": {
+ "nodeTemplate": {
SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
+ Description: "NodeTemplateSpec describes the data a node should have when created from a template",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplateSpec"),
},
},
- "credentialsSecretRef": {
+ "drainTimeout": {
SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
+ Description: "MachineDraintimeout is the timeout after which machine is forcefully deleted.",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
},
},
- "podNetworkCidr": {
+ "healthTimeout": {
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Description: "MachineHealthTimeout is the timeout after which machine is declared unhealhty/failed.",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
},
},
- "rootDiskSize": {
+ "creationTimeout": {
SchemaProps: spec.SchemaProps{
- Type: []string{"integer"},
- Format: "int32",
+ Description: "MachineCreationTimeout is the timeout after which machinie creation is declared failed.",
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"),
},
},
- "useConfigDrive": {
+ "maxEvictRetries": {
SchemaProps: spec.SchemaProps{
- Description: "in GB",
- Type: []string{"boolean"},
- Format: "",
+ Description: "MaxEvictRetries is the number of retries that will be attempted while draining the node.",
+ Type: []string{"integer"},
+ Format: "int32",
},
},
- "serverGroupID": {
+ "nodeConditions": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "NodeConditions are the set of conditions if set to true for MachineHealthTimeOut, machine will be declared failed.",
+ Type: []string{"string"},
+ Format: "",
},
},
},
- Required: []string{"imageID", "imageName", "region", "availabilityZone", "flavorName", "keyName", "securityGroups", "networkID", "podNetworkCidr"},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.OpenStackNetwork", "k8s.io/api/core/v1.SecretReference"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.ClassSpec", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.NodeTemplateSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"},
}
}
-func schema_pkg_apis_machine_v1alpha1_OpenStackNetwork(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Type: []string{"object"},
+ Description: "MachineStatus holds the most recently observed status of Machine.",
+ Type: []string{"object"},
Properties: map[string]spec.Schema{
- "id": {
+ "conditions": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "Conditions of this machine, same as node",
+ Type: []string{"array"},
+ Items: &spec.SchemaOrArray{
+ Schema: &spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/api/core/v1.NodeCondition"),
+ },
+ },
+ },
},
},
- "name": {
+ "lastOperation": {
SchemaProps: spec.SchemaProps{
- Description: "takes priority before name",
- Type: []string{"string"},
- Format: "",
+ Description: "Last operation refers to the status of the last operation performed",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"),
},
},
- "podNetwork": {
+ "currentStatus": {
SchemaProps: spec.SchemaProps{
- Type: []string{"boolean"},
- Format: "",
+ Description: "Current status of the machine object",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus"),
+ },
+ },
+ "lastKnownState": {
+ SchemaProps: spec.SchemaProps{
+ Description: "LastKnownState can store details of the last known state of the VM by the plugins. It can be used by future operation calls to determine current infrastucture state",
+ Type: []string{"string"},
+ Format: "",
},
},
},
},
},
+ Dependencies: []string{
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.CurrentStatus", "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation", "k8s.io/api/core/v1.NodeCondition"},
}
}
-func schema_pkg_apis_machine_v1alpha1_PacketMachineClass(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineSummary(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "PacketMachineClass TODO",
+ Description: "MachineSummary store the summary of machine.",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "metadata": {
+ "name": {
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
+ Description: "Name of the machine object",
+ Type: []string{"string"},
+ Format: "",
},
},
- "kind": {
+ "providerID": {
SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
+ Description: "ProviderID represents the provider's unique ID given to a machine",
Type: []string{"string"},
Format: "",
},
},
- "apiVersion": {
+ "lastOperation": {
SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
+ Description: "Last operation refers to the status of the last operation performed",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"),
},
},
- "spec": {
+ "ownerRef": {
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.PacketMachineClassSpec"),
+ Description: "OwnerRef",
+ Type: []string{"string"},
+ Format: "",
},
},
},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.PacketMachineClassSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.LastOperation"},
}
}
-func schema_pkg_apis_machine_v1alpha1_PacketMachineClassList(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_MachineTemplateSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "PacketMachineClassList is a collection of PacketMachineClasses.",
+ Description: "MachineTemplateSpec describes the data a machine should have when created from a template",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "kind": {
- SchemaProps: spec.SchemaProps{
- Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
- Type: []string{"string"},
- Format: "",
- },
- },
- "apiVersion": {
- SchemaProps: spec.SchemaProps{
- Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
- Type: []string{"string"},
- Format: "",
- },
- },
"metadata": {
SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"),
+ Description: "Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
- "items": {
+ "spec": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: map[string]interface{}{},
- Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.PacketMachineClass"),
- },
- },
- },
+ Description: "Specification of the desired behavior of the machine. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status",
+ Default: map[string]interface{}{},
+ Ref: ref("github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec"),
},
},
},
},
},
Dependencies: []string{
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.PacketMachineClass", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"},
+ "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1.MachineSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
-func schema_pkg_apis_machine_v1alpha1_PacketMachineClassSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+func schema_pkg_apis_machine_v1alpha1_NodeTemplate(ref common.ReferenceCallback) common.OpenAPIDefinition {
return common.OpenAPIDefinition{
Schema: spec.Schema{
SchemaProps: spec.SchemaProps{
- Description: "PacketMachineClassSpec is the specification of a PacketMachineClass.",
+ Description: "NodeTemplate contains subfields to track all node resources and other node info required to scale nodegroup from zero",
Type: []string{"object"},
Properties: map[string]spec.Schema{
- "facility": {
+ "capacity": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
+ Description: "Capacity contains subfields to track all node resources required to scale nodegroup from zero",
+ Type: []string{"object"},
+ AdditionalProperties: &spec.SchemaOrBool{
+ Allows: true,
Schema: &spec.Schema{
SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"),
},
},
},
},
},
- "machineType": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "billingCycle": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "OS": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "projectID": {
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- "tags": {
+ "instanceType": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
+ Description: "Instance type of the node belonging to nodeGroup",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
},
},
- "sshKeys": {
+ "region": {
SchemaProps: spec.SchemaProps{
- Type: []string{"array"},
- Items: &spec.SchemaOrArray{
- Schema: &spec.Schema{
- SchemaProps: spec.SchemaProps{
- Default: "",
- Type: []string{"string"},
- Format: "",
- },
- },
- },
+ Description: "Region of the expected node belonging to nodeGroup",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
},
},
- "userdata": {
+ "zone": {
SchemaProps: spec.SchemaProps{
- Type: []string{"string"},
- Format: "",
+ Description: "Zone of the expected node belonging to nodeGroup",
+ Default: "",
+ Type: []string{"string"},
+ Format: "",
},
},
- "secretRef": {
+ },
+ Required: []string{"capacity", "instanceType", "region", "zone"},
+ },
+ },
+ Dependencies: []string{
+ "k8s.io/apimachinery/pkg/api/resource.Quantity"},
+ }
+}
+
+func schema_pkg_apis_machine_v1alpha1_NodeTemplateSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
+ return common.OpenAPIDefinition{
+ Schema: spec.Schema{
+ SchemaProps: spec.SchemaProps{
+ Description: "NodeTemplateSpec describes the data a node should have when created from a template",
+ Type: []string{"object"},
+ Properties: map[string]spec.Schema{
+ "metadata": {
SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"),
},
},
- "credentialsSecretRef": {
+ "spec": {
SchemaProps: spec.SchemaProps{
- Ref: ref("k8s.io/api/core/v1.SecretReference"),
+ Description: "NodeSpec describes the attributes that a node is created with.",
+ Default: map[string]interface{}{},
+ Ref: ref("k8s.io/api/core/v1.NodeSpec"),
},
},
},
- Required: []string{"facility", "machineType", "billingCycle", "OS", "projectID"},
},
},
Dependencies: []string{
- "k8s.io/api/core/v1.SecretReference"},
+ "k8s.io/api/core/v1.NodeSpec", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"},
}
}
diff --git a/pkg/options/types.go b/pkg/options/types.go
index 352c4dce0..4d8c609a8 100644
--- a/pkg/options/types.go
+++ b/pkg/options/types.go
@@ -18,8 +18,6 @@ limitations under the License.
package options
import (
- "time"
-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@@ -75,12 +73,6 @@ type MachineControllerManagerConfiguration struct {
MinResyncPeriod metav1.Duration
// SafetyOptions is the set of options to set to ensure safety of controller
SafetyOptions SafetyOptions
- // NodeCondition is the string of known NodeConditions. If any of these NodeCondition is set for a timeout period, the machine will be declared failed and will replaced.
- NodeConditions string
- // BootstrapTokenAuthExtraGroups is a comma-separated string of groups to set bootstrap token's "auth-extra-groups" field to.
- BootstrapTokenAuthExtraGroups string
- // DeleteMigratedMachineClass deletes any machine class with has the migrate machineclass
- DeleteMigratedMachineClass bool
// AutoscalerScaleDownAnnotationDuringRollout is an option to disable annotating the node-objects during roll-out.
// The cluster autoscaler native annotation is "cluster-autoscaler.kubernetes.io/scale-down-disabled".
AutoscalerScaleDownAnnotationDuringRollout bool
@@ -91,43 +83,13 @@ type MachineControllerManagerConfiguration struct {
type SafetyOptions struct {
// SafetyUp
SafetyUp int32
+
// SafetyDown
SafetyDown int32
- // Timeout (in durartion) used while creation of
- // a machine before it is declared as failed
- MachineCreationTimeout metav1.Duration
- // Timeout (in durartion) used while health-check of
- // a machine before it is declared as failed
- MachineHealthTimeout metav1.Duration
- // Deprecated. No effect. Timeout (in durartion) used while draining of machine before deletion,
- // beyond which it forcefully deletes machine
- MachineDrainTimeout metav1.Duration
- // Maximum number of times evicts would be attempted on a pod for it is forcibly deleted
- // during draining of a machine.
- MaxEvictRetries int32
- // Timeout (in duration) used while waiting for PV to detach
- PvDetachTimeout metav1.Duration
- // Timeout (in duration) for which the APIServer can be down before
- // declare the machine controller frozen by safety controller
- MachineSafetyAPIServerStatusCheckTimeout metav1.Duration
-
- // Period (in durartion) used to poll for orphan VMs
- // by safety controller
- MachineSafetyOrphanVMsPeriod metav1.Duration
// Period (in durartion) used to poll for overshooting
// of machine objects backing a machineSet by safety controller
MachineSafetyOvershootingPeriod metav1.Duration
- // Period (in duration) used to poll for APIServer's health
- // by safety controller
- MachineSafetyAPIServerStatusCheckPeriod metav1.Duration
-
- // APIserverInactiveStartTime to keep track of the
- // start time of when the APIServers were not reachable
- APIserverInactiveStartTime time.Time
- // MachineControllerFrozen indicates if the machine controller
- // is frozen due to Unreachable APIServers
- MachineControllerFrozen bool
}
// LeaderElectionConfiguration defines the configuration of leader election
diff --git a/pkg/util/provider/driver/driver.go b/pkg/util/provider/driver/driver.go
index b0da2913e..08e6bc286 100644
--- a/pkg/util/provider/driver/driver.go
+++ b/pkg/util/provider/driver/driver.go
@@ -36,9 +36,6 @@ type Driver interface {
ListMachines(context.Context, *ListMachinesRequest) (*ListMachinesResponse, error)
// GetVolumeIDs returns a list volumeIDs for the list of PVSpecs
GetVolumeIDs(context.Context, *GetVolumeIDsRequest) (*GetVolumeIDsResponse, error)
- // GenerateMachineClassForMigration returns the generic machineClass for provider specific machine class CR
- // e.g. AWSMachineClass --> MachineClass
- GenerateMachineClassForMigration(context.Context, *GenerateMachineClassForMigrationRequest) (*GenerateMachineClassForMigrationResponse, error)
}
// CreateMachineRequest is the create request for VM creation
diff --git a/pkg/util/provider/machinecontroller/controller.go b/pkg/util/provider/machinecontroller/controller.go
index ef7182b9f..a9ff3c941 100644
--- a/pkg/util/provider/machinecontroller/controller.go
+++ b/pkg/util/provider/machinecontroller/controller.go
@@ -22,24 +22,25 @@ import (
"sync"
"time"
- "github.com/Masterminds/semver"
- machineinternal "github.com/gardener/machine-controller-manager/pkg/apis/machine"
- machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- machineapi "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/typed/machine/v1alpha1"
- machineinformers "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/machine/v1alpha1"
- machinelisters "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
-
"github.com/gardener/machine-controller-manager/pkg/handlers"
"github.com/gardener/machine-controller-manager/pkg/util/k8sutils"
"github.com/gardener/machine-controller-manager/pkg/util/permits"
"github.com/gardener/machine-controller-manager/pkg/util/provider/drain"
"github.com/gardener/machine-controller-manager/pkg/util/provider/driver"
"github.com/gardener/machine-controller-manager/pkg/util/provider/options"
+ "github.com/gardener/machine-controller-manager/pkg/util/worker"
+
+ machineinternal "github.com/gardener/machine-controller-manager/pkg/apis/machine"
+ machinev1alpha1 "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
+ machineapi "github.com/gardener/machine-controller-manager/pkg/client/clientset/versioned/typed/machine/v1alpha1"
+ machineinformers "github.com/gardener/machine-controller-manager/pkg/client/informers/externalversions/machine/v1alpha1"
+ machinelisters "github.com/gardener/machine-controller-manager/pkg/client/listers/machine/v1alpha1"
+
+ "github.com/Masterminds/semver"
"github.com/prometheus/client_golang/prometheus"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
runtimeutil "k8s.io/apimachinery/pkg/util/runtime"
- "k8s.io/apimachinery/pkg/util/wait"
coreinformers "k8s.io/client-go/informers/core/v1"
policyv1informers "k8s.io/client-go/informers/policy/v1"
policyv1beta1informers "k8s.io/client-go/informers/policy/v1beta1"
@@ -57,12 +58,6 @@ import (
)
const (
- maxRetries = 15
-
- // ClassAnnotation is the annotation used to identify a machine class
- ClassAnnotation = "machine.sapcloud.io/class"
- // MachineIDAnnotation is the annotation used to identify a machine ID
- MachineIDAnnotation = "machine.sapcloud.io/id"
// MCMFinalizerName is the finalizer used to tag dependecies before deletion
// of the object. This finalizer is carried over from the MCM
MCMFinalizerName = "machine.sapcloud.io/machine-controller-manager"
@@ -96,14 +91,6 @@ func NewController(
targetKubernetesVersion *semver.Version,
) (Controller, error) {
const (
- // volumeAttachmentGroupName group name
- volumeAttachmentGroupName = "storage.k8s.io"
- // volumenAttachmentKind is the kind used for VolumeAttachment
- volumeAttachmentResourceName = "volumeattachments"
- // volumeAttachmentResource is the kind used for VolumeAttachment
- volumeAttachmentResourceKind = "VolumeAttachment"
- // permitGiverStaleEntryTimeout is the time for which an entry can stay stale in the map
- // maintained by permitGiver
permitGiverStaleEntryTimeout = 1 * time.Hour
// janitorFreq is the time after which permitGiver ranges its map for stale entries
janitorFreq = 10 * time.Minute
@@ -335,12 +322,12 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) {
prometheus.MustRegister(c)
for i := 0; i < workers; i++ {
- createWorker(c.secretQueue, "ClusterSecret", maxRetries, true, c.reconcileClusterSecretKey, stopCh, &waitGroup)
- createWorker(c.machineClassQueue, "ClusterMachineClass", maxRetries, true, c.reconcileClusterMachineClassKey, stopCh, &waitGroup)
- createWorker(c.nodeQueue, "ClusterNode", maxRetries, true, c.reconcileClusterNodeKey, stopCh, &waitGroup)
- createWorker(c.machineQueue, "ClusterMachine", maxRetries, true, c.reconcileClusterMachineKey, stopCh, &waitGroup)
- createWorker(c.machineSafetyOrphanVMsQueue, "ClusterMachineSafetyOrphanVMs", maxRetries, true, c.reconcileClusterMachineSafetyOrphanVMs, stopCh, &waitGroup)
- createWorker(c.machineSafetyAPIServerQueue, "ClusterMachineAPIServer", maxRetries, true, c.reconcileClusterMachineSafetyAPIServer, stopCh, &waitGroup)
+ worker.Run(c.secretQueue, "ClusterSecret", worker.DefaultMaxRetries, true, c.reconcileClusterSecretKey, stopCh, &waitGroup)
+ worker.Run(c.machineClassQueue, "ClusterMachineClass", worker.DefaultMaxRetries, true, c.reconcileClusterMachineClassKey, stopCh, &waitGroup)
+ worker.Run(c.nodeQueue, "ClusterNode", worker.DefaultMaxRetries, true, c.reconcileClusterNodeKey, stopCh, &waitGroup)
+ worker.Run(c.machineQueue, "ClusterMachine", worker.DefaultMaxRetries, true, c.reconcileClusterMachineKey, stopCh, &waitGroup)
+ worker.Run(c.machineSafetyOrphanVMsQueue, "ClusterMachineSafetyOrphanVMs", worker.DefaultMaxRetries, true, c.reconcileClusterMachineSafetyOrphanVMs, stopCh, &waitGroup)
+ worker.Run(c.machineSafetyAPIServerQueue, "ClusterMachineAPIServer", worker.DefaultMaxRetries, true, c.reconcileClusterMachineSafetyAPIServer, stopCh, &waitGroup)
}
<-stopCh
@@ -349,52 +336,3 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) {
waitGroup.Wait()
}
-
-// createWorker creates and runs a worker thread that just processes items in the
-// specified queue. The worker will run until stopCh is closed. The worker will be
-// added to the wait group when started and marked done when finished.
-func createWorker(queue workqueue.RateLimitingInterface, resourceType string, maxRetries int, forgetAfterSuccess bool, reconciler func(key string) error, stopCh <-chan struct{}, waitGroup *sync.WaitGroup) {
- waitGroup.Add(1)
- go func() {
- wait.Until(worker(queue, resourceType, maxRetries, forgetAfterSuccess, reconciler), time.Second, stopCh)
- waitGroup.Done()
- }()
-}
-
-// worker runs a worker thread that just dequeues items, processes them, and marks them done.
-// If reconciler returns an error, requeue the item up to maxRetries before giving up.
-// It enforces that the reconciler is never invoked concurrently with the same key.
-// If forgetAfterSuccess is true, it will cause the queue to forget the item should reconciliation
-// have no error.
-func worker(queue workqueue.RateLimitingInterface, resourceType string, maxRetries int, forgetAfterSuccess bool, reconciler func(key string) error) func() {
- return func() {
- exit := false
- for !exit {
- exit = func() bool {
- key, quit := queue.Get()
- if quit {
- return true
- }
- defer queue.Done(key)
-
- err := reconciler(key.(string))
- if err == nil {
- if forgetAfterSuccess {
- queue.Forget(key)
- }
- return false
- }
-
- if queue.NumRequeues(key) < maxRetries {
- klog.V(4).Infof("Error syncing %s %v: %v", resourceType, key, err)
- queue.AddRateLimited(key)
- return false
- }
-
- klog.V(4).Infof("Dropping %s %q out of the queue: %v", resourceType, key, err)
- queue.Forget(key)
- return false
- }()
- }
- }
-}
diff --git a/pkg/util/provider/machinecontroller/machine_safety.go b/pkg/util/provider/machinecontroller/machine_safety.go
index 1d02a822d..d29133a58 100644
--- a/pkg/util/provider/machinecontroller/machine_safety.go
+++ b/pkg/util/provider/machinecontroller/machine_safety.go
@@ -35,17 +35,6 @@ import (
"k8s.io/klog/v2"
)
-const (
- // OverShootingReplicaCount freeze reason when replica count overshoots
- OverShootingReplicaCount = "OverShootingReplicaCount"
- // MachineDeploymentStateSync freeze reason when machineDeployment was found with inconsistent state
- MachineDeploymentStateSync = "MachineDeploymentStateSync"
- // TimeoutOccurred freeze reason when machineSet timeout occurs
- TimeoutOccurred = "MachineSetTimeoutOccurred"
- // UnfreezeAnnotation indicates the controllers to unfreeze this object
- UnfreezeAnnotation = "safety.machine.sapcloud.io/unfreeze"
-)
-
// reconcileClusterMachineSafetyOrphanVMs checks for any orphan VMs and deletes them
func (c *controller) reconcileClusterMachineSafetyOrphanVMs(key string) error {
ctx := context.Background()
diff --git a/pkg/util/provider/machinecontroller/machine_util.go b/pkg/util/provider/machinecontroller/machine_util.go
index 339194828..6b33c05c3 100644
--- a/pkg/util/provider/machinecontroller/machine_util.go
+++ b/pkg/util/provider/machinecontroller/machine_util.go
@@ -68,7 +68,7 @@ const (
// TODO: use client library instead when it starts to support update retries
//
// see https://github.com/kubernetes/kubernetes/issues/21479
-type updateMachineFunc func(machine *v1alpha1.Machine) error
+//type updateMachineFunc func(machine *v1alpha1.Machine) error
/*
// UpdateMachineWithRetries updates a machine with given applyUpdate function. Note that machine not found error is ignored.
@@ -103,17 +103,13 @@ func UpdateMachineWithRetries(machineClient v1alpha1client.MachineInterface, mac
*/
// ValidateMachineClass validates the machine class.
-func (c *controller) ValidateMachineClass(ctx context.Context, classSpec *v1alpha1.ClassSpec) (*v1alpha1.MachineClass, map[string][]byte, machineutils.RetryPeriod, error) {
+func (c *controller) ValidateMachineClass(_ context.Context, classSpec *v1alpha1.ClassSpec) (*v1alpha1.MachineClass, map[string][]byte, machineutils.RetryPeriod, error) {
var (
machineClass *v1alpha1.MachineClass
err error
retry = machineutils.LongRetry
)
- if classSpec.Kind != machineutils.MachineClassKind {
- return c.TryMachineClassMigration(ctx, classSpec)
- }
-
machineClass, err = c.machineClassLister.MachineClasses(c.namespace).Get(classSpec.Name)
if err != nil {
klog.Errorf("MachineClass %s/%s not found. Skipping. %v", c.namespace, classSpec.Name, err)
@@ -1466,20 +1462,6 @@ func setTerminationReasonByPhase(phase v1alpha1.MachinePhase, terminationConditi
}
}
-// TryLock tries to write to channel. It times out after specified duration
-func TryLock(lockC chan<- struct{}, duration time.Duration) bool {
- ctx, cancelFn := context.WithTimeout(context.Background(), duration)
- defer cancelFn()
- for {
- select {
- case lockC <- struct{}{}:
- return true
- case <-ctx.Done():
- return false
- }
- }
-}
-
func (c *controller) tryMarkingMachineFailed(ctx context.Context, machine, clone *v1alpha1.Machine, machineDeployName, description string, lockAcquireTimeout time.Duration) (machineutils.RetryPeriod, error) {
if c.permitGiver.TryPermit(machineDeployName, lockAcquireTimeout) {
defer c.permitGiver.ReleasePermit(machineDeployName)
diff --git a/pkg/util/provider/machinecontroller/migrate_machineclass.go b/pkg/util/provider/machinecontroller/migrate_machineclass.go
deleted file mode 100644
index 842b845df..000000000
--- a/pkg/util/provider/machinecontroller/migrate_machineclass.go
+++ /dev/null
@@ -1,429 +0,0 @@
-// Package controller is used to provide the core functionalities of machine-controller-manager
-package controller
-
-import (
- "context"
- "fmt"
-
- apierrors "k8s.io/apimachinery/pkg/api/errors"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/labels"
- "k8s.io/apimachinery/pkg/util/sets"
- "k8s.io/klog/v2"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/driver"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machinecodes/codes"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machinecodes/status"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
-)
-
-const (
- // AlicloudMachineClassKind is used to identify the machineClassKind as Alicloud
- AlicloudMachineClassKind = "AlicloudMachineClass"
- // AWSMachineClassKind is used to identify the machineClassKind as AWS
- AWSMachineClassKind = "AWSMachineClass"
- // AzureMachineClassKind is used to identify the machineClassKind as Azure
- AzureMachineClassKind = "AzureMachineClass"
- // GCPMachineClassKind is used to identify the machineClassKind as GCP
- GCPMachineClassKind = "GCPMachineClass"
- // OpenStackMachineClassKind is used to identify the machineClassKind as OpenStack
- OpenStackMachineClassKind = "OpenStackMachineClass"
- // PacketMachineClassKind is used to identify the machineClassKind as Packet
- PacketMachineClassKind = "PacketMachineClass"
- // MachineController is the string constant to identify the controller responsible for the migration
- MachineController = "machine-controller"
-)
-
-// getProviderSpecificMachineClass returns the providerSpecificMachineClass object for the provided machineClass
-func (c *controller) getProviderSpecificMachineClass(ctx context.Context, classSpec *v1alpha1.ClassSpec) (interface{}, error) {
- var (
- machineClass interface{}
- err error
- )
-
- switch classSpec.Kind {
- case AlicloudMachineClassKind:
- machineClass, err = c.controlMachineClient.AlicloudMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- case AWSMachineClassKind:
- machineClass, err = c.controlMachineClient.AWSMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- case AzureMachineClassKind:
- machineClass, err = c.controlMachineClient.AzureMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- case GCPMachineClassKind:
- machineClass, err = c.controlMachineClient.GCPMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- case OpenStackMachineClassKind:
- machineClass, err = c.controlMachineClient.OpenStackMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- case PacketMachineClassKind:
- machineClass, err = c.controlMachineClient.PacketMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- default:
- return nil, fmt.Errorf("machine class kind not found")
- }
-
- if err != nil {
- if apierrors.IsNotFound(err) {
- _, innerErr := c.machineClassLister.MachineClasses(c.namespace).Get(classSpec.Name)
- if innerErr == nil {
- // MachineClass object with same name was found.
- // Most likely an external controller has already performed the migration.
- // And also {Provider}MachineClass isn't found, hence we can continue with the migration.
- return nil, fmt.Errorf("ProviderMachineClass not found. Found a MachineClass with matching name")
- }
- }
- return nil, err
- }
-
- return machineClass, nil
-}
-
-// createMachineClass creates the generic machineClass corresponding to the providerMachineClass
-func (c *controller) createMachineClass(ctx context.Context, providerSpecificMachineClass interface{}, classSpec *v1alpha1.ClassSpec) (machineutils.RetryPeriod, error) {
-
- machineClass, err := c.machineClassLister.MachineClasses(c.namespace).Get(classSpec.Name)
- if err != nil && apierrors.IsNotFound(err) {
- // MachineClass doesn't exist, initialize a new one
- machineClass = &v1alpha1.MachineClass{
- ObjectMeta: metav1.ObjectMeta{
- Name: classSpec.Name,
- },
- }
- machineClass, err = c.controlMachineClient.MachineClasses(c.namespace).Create(ctx, machineClass, metav1.CreateOptions{})
- if err != nil {
- return machineutils.ShortRetry, err
- }
-
- } else if err != nil {
- // Another kind of error while fetching the machineClass object
- return machineutils.ShortRetry, err
- }
-
- cloneMachineClass := machineClass.DeepCopy()
-
- // Generate the generic machineClass object from driver
- _, err = c.driver.GenerateMachineClassForMigration(
- ctx,
- &driver.GenerateMachineClassForMigrationRequest{
- ProviderSpecificMachineClass: providerSpecificMachineClass,
- MachineClass: cloneMachineClass,
- ClassSpec: classSpec,
- },
- )
- if err != nil {
- retry := machineutils.LongRetry
-
- if machineErr, ok := status.FromError(err); !ok {
- // Do nothing
- } else {
- // Decoding machineErr error code
- switch machineErr.Code() {
- case codes.Unimplemented:
- retry = machineutils.LongRetry
- default:
- retry = machineutils.ShortRetry
- }
- err = machineErr
- }
- klog.V(3).Infof("Couldn't fill up the machine class %s/%s. Error: %s", classSpec.Kind, classSpec.Name, err)
- return retry, err
- }
-
- klog.V(1).Infof("Generated generic machineClass for class %s/%s", classSpec.Kind, classSpec.Name)
-
- // MachineClass exists, and needs to be updated
- _, err = c.controlMachineClient.MachineClasses(c.namespace).Update(ctx, cloneMachineClass, metav1.UpdateOptions{})
- if err != nil {
- return machineutils.ShortRetry, err
- }
-
- klog.V(2).Infof("Create/Apply successful for MachineClass %s", machineClass.Name)
-
- return machineutils.ShortRetry, err
-}
-
-// updateClassReferences updates all machine objects to refer to the new MachineClass.
-func (c *controller) updateClassReferences(ctx context.Context, classSpec *v1alpha1.ClassSpec) error {
-
- // Update Machines
- machineList, err := c.machineLister.Machines(c.namespace).List(labels.Everything())
- if err != nil {
- return err
- }
- for _, machine := range machineList {
- if machine.Spec.Class.Name == classSpec.Name && machine.Spec.Class.Kind == classSpec.Kind {
- clone := machine.DeepCopy()
- clone.Spec.Class.Kind = machineutils.MachineClassKind
-
- _, err := c.controlMachineClient.Machines(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
- klog.V(1).Infof("Updated class reference for machine %s/%s", c.namespace, machine.Name)
- }
- }
-
- // Update MachineSets
- machinesetList, err := c.controlMachineClient.MachineSets(c.namespace).List(ctx, metav1.ListOptions{})
- if err != nil {
- return err
- }
- for _, machineset := range machinesetList.Items {
- if machineset.Spec.Template.Spec.Class.Name == classSpec.Name &&
- machineset.Spec.Template.Spec.Class.Kind == classSpec.Kind {
- clone := machineset.DeepCopy()
- clone.Spec.Template.Spec.Class.Kind = machineutils.MachineClassKind
-
- _, err := c.controlMachineClient.MachineSets(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
- klog.V(1).Infof("Updated class reference for machineset %s/%s", c.namespace, machineset.Name)
- }
- }
-
- // Update MachineDeployments
- machinedeploymentList, err := c.controlMachineClient.MachineDeployments(c.namespace).List(ctx, metav1.ListOptions{})
- if err != nil {
- return err
- }
- for _, machinedeployment := range machinedeploymentList.Items {
- if machinedeployment.Spec.Template.Spec.Class.Name == classSpec.Name &&
- machinedeployment.Spec.Template.Spec.Class.Kind == classSpec.Kind {
- clone := machinedeployment.DeepCopy()
- clone.Spec.Template.Spec.Class.Kind = machineutils.MachineClassKind
-
- _, err := c.controlMachineClient.MachineDeployments(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
- klog.V(1).Infof("Updated class reference for machinedeployment %s/%s", c.namespace, machinedeployment.Name)
- }
- }
-
- return nil
-}
-
-// addMigratedAnnotationForProviderMachineClass adds ignore provider MachineClass annotation
-func (c *controller) addMigratedAnnotationForProviderMachineClass(ctx context.Context, classSpec *v1alpha1.ClassSpec) error {
-
- switch classSpec.Kind {
-
- case AlicloudMachineClassKind:
- providerSpecificMachineClass, err := c.controlMachineClient.AlicloudMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- if err != nil {
- return err
- }
-
- clone := providerSpecificMachineClass.DeepCopy()
- if clone.Annotations == nil {
- clone.Annotations = make(map[string]string)
- }
- clone.Annotations[machineutils.MigratedMachineClass] = MachineController + "-" + classSpec.Kind
-
- // Remove finalizers from old provider specific machineClass
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(MCMFinalizerName) {
- finalizers.Delete(MCMFinalizerName)
- clone.Finalizers = finalizers.List()
- }
-
- _, err = c.controlMachineClient.AlicloudMachineClasses(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
-
- case AWSMachineClassKind:
- providerSpecificMachineClass, err := c.controlMachineClient.AWSMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- if err != nil {
- return err
- }
-
- clone := providerSpecificMachineClass.DeepCopy()
- if clone.Annotations == nil {
- clone.Annotations = make(map[string]string)
- }
- clone.Annotations[machineutils.MigratedMachineClass] = MachineController + "-" + classSpec.Kind
-
- // Remove finalizers from old provider specific machineClass
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(MCMFinalizerName) {
- finalizers.Delete(MCMFinalizerName)
- clone.Finalizers = finalizers.List()
- }
-
- _, err = c.controlMachineClient.AWSMachineClasses(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
-
- case AzureMachineClassKind:
- providerSpecificMachineClass, err := c.controlMachineClient.AzureMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- if err != nil {
- return err
- }
-
- clone := providerSpecificMachineClass.DeepCopy()
- if clone.Annotations == nil {
- clone.Annotations = make(map[string]string)
- }
- clone.Annotations[machineutils.MigratedMachineClass] = MachineController + "-" + classSpec.Kind
-
- // Remove finalizers from old provider specific machineClass
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(MCMFinalizerName) {
- finalizers.Delete(MCMFinalizerName)
- clone.Finalizers = finalizers.List()
- }
-
- _, err = c.controlMachineClient.AzureMachineClasses(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
-
- case GCPMachineClassKind:
- providerSpecificMachineClass, err := c.controlMachineClient.GCPMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- if err != nil {
- return err
- }
-
- clone := providerSpecificMachineClass.DeepCopy()
- if clone.Annotations == nil {
- clone.Annotations = make(map[string]string)
- }
- clone.Annotations[machineutils.MigratedMachineClass] = MachineController + "-" + classSpec.Kind
-
- // Remove finalizers from old provider specific machineClass
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(MCMFinalizerName) {
- finalizers.Delete(MCMFinalizerName)
- clone.Finalizers = finalizers.List()
- }
-
- _, err = c.controlMachineClient.GCPMachineClasses(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
-
- case OpenStackMachineClassKind:
- providerSpecificMachineClass, err := c.controlMachineClient.OpenStackMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- if err != nil {
- return err
- }
-
- clone := providerSpecificMachineClass.DeepCopy()
- if clone.Annotations == nil {
- clone.Annotations = make(map[string]string)
- }
- clone.Annotations[machineutils.MigratedMachineClass] = MachineController + "-" + classSpec.Kind
-
- // Remove finalizers from old provider specific machineClass
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(MCMFinalizerName) {
- finalizers.Delete(MCMFinalizerName)
- clone.Finalizers = finalizers.List()
- }
-
- _, err = c.controlMachineClient.OpenStackMachineClasses(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
-
- case PacketMachineClassKind:
- providerSpecificMachineClass, err := c.controlMachineClient.PacketMachineClasses(c.namespace).Get(ctx, classSpec.Name, metav1.GetOptions{
- TypeMeta: metav1.TypeMeta{},
- ResourceVersion: "",
- })
- if err != nil {
- return err
- }
-
- clone := providerSpecificMachineClass.DeepCopy()
- if clone.Annotations == nil {
- clone.Annotations = make(map[string]string)
- }
- clone.Annotations[machineutils.MigratedMachineClass] = MachineController + "-" + classSpec.Kind
-
- // Remove finalizers from old provider specific machineClass
- if finalizers := sets.NewString(clone.Finalizers...); finalizers.Has(MCMFinalizerName) {
- finalizers.Delete(MCMFinalizerName)
- clone.Finalizers = finalizers.List()
- }
-
- _, err = c.controlMachineClient.PacketMachineClasses(c.namespace).Update(ctx, clone, metav1.UpdateOptions{})
- if err != nil {
- return err
- }
- }
-
- klog.V(1).Infof("Set migrated annotation for ProviderSpecificMachineClass %s/%s", classSpec.Kind, classSpec.Name)
-
- return nil
-}
-
-// TryMachineClassMigration tries to migrate the provider-specific machine class to the generic machine-class.
-func (c *controller) TryMachineClassMigration(ctx context.Context, classSpec *v1alpha1.ClassSpec) (*v1alpha1.MachineClass, map[string][]byte, machineutils.RetryPeriod, error) {
- var (
- err error
- providerSpecificMachineClass interface{}
- updateMachineClassObjects = true
- )
-
- // Get the provider specific (e.g. AWSMachineClass) from the classSpec
- if providerSpecificMachineClass, err = c.getProviderSpecificMachineClass(ctx, classSpec); err != nil {
- if err.Error() == "ProviderMachineClass not found. Found a MachineClass with matching name" {
- klog.Info(err.Error() + ". However, will continue with this migration with class reference updates.")
- updateMachineClassObjects = false
- } else {
- return nil, nil, machineutils.ShortRetry, err
- }
- }
-
- if updateMachineClassObjects {
- // Create/Apply the new MachineClass CR by copying/migrating over all the fields.
- if retry, err := c.createMachineClass(ctx, providerSpecificMachineClass, classSpec); err != nil {
- return nil, nil, retry, err
- }
- }
-
- // Update any references to the old {Provider}MachineClass CR.
- if err = c.updateClassReferences(ctx, classSpec); err != nil {
- return nil, nil, machineutils.ShortRetry, err
- }
-
- if updateMachineClassObjects {
- // Annotate the old {Provider}MachineClass CR with an migrated annotation.
- if err = c.addMigratedAnnotationForProviderMachineClass(ctx, classSpec); err != nil {
- return nil, nil, machineutils.ShortRetry, err
- }
- }
-
- klog.V(1).Infof("Migration successful for class %s/%s", classSpec.Kind, classSpec.Name)
-
- return nil, nil, machineutils.ShortRetry, nil
-}
diff --git a/pkg/util/provider/machinecontroller/migrate_machineclass_test.go b/pkg/util/provider/machinecontroller/migrate_machineclass_test.go
deleted file mode 100644
index b15f8e095..000000000
--- a/pkg/util/provider/machinecontroller/migrate_machineclass_test.go
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
-Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-package controller
-
-import (
- "context"
- "fmt"
-
- "github.com/gardener/machine-controller-manager/pkg/apis/machine/v1alpha1"
- customfake "github.com/gardener/machine-controller-manager/pkg/fakeclient"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/driver"
- "github.com/gardener/machine-controller-manager/pkg/util/provider/machineutils"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/ginkgo/extensions/table"
- . "github.com/onsi/gomega"
- metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- "k8s.io/apimachinery/pkg/runtime"
-)
-
-var (
- machines = []*v1alpha1.Machine{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Kind: GCPMachineClassKind,
- Name: TestMachineClassName,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- Status: v1alpha1.MachineStatus{},
- },
- }
- machineSets = []*v1alpha1.MachineSet{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineSetName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.MachineSetSpec{
- Replicas: 0,
- Selector: &metav1.LabelSelector{},
- Template: v1alpha1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Kind: GCPMachineClassKind,
- Name: TestMachineClassName,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- },
- MinReadySeconds: 0,
- },
- Status: v1alpha1.MachineSetStatus{},
- },
- }
- machineDeployments = []*v1alpha1.MachineDeployment{
- {
- TypeMeta: metav1.TypeMeta{},
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineDeploymentName,
- Namespace: TestNamespace,
- },
- Spec: v1alpha1.MachineDeploymentSpec{
- Replicas: 0,
- Selector: &metav1.LabelSelector{},
- Template: v1alpha1.MachineTemplateSpec{
- ObjectMeta: metav1.ObjectMeta{},
- Spec: v1alpha1.MachineSpec{
- Class: v1alpha1.ClassSpec{
- Kind: GCPMachineClassKind,
- Name: TestMachineClassName,
- },
- ProviderID: "",
- NodeTemplateSpec: v1alpha1.NodeTemplateSpec{},
- MachineConfiguration: &v1alpha1.MachineConfiguration{},
- },
- },
- Strategy: v1alpha1.MachineDeploymentStrategy{},
- MinReadySeconds: 0,
- RevisionHistoryLimit: new(int32),
- Paused: false,
- RollbackTo: &v1alpha1.RollbackConfig{},
- ProgressDeadlineSeconds: new(int32),
- },
- Status: v1alpha1.MachineDeploymentStatus{},
- },
- }
-)
-
-var _ = Describe("machine", func() {
-
- Describe("#TryMachineClassMigration", func() {
- type setup struct {
- gcpMachineClass []*v1alpha1.GCPMachineClass
- fakeResourceActions *customfake.ResourceActions
- machineClass []*v1alpha1.MachineClass
- }
- type action struct {
- classSpec *v1alpha1.ClassSpec
- fakeDriver *driver.FakeDriver
- }
- type expect struct {
- err error
- gcpMachineClass *v1alpha1.GCPMachineClass
- machineClass *v1alpha1.MachineClass
-
- retry machineutils.RetryPeriod
- }
- type data struct {
- setup setup
- action action
- expect expect
- }
- DescribeTable("##gcp",
- func(data *data) {
- stop := make(chan struct{})
- defer close(stop)
-
- machineObjects := []runtime.Object{}
-
- for _, o := range data.setup.gcpMachineClass {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range data.setup.machineClass {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range machines {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range machineSets {
- machineObjects = append(machineObjects, o)
- }
- for _, o := range machineDeployments {
- machineObjects = append(machineObjects, o)
- }
-
- fakedriver := driver.NewFakeDriver(
- data.action.fakeDriver.VMExists,
- data.action.fakeDriver.ProviderID,
- data.action.fakeDriver.NodeName,
- data.action.fakeDriver.LastKnownState,
- data.action.fakeDriver.Err,
- nil,
- )
-
- controller, trackers := createController(stop, TestNamespace, machineObjects, nil, nil, fakedriver)
- defer trackers.Stop()
- waitForCacheSync(stop, controller)
-
- action := data.action
- if data.setup.gcpMachineClass != nil {
- _, err := controller.controlMachineClient.GCPMachineClasses(TestNamespace).Get(context.TODO(), action.classSpec.Name, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
- }
-
- _, _, retry, err := controller.TryMachineClassMigration(context.TODO(), data.action.classSpec)
- Expect(retry).To(Equal(data.expect.retry))
- waitForCacheSync(stop, controller)
-
- if data.expect.err != nil || err != nil {
- Expect(err).To(HaveOccurred())
- Expect(err.Error()).To(Equal(data.expect.err.Error()))
- } else {
- Expect(err).ToNot(HaveOccurred())
-
- if data.expect.gcpMachineClass != nil {
- actualGCPMachineClass, err := controller.controlMachineClient.GCPMachineClasses(TestNamespace).Get(context.TODO(), action.classSpec.Name, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
- Expect(data.expect.gcpMachineClass).To(Equal(actualGCPMachineClass))
- }
-
- actualMachineClass, err := controller.controlMachineClient.MachineClasses(TestNamespace).Get(context.TODO(), action.classSpec.Name, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
- Expect(data.expect.machineClass).To(Equal(actualMachineClass))
-
- actualMachine, err := controller.controlMachineClient.Machines(TestNamespace).Get(context.TODO(), TestMachineName, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
- Expect(actualMachine.Spec.Class.Kind).To(Equal(machineutils.MachineClassKind))
-
- actualMachineSet, err := controller.controlMachineClient.MachineSets(TestNamespace).Get(context.TODO(), TestMachineSetName, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
- Expect(actualMachineSet.Spec.Template.Spec.Class.Kind).To(Equal(machineutils.MachineClassKind))
-
- actualMachineDeployment, err := controller.controlMachineClient.MachineDeployments(TestNamespace).Get(context.TODO(), TestMachineDeploymentName, metav1.GetOptions{})
- Expect(err).ToNot(HaveOccurred())
- Expect(actualMachineDeployment.Spec.Template.Spec.Class.Kind).To(Equal(machineutils.MachineClassKind))
- }
- },
-
- Entry("MachineClass migration successful for GCP machine class by creating new machine class", &data{
- setup: setup{
- gcpMachineClass: []*v1alpha1.GCPMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{},
- },
- },
- },
- action: action{
- classSpec: &v1alpha1.ClassSpec{
- Kind: GCPMachineClassKind,
- Name: TestMachineClassName,
- },
- fakeDriver: &driver.FakeDriver{
- VMExists: false,
- ProviderID: "fakeID-0",
- NodeName: "fakeNode-0",
- Err: nil,
- },
- },
- expect: expect{
- machineClass: &v1alpha1.MachineClass{
- TypeMeta: metav1.TypeMeta{},
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- ProviderSpec: runtime.RawExtension{},
- SecretRef: nil,
- Provider: "FakeProvider",
- },
- gcpMachineClass: &v1alpha1.GCPMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- Annotations: map[string]string{
- machineutils.MigratedMachineClass: "machine-controller-GCPMachineClass",
- },
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{},
- },
- err: nil,
- retry: machineutils.ShortRetry,
- },
- }),
- Entry("MachineClass migration successful for GCP machine class by updating existing machine class", &data{
- setup: setup{
- gcpMachineClass: []*v1alpha1.GCPMachineClass{
- {
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{},
- },
- },
- machineClass: []*v1alpha1.MachineClass{
- {
- TypeMeta: metav1.TypeMeta{},
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- ProviderSpec: runtime.RawExtension{},
- SecretRef: nil,
- Provider: "ERROR",
- },
- },
- },
- action: action{
- classSpec: &v1alpha1.ClassSpec{
- Kind: GCPMachineClassKind,
- Name: TestMachineClassName,
- },
- fakeDriver: &driver.FakeDriver{
- VMExists: false,
- ProviderID: "fakeID-0",
- NodeName: "fakeNode-0",
- Err: nil,
- },
- },
- expect: expect{
- machineClass: &v1alpha1.MachineClass{
- TypeMeta: metav1.TypeMeta{},
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- ProviderSpec: runtime.RawExtension{},
- SecretRef: nil,
- Provider: "FakeProvider",
- },
- gcpMachineClass: &v1alpha1.GCPMachineClass{
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- Annotations: map[string]string{
- machineutils.MigratedMachineClass: "machine-controller-GCPMachineClass",
- },
- },
- TypeMeta: metav1.TypeMeta{},
- Spec: v1alpha1.GCPMachineClassSpec{},
- },
- err: nil,
- retry: machineutils.ShortRetry,
- },
- }),
- Entry("MachineClass migration succeeds by only updating existing machine class references as machineClass with same name was found", &data{
- setup: setup{
- machineClass: []*v1alpha1.MachineClass{
- {
- TypeMeta: metav1.TypeMeta{},
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- ProviderSpec: runtime.RawExtension{},
- SecretRef: nil,
- Provider: "FakeProvider",
- },
- },
- },
- action: action{
- classSpec: &v1alpha1.ClassSpec{
- Kind: GCPMachineClassKind,
- Name: TestMachineClassName,
- },
- fakeDriver: &driver.FakeDriver{
- VMExists: false,
- ProviderID: "fakeID-0",
- NodeName: "fakeNode-0",
- Err: nil,
- },
- },
- expect: expect{
- machineClass: &v1alpha1.MachineClass{
- TypeMeta: metav1.TypeMeta{},
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- ProviderSpec: runtime.RawExtension{},
- SecretRef: nil,
- Provider: "FakeProvider",
- },
- err: nil,
- retry: machineutils.ShortRetry,
- },
- }),
- Entry("MachineClass migration fails as existing machine class references as machineClass with same name was not found", &data{
- setup: setup{
- machineClass: []*v1alpha1.MachineClass{
- {
- TypeMeta: metav1.TypeMeta{},
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName + "-error",
- Namespace: TestNamespace,
- },
- ProviderSpec: runtime.RawExtension{},
- SecretRef: nil,
- Provider: "FakeProvider",
- },
- },
- },
- action: action{
- classSpec: &v1alpha1.ClassSpec{
- Kind: GCPMachineClassKind,
- Name: TestMachineClassName,
- },
- fakeDriver: &driver.FakeDriver{
- VMExists: false,
- ProviderID: "fakeID-0",
- NodeName: "fakeNode-0",
- Err: nil,
- },
- },
- expect: expect{
- machineClass: &v1alpha1.MachineClass{
- TypeMeta: metav1.TypeMeta{},
- ObjectMeta: metav1.ObjectMeta{
- Name: TestMachineClassName,
- Namespace: TestNamespace,
- },
- ProviderSpec: runtime.RawExtension{},
- SecretRef: nil,
- Provider: "FakeProvider",
- },
- err: fmt.Errorf("gcpmachineclasses.machine.sapcloud.io \"test-mc\" not found"),
- retry: machineutils.ShortRetry,
- },
- }),
- )
- })
-})
diff --git a/pkg/util/provider/options/types.go b/pkg/util/provider/options/types.go
index 5a752b692..d64f11ed5 100644
--- a/pkg/util/provider/options/types.go
+++ b/pkg/util/provider/options/types.go
@@ -90,13 +90,13 @@ type MachineControllerConfiguration struct {
// SafetyOptions are used to configure the upper-limit and lower-limit
// while configuring freezing of machineSet objects
type SafetyOptions struct {
- // Timeout (in durartion) used while creation of
+ // Timeout (in duration) used while creation of
// a machine before it is declared as failed
MachineCreationTimeout metav1.Duration
- // Timeout (in durartion) used while health-check of
+ // Timeout (in duration) used while health-check of
// a machine before it is declared as failed
MachineHealthTimeout metav1.Duration
- // Deprecated. No effect. Timeout (in durartion) used while draining of machine before deletion,
+ // Timeout (in duration) used while draining of machine before deletion,
// beyond which it forcefully deletes machine
MachineDrainTimeout metav1.Duration
// Maximum number of times evicts would be attempted on a pod for it is forcibly deleted
diff --git a/pkg/util/worker/worker.go b/pkg/util/worker/worker.go
new file mode 100644
index 000000000..2ac3f7d48
--- /dev/null
+++ b/pkg/util/worker/worker.go
@@ -0,0 +1,64 @@
+package worker
+
+import (
+ "sync"
+ "time"
+
+ "k8s.io/apimachinery/pkg/util/wait"
+ "k8s.io/client-go/util/workqueue"
+ "k8s.io/klog/v2"
+)
+
+const (
+ // DefaultMaxRetries is the default value for max number of re-queues when running worker.Run
+ DefaultMaxRetries = 15
+)
+
+// Run creates and runs a worker routine that just processes items in the
+// specified queue. The worker will run until stopCh is closed. The worker will be
+// added to the wait group when started and marked done when finished.
+func Run(queue workqueue.RateLimitingInterface, resourceType string, maxRetries int, forgetAfterSuccess bool, reconciler func(key string) error, stopCh <-chan struct{}, waitGroup *sync.WaitGroup) {
+ waitGroup.Add(1)
+ go func() {
+ wait.Until(worker(queue, resourceType, maxRetries, forgetAfterSuccess, reconciler), time.Second, stopCh)
+ waitGroup.Done()
+ }()
+}
+
+// worker runs a worker thread that just dequeues items, processes them, and marks them done.
+// If reconciler returns an error, requeue the item up to maxRetries before giving up.
+// It enforces that the reconciler is never invoked concurrently with the same key.
+// If forgetAfterSuccess is true, it will cause the queue to forget the item should reconciliation
+// have no error.
+func worker(queue workqueue.RateLimitingInterface, resourceType string, maxRetries int, forgetAfterSuccess bool, reconciler func(key string) error) func() {
+ return func() {
+ exit := false
+ for !exit {
+ exit = func() bool {
+ key, quit := queue.Get()
+ if quit {
+ return true
+ }
+ defer queue.Done(key)
+
+ err := reconciler(key.(string))
+ if err == nil {
+ if forgetAfterSuccess {
+ queue.Forget(key)
+ }
+ return false
+ }
+
+ if queue.NumRequeues(key) < maxRetries {
+ klog.V(4).Infof("Error syncing %s %v: %v", resourceType, key, err)
+ queue.AddRateLimited(key)
+ return false
+ }
+
+ klog.V(4).Infof("Dropping %s %q out of the queue: %v", resourceType, key, err)
+ queue.Forget(key)
+ return false
+ }()
+ }
+ }
+}