Skip to content
This repository has been archived by the owner on Sep 24, 2021. It is now read-only.

Commit

Permalink
Be careful with control-plane vs controlplane
Browse files Browse the repository at this point in the history
Signed-off-by: Chuck Ha <chuckh@vmware.com>
  • Loading branch information
chuckha committed Jun 18, 2019
1 parent 1b3b34b commit 3e90c24
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion capkactuators/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ import (
"sigs.k8s.io/kind/pkg/cluster/nodes"
)

const (
// kind uses 'control-plane' and cluster-api uses 'controlplane'. Both use 'worker'.

clusterAPIControlPlaneSetLabel = "controlplane"
)

type Machine struct {
Core corev1.CoreV1Interface
ClusterAPI v1alpha1.ClusterV1alpha1Interface
Expand Down Expand Up @@ -69,7 +75,7 @@ func (m *Machine) Create(ctx context.Context, c *clusterv1.Cluster, machine *clu
fmt.Printf("Is there a cluster? %v\n", clusterExists)
setValue := getRole(machine)
fmt.Printf("This node has a role of %q\n", setValue)
if setValue == constants.ControlPlaneNodeRoleValue {
if setValue == clusterAPIControlPlaneSetLabel {
if len(controlPlanes) > 0 {
fmt.Println("Adding a control plane")
controlPlaneNode, err := actions.AddControlPlane(c.Name, machine.Spec.Versions.ControlPlane)
Expand Down
4 changes: 2 additions & 2 deletions cmd/capkctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (mo *machineOptions) initFlags(fs *flag.FlagSet) {
mo.name = fs.String("name", "my-machine", "The name of the machine")
mo.namespace = fs.String("namespace", "my-namespace", "The namespece of the machine")
mo.clusterName = fs.String("cluster-name", "my-cluster", "The name of the cluster the machine belongs to")
mo.set = fs.String("set", "worker", "The role of the machine. Valid entries ['worker', 'control-plane']")
mo.set = fs.String("set", "worker", "The role of the machine. Valid entries ['worker', 'controlplane']")
mo.version = fs.String("version", "v1.14.2", "The Kubernetes version to run")
}

Expand All @@ -53,7 +53,7 @@ func main() {
controlPlane := flag.NewFlagSet("control-plane", flag.ExitOnError)
controlPlaneOpts := new(machineOptions)
controlPlaneOpts.initFlags(controlPlane)
*controlPlaneOpts.set = "control-plane"
*controlPlaneOpts.set = "controlplane"

worker := flag.NewFlagSet("worker", flag.ExitOnError)
workerOpts := new(machineOptions)
Expand Down
3 changes: 1 addition & 2 deletions examples/simple-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ metadata:
name: my-control-plane
labels:
cluster.k8s.io/cluster-name: my-cluster
annotations:
set: "control-plane"
spec:
providerSpec: {}
Expand All @@ -27,8 +26,8 @@ metadata:
name: worker
labels:
cluster.k8s.io/cluster-name: my-cluster
annotations:
set: "worker"
annotations:
name: "my-cluster-worker"
spec:
providerSpec: {}

0 comments on commit 3e90c24

Please sign in to comment.