Skip to content

Commit

Permalink
Fix kustomize path issue (#3201)
Browse files Browse the repository at this point in the history
Reuse verify-kustomize.sh to install and verify kustomize

Signed-off-by: Lan Luo <[email protected]>
  • Loading branch information
luolanzone committed Jan 20, 2022
1 parent 0c4dbb5 commit 687679f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 28 deletions.
2 changes: 1 addition & 1 deletion ci/jenkins/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Run K8s e2e community tests (Conformance & Network Policy) or Antrea e2e tests o
--kubeconfig Path of cluster kubeconfig.
--workdir Home path for Go, vSphere information and antrea_logs during cluster setup. Default is $WORKDIR.
--testcase Windows install OVS, Conformance and Network Policy or Antrea e2e test cases on a Windows or Linux cluster. It can also be flexible ipam e2e test.
--testcase Windows install OVS, Conformance and Network Policy or Antrea e2e testcases on a Windows or Linux cluster. It can also be flexible ipam or multicast e2e test.
--registry The docker registry to use instead of dockerhub.
--proxyall Enable proxyAll to test AntreaProxy.
--flexible-ipam Run tests in flexible ipam mode"
Expand Down
19 changes: 0 additions & 19 deletions multicluster/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,29 +92,10 @@ docker-build: build ## Build docker image with the manager.

##@ Deployment

install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -

undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete -f -


CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])

KUSTOMIZE = $(shell pwd)/bin/kustomize

kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])

codegen:
./hack/update-codegen.sh

Expand Down
17 changes: 11 additions & 6 deletions multicluster/hack/generate-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ Generate a YAML manifest for Antrea MultiCluster using Kustomize and print it to
--member | -m Generate a manifest for a Cluster as member in a ClusterSet
--help | -h Print this message and exit
This tool uses kustomize (https://github.com/kubernetes-sigs/kustomize) to generate manifests for
Antrea MultiCluster Controller. please run 'make kustomize' first
Environment variables IMG_NAME and IMG_TAG must be set when release mode is enabled.
"

Expand Down Expand Up @@ -91,11 +88,19 @@ if [ "$MODE" == "release" ] && [ -z "$IMG_NAME" ]; then
exit 1
fi

THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

source $WORK_DIR/../../hack/verify-kustomize.sh

KUSTOMIZE=$THIS_DIR/../bin/kustomize
if [ -z "$KUSTOMIZE" ]; then
KUSTOMIZE="$(verify_kustomize)"
elif ! $KUSTOMIZE version > /dev/null 2>&1; then
echoerr "$KUSTOMIZE does not appear to be a valid kustomize binary"
print_help
exit 1
fi

KUSTOMIZATION_DIR=$THIS_DIR/../config
KUSTOMIZATION_DIR=$WORK_DIR/../config

cd $KUSTOMIZATION_DIR

Expand Down
5 changes: 3 additions & 2 deletions multicluster/test/integration/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ var _ = BeforeSuite(func() {
k8sClient.Create(ctx, testNS)
k8sClient.Create(ctx, testNSStale)
clusterSetReconciler := &multiclustercontrollers.MemberClusterSetReconciler{
Client: k8sManager.GetClient(),
Scheme: k8sManager.GetScheme(),
Client: k8sManager.GetClient(),
Scheme: k8sManager.GetScheme(),
Namespace: LeaderNamespace,
}
err = clusterSetReconciler.SetupWithManager(k8sManager)
Expect(err).ToNot(HaveOccurred())
Expand Down

0 comments on commit 687679f

Please sign in to comment.