diff --git a/cmd/capd-manager/main.go b/cmd/capd-manager/main.go index f25c45d..6766589 100644 --- a/cmd/capd-manager/main.go +++ b/cmd/capd-manager/main.go @@ -37,7 +37,7 @@ import ( func main() { // Must set up klog for the cluster api loggers - klog.InitFlags(flag.CommandLine) + klog.InitFlags(nil) flag.Parse() log := klogr.New() diff --git a/cmd/capdctl/main.go b/cmd/capdctl/main.go index 1e2d7d2..b8948e3 100644 --- a/cmd/capdctl/main.go +++ b/cmd/capdctl/main.go @@ -63,7 +63,7 @@ func (mo *machineDeploymentOptions) initFlags(fs *flag.FlagSet) { func main() { setup := flag.NewFlagSet("setup", flag.ExitOnError) managementClusterName := setup.String("cluster-name", "management", "The name of the management cluster") - version := setup.String("capi-version", "v0.1.6", "The CRD versions to pull from CAPI. Does not support < v0.1.6.") + version := setup.String("capi-version", "v0.1.7", "The CRD versions to pull from CAPI. Does not support < v0.1.7.") capdImage := setup.String("capd-image", "gcr.io/kubernetes1-226021/capd-manager:latest", "The capd manager image to run") capiImage := setup.String("capi-image", "", "This is normally left blank and filled in automatically. But this will override the generated image name.") diff --git a/examples/simple-cluster.yaml b/examples/simple-cluster.yaml index 8987cf9..d477d85 100644 --- a/examples/simple-cluster.yaml +++ b/examples/simple-cluster.yaml @@ -19,6 +19,8 @@ metadata: set: "controlplane" spec: providerSpec: {} + versions: + controlPlane: "v1.14.2" --- apiVersion: "cluster.k8s.io/v1alpha1" kind: Machine @@ -31,3 +33,5 @@ metadata: name: "my-cluster-worker" spec: providerSpec: {} + versions: + kubelet: "v1.14.2" diff --git a/objects/cluster.go b/objects/cluster.go index 61fc7bb..e444368 100644 --- a/objects/cluster.go +++ b/objects/cluster.go @@ -17,36 +17,40 @@ limitations under the License. package objects import ( - meta "k8s.io/apimachinery/pkg/apis/meta/v1" - capi "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1alpha1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1" ) const controlPlaneSet = "controlplane" // GetMachineDeployment returns a worker node machine deployment object -func GetMachineDeployment(name, namespace, clusterName, kubeletVersion string, replicas int32) capi.MachineDeployment { +func GetMachineDeployment(name, namespace, clusterName, kubeletVersion string, replicas int32) clusterv1alpha1.MachineDeployment { labels := map[string]string{ "cluster.k8s.io/cluster-name": clusterName, "set": "node", } - return capi.MachineDeployment{ - ObjectMeta: meta.ObjectMeta{ + return clusterv1alpha1.MachineDeployment{ + TypeMeta: metav1.TypeMeta{ + Kind: "MachineDeployment", + APIVersion: "cluster.k8s.io/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, Labels: labels, }, - Spec: capi.MachineDeploymentSpec{ + Spec: clusterv1alpha1.MachineDeploymentSpec{ Replicas: &replicas, - Selector: meta.LabelSelector{ + Selector: metav1.LabelSelector{ MatchLabels: labels, }, - Template: capi.MachineTemplateSpec{ - ObjectMeta: meta.ObjectMeta{ + Template: clusterv1alpha1.MachineTemplateSpec{ + ObjectMeta: metav1.ObjectMeta{ Labels: labels, }, - Spec: capi.MachineSpec{ - ProviderSpec: capi.ProviderSpec{}, - Versions: capi.MachineVersionInfo{ + Spec: clusterv1alpha1.MachineSpec{ + ProviderSpec: clusterv1alpha1.ProviderSpec{}, + Versions: clusterv1alpha1.MachineVersionInfo{ Kubelet: kubeletVersion, }, }, @@ -56,18 +60,22 @@ func GetMachineDeployment(name, namespace, clusterName, kubeletVersion string, r } // GetCluster returns a cluster object with the given name and namespace -func GetCluster(clusterName, namespace string) capi.Cluster { - return capi.Cluster{ - ObjectMeta: meta.ObjectMeta{ +func GetCluster(clusterName, namespace string) clusterv1alpha1.Cluster { + return clusterv1alpha1.Cluster{ + TypeMeta: metav1.TypeMeta{ + Kind: "Cluster", + APIVersion: "cluster.k8s.io/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ Name: clusterName, Namespace: namespace, }, - Spec: capi.ClusterSpec{ - ClusterNetwork: capi.ClusterNetworkingConfig{ - Services: capi.NetworkRanges{ + Spec: clusterv1alpha1.ClusterSpec{ + ClusterNetwork: clusterv1alpha1.ClusterNetworkingConfig{ + Services: clusterv1alpha1.NetworkRanges{ CIDRBlocks: []string{"10.96.0.0/12"}, }, - Pods: capi.NetworkRanges{ + Pods: clusterv1alpha1.NetworkRanges{ CIDRBlocks: []string{"192.168.0.0/16"}, }, ServiceDomain: "cluster.local", @@ -77,9 +85,13 @@ func GetCluster(clusterName, namespace string) capi.Cluster { } // GetMachine returns a machine with the given parameters -func GetMachine(name, namespace, clusterName, set, version string) capi.Machine { - machine := capi.Machine{ - ObjectMeta: meta.ObjectMeta{ +func GetMachine(name, namespace, clusterName, set, version string) clusterv1alpha1.Machine { + machine := clusterv1alpha1.Machine{ + TypeMeta: metav1.TypeMeta{ + Kind: "Machine", + APIVersion: "cluster.k8s.io/v1alpha1", + }, + ObjectMeta: metav1.ObjectMeta{ Name: name, Namespace: namespace, Labels: map[string]string{ @@ -87,8 +99,8 @@ func GetMachine(name, namespace, clusterName, set, version string) capi.Machine "set": set, }, }, - Spec: capi.MachineSpec{ - ProviderSpec: capi.ProviderSpec{}, + Spec: clusterv1alpha1.MachineSpec{ + ProviderSpec: clusterv1alpha1.ProviderSpec{}, }, } if set == controlPlaneSet { diff --git a/objects/control_plane.go b/objects/control_plane.go index 12cd532..46dad8a 100644 --- a/objects/control_plane.go +++ b/objects/control_plane.go @@ -71,10 +71,8 @@ func GetStatefulSet(image string) apps.StatefulSet { { Name: "capd-manager", Image: image, - Command: []string{ - "capd-manager", - "-v=3", - "-logtostderr=true", + Args: []string{ + "-v", "3", }, VolumeMounts: []core.VolumeMount{ {