From 77cd0510a9c9be8003ff0677ff783427a3f6cb9f Mon Sep 17 00:00:00 2001 From: Enxebre Date: Mon, 29 Apr 2019 17:27:39 +0200 Subject: [PATCH 1/2] Add machine and labels explanation --- README.md | 13 ++++++ docs/examples/machine.yaml | 45 +++++++++++++++++++ .../machine-disruption-budget-kpe.md | 0 3 files changed, 58 insertions(+) create mode 100644 docs/examples/machine.yaml rename docs/{ => proposals}/machine-disruption-budget-kpe.md (100%) diff --git a/README.md b/README.md index 7fded4ac7d..73a1e939a4 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,19 @@ $ make nodelink-controller new instance is created. Followed by new node joining the cluster and turning in `Ready` state. +## Creating machines + +You can create a new machine by [applying a manifest representing an instance of the machine CRD](docs/examples/machine.yaml) + +The `machine.openshift.io/cluster-api-cluster` label will be used by the controllers to lookup for the right cloud instance. + +You can set other labels to provide a convenient way for users and consumers to retrieve groups of machines: +``` +machine.openshift.io/cluster-api-machine-role: worker +machine.openshift.io/cluster-api-machine-type: worker +``` + + ## Dev - Generate code (if needed): diff --git a/docs/examples/machine.yaml b/docs/examples/machine.yaml new file mode 100644 index 0000000000..f1a9920302 --- /dev/null +++ b/docs/examples/machine.yaml @@ -0,0 +1,45 @@ +apiVersion: machine.openshift.io/v1beta1 +kind: Machine +metadata: + labels: + machine.openshift.io/cluster-api-cluster: clusterID + machine.openshift.io/cluster-api-machine-role: role + machine.openshift.io/cluster-api-machine-type: role + name: machineName + namespace: openshift-machine-api +spec: + providerSpec: + value: + kind: AWSMachineProviderConfig + ami: + id: ami-0df3f99538fbef10f + apiVersion: awsproviderconfig.openshift.io/v1beta1 + blockDevices: + - ebs: + iops: 0 + volumeSize: 120 + volumeType: gp2 + credentialsSecret: + name: aws-cloud-credentials + deviceIndex: 0 + iamInstanceProfile: + id: clusterID-worker-profile + instanceType: m4.large + placement: + availabilityZone: us-east-1a + region: us-east-1 + securityGroups: + - filters: + - name: tag:Name + values: + - clusterID-worker-sg + subnet: + filters: + - name: tag:Name + values: + - clusterID-private-us-east-1a + tags: + - name: kubernetes.io/cluster/clusterID + value: owned + userDataSecret: + name: worker-user-data \ No newline at end of file diff --git a/docs/machine-disruption-budget-kpe.md b/docs/proposals/machine-disruption-budget-kpe.md similarity index 100% rename from docs/machine-disruption-budget-kpe.md rename to docs/proposals/machine-disruption-budget-kpe.md From fcaf68a11e488ba8400765848b9085db5b768a2b Mon Sep 17 00:00:00 2001 From: Enxebre Date: Thu, 2 May 2019 18:09:57 +0200 Subject: [PATCH 2/2] Revendor for https://github.com/openshift/cluster-api-actuator-pkg/pull/78 --- Gopkg.lock | 4 ++-- .../openshift/cluster-api-actuator-pkg/Gopkg.lock | 10 ++++++---- .../openshift/cluster-api-actuator-pkg/Gopkg.toml | 2 +- .../pkg/e2e/autoscaler/autoscaler.go | 1 - .../pkg/e2e/framework/clusterapi.go | 2 +- .../pkg/e2e/framework/clusters.go | 8 ++++---- .../cluster-api-actuator-pkg/pkg/e2e/infra/infra.go | 4 ++-- .../pkg/e2e/operators/utils.go | 2 +- .../pkg/manifests/manifests.go | 6 +++--- 9 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 66a39ecf3b..2082430d54 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -441,7 +441,7 @@ [[projects]] branch = "master" - digest = "1:9941e130964f8b2d2f1b17084ed0d254e00d237fc5bb58e922fd22e2d949d2e0" + digest = "1:8ac51ce0543106c1f7ae943463db52e48e816420351886a14fcf799b5fd14be9" name = "github.com/openshift/cluster-api-actuator-pkg" packages = [ "pkg/e2e", @@ -454,7 +454,7 @@ "pkg/types", ] pruneopts = "" - revision = "0956b3853db225806a79284f3cffbf66ea32be1f" + revision = "dc2d4c7f4e839792f76b43e4844a5f87a09300b2" [[projects]] branch = "master" diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock index 13955cb251..33b0a07797 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.lock @@ -364,15 +364,16 @@ version = "v1.4.2" [[projects]] - digest = "1:853f9ec7a92a4b87a9b660e838731623d098613ef3bd5443b8331790ff7bef10" + branch = "master" + digest = "1:1267d3ab59b1de9f72b0bd74615c0926814806fbf2a6136cffc0fe1ee66a22f4" name = "github.com/openshift/api" packages = ["config/v1"] pruneopts = "" - revision = "8e476cb7322e59919cbb6482fd076ec5a214df25" + revision = "77b8897ec79a562e85920134fc65b63300c4d27a" [[projects]] branch = "openshift-4.0-cluster-api-0.0.0-alpha.4" - digest = "1:70aff930abe993c5b2c11128f615ac7ad529e99d82ee3fb13e41e2afac30a38c" + digest = "1:094eb37dfdc149e4b46a1f8ba2f0a01d2e14973b20ae758038ab66aef16b75ae" name = "github.com/openshift/cluster-api" packages = [ "pkg/apis/cluster/common", @@ -388,7 +389,7 @@ "pkg/util", ] pruneopts = "" - revision = "d8958b539e331bf5ebb056b7f872541e13fb8e01" + revision = "0b649f443f830353db113f92aa86db2d4d34943a" [[projects]] branch = "master" @@ -1062,6 +1063,7 @@ "github.com/onsi/ginkgo", "github.com/onsi/gomega", "github.com/openshift/api/config/v1", + "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1", "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1", "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset", "github.com/openshift/cluster-api/pkg/controller/node", diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml index 3f62356489..184352c5c6 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/Gopkg.toml @@ -43,7 +43,7 @@ required = [ [[constraint]] name = "github.com/openshift/api" - revision = "8e476cb7322e59919cbb6482fd076ec5a214df25" + branch = "master" [[constraint]] name = "github.com/openshift/cluster-api" diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler/autoscaler.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler/autoscaler.go index 99c83f0105..012cd89f71 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler/autoscaler.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/autoscaler/autoscaler.go @@ -316,7 +316,6 @@ var _ = g.Describe("[Feature:Machines] Autoscaler should", func() { initialNumberOfReplicas0 := pointer.Int32PtrDerefOr(targetMachineSet0.Spec.Replicas, e2e.DefaultMachineSetReplicas) initialNumberOfReplicas1 := pointer.Int32PtrDerefOr(targetMachineSet1.Spec.Replicas, e2e.DefaultMachineSetReplicas) glog.Infof("initialNumberOfReplicas0 %d, initialNumberOfReplicas1 %d", initialNumberOfReplicas0, initialNumberOfReplicas1) - o.Expect(initialNumberOfReplicas0).To(o.BeNumerically("==", initialNumberOfReplicas1)) g.By("Creating workload") err = client.Create(context.TODO(), newWorkLoad()) diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusterapi.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusterapi.go index 5e048feb7a..6b02fde547 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusterapi.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusterapi.go @@ -73,7 +73,7 @@ func (f *Framework) DeployClusterAPIStack(clusterAPINamespace, actuatorPrivateKe f.By("Waiting until cluster objects can be listed") err = wait.Poll(PollInterval, PoolClusterAPIDeploymentTimeout, func() (bool, error) { // Any namespace will do just to that one can list cluster objects - _, err := f.CAPIClient.MachineV1beta1().Clusters("default").List(metav1.ListOptions{}) + _, err := f.CAPIClient.ClusterV1alpha1().Clusters("default").List(metav1.ListOptions{}) if err != nil { glog.V(2).Infof("unable to list clusters: %v", err) return false, nil diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusters.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusters.go index c5ae5c37c0..cc63ca775b 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusters.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework/clusters.go @@ -5,15 +5,15 @@ import ( "github.com/golang/glog" - machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/wait" ) -func (f *Framework) CreateClusterAndWait(cluster *machinev1beta1.Cluster) { +func (f *Framework) CreateClusterAndWait(cluster *clusterv1alpha1.Cluster) { f.By(fmt.Sprintf("Creating %q cluster", cluster.Name)) err := wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { - _, err := f.CAPIClient.MachineV1beta1().Clusters(cluster.Namespace).Create(cluster) + _, err := f.CAPIClient.ClusterV1alpha1().Clusters(cluster.Namespace).Create(cluster) if err != nil { glog.V(2).Infof("error creating cluster: %v", err) return false, nil @@ -23,7 +23,7 @@ func (f *Framework) CreateClusterAndWait(cluster *machinev1beta1.Cluster) { f.ErrNotExpected(err) err = wait.Poll(PollInterval, PoolTimeout, func() (bool, error) { - _, err := f.CAPIClient.MachineV1beta1().Clusters(cluster.Namespace).Get(cluster.Name, metav1.GetOptions{}) + _, err := f.CAPIClient.ClusterV1alpha1().Clusters(cluster.Namespace).Get(cluster.Name, metav1.GetOptions{}) if err != nil { return false, nil } diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/infra.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/infra.go index 6bddb342a6..661120e9ae 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/infra.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/infra/infra.go @@ -269,7 +269,7 @@ var _ = g.Describe("[Feature:Machines] Managed cluster should", func() { machineSets, err := e2e.GetMachineSets(context.TODO(), client) o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(len(machineSets)).To(o.BeNumerically(">", 2)) + o.Expect(len(machineSets)).To(o.BeNumerically(">=", 2)) machineSet := machineSets[0] initialReplicasMachineSet := int(pointer.Int32PtrDerefOr(machineSet.Spec.Replicas, e2e.DefaultMachineSetReplicas)) scaleOut := 3 @@ -309,7 +309,7 @@ var _ = g.Describe("[Feature:Machines] Managed cluster should", func() { g.By("getting worker machineSets") machineSets, err := e2e.GetMachineSets(context.TODO(), client) o.Expect(err).NotTo(o.HaveOccurred()) - o.Expect(len(machineSets)).To(o.BeNumerically(">", 2)) + o.Expect(len(machineSets)).To(o.BeNumerically(">=", 2)) machineSet0 := machineSets[0] initialReplicasMachineSet0 := int(pointer.Int32PtrDerefOr(machineSet0.Spec.Replicas, e2e.DefaultMachineSetReplicas)) machineSet1 := machineSets[1] diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/utils.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/utils.go index 29adce0762..fcd48f39c0 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/utils.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/operators/utils.go @@ -84,7 +84,7 @@ func isStatusAvailable(client runtimeclient.Client, name string) bool { glog.Errorf("Condition: %q is true", osconfigv1.OperatorProgressing) return false, nil } - if cov1helpers.IsStatusConditionTrue(clusterOperator.Status.Conditions, osconfigv1.OperatorFailing) || cov1helpers.IsStatusConditionTrue(clusterOperator.Status.Conditions, osconfigv1.OperatorDegraded) { + if cov1helpers.IsStatusConditionTrue(clusterOperator.Status.Conditions, osconfigv1.OperatorDegraded) { glog.Errorf("Condition: %q is true", osconfigv1.OperatorDegraded) return false, nil } diff --git a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go index dceb3efc16..4464ec3586 100644 --- a/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go +++ b/vendor/github.com/openshift/cluster-api-actuator-pkg/pkg/manifests/manifests.go @@ -24,14 +24,14 @@ func ClusterCRDManifest() *v1beta1.CustomResourceDefinition { APIVersion: "apiextensions.k8s.io/v1beta1", }, ObjectMeta: metav1.ObjectMeta{ - Name: "clusters.machine.openshift.io", + Name: "clusters.cluster.k8s.io", Labels: map[string]string{ "controller-tools.k8s.io": "1.0", }, }, Spec: v1beta1.CustomResourceDefinitionSpec{ - Group: "machine.openshift.io", - Version: "v1beta1", + Group: "cluster.k8s.io", + Version: "v1alpha1", Names: v1beta1.CustomResourceDefinitionNames{ Plural: "clusters", Kind: "Cluster",