Skip to content

Commit

Permalink
Update CAPI dependency, remove clusterctl and make examples top level
Browse files Browse the repository at this point in the history
Signed-off-by: Vince Prignano <[email protected]>
  • Loading branch information
vincepri committed Jul 25, 2019
1 parent caf9d39 commit 40fd2e5
Show file tree
Hide file tree
Showing 26 changed files with 94 additions and 1,647 deletions.
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ kind.kubeconfig
minikube.kubeconfig
kubeconfig

# binaries
/manager
/clusterctl
/clusterawsadm

# Example and binary output directory
/out

Expand All @@ -50,5 +45,5 @@ kubeconfig
.idea

# Ignore output manifests
cmd/clusterctl/examples/aws/out
cmd/clusterctl/examples/aws/provider-components-base.yaml
examples/out
examples/provider-components-base.yaml
56 changes: 27 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ docker-push: docker-build ## Push the docker image
## --------------------------------------

.PHONY: manifests
manifests: cmd/clusterctl/examples/aws/provider-components-base.yaml ## Build example set of manifests from the current source
./cmd/clusterctl/examples/aws/generate-yaml.sh
manifests: examples/provider-components-base.yaml ## Build example set of manifests from the current source
./examples/generate-yaml.sh

.PHONY: cmd/clusterctl/examples/aws/provider-components-base.yaml
cmd/clusterctl/examples/aws/provider-components-base.yaml:
bazel build //cmd/clusterctl/examples/aws:provider-components-base $(BAZEL_BUILD_ARGS)
install bazel-genfiles/cmd/clusterctl/examples/aws/provider-components-base.yaml cmd/clusterctl/examples/aws
.PHONY: examples/provider-components-base.yaml
examples/provider-components-base.yaml:
bazel build //examples:provider-components-base $(BAZEL_BUILD_ARGS)
install bazel-genfiles/examples/provider-components-base.yaml examples

## --------------------------------------
## Generate
Expand Down Expand Up @@ -168,7 +168,7 @@ manager: ## Build manager binary.

.PHONY: clusterctl
clusterctl: ## Build clusterctl binary.
go build -o bin/clusterctl ./cmd/clusterctl
GOFLAGS="" go build -o bin/clusterctl ./vendor/sigs.k8s.io/cluster-api/cmd/clusterctl

.PHONY: clusterawsadm
clusterawsadm: ## Build clusterawsadm binary.
Expand All @@ -180,15 +180,13 @@ clusterawsadm: ## Build clusterawsadm binary.

.PHONY: release-artifacts
release-artifacts: ## Build release artifacts
bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/clusterctl //cmd/clusterawsadm
bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/clusterctl //cmd/clusterawsadm
bazel build //cmd/clusterctl/examples/aws $(BAZEL_BUILD_ARGS)
bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd/clusterawsadm
bazel build --platforms=@io_bazel_rules_go//go/toolchain:darwin_amd64 //cmd/clusterawsadm
bazel build //examples $(BAZEL_BUILD_ARGS)
mkdir -p out
install bazel-bin/cmd/clusterawsadm/darwin_amd64_pure_stripped/clusterawsadm out/clusterawsadm-darwin-amd64
install bazel-bin/cmd/clusterawsadm/linux_amd64_pure_stripped/clusterawsadm out/clusterawsadm-linux-amd64
install bazel-bin/cmd/clusterctl/darwin_amd64_pure_stripped/clusterctl out/clusterctl-darwin-amd64
install bazel-bin/cmd/clusterctl/linux_amd64_pure_stripped/clusterctl out/clusterctl-linux-amd64
install bazel-bin/cmd/clusterctl/examples/aws/aws.tar out/cluster-api-provider-aws-examples.tar
install bazel-bin/examples/aws.tar out/cluster-api-provider-aws-examples.tar

## --------------------------------------
## Define local development targets here
Expand All @@ -199,36 +197,36 @@ create-cluster: binaries ## Create a development Kubernetes cluster on AWS using
bin/clusterctl create cluster -v 4 \
--provider aws \
--bootstrap-type kind \
-m ./cmd/clusterctl/examples/aws/out/machines.yaml \
-c ./cmd/clusterctl/examples/aws/out/cluster.yaml \
-p ./cmd/clusterctl/examples/aws/out/provider-components.yaml \
-a ./cmd/clusterctl/examples/aws/out/addons.yaml
-m ./examples/out/machines.yaml \
-c ./examples/out/cluster.yaml \
-p ./examples/out/provider-components.yaml \
-a ./examples/out/addons.yaml

.PHONY: create-cluster-ha
create-cluster-ha: binaries ## Create a development Kubernetes cluster on AWS using HA examples
bin/clusterctl create cluster -v 4 \
--provider aws \
--bootstrap-type kind \
-m ./cmd/clusterctl/examples/aws/out/machines-ha.yaml \
-c ./cmd/clusterctl/examples/aws/out/cluster.yaml \
-p ./cmd/clusterctl/examples/aws/out/provider-components.yaml \
-a ./cmd/clusterctl/examples/aws/out/addons.yaml
-m ./examples/machines-ha.yaml \
-c ./examples/cluster.yaml \
-p ./examples/provider-components.yaml \
-a ./examples/addons.yaml

