diff --git a/Gopkg.lock b/Gopkg.lock index 6146b661f..1a00e5c03 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -511,11 +511,14 @@ revision = "5933b9771b71c2d05543a0cd088542013c1446e0" [[projects]] - digest = "1:032b67ae5a3cd593171814b4f6e659831d4de7885e4aedae9dfb9f2b89d612c0" + digest = "1:2c310b2c2e8837e5cbfce86ca9af127bf312877337168f20b7e5e382352ff25a" name = "sigs.k8s.io/cluster-api" packages = [ "pkg/apis/cluster/common", "pkg/apis/cluster/v1alpha1", + "pkg/client/clientset_generated/clientset", + "pkg/client/clientset_generated/clientset/scheme", + "pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", ] pruneopts = "NUT" revision = "45f1c93260140936c610e56575d7505ba3d52444" @@ -558,6 +561,7 @@ "k8s.io/apimachinery/pkg/labels", "k8s.io/apimachinery/pkg/runtime", "k8s.io/apimachinery/pkg/util/intstr", + "k8s.io/apimachinery/pkg/util/wait", "k8s.io/client-go/kubernetes", "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1", "k8s.io/client-go/kubernetes/typed/apps/v1", @@ -572,6 +576,8 @@ "k8s.io/kubernetes/pkg/registry/core/service/ipallocator", "sigs.k8s.io/cluster-api/pkg/apis/cluster/common", "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1", + "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset", + "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1", ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/pkg/installer/installation/prerequisites.go b/pkg/installer/installation/prerequisites.go index 08629db69..2732dc739 100644 --- a/pkg/installer/installation/prerequisites.go +++ b/pkg/installer/installation/prerequisites.go @@ -6,7 +6,6 @@ import ( "github.com/kubermatic/kubeone/pkg/config" "github.com/kubermatic/kubeone/pkg/installer/util" "github.com/kubermatic/kubeone/pkg/ssh" - "github.com/kubermatic/kubeone/pkg/templates/machinecontroller" ) const dockerVersion = "18.09.2" @@ -23,15 +22,6 @@ func installPrerequisites(ctx *util.Context) error { func generateConfigurationFiles(ctx *util.Context) error { ctx.Configuration.AddFile("cfg/cloud-config", ctx.Cluster.Provider.CloudConfig) - - if len(ctx.Cluster.Workers) > 0 { - machines, deployErr := machinecontroller.MachineDeployments(ctx.Cluster) - if deployErr != nil { - return fmt.Errorf("failed to create worker machine configuration: %v", deployErr) - } - ctx.Configuration.AddFile("workers.yaml", machines) - } - return nil } diff --git a/pkg/installer/installation/worker.go b/pkg/installer/installation/worker.go index bfa1f6b45..601ba0982 100644 --- a/pkg/installer/installation/worker.go +++ b/pkg/installer/installation/worker.go @@ -5,9 +5,7 @@ import ( "fmt" "time" - "github.com/kubermatic/kubeone/pkg/config" "github.com/kubermatic/kubeone/pkg/installer/util" - "github.com/kubermatic/kubeone/pkg/ssh" "github.com/kubermatic/kubeone/pkg/templates/machinecontroller" ) @@ -16,37 +14,17 @@ func createWorkerMachines(ctx *util.Context) error { return nil } - return ctx.RunTaskOnLeader(func(ctx *util.Context, _ *config.HostConfig, conn ssh.Connection) error { - ctx.Logger.Infoln("Waiting for machine-controller to come up…") - - cmd := fmt.Sprintf( - `kubectl -n "%s" get pods -l '%s=%s' -o jsonpath='{.items[0].status.phase}'`, - machinecontroller.WebhookNamespace, - machinecontroller.WebhookAppLabelKey, - machinecontroller.WebhookAppLabelValue, - ) - if !ctx.Runner.WaitForCondition(cmd, 1*time.Minute, util.IsRunning) { - return errors.New("machine-controller-webhook did not come up") - } - - cmd = fmt.Sprintf( - `kubectl -n "%s" get pods -l '%s=%s' -o jsonpath='{.items[0].status.phase}'`, - machinecontroller.MachineControllerNamespace, - machinecontroller.MachineControllerAppLabelKey, - machinecontroller.MachineControllerAppLabelValue, - ) - if !ctx.Runner.WaitForCondition(cmd, 1*time.Minute, util.IsRunning) { - return errors.New("machine-controller did not come up") - } - - // it can still take a bit before the MC is actually ready - time.Sleep(10 * time.Second) + ctx.Logger.Infoln("Waiting for machine-controller to come up…") + if err := machinecontroller.WaitForWebhook(ctx.Clientset.CoreV1()); err != nil { + return fmt.Errorf("machine-controller-webhook did not come up: %v", err) + } + if err := machinecontroller.WaitForMachineController(ctx.Clientset.CoreV1()); err != nil { + return errors.New("machine-controller did not come up") + } - ctx.Logger.Infoln("Creating worker machines…") - _, _, err := ctx.Runner.Run(`kubectl apply -f ./{{ .WORK_DIR }}/workers.yaml`, util.TemplateVariables{ - "WORK_DIR": ctx.WorkDir, - }) + // it can still take a bit before the MC is actually ready + time.Sleep(10 * time.Second) - return err - }) + ctx.Logger.Infoln("Creating worker machines…") + return machinecontroller.DeployMachineDeployments(ctx) } diff --git a/pkg/templates/ark/ark.go b/pkg/templates/ark/ark.go index 52394e0f3..a8b3cb617 100644 --- a/pkg/templates/ark/ark.go +++ b/pkg/templates/ark/ark.go @@ -29,6 +29,9 @@ func Deploy(ctx *util.Context) error { if ctx.APIExtensionClientset == nil { return errors.New("kubernetes apiextension clientset not initialized") } + if ctx.RESTConfig == nil { + return errors.New("kubernetes rest config not initialized") + } // Kubernetes clientsets coreClient := ctx.Clientset.CoreV1() @@ -118,10 +121,10 @@ func Deploy(ctx *util.Context) error { return nil } -func ensureBackupStorageLocation(backupLocationInterface arkclientset.BackupStorageLocationInterface, required *arkv1.BackupStorageLocation) error { - existing, err := backupLocationInterface.Get(required.Name, metav1.GetOptions{}) +func ensureBackupStorageLocation(backupStorageLocationsClient arkclientset.BackupStorageLocationInterface, required *arkv1.BackupStorageLocation) error { + existing, err := backupStorageLocationsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = backupLocationInterface.Create(required) + _, err = backupStorageLocationsClient.Create(required) return err } if err != nil { @@ -135,14 +138,14 @@ func ensureBackupStorageLocation(backupLocationInterface arkclientset.BackupStor return nil } - _, err = backupLocationInterface.Update(existing) + _, err = backupStorageLocationsClient.Update(existing) return err } -func ensureVolumeSnapshotLocation(snapshotLocationInterface arkclientset.VolumeSnapshotLocationInterface, required *arkv1.VolumeSnapshotLocation) error { - existing, err := snapshotLocationInterface.Get(required.Name, metav1.GetOptions{}) +func ensureVolumeSnapshotLocation(volumeSnapshotLocationsClient arkclientset.VolumeSnapshotLocationInterface, required *arkv1.VolumeSnapshotLocation) error { + existing, err := volumeSnapshotLocationsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = snapshotLocationInterface.Create(required) + _, err = volumeSnapshotLocationsClient.Create(required) return err } if err != nil { @@ -156,6 +159,6 @@ func ensureVolumeSnapshotLocation(snapshotLocationInterface arkclientset.VolumeS return nil } - _, err = snapshotLocationInterface.Update(existing) + _, err = volumeSnapshotLocationsClient.Update(existing) return err } diff --git a/pkg/templates/machinecontroller/deployment.go b/pkg/templates/machinecontroller/deployment.go index 35ebf305f..da47967eb 100644 --- a/pkg/templates/machinecontroller/deployment.go +++ b/pkg/templates/machinecontroller/deployment.go @@ -2,7 +2,9 @@ package machinecontroller import ( "errors" + "fmt" "net" + "time" "github.com/kubermatic/kubeone/pkg/config" "github.com/kubermatic/kubeone/pkg/installer/util" @@ -14,6 +16,8 @@ import ( apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/wait" + corev1types "k8s.io/client-go/kubernetes/typed/core/v1" "k8s.io/kubernetes/pkg/registry/core/service/ipallocator" ) @@ -134,6 +138,22 @@ func Deploy(ctx *util.Context) error { return nil } +// WaitForMachineController waits for machine-controller-webhook to become running +func WaitForMachineController(corev1Client corev1types.CoreV1Interface) error { + return wait.Poll(5*time.Second, 3*time.Minute, func() (bool, error) { + machineControllerPods, err := corev1Client.Pods(WebhookNamespace).List(metav1.ListOptions{ + LabelSelector: fmt.Sprintf("%s=%s", MachineControllerAppLabelKey, MachineControllerAppLabelValue), + }) + if err != nil { + return false, err + } + if machineControllerPods.Items[0].Status.Phase == corev1.PodRunning { + return true, nil + } + return false, nil + }) +} + func machineControllerServiceAccount() *corev1.ServiceAccount { return &corev1.ServiceAccount{ TypeMeta: metav1.TypeMeta{ diff --git a/pkg/templates/machinecontroller/machines.go b/pkg/templates/machinecontroller/machines.go index 86c4e0401..455532b4b 100644 --- a/pkg/templates/machinecontroller/machines.go +++ b/pkg/templates/machinecontroller/machines.go @@ -6,14 +6,19 @@ import ( "fmt" "github.com/kubermatic/kubeone/pkg/config" + "github.com/kubermatic/kubeone/pkg/installer/util" "github.com/kubermatic/kubeone/pkg/templates" + "k8s.io/apimachinery/pkg/api/equality" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/intstr" clustercommon "sigs.k8s.io/cluster-api/pkg/apis/cluster/common" clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + clusterclientset "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset" + clustertypes "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" ) type providerSpec struct { @@ -24,20 +29,36 @@ type providerSpec struct { OperatingSystemSpec interface{} `json:"operatingSystemSpec"` } -// MachineDeployments returns YAML manifests for MachineDeployments -func MachineDeployments(cluster *config.Cluster) (string, error) { - deployments := make([]interface{}, 0) +// DeployMachineDeployments deploys MachineDeployments that create appropriate machines +func DeployMachineDeployments(ctx *util.Context) error { + if ctx.Clientset == nil { + return errors.New("kubernetes clientset not initialized") + } + if ctx.RESTConfig == nil { + return errors.New("kubernetes rest config not initialized") + } + + // Create Cluster-API clientset + clusterapiClientset, err := clusterclientset.NewForConfig(ctx.RESTConfig) + if err != nil { + return err + } + clusterapiClient := clusterapiClientset.ClusterV1alpha1() - for _, workerset := range cluster.Workers { - deployment, err := createMachineDeployment(cluster, workerset) + // Apply MachineDeployments + for _, workerset := range ctx.Cluster.Workers { + deployment, err := createMachineDeployment(ctx.Cluster, workerset) if err != nil { - return "", err + return err } - deployments = append(deployments, deployment) + err = ensureMachineDeployment(clusterapiClient.MachineDeployments(deployment.Namespace), deployment) + if err != nil { + return err + } } - return templates.KubernetesToYAML(deployments) + return nil } func createMachineDeployment(cluster *config.Cluster, workerset config.WorkerConfig) (*clusterv1alpha1.MachineDeployment, error) { @@ -113,6 +134,27 @@ func createMachineDeployment(cluster *config.Cluster, workerset config.WorkerCon }, nil } +func ensureMachineDeployment(machineDeploymentsClient clustertypes.MachineDeploymentInterface, required *clusterv1alpha1.MachineDeployment) error { + existing, err := machineDeploymentsClient.Get(required.Name, metav1.GetOptions{}) + if apierrors.IsNotFound(err) { + _, err = machineDeploymentsClient.Create(required) + return err + } + if err != nil { + return err + } + + modified := false + templates.MergeStringMap(&modified, &existing.ObjectMeta.Annotations, required.ObjectMeta.Annotations) + templates.MergeStringMap(&modified, &existing.ObjectMeta.Labels, required.ObjectMeta.Labels) + if equality.Semantic.DeepEqual(required.Spec, existing.Spec) && !modified { + return nil + } + + _, err = machineDeploymentsClient.Update(existing) + return err +} + func machineSpec(cluster *config.Cluster, workerset config.WorkerConfig, provider config.ProviderName) (map[string]interface{}, error) { var err error diff --git a/pkg/templates/machinecontroller/webhook.go b/pkg/templates/machinecontroller/webhook.go index fa9a7abde..783313ff7 100644 --- a/pkg/templates/machinecontroller/webhook.go +++ b/pkg/templates/machinecontroller/webhook.go @@ -3,6 +3,7 @@ package machinecontroller import ( "errors" "fmt" + "time" "github.com/kubermatic/kubeone/pkg/certificate" "github.com/kubermatic/kubeone/pkg/config" @@ -14,6 +15,8 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/apimachinery/pkg/util/wait" + corev1types "k8s.io/client-go/kubernetes/typed/core/v1" certutil "k8s.io/client-go/util/cert" "k8s.io/client-go/util/cert/triple" ) @@ -44,21 +47,21 @@ func DeployWebhookConfiguration(ctx *util.Context) error { } // Deploy Webhook - deployment := WebhookDeployment(ctx.Cluster) + deployment := webhookDeployment(ctx.Cluster) err = templates.EnsureDeployment(appsClient.Deployments(deployment.Namespace), deployment) if err != nil { return err } // Deploy Webhook service - svc := Service() + svc := service() err = templates.EnsureService(coreClient.Services(svc.Namespace), svc) if err != nil { return err } // Deploy serving certificate secret - servingCert, err := TLSServingCertificate(caKeyPair) + servingCert, err := tlsServingCertificate(caKeyPair) if err != nil { return err } @@ -69,11 +72,27 @@ func DeployWebhookConfiguration(ctx *util.Context) error { return templates.EnsureMutatingWebhookConfiguration( admissionClient.MutatingWebhookConfigurations(), - MutatingwebhookConfiguration(caKeyPair)) + mutatingwebhookConfiguration(caKeyPair)) } -// WebhookDeployment returns the deployment for the machine-controllers MutatignAdmissionWebhook -func WebhookDeployment(cluster *config.Cluster) *appsv1.Deployment { +// WaitForWebhook waits for machine-controller-webhook to become running +func WaitForWebhook(corev1Client corev1types.CoreV1Interface) error { + return wait.Poll(5*time.Second, 3*time.Minute, func() (bool, error) { + webhookPods, err := corev1Client.Pods(WebhookNamespace).List(metav1.ListOptions{ + LabelSelector: fmt.Sprintf("%s=%s", WebhookAppLabelKey, WebhookAppLabelValue), + }) + if err != nil { + return false, err + } + if webhookPods.Items[0].Status.Phase == corev1.PodRunning { + return true, nil + } + return false, nil + }) +} + +// webhookDeployment returns the deployment for the machine-controllers MutatignAdmissionWebhook +func webhookDeployment(cluster *config.Cluster) *appsv1.Deployment { dep := &appsv1.Deployment{ TypeMeta: metav1.TypeMeta{ APIVersion: "apps/v1", @@ -178,8 +197,8 @@ func WebhookDeployment(cluster *config.Cluster) *appsv1.Deployment { return dep } -// Service returns the internal service for the machine-controller webhook -func Service() *corev1.Service { +// service returns the internal service for the machine-controller webhook +func service() *corev1.Service { se := &corev1.Service{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", @@ -220,8 +239,8 @@ func getServingCertVolume() corev1.Volume { } } -// TLSServingCertificate returns a secret with the machine-controller-webhook tls certificate -func TLSServingCertificate(ca *triple.KeyPair) (*corev1.Secret, error) { +// tlsServingCertificate returns a secret with the machine-controller-webhook tls certificate +func tlsServingCertificate(ca *triple.KeyPair) (*corev1.Secret, error) { se := &corev1.Secret{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", @@ -254,8 +273,8 @@ func TLSServingCertificate(ca *triple.KeyPair) (*corev1.Secret, error) { return se, nil } -// MutatingwebhookConfiguration returns the MutatingwebhookConfiguration for the machine controler -func MutatingwebhookConfiguration(ca *triple.KeyPair) *admissionregistrationv1beta1.MutatingWebhookConfiguration { +// mutatingwebhookConfiguration returns the MutatingwebhookConfiguration for the machine controler +func mutatingwebhookConfiguration(ca *triple.KeyPair) *admissionregistrationv1beta1.MutatingWebhookConfiguration { cfg := &admissionregistrationv1beta1.MutatingWebhookConfiguration{ TypeMeta: metav1.TypeMeta{ APIVersion: "admissionregistration.k8s.io/v1beta1", diff --git a/pkg/templates/resources.go b/pkg/templates/resources.go index 3a503ae14..567b86840 100644 --- a/pkg/templates/resources.go +++ b/pkg/templates/resources.go @@ -18,10 +18,10 @@ import ( // EnsureNamespace checks does Namespace already exists and creates it if it doesn't. If it already exists, // the function compares labels and annotations, and if they're not as expected updates the Namespace. -func EnsureNamespace(namespaceInterface corev1types.NamespaceInterface, required *corev1.Namespace) error { - existing, err := namespaceInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureNamespace(namespacesClient corev1types.NamespaceInterface, required *corev1.Namespace) error { + existing, err := namespacesClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = namespaceInterface.Create(required) + _, err = namespacesClient.Create(required) return err } if err != nil { @@ -35,16 +35,16 @@ func EnsureNamespace(namespaceInterface corev1types.NamespaceInterface, required return nil } - _, err = namespaceInterface.Update(existing) + _, err = namespacesClient.Update(existing) return err } // EnsureServiceAccount checks does ServiceAccount already exists and creates it if it doesn't. If it already exists, // the function compares labels and annotations, and if they're not as expected updates the ServiceAccount. -func EnsureServiceAccount(serviceAccountInterface corev1types.ServiceAccountInterface, required *corev1.ServiceAccount) error { - existing, err := serviceAccountInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureServiceAccount(serviceAccountsClient corev1types.ServiceAccountInterface, required *corev1.ServiceAccount) error { + existing, err := serviceAccountsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = serviceAccountInterface.Create(required) + _, err = serviceAccountsClient.Create(required) return err } if err != nil { @@ -58,16 +58,16 @@ func EnsureServiceAccount(serviceAccountInterface corev1types.ServiceAccountInte return nil } - _, err = serviceAccountInterface.Update(existing) + _, err = serviceAccountsClient.Update(existing) return err } // EnsureClusterRole checks does RBAC ClusterRole already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, and rules, and if they're not as expected updates the ClusterRole. -func EnsureClusterRole(clusterRoleInterface rbacv1types.ClusterRoleInterface, required *rbacv1.ClusterRole) error { - existing, err := clusterRoleInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureClusterRole(clusterRolesClient rbacv1types.ClusterRoleInterface, required *rbacv1.ClusterRole) error { + existing, err := clusterRolesClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = clusterRoleInterface.Create(required) + _, err = clusterRolesClient.Create(required) return err } if err != nil { @@ -81,16 +81,16 @@ func EnsureClusterRole(clusterRoleInterface rbacv1types.ClusterRoleInterface, re return nil } - _, err = clusterRoleInterface.Update(existing) + _, err = clusterRolesClient.Update(existing) return err } // EnsureClusterRoleBinding checks does RBAC ClusterRoleBinding already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, role references, and subjects, and if they're not as expected updates the ClusterRoleBinding. -func EnsureClusterRoleBinding(clusterRoleBindingInterface rbacv1types.ClusterRoleBindingInterface, required *rbacv1.ClusterRoleBinding) error { - existing, err := clusterRoleBindingInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureClusterRoleBinding(clusterRoleBindingsClient rbacv1types.ClusterRoleBindingInterface, required *rbacv1.ClusterRoleBinding) error { + existing, err := clusterRoleBindingsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = clusterRoleBindingInterface.Create(required) + _, err = clusterRoleBindingsClient.Create(required) return err } if err != nil { @@ -104,16 +104,16 @@ func EnsureClusterRoleBinding(clusterRoleBindingInterface rbacv1types.ClusterRol return nil } - _, err = clusterRoleBindingInterface.Update(existing) + _, err = clusterRoleBindingsClient.Update(existing) return err } // EnsureRole checks does RBAC Role already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, and rules, and if they're not as expected updates the Role. -func EnsureRole(roleInterface rbacv1types.RoleInterface, required *rbacv1.Role) error { - existing, err := roleInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureRole(rolesClient rbacv1types.RoleInterface, required *rbacv1.Role) error { + existing, err := rolesClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = roleInterface.Create(required) + _, err = rolesClient.Create(required) return err } if err != nil { @@ -127,16 +127,16 @@ func EnsureRole(roleInterface rbacv1types.RoleInterface, required *rbacv1.Role) return nil } - _, err = roleInterface.Update(existing) + _, err = rolesClient.Update(existing) return err } // EnsureRoleBinding checks does RBAC RoleBinding already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, role references, and subjects, and if they're not as expected updates the RoleBinding. -func EnsureRoleBinding(roleBindingInterface rbacv1types.RoleBindingInterface, required *rbacv1.RoleBinding) error { - existing, err := roleBindingInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureRoleBinding(roleBindingsClient rbacv1types.RoleBindingInterface, required *rbacv1.RoleBinding) error { + existing, err := roleBindingsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = roleBindingInterface.Create(required) + _, err = roleBindingsClient.Create(required) return err } if err != nil { @@ -150,16 +150,16 @@ func EnsureRoleBinding(roleBindingInterface rbacv1types.RoleBindingInterface, re return nil } - _, err = roleBindingInterface.Update(existing) + _, err = roleBindingsClient.Update(existing) return err } // EnsureConfigMap checks does ConfigMap already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, and data, and if they're not as expected updates the ConfigMap. -func EnsureConfigMap(configMapInterface corev1types.ConfigMapInterface, required *corev1.ConfigMap) error { - existing, err := configMapInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureConfigMap(configMapsClient corev1types.ConfigMapInterface, required *corev1.ConfigMap) error { + existing, err := configMapsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = configMapInterface.Create(required) + _, err = configMapsClient.Create(required) return err } if err != nil { @@ -173,16 +173,16 @@ func EnsureConfigMap(configMapInterface corev1types.ConfigMapInterface, required return nil } - _, err = configMapInterface.Update(existing) + _, err = configMapsClient.Update(existing) return err } // EnsureSecret checks does Secret already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, and data, and if they're not as expected updates the Secret. -func EnsureSecret(secretInterface corev1types.SecretInterface, required *corev1.Secret) error { - existing, err := secretInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureSecret(secretsClient corev1types.SecretInterface, required *corev1.Secret) error { + existing, err := secretsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = secretInterface.Create(required) + _, err = secretsClient.Create(required) return err } if err != nil { @@ -196,16 +196,16 @@ func EnsureSecret(secretInterface corev1types.SecretInterface, required *corev1. return nil } - _, err = secretInterface.Update(existing) + _, err = secretsClient.Update(existing) return err } // EnsureDeployment checks does Deployment already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, and spec, and if they're not as expected updates the Deployment. -func EnsureDeployment(deploymentInterface appsv1types.DeploymentInterface, required *appsv1.Deployment) error { - existing, err := deploymentInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureDeployment(deploymentsClient appsv1types.DeploymentInterface, required *appsv1.Deployment) error { + existing, err := deploymentsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = deploymentInterface.Create(required) + _, err = deploymentsClient.Create(required) return err } if err != nil { @@ -219,16 +219,16 @@ func EnsureDeployment(deploymentInterface appsv1types.DeploymentInterface, requi return nil } - _, err = deploymentInterface.Update(existing) + _, err = deploymentsClient.Update(existing) return err } // EnsureDaemonSet checks does DaemonSet already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, and spec, and if they're not as expected updates the DaemonSet. -func EnsureDaemonSet(daemonSetInterface appsv1types.DaemonSetInterface, required *appsv1.DaemonSet) error { - existing, err := daemonSetInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureDaemonSet(daemonSetsClient appsv1types.DaemonSetInterface, required *appsv1.DaemonSet) error { + existing, err := daemonSetsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = daemonSetInterface.Create(required) + _, err = daemonSetsClient.Create(required) return err } if err != nil { @@ -242,16 +242,16 @@ func EnsureDaemonSet(daemonSetInterface appsv1types.DaemonSetInterface, required return nil } - _, err = daemonSetInterface.Update(existing) + _, err = daemonSetsClient.Update(existing) return err } // EnsureService checks does Service already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, and spec, and if they're not as expected updates the Service. -func EnsureService(serviceInterface corev1types.ServiceInterface, required *corev1.Service) error { - existing, err := serviceInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureService(servicesClient corev1types.ServiceInterface, required *corev1.Service) error { + existing, err := servicesClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = serviceInterface.Create(required) + _, err = servicesClient.Create(required) return err } if err != nil { @@ -265,16 +265,16 @@ func EnsureService(serviceInterface corev1types.ServiceInterface, required *core return nil } - _, err = serviceInterface.Update(existing) + _, err = servicesClient.Update(existing) return err } // EnsureCRD checks does CRD already exists and creates it if it doesn't. If it already exists, // the function compares labels, annotations, and spec, and if they're not as expected updates the CRD. -func EnsureCRD(customResourceDefinitionInterface apiextensionsv1beta1types.CustomResourceDefinitionInterface, required *apiextensionsv1beta1.CustomResourceDefinition) error { - existing, err := customResourceDefinitionInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureCRD(customResourceDefinitionsClient apiextensionsv1beta1types.CustomResourceDefinitionInterface, required *apiextensionsv1beta1.CustomResourceDefinition) error { + existing, err := customResourceDefinitionsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = customResourceDefinitionInterface.Create(required) + _, err = customResourceDefinitionsClient.Create(required) return err } if err != nil { @@ -288,17 +288,17 @@ func EnsureCRD(customResourceDefinitionInterface apiextensionsv1beta1types.Custo return nil } - _, err = customResourceDefinitionInterface.Update(existing) + _, err = customResourceDefinitionsClient.Update(existing) return err } // EnsureMutatingWebhookConfiguration checks does MutatingWebhookConfiguration already exists and creates it if it doesn't. // If it already exists, the function compares labels, annotations, and spec, and if they're not as expected updates // the MutatingWebhookConfiguration. -func EnsureMutatingWebhookConfiguration(mutatingWebhookConfigurationInterface admissionregistrationv1beta1types.MutatingWebhookConfigurationInterface, required *admissionregistrationv1beta1.MutatingWebhookConfiguration) error { - existing, err := mutatingWebhookConfigurationInterface.Get(required.Name, metav1.GetOptions{}) +func EnsureMutatingWebhookConfiguration(mutatingWebhookConfigurationsClient admissionregistrationv1beta1types.MutatingWebhookConfigurationInterface, required *admissionregistrationv1beta1.MutatingWebhookConfiguration) error { + existing, err := mutatingWebhookConfigurationsClient.Get(required.Name, metav1.GetOptions{}) if apierrors.IsNotFound(err) { - _, err = mutatingWebhookConfigurationInterface.Create(required) + _, err = mutatingWebhookConfigurationsClient.Create(required) return err } if err != nil { @@ -312,6 +312,6 @@ func EnsureMutatingWebhookConfiguration(mutatingWebhookConfigurationInterface ad return nil } - _, err = mutatingWebhookConfigurationInterface.Update(existing) + _, err = mutatingWebhookConfigurationsClient.Update(existing) return err } diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/clientset.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/clientset.go new file mode 100644 index 000000000..1d5483d3f --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/clientset.go @@ -0,0 +1,98 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package clientset + +import ( + discovery "k8s.io/client-go/discovery" + rest "k8s.io/client-go/rest" + flowcontrol "k8s.io/client-go/util/flowcontrol" + clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1" +) + +type Interface interface { + Discovery() discovery.DiscoveryInterface + ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface + // Deprecated: please explicitly pick a version if possible. + Cluster() clusterv1alpha1.ClusterV1alpha1Interface +} + +// Clientset contains the clients for groups. Each group has exactly one +// version included in a Clientset. +type Clientset struct { + *discovery.DiscoveryClient + clusterV1alpha1 *clusterv1alpha1.ClusterV1alpha1Client +} + +// ClusterV1alpha1 retrieves the ClusterV1alpha1Client +func (c *Clientset) ClusterV1alpha1() clusterv1alpha1.ClusterV1alpha1Interface { + return c.clusterV1alpha1 +} + +// Deprecated: Cluster retrieves the default version of ClusterClient. +// Please explicitly pick a version. +func (c *Clientset) Cluster() clusterv1alpha1.ClusterV1alpha1Interface { + return c.clusterV1alpha1 +} + +// Discovery retrieves the DiscoveryClient +func (c *Clientset) Discovery() discovery.DiscoveryInterface { + if c == nil { + return nil + } + return c.DiscoveryClient +} + +// NewForConfig creates a new Clientset for the given config. +func NewForConfig(c *rest.Config) (*Clientset, error) { + configShallowCopy := *c + if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 { + configShallowCopy.RateLimiter = flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, configShallowCopy.Burst) + } + var cs Clientset + var err error + cs.clusterV1alpha1, err = clusterv1alpha1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + + cs.DiscoveryClient, err = discovery.NewDiscoveryClientForConfig(&configShallowCopy) + if err != nil { + return nil, err + } + return &cs, nil +} + +// NewForConfigOrDie creates a new Clientset for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *Clientset { + var cs Clientset + cs.clusterV1alpha1 = clusterv1alpha1.NewForConfigOrDie(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c) + return &cs +} + +// New creates a new Clientset for the given RESTClient. +func New(c rest.Interface) *Clientset { + var cs Clientset + cs.clusterV1alpha1 = clusterv1alpha1.New(c) + + cs.DiscoveryClient = discovery.NewDiscoveryClient(c) + return &cs +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/doc.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/doc.go new file mode 100644 index 000000000..3421911a7 --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated clientset. +package clientset diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/doc.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/doc.go new file mode 100644 index 000000000..5c5c8debb --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package contains the scheme of the automatically generated clientset. +package scheme diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go new file mode 100644 index 000000000..ecb609f77 --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme/register.go @@ -0,0 +1,56 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package scheme + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + schema "k8s.io/apimachinery/pkg/runtime/schema" + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" +) + +var Scheme = runtime.NewScheme() +var Codecs = serializer.NewCodecFactory(Scheme) +var ParameterCodec = runtime.NewParameterCodec(Scheme) +var localSchemeBuilder = runtime.SchemeBuilder{ + clusterv1alpha1.AddToScheme, +} + +// 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" +// ) +// +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// +// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types +// correctly. +var AddToScheme = localSchemeBuilder.AddToScheme + +func init() { + v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"}) + utilruntime.Must(AddToScheme(Scheme)) +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go new file mode 100644 index 000000000..531c48ba6 --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster.go @@ -0,0 +1,174 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + 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" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" +) + +// ClustersGetter has a method to return a ClusterInterface. +// A group's client should implement this interface. +type ClustersGetter interface { + Clusters(namespace string) ClusterInterface +} + +// ClusterInterface has methods to work with Cluster resources. +type ClusterInterface interface { + Create(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + Update(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + UpdateStatus(*v1alpha1.Cluster) (*v1alpha1.Cluster, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Cluster, error) + List(opts v1.ListOptions) (*v1alpha1.ClusterList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) + ClusterExpansion +} + +// clusters implements ClusterInterface +type clusters struct { + client rest.Interface + ns string +} + +// newClusters returns a Clusters +func newClusters(c *ClusterV1alpha1Client, namespace string) *clusters { + return &clusters{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the cluster, and returns the corresponding cluster object, and an error if there is any. +func (c *clusters) Get(name string, options v1.GetOptions) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Clusters that match those selectors. +func (c *clusters) List(opts v1.ListOptions) (result *v1alpha1.ClusterList, err error) { + result = &v1alpha1.ClusterList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested clusters. +func (c *clusters) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a cluster and creates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *clusters) Create(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Post(). + Namespace(c.ns). + Resource("clusters"). + Body(cluster). + Do(). + Into(result) + return +} + +// Update takes the representation of a cluster and updates it. Returns the server's representation of the cluster, and an error, if there is any. +func (c *clusters) Update(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusters"). + Name(cluster.Name). + Body(cluster). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *clusters) UpdateStatus(cluster *v1alpha1.Cluster) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Put(). + Namespace(c.ns). + Resource("clusters"). + Name(cluster.Name). + SubResource("status"). + Body(cluster). + Do(). + Into(result) + return +} + +// Delete takes name of the cluster and deletes it. Returns an error if one occurs. +func (c *clusters) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *clusters) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("clusters"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched cluster. +func (c *clusters) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Cluster, err error) { + result = &v1alpha1.Cluster{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("clusters"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go new file mode 100644 index 000000000..85c29d2fb --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/cluster_client.go @@ -0,0 +1,110 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + rest "k8s.io/client-go/rest" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" +) + +type ClusterV1alpha1Interface interface { + RESTClient() rest.Interface + ClustersGetter + MachinesGetter + MachineClassesGetter + MachineDeploymentsGetter + MachineSetsGetter +} + +// ClusterV1alpha1Client is used to interact with features provided by the cluster.k8s.io group. +type ClusterV1alpha1Client struct { + restClient rest.Interface +} + +func (c *ClusterV1alpha1Client) Clusters(namespace string) ClusterInterface { + return newClusters(c, namespace) +} + +func (c *ClusterV1alpha1Client) Machines(namespace string) MachineInterface { + return newMachines(c, namespace) +} + +func (c *ClusterV1alpha1Client) MachineClasses(namespace string) MachineClassInterface { + return newMachineClasses(c, namespace) +} + +func (c *ClusterV1alpha1Client) MachineDeployments(namespace string) MachineDeploymentInterface { + return newMachineDeployments(c, namespace) +} + +func (c *ClusterV1alpha1Client) MachineSets(namespace string) MachineSetInterface { + return newMachineSets(c, namespace) +} + +// NewForConfig creates a new ClusterV1alpha1Client for the given config. +func NewForConfig(c *rest.Config) (*ClusterV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &ClusterV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new ClusterV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *ClusterV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new ClusterV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *ClusterV1alpha1Client { + return &ClusterV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *ClusterV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/doc.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/doc.go new file mode 100644 index 000000000..69ca30111 --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/doc.go @@ -0,0 +1,20 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +// This package has the automatically generated typed clients. +package v1alpha1 diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/generated_expansion.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/generated_expansion.go new file mode 100644 index 000000000..2bb55c714 --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/generated_expansion.go @@ -0,0 +1,29 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +type ClusterExpansion interface{} + +type MachineExpansion interface{} + +type MachineClassExpansion interface{} + +type MachineDeploymentExpansion interface{} + +type MachineSetExpansion interface{} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go new file mode 100644 index 000000000..2d5b5c4cb --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machine.go @@ -0,0 +1,174 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + 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" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" +) + +// MachinesGetter has a method to return a MachineInterface. +// A group's client should implement this interface. +type MachinesGetter interface { + Machines(namespace string) MachineInterface +} + +// MachineInterface has methods to work with Machine resources. +type MachineInterface interface { + Create(*v1alpha1.Machine) (*v1alpha1.Machine, error) + Update(*v1alpha1.Machine) (*v1alpha1.Machine, error) + UpdateStatus(*v1alpha1.Machine) (*v1alpha1.Machine, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.Machine, error) + List(opts v1.ListOptions) (*v1alpha1.MachineList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Machine, err error) + MachineExpansion +} + +// machines implements MachineInterface +type machines struct { + client rest.Interface + ns string +} + +// newMachines returns a Machines +func newMachines(c *ClusterV1alpha1Client, namespace string) *machines { + return &machines{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machine, and returns the corresponding machine object, and an error if there is any. +func (c *machines) Get(name string, options v1.GetOptions) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machines"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Machines that match those selectors. +func (c *machines) List(opts v1.ListOptions) (result *v1alpha1.MachineList, err error) { + result = &v1alpha1.MachineList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machines. +func (c *machines) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machine and creates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *machines) Create(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machines"). + Body(machine). + Do(). + Into(result) + return +} + +// Update takes the representation of a machine and updates it. Returns the server's representation of the machine, and an error, if there is any. +func (c *machines) Update(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machines"). + Name(machine.Name). + Body(machine). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machines) UpdateStatus(machine *v1alpha1.Machine) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machines"). + Name(machine.Name). + SubResource("status"). + Body(machine). + Do(). + Into(result) + return +} + +// Delete takes name of the machine and deletes it. Returns an error if one occurs. +func (c *machines) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machines"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machines"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machine. +func (c *machines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.Machine, err error) { + result = &v1alpha1.Machine{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machines"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go new file mode 100644 index 000000000..9d685d94f --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineclass.go @@ -0,0 +1,157 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + 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" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" +) + +// MachineClassesGetter has a method to return a MachineClassInterface. +// A group's client should implement this interface. +type MachineClassesGetter interface { + MachineClasses(namespace string) MachineClassInterface +} + +// MachineClassInterface has methods to work with MachineClass resources. +type MachineClassInterface interface { + Create(*v1alpha1.MachineClass) (*v1alpha1.MachineClass, error) + Update(*v1alpha1.MachineClass) (*v1alpha1.MachineClass, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.MachineClass, error) + List(opts v1.ListOptions) (*v1alpha1.MachineClassList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineClass, err error) + MachineClassExpansion +} + +// machineClasses implements MachineClassInterface +type machineClasses struct { + client rest.Interface + ns string +} + +// newMachineClasses returns a MachineClasses +func newMachineClasses(c *ClusterV1alpha1Client, namespace string) *machineClasses { + return &machineClasses{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineClass, and returns the corresponding machineClass object, and an error if there is any. +func (c *machineClasses) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineClass, err error) { + result = &v1alpha1.MachineClass{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineClasses that match those selectors. +func (c *machineClasses) List(opts v1.ListOptions) (result *v1alpha1.MachineClassList, err error) { + result = &v1alpha1.MachineClassList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineClasses. +func (c *machineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineClass and creates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *machineClasses) Create(machineClass *v1alpha1.MachineClass) (result *v1alpha1.MachineClass, err error) { + result = &v1alpha1.MachineClass{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machineclasses"). + Body(machineClass). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineClass and updates it. Returns the server's representation of the machineClass, and an error, if there is any. +func (c *machineClasses) Update(machineClass *v1alpha1.MachineClass) (result *v1alpha1.MachineClass, err error) { + result = &v1alpha1.MachineClass{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machineclasses"). + Name(machineClass.Name). + Body(machineClass). + Do(). + Into(result) + return +} + +// Delete takes name of the machineClass and deletes it. Returns an error if one occurs. +func (c *machineClasses) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machineclasses"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machineclasses"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineClass. +func (c *machineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineClass, err error) { + result = &v1alpha1.MachineClass{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machineclasses"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go new file mode 100644 index 000000000..41a499054 --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machinedeployment.go @@ -0,0 +1,174 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + 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" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" +) + +// MachineDeploymentsGetter has a method to return a MachineDeploymentInterface. +// A group's client should implement this interface. +type MachineDeploymentsGetter interface { + MachineDeployments(namespace string) MachineDeploymentInterface +} + +// MachineDeploymentInterface has methods to work with MachineDeployment resources. +type MachineDeploymentInterface interface { + Create(*v1alpha1.MachineDeployment) (*v1alpha1.MachineDeployment, error) + Update(*v1alpha1.MachineDeployment) (*v1alpha1.MachineDeployment, error) + UpdateStatus(*v1alpha1.MachineDeployment) (*v1alpha1.MachineDeployment, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.MachineDeployment, error) + List(opts v1.ListOptions) (*v1alpha1.MachineDeploymentList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineDeployment, err error) + MachineDeploymentExpansion +} + +// machineDeployments implements MachineDeploymentInterface +type machineDeployments struct { + client rest.Interface + ns string +} + +// newMachineDeployments returns a MachineDeployments +func newMachineDeployments(c *ClusterV1alpha1Client, namespace string) *machineDeployments { + return &machineDeployments{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineDeployment, and returns the corresponding machineDeployment object, and an error if there is any. +func (c *machineDeployments) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineDeployments that match those selectors. +func (c *machineDeployments) List(opts v1.ListOptions) (result *v1alpha1.MachineDeploymentList, err error) { + result = &v1alpha1.MachineDeploymentList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineDeployments. +func (c *machineDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineDeployment and creates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *machineDeployments) Create(machineDeployment *v1alpha1.MachineDeployment) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machinedeployments"). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineDeployment and updates it. Returns the server's representation of the machineDeployment, and an error, if there is any. +func (c *machineDeployments) Update(machineDeployment *v1alpha1.MachineDeployment) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(machineDeployment.Name). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machineDeployments) UpdateStatus(machineDeployment *v1alpha1.MachineDeployment) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(machineDeployment.Name). + SubResource("status"). + Body(machineDeployment). + Do(). + Into(result) + return +} + +// Delete takes name of the machineDeployment and deletes it. Returns an error if one occurs. +func (c *machineDeployments) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinedeployments"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinedeployments"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineDeployment. +func (c *machineDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineDeployment, err error) { + result = &v1alpha1.MachineDeployment{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machinedeployments"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go new file mode 100644 index 000000000..25886851d --- /dev/null +++ b/vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/typed/cluster/v1alpha1/machineset.go @@ -0,0 +1,174 @@ +/* +Copyright 2018 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + 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" + v1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + scheme "sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset/scheme" +) + +// MachineSetsGetter has a method to return a MachineSetInterface. +// A group's client should implement this interface. +type MachineSetsGetter interface { + MachineSets(namespace string) MachineSetInterface +} + +// MachineSetInterface has methods to work with MachineSet resources. +type MachineSetInterface interface { + Create(*v1alpha1.MachineSet) (*v1alpha1.MachineSet, error) + Update(*v1alpha1.MachineSet) (*v1alpha1.MachineSet, error) + UpdateStatus(*v1alpha1.MachineSet) (*v1alpha1.MachineSet, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.MachineSet, error) + List(opts v1.ListOptions) (*v1alpha1.MachineSetList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineSet, err error) + MachineSetExpansion +} + +// machineSets implements MachineSetInterface +type machineSets struct { + client rest.Interface + ns string +} + +// newMachineSets returns a MachineSets +func newMachineSets(c *ClusterV1alpha1Client, namespace string) *machineSets { + return &machineSets{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the machineSet, and returns the corresponding machineSet object, and an error if there is any. +func (c *machineSets) Get(name string, options v1.GetOptions) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MachineSets that match those selectors. +func (c *machineSets) List(opts v1.ListOptions) (result *v1alpha1.MachineSetList, err error) { + result = &v1alpha1.MachineSetList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested machineSets. +func (c *machineSets) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a machineSet and creates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *machineSets) Create(machineSet *v1alpha1.MachineSet) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Post(). + Namespace(c.ns). + Resource("machinesets"). + Body(machineSet). + Do(). + Into(result) + return +} + +// Update takes the representation of a machineSet and updates it. Returns the server's representation of the machineSet, and an error, if there is any. +func (c *machineSets) Update(machineSet *v1alpha1.MachineSet) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinesets"). + Name(machineSet.Name). + Body(machineSet). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *machineSets) UpdateStatus(machineSet *v1alpha1.MachineSet) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Put(). + Namespace(c.ns). + Resource("machinesets"). + Name(machineSet.Name). + SubResource("status"). + Body(machineSet). + Do(). + Into(result) + return +} + +// Delete takes name of the machineSet and deletes it. Returns an error if one occurs. +func (c *machineSets) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinesets"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *machineSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("machinesets"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched machineSet. +func (c *machineSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.MachineSet, err error) { + result = &v1alpha1.MachineSet{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("machinesets"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +}