Skip to content

Commit

Permalink
Stabilize local setup
Browse files Browse the repository at this point in the history
* Deploy stable helm chart together with stable k8gb controller version
* Deploy test helm chart together with temporary test build of k8gb
  controller from current tree
* Update contributor documentation
* Resolves #446

Signed-off-by: Yury Tsarev <yury.tsarev@absa.africa>
  • Loading branch information
ytsarev committed Apr 15, 2021
1 parent 04ccfb8 commit 8f274ae
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/upgrade-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
- name: K8GB deploy stable
run: make deploy-stable

- name: K8GB deploy-candidate-with-helm
run: make deploy-candidate-with-helm
- name: K8GB upgrade candidate
run: make upgrade-candidate

- name: Terratest
run: make terratest
22 changes: 21 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ This is a rough outline of what a contributor's workflow looks like:

Thanks for contributing!

### Local setup

```sh
make make deploy-full-local-setup
```
Deploys k8gb from scracth including:

* 2 local clusters
* Stable k8gb helm chart
* Gslb Custom Resources examples
* Test applications

```sh
make upgrade-candidate
```
Performs upgrade of k8gb helm chart and controller
to the testing version that is built from your current
development tree.

### Testing

* Unit tests should be updated for any functional code change at [test suite location](https://github.com/AbsaOSS/k8gb/tree/master/controllers/gslb_controller_test.go).
Expand Down Expand Up @@ -85,7 +104,8 @@ The first line is the subject and should be no longer than 70 characters, the se

## Documentation

If the contribution changes the existing APIs or user interface it must include sufficient documentation to explain the use of the new or updated feature. Likewise the [CHANGELOG][changelog] should be updated with a summary of the change and link to the pull request.
If the contribution changes the existing APIs or user interface it must include sufficient documentation to explain the use of the new or updated feature.
[CHANGELOG](CHANGELOG.md) is automatically generated from Github PRs and Issues. Please use special [keywords](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) to link PR to and Issue for a clean changelog generation.


[golang-style-doc]: https://github.com/golang/go/wiki/CodeReviewComments
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,20 @@ deploy-full-local-setup: ## Deploy full local multicluster setup (k3d >= 4.2.0)
$(call create-local-cluster,$(CLUSTER_GSLB1))
$(call create-local-cluster,$(CLUSTER_GSLB2))

$(call deploy-local-cluster,$(CLUSTER_GSLB1),$(CLUSTER_GSLB2),$(VERSION),)
$(call deploy-local-cluster,$(CLUSTER_GSLB2),$(CLUSTER_GSLB1),$(VERSION),$(CLUSTER_GSLB2_HELM_ARGS))
$(call deploy-local-cluster,$(CLUSTER_GSLB1),$(CLUSTER_GSLB2),$(VERSION),,'k8gb/k8gb')
$(call deploy-local-cluster,$(CLUSTER_GSLB2),$(CLUSTER_GSLB1),$(VERSION),$(CLUSTER_GSLB2_HELM_ARGS),'k8gb/k8gb')

.PHONY: deploy-stable
deploy-stable:
@echo "\n$(YELLOW) import $(CYAN)k8gb:$(VERSION) $(YELLOW)to $(CYAN)$(CLUSTER_GSLB1), $(CLUSTER_GSLB2) $(NC)"
$(call deploy-local-cluster,$(CLUSTER_GSLB1),$(CLUSTER_GSLB2),$(VERSION),)
$(call deploy-local-cluster,$(CLUSTER_GSLB2),$(CLUSTER_GSLB1),$(VERSION),$(CLUSTER_GSLB2_HELM_ARGS))
$(call deploy-local-cluster,$(CLUSTER_GSLB1),$(CLUSTER_GSLB2),$(VERSION),,'k8gb/k8gb')
$(call deploy-local-cluster,$(CLUSTER_GSLB2),$(CLUSTER_GSLB1),$(VERSION),$(CLUSTER_GSLB2_HELM_ARGS),'k8gb/k8gb')

$(call list-running-pods,$(CLUSTER_GSLB1))
$(call list-running-pods,$(CLUSTER_GSLB2))

.PHONY: deploy-candidate-with-helm
deploy-candidate-with-helm:
.PHONY: upgrade-candidate
upgrade-candidate: ## Upgrade k8gb to the test version on existing clusters
@echo "\n$(YELLOW)build k8gb docker and import to $(CYAN)$(CLUSTER_GSLB1), $(CLUSTER_GSLB2) $(NC)"
docker build . -t $(REPO):$(SEMVER)

Expand All @@ -128,26 +128,25 @@ deploy-candidate-with-helm:

@echo "\n$(YELLOW)Upgrade GSLB operator from $(VERSION) to $(SEMVER) on k3d-$(CLUSTER_GSLB1) $(NC)"
kubectl config use-context k3d-$(CLUSTER_GSLB1)
$(call deploy-k8gb-with-helm,$(CLUSTER_GSLB1),$(CLUSTER_GSLB2),$(SEMVER),)
$(call deploy-k8gb-with-helm,$(CLUSTER_GSLB1),$(CLUSTER_GSLB2),$(SEMVER),,'./chart/k8gb')

@echo "\n$(YELLOW)Upgrade GSLB operator from $(VERSION) to $(SEMVER) on k3d-$(CLUSTER_GSLB2) $(NC)"
kubectl config use-context k3d-$(CLUSTER_GSLB2)
$(call deploy-k8gb-with-helm,$(CLUSTER_GSLB2),$(CLUSTER_GSLB1),$(SEMVER),$(CLUSTER_GSLB2_HELM_ARGS))
$(call deploy-k8gb-with-helm,$(CLUSTER_GSLB2),$(CLUSTER_GSLB1),$(SEMVER),$(CLUSTER_GSLB2_HELM_ARGS),'./chart/k8gb')

$(call list-running-pods,$(CLUSTER_GSLB1))
$(call list-running-pods,$(CLUSTER_GSLB2))

# triggered by terraform GitHub Action. Clusters already exists. GO is not installed yet
.PHONY: deploy-candidate
deploy-candidate:
deploy-candidate: ## Deploy test k8gb version together with CRs and test apps on top of existing clusters
@echo "\n$(YELLOW)build k8gb docker and import to $(CYAN)$(CLUSTER_GSLB1), $(CLUSTER_GSLB2) $(NC)"
docker build . -t $(REPO):$(SEMVER)

k3d image import $(REPO):$(SEMVER) -c $(CLUSTER_GSLB1)
k3d image import $(REPO):$(SEMVER) -c $(CLUSTER_GSLB2)

$(call deploy-local-cluster,$(CLUSTER_GSLB1),$(CLUSTER_GSLB2),$(SEMVER),)
$(call deploy-local-cluster,$(CLUSTER_GSLB2),$(CLUSTER_GSLB1),$(SEMVER),$(CLUSTER_GSLB2_HELM_ARGS))
$(call deploy-local-cluster,$(CLUSTER_GSLB1),$(CLUSTER_GSLB2),$(SEMVER),,'./chart/k8gb')
$(call deploy-local-cluster,$(CLUSTER_GSLB2),$(CLUSTER_GSLB1),$(SEMVER),$(CLUSTER_GSLB2_HELM_ARGS),'./chart/k8gb')

$(call list-running-pods,$(CLUSTER_GSLB1))
$(call list-running-pods,$(CLUSTER_GSLB2))
Expand Down Expand Up @@ -333,8 +332,9 @@ define create-local-cluster
endef

define deploy-k8gb-with-helm
helm repo add --force-update k8gb https://www.k8gb.io
cd chart/k8gb && helm dependency update
helm -n k8gb upgrade -i k8gb chart/k8gb -f $(VALUES_YAML) \
helm -n k8gb upgrade -i k8gb $5 -f $(VALUES_YAML) \
--set k8gb.hostAlias.enabled=true \
--set k8gb.hostAlias.ip="`$(call get-host-alias-ip,k3d-$1,k3d-$2)`" \
--set k8gb.imageTag=$3 $4 \
Expand All @@ -351,7 +351,7 @@ define deploy-local-cluster
kubectl apply -f deploy/namespace.yaml

@echo "\n$(YELLOW)Deploy GSLB operator from $3 $(NC)"
$(call deploy-k8gb-with-helm,$1,$2,$3,$4)
$(call deploy-k8gb-with-helm,$1,$2,$3,$4,$5)

@echo "\n$(YELLOW)Deploy Ingress $(NC)"
helm repo add --force-update nginx-stable https://kubernetes.github.io/ingress-nginx
Expand Down

0 comments on commit 8f274ae

Please sign in to comment.