.PHONY: create-cluster-management
create-cluster-management: ## Create a development Kubernetes cluster on AWS in a KIND management cluster.
kind create cluster --name=clusterapi
# Apply provider-components.
kubectl \
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
create -f cmd/clusterctl/examples/aws/out/provider-components.yaml
create -f examples/out/provider-components.yaml
# Create Cluster.
kubectl \
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
create -f cmd/clusterctl/examples/aws/out/cluster.yaml
create -f examples/out/cluster.yaml
# Create control plane machine.
kubectl \
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
create -f cmd/clusterctl/examples/aws/out/controlplane-machine.yaml
create -f examples/out/controlplane-machine.yaml
# Get KubeConfig using clusterctl.
bin/clusterctl alpha phases get-kubeconfig -v=3 \
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
Expand All @@ -237,19 +235,19 @@ create-cluster-management: ## Create a development Kubernetes cluster on AWS in
# Apply addons on the target cluster, waiting for the control-plane to become available.
bin/clusterctl alpha phases apply-addons -v=3 \
--kubeconfig=./kubeconfig \
-a cmd/clusterctl/examples/aws/out/addons.yaml
-a examples/out/addons.yaml
# Create a worker node with MachineDeployment.
kubectl \
--kubeconfig=$$(kind get kubeconfig-path --name="clusterapi") \
create -f cmd/clusterctl/examples/aws/out/machine-deployment.yaml
create -f examples/out/machine-deployment.yaml

.PHONY: delete-cluster
delete-cluster: binaries ## Deletes the development Kubernetes Cluster "test1"
bin/clusterctl delete cluster -v 4 \
--bootstrap-type kind \
--cluster test1 \
--kubeconfig ./kubeconfig \
-p ./cmd/clusterctl/examples/aws/out/provider-components.yaml \
-p ./examples/out/provider-components.yaml \

kind-reset: ## Destroys the "clusterapi" kind cluster.
kind delete cluster --name=clusterapi || true
Expand Down Expand Up @@ -277,8 +275,8 @@ clean-temporary: ## Remove all temporary files and folders
rm -f minikube.kubeconfig
rm -f kubeconfig
rm -rf out/
rm -rf cmd/clusterctl/examples/aws/out/
rm -f cmd/clusterctl/examples/aws/provider-components-base.yaml
rm -rf examples/out/
rm -f examples/provider-components-base.yaml

.PHONY: verify
verify: ## Runs verification scripts to ensure correct execution
Expand Down
30 changes: 0 additions & 30 deletions cmd/clusterctl/BUILD.bazel

This file was deleted.

35 changes: 0 additions & 35 deletions cmd/clusterctl/main.go

This file was deleted.

1 change: 0 additions & 1 deletion cmd/manager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ go_library(
"//vendor/k8s.io/klog:go_default_library",
"//vendor/k8s.io/klog/klogr:go_default_library",
"//vendor/sigs.k8s.io/cluster-api/pkg/apis:go_default_library",
"//vendor/sigs.k8s.io/cluster-api/pkg/apis/cluster/common:go_default_library",
"//vendor/sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset:go_default_library",
"//vendor/sigs.k8s.io/cluster-api/pkg/controller/cluster:go_default_library",
"//vendor/sigs.k8s.io/controller-runtime/pkg/client/config:go_default_library",
Expand Down
4 changes: 0 additions & 4 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"sigs.k8s.io/cluster-api-provider-aws/pkg/controller"
"sigs.k8s.io/cluster-api-provider-aws/pkg/record"
capi "sigs.k8s.io/cluster-api/pkg/apis"
"sigs.k8s.io/cluster-api/pkg/apis/cluster/common"
"sigs.k8s.io/cluster-api/pkg/client/clientset_generated/clientset"
capicluster "sigs.k8s.io/cluster-api/pkg/controller/cluster"
"sigs.k8s.io/controller-runtime/pkg/client/config"
Expand Down Expand Up @@ -100,9 +99,6 @@ func main() {
LoggingContext: "[cluster-actuator]",
})

// Register our cluster deployer (the interface is in clusterctl and we define the Deployer interface on the actuator)
common.RegisterClusterProvisioner("aws", clusterActuator)

if err := capi.AddToScheme(mgr.GetScheme()); err != nil {
klog.Fatal(err)
}
Expand Down
2 changes: 0 additions & 2 deletions cmd/release/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ func main() {
"cluster-api-provider-aws-examples.tar",
"clusterawsadm-darwin-amd64",
"clusterawsadm-linux-amd64",
"clusterctl-darwin-amd64",
"clusterctl-linux-amd64",
},
registry: fmt.Sprintf("%s/%s", registry, repository),
imageName: managerImageName,
Expand Down
Loading

0 comments on commit 40fd2e5

Please sign in to comment.