From 1b3b34bb2b0bbb9e456cb0bbf53863d4a3d89e3a Mon Sep 17 00:00:00 2001 From: Chuck Ha Date: Tue, 18 Jun 2019 10:10:53 -0400 Subject: [PATCH] Encode secret and use labels not annotations Signed-off-by: Chuck Ha --- capkactuators/actuators.go | 9 +++++---- cmd/capkctl/main.go | 4 +--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/capkactuators/actuators.go b/capkactuators/actuators.go index a0f4c0f..5f63155 100644 --- a/capkactuators/actuators.go +++ b/capkactuators/actuators.go @@ -17,6 +17,7 @@ limitations under the License. package capkactuators import ( + "encoding/base64" "fmt" "io/ioutil" @@ -42,8 +43,8 @@ func getKindName(machine *clusterv1.Machine) string { func getRole(machine *clusterv1.Machine) string { // Figure out what kind of node we're making - annotations := machine.GetAnnotations() - setValue, ok := annotations["set"] + labels := machine.GetLabels() + setValue, ok := labels["set"] if !ok { setValue = constants.WorkerNodeRoleValue } @@ -106,8 +107,8 @@ func kubeconfigToSecret(clusterName, namespace string) (*v1.Secret, error) { Name: fmt.Sprintf("kubeconfig-%s", clusterName), Namespace: namespace, }, - Data: map[string][]byte{ - "kubeconfig": data, + StringData: map[string]string{ + "kubeconfig": base64.StdEncoding.EncodeToString(data), }, }, nil } diff --git a/cmd/capkctl/main.go b/cmd/capkctl/main.go index 073f3ca..90202e8 100644 --- a/cmd/capkctl/main.go +++ b/cmd/capkctl/main.go @@ -148,9 +148,7 @@ func machineYAML(opts *machineOptions) string { Namespace: *opts.namespace, Labels: map[string]string{ "cluster.k8s.io/cluster-name": *opts.clusterName, - }, - Annotations: map[string]string{ - "set": *opts.set, + "set": *opts.set, }, }, Spec: v1alpha1.MachineSpec{