Skip to content

Commit

Permalink
the great renaming
Browse files Browse the repository at this point in the history
Signed-off-by: Vince Prignano <[email protected]>
  • Loading branch information
vincepri committed Jun 24, 2019
1 parent e018bfe commit 688f73d
Show file tree
Hide file tree
Showing 139 changed files with 7,546 additions and 6,213 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ generate-clientset: ## Generate a typed clientset
go run ./vendor/k8s.io/code-generator/cmd/client-gen/main.go \
--clientset-name clientset \
--input-base sigs.k8s.io/cluster-api/pkg/apis \
--input cluster/v1alpha1 \
--input cluster/v1alpha2 \
--output-package sigs.k8s.io/cluster-api/pkg/client/clientset_generated \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
go run ./vendor/k8s.io/code-generator/cmd/lister-gen/main.go \
--input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1 \
--input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2 \
--output-package sigs.k8s.io/cluster-api/pkg/client/listers_generated \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt
go run ./vendor/k8s.io/code-generator/cmd/informer-gen/main.go \
--input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1 \
--input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2 \
--versioned-clientset-package sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset \
--listers-package sigs.k8s.io/cluster-api/pkg/client/listers_generated \
--output-package sigs.k8s.io/cluster-api/pkg/client/informers_generated \
Expand All @@ -120,7 +120,7 @@ generate-clientset: ## Generate a typed clientset
generate-manifests: ## Generate manifests e.g. CRD, RBAC etc.
go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go \
paths=./pkg/... \
crd:trivialVersions=true \
crd \
rbac:roleName=manager-role \
output:crd:dir=./config/crds
cp -f ./config/rbac/role*.yaml ./config/ci/rbac/
Expand Down
4 changes: 2 additions & 2 deletions cmd/clusterctl/clusterdeployer/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ go_library(
"//cmd/clusterctl/clusterdeployer/provider:go_default_library",
"//cmd/clusterctl/phases:go_default_library",
"//cmd/clusterctl/providercomponents:go_default_library",
"//pkg/apis/cluster/v1alpha1:go_default_library",
"//pkg/apis/cluster/v1alpha2:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
"//vendor/k8s.io/klog:go_default_library",
Expand All @@ -28,7 +28,7 @@ go_test(
deps = [
"//cmd/clusterctl/clusterdeployer/clusterclient:go_default_library",
"//cmd/clusterctl/clusterdeployer/provider:go_default_library",
"//pkg/apis/cluster/v1alpha1:go_default_library",
"//pkg/apis/cluster/v1alpha2:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/clusterdeployer/clusterclient/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//cmd/clusterctl/clientcmd:go_default_library",
"//pkg/apis/cluster/v1alpha1:go_default_library",
"//pkg/apis/cluster/v1alpha2:go_default_library",
"//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/util:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
Expand Down
178 changes: 49 additions & 129 deletions cmd/clusterctl/clusterdeployer/clusterclient/clusterclient.go

Large diffs are not rendered by default.

7 changes: 1 addition & 6 deletions cmd/clusterctl/clusterdeployer/clusterdeployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient"
"sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/provider"
"sigs.k8s.io/cluster-api/cmd/clusterctl/phases"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2"
)

type ClusterDeployer struct {
Expand Down Expand Up @@ -237,11 +237,6 @@ func deleteClusterAPIObjectsInAllNamespaces(client clusterclient.Client) error {
err = errors.Wrap(err, "error deleting Machines")
errorList = append(errorList, err.Error())
}
klog.Infof("Deleting MachineClasses in all namespaces")
if err := client.DeleteMachineClasses(""); err != nil {
err = errors.Wrap(err, "error deleting MachineClasses")
errorList = append(errorList, err.Error())
}
klog.Infof("Deleting Clusters in all namespaces")
if err := client.DeleteClusters(""); err != nil {
err = errors.Wrap(err, "error deleting Clusters")
Expand Down
52 changes: 8 additions & 44 deletions cmd/clusterctl/clusterdeployer/clusterdeployer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"k8s.io/client-go/kubernetes"
"sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient"
"sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/provider"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2"
)

type testClusterProvisioner struct {
Expand Down Expand Up @@ -91,7 +91,7 @@ type stringCheckFunc func(string) error
type testClusterClient struct {
ApplyErr error
DeleteErr error
WaitForClusterV1alpha1ReadyErr error
WaitForClusterV1alpha2ReadyErr error
GetClustersErr error
GetClusterErr error
GetMachineClassesErr error
Expand All @@ -117,7 +117,6 @@ type testClusterClient struct {
ApplyFunc stringCheckFunc

clusters map[string][]*clusterv1.Cluster
machineClasses map[string][]*clusterv1.MachineClass
machineDeployments map[string][]*clusterv1.MachineDeployment
machineSets map[string][]*clusterv1.MachineSet
machines map[string][]*clusterv1.Machine
Expand All @@ -143,8 +142,8 @@ func (c *testClusterClient) GetContextNamespace() string {
return c.contextNamespace
}

func (c *testClusterClient) WaitForClusterV1alpha1Ready() error {
return c.WaitForClusterV1alpha1ReadyErr
func (c *testClusterClient) WaitForClusterV1alpha2Ready() error {
return c.WaitForClusterV1alpha2ReadyErr
}

func (c *testClusterClient) GetCluster(clusterName, namespace string) (*clusterv1.Cluster, error) {
Expand Down Expand Up @@ -273,18 +272,6 @@ func (c *testClusterClient) DeleteClusters(ns string) error {
return nil
}

func (c *testClusterClient) DeleteMachineClasses(ns string) error {
if c.DeleteMachineClassesErr != nil {
return c.DeleteMachineClassesErr
}
if ns == "" {
c.machineClasses = make(map[string][]*clusterv1.MachineClass)
} else {
delete(c.machineClasses, ns)
}
return nil
}

func (c *testClusterClient) DeleteMachineDeployments(ns string) error {
if c.DeleteMachineDeploymentsErr != nil {
return c.DeleteMachineDeploymentsErr
Expand Down Expand Up @@ -490,21 +477,6 @@ func (c *testClusterClient) WaitForResourceStatuses() error {
return nil
}

// TODO: implement GetMachineClasses for testClusterClient and add tests
func (c *testClusterClient) GetMachineClasses(namespace string) ([]*clusterv1.MachineClass, error) {
return c.machineClasses[namespace], c.GetMachineClassesErr
}

// TODO: implement CreateMachineClass for testClusterClient and add tests
func (c *testClusterClient) CreateMachineClass(*clusterv1.MachineClass) error {
return errors.Errorf("CreateMachineClass Not yet implemented.")
}

// TODO: implement DeleteMachineClass for testClusterClient and add tests
func (c *testClusterClient) DeleteMachineClass(namespace, name string) error {
return errors.Errorf("DeleteMachineClass Not yet implemented.")
}

func contains(s []string, e string) bool {
exists := false
for _, existingNs := range s {
Expand Down Expand Up @@ -702,7 +674,7 @@ func TestClusterCreate(t *testing.T) {
{
name: "fail waiting for api ready on bootstrap cluster",
targetClient: &testClusterClient{ApplyFunc: func(yaml string) error { return nil }},
bootstrapClient: &testClusterClient{WaitForClusterV1alpha1ReadyErr: errors.New("Test failure")},
bootstrapClient: &testClusterClient{WaitForClusterV1alpha2ReadyErr: errors.New("Test failure")},
namespaceToExpectedInternalMachines: make(map[string]int),
namespaceToInputCluster: map[string][]*clusterv1.Cluster{metav1.NamespaceDefault: getClustersForNamespace(metav1.NamespaceDefault, 1)},
cleanupExternal: true,
Expand Down Expand Up @@ -771,7 +743,7 @@ func TestClusterCreate(t *testing.T) {
},
{
name: "fail wait for api ready on target cluster",
targetClient: &testClusterClient{WaitForClusterV1alpha1ReadyErr: errors.New("Test failure")},
targetClient: &testClusterClient{WaitForClusterV1alpha2ReadyErr: errors.New("Test failure")},
bootstrapClient: &testClusterClient{},
namespaceToExpectedInternalMachines: make(map[string]int),
namespaceToInputCluster: map[string][]*clusterv1.Cluster{metav1.NamespaceDefault: getClustersForNamespace(metav1.NamespaceDefault, 1)},
Expand Down Expand Up @@ -1376,9 +1348,6 @@ func TestClusterDelete(t *testing.T) {
for _, machineSets := range testCase.bootstrapClient.machineSets {
bootstrapMachineSets = bootstrapMachineSets + len(machineSets)
}
for _, machineClasses := range testCase.bootstrapClient.machineClasses {
bootstrapMachineClasses = bootstrapMachineClasses + len(machineClasses)
}
for _, clusters := range testCase.targetClient.clusters {
targetClusters = targetClusters + len(clusters)
}
Expand All @@ -1391,9 +1360,6 @@ func TestClusterDelete(t *testing.T) {
for _, machineSets := range testCase.targetClient.machineSets {
targetMachineSets = targetMachineSets + len(machineSets)
}
for _, machineClasses := range testCase.targetClient.machineClasses {
targetMachineClasses = targetMachineClasses + len(machineClasses)
}

if bootstrapClusters != 0 {
t.Fatalf("Unexpected Cluster count in bootstrap cluster. Got: %d, Want: 0", bootstrapClusters)
Expand Down Expand Up @@ -1434,10 +1400,8 @@ func generateTestControlPlaneMachines(cluster *clusterv1.Cluster, ns string, nam
machines := make([]*clusterv1.Machine, 0, len(names))
for _, name := range names {
machine := generateTestNodeMachine(cluster, ns, name)
machine.Spec = clusterv1.MachineSpec{
Versions: clusterv1.MachineVersionInfo{
ControlPlane: "1.10.1",
},
machine.ObjectMeta.Labels = map[string]string{
clusterv1.MachineControlPlaneLabelName: "true",
}
machines = append(machines, machine)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/clusterdeployer/provider/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ go_library(
importpath = "sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/provider",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/cluster/v1alpha1:go_default_library",
"//pkg/apis/cluster/v1alpha2:go_default_library",
"//vendor/k8s.io/client-go/kubernetes:go_default_library",
],
)
2 changes: 1 addition & 1 deletion cmd/clusterctl/clusterdeployer/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package provider

import (
"k8s.io/client-go/kubernetes"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2"
)

// Deployer is a deprecated interface for Provider specific logic. Please do not extend or add. This interface should be removed
Expand Down
4 changes: 2 additions & 2 deletions cmd/clusterctl/phases/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ go_library(
"//cmd/clusterctl/clusterdeployer/bootstrap:go_default_library",
"//cmd/clusterctl/clusterdeployer/clusterclient:go_default_library",
"//cmd/clusterctl/clusterdeployer/provider:go_default_library",
"//pkg/apis/cluster/v1alpha1:go_default_library",
"//pkg/apis/cluster/v1alpha2:go_default_library",
"//pkg/util:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
"//vendor/k8s.io/api/apps/v1:go_default_library",
Expand All @@ -32,7 +32,7 @@ go_test(
srcs = ["pivot_test.go"],
embed = [":go_default_library"],
deps = [
"//pkg/apis/cluster/v1alpha1:go_default_library",
"//pkg/apis/cluster/v1alpha2:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
],
)
2 changes: 1 addition & 1 deletion cmd/clusterctl/phases/applycluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/pkg/errors"
"k8s.io/klog"
"sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2"
)

func ApplyCluster(client clusterclient.Client, cluster *clusterv1.Cluster) error {
Expand Down
2 changes: 1 addition & 1 deletion cmd/clusterctl/phases/applyclusterapicomponents.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ func ApplyClusterAPIComponents(client clusterclient.Client, providerComponents s
return errors.Wrap(err, "unable to apply cluster api controllers")
}

return client.WaitForClusterV1alpha1Ready()
return client.WaitForClusterV1alpha2Ready()
}
2 changes: 1 addition & 1 deletion cmd/clusterctl/phases/applymachines.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/pkg/errors"
"k8s.io/klog"
"sigs.k8s.io/cluster-api/cmd/clusterctl/clusterdeployer/clusterclient"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1"
clusterv1 "sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2"
)

func ApplyMachines(client clusterclient.Client, namespace string, machines []*clusterv1.Machine) error {
Expand Down
Loading

0 comments on commit 688f73d

Please sign in to comment.