Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multicluster setup (n > 2) #722

Merged
merged 1 commit into from
Nov 19, 2021
Merged

Conversation

jkremser
Copy link
Member

@jkremser jkremser commented Nov 9, 2021

  • change the Makefile targets so that they run in a for loop
  • add tests for terratest for round-robin @ 3 clusters (failover is still pending)
  • change the helm chart to be able to set up more than one hostAlias entry for a pod
  • add simple script that generates the yaml configs for k3d clusters so that we are DRY

to verify the change locally i suggest:

# deploy 5 clusters
make deploy-full-local-setup CLUSTERS_NUMBER=5

# do some testing
for i in {0..20} ; do make test-round-robin | grep mess ; done

# cleanup
make destroy-full-local-setup CLUSTERS_NUMBER=5

another consequence of this PR is that when trying to incorporate a change in local helm chart (that hasn't been published yet), one can do make deploy-full-local-setup CHART=./chart/k8gb

Signed-off-by: Jirka Kremser jiri.kremser@gmail.com

@jkremser jkremser force-pushed the round-robin-3-clusters branch 8 times, most recently from f1d48f7 to 8ffee2f Compare November 10, 2021 17:34
Copy link
Collaborator

@kuritka kuritka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably requires additional investigation,
please consider native iterators (see example):

# search, based on value from first list retrieves value in second list
# l1=[a b c] l2=[A D E] -> search(b, l1,l2) -> D 
search = $(subst $1_,,$(filter $1_%, $(join $(addsuffix _,$2),$3)))

k3ds ?= $(shell seq -f 'k3d-%g.yaml' 1 10)
k3dgeo ?= us de za cz es sp nl ru cn eu
https ?= $(shell seq 8053 8063)

k3d-%.yaml:
	@echo anycommand $@ $(*) \
	$(call search,$@,$(k3ds),$(k3dgeo)) \
	$(call search,$@,$(k3ds),$(https))

.PHONY: k3dgen
k3dgen: $(k3ds)
❯ make k3dgen
anycommand k3d-1.yaml 1 us 8053
anycommand k3d-2.yaml 2 de 8054
anycommand k3d-3.yaml 3 za 8055
anycommand k3d-4.yaml 4 cz 8056
anycommand k3d-5.yaml 5 es 8057
anycommand k3d-6.yaml 6 sp 8058
anycommand k3d-7.yaml 7 nl 8059
anycommand k3d-8.yaml 8 ru 8060
anycommand k3d-9.yaml 9 cn 8061
anycommand k3d-10.yaml 10 eu 8062

k3d/test-gslb4.yaml Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@jkremser jkremser force-pushed the round-robin-3-clusters branch from 8ffee2f to 6c0fcaa Compare November 15, 2021 13:39
@jkremser
Copy link
Member Author

please consider native iterators (see example):

I know about it, but I wanted to avoid 'dynamic targets' or pattern rules, or what is it called to make it simple. I like the way how you combine two strings together and then allow for "random access" in it so I've borrowed that for the geo tags to have it as one-liner (space separated) instead of those 10 lines and 10 different variables

@jkremser jkremser force-pushed the round-robin-3-clusters branch 2 times, most recently from 062cbfd to 27738fa Compare November 15, 2021 14:22
.gitignore Outdated Show resolved Hide resolved
@jkremser jkremser force-pushed the round-robin-3-clusters branch from 27738fa to 7bfe646 Compare November 15, 2021 17:00
@jkremser jkremser requested a review from kuritka November 16, 2021 08:35
kuritka
kuritka previously approved these changes Nov 16, 2021
@jkremser jkremser force-pushed the round-robin-3-clusters branch 2 times, most recently from 4f7398a to 0530c74 Compare November 16, 2021 16:50
@jkremser jkremser requested a review from kuritka November 16, 2021 20:11
@jkremser jkremser force-pushed the round-robin-3-clusters branch 4 times, most recently from c62a134 to 3a731ff Compare November 18, 2021 14:26
Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concern:

The default number of clusters produced by Makefile is 2.

The hardcoded number of clusters in terratest is becoming 3 with this change.

It will break local make terratest invocation when CLUSTER_NUMBER != 3

We probably should fail fast in make terratest target if CLUSTER_NUMBER !=3 with a clear message that tests are expecting 3 clusters to avoid confusion in future.

In the long run we might extend terratest suite to be more dynamic in this regards but it will be probably overkilling.

@jkremser jkremser force-pushed the round-robin-3-clusters branch from 3a731ff to a14a046 Compare November 19, 2021 10:38
- change the Makefile targets so that they run in a for loop
- add tests for terratest for round-robin @ 3 clusters (failover is still pending)
- change the helm chart to be able to set up more than one hostAlias entry for a pod
- add simple script that generates the yaml configs for k3d clusters so that we are DRY

Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
@jkremser jkremser force-pushed the round-robin-3-clusters branch from a14a046 to 94fd1bb Compare November 19, 2021 11:00
@jkremser jkremser requested a review from ytsarev November 19, 2021 12:29
@jkremser
Copy link
Member Author

We probably should fail fast in make terratest target if CLUSTER_NUMBER !=3 with a clear message that tests are expecting 3 clusters to avoid confusion in future.

it's there

Copy link
Member

@ytsarev ytsarev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the fixes, LGTM

@jkremser
Copy link
Member Author

Thanks for reviews!

terrascan & CodeQL checks are being stucked, but these were passing before, so merging..

@jkremser jkremser merged commit 6f3f219 into k8gb-io:master Nov 19, 2021
@jkremser jkremser deleted the round-robin-3-clusters branch November 19, 2021 13:41
jkremser added a commit to jkremser/k8gb that referenced this pull request Nov 22, 2021
Only `deploy-full-local-setup` target will deploy podinfo and custom resources.
I accidentally reverted this existing logic in pr k8gb-io#722

Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
jkremser added a commit that referenced this pull request Nov 22, 2021
Only `deploy-full-local-setup` target will deploy podinfo and custom resources.
I accidentally reverted this existing logic in pr #722

Signed-off-by: Jirka Kremser <jiri.kremser@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants