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

feat(test): creating local cluster for e2e #250

Merged
merged 35 commits into from
Aug 1, 2024
Merged

Conversation

onuryilmaz
Copy link
Contributor

@onuryilmaz onuryilmaz commented May 28, 2024

Creating a local cluster:

$ make e2e-local-cluster-create
cd test/e2e/local-cluster && go run .
I0629 13:22:52.739416  580350 create_cluster.go:63] "configuration loaded" kindClusterName="greenhouse-e2e" dockerImageRepository="greenhouse" dockerImageTag="e2e-latest" dockerImageBuildSkip=false kubeconfigName="e2e.kubeconfig" kubeconfigInternalName="e2e.internal.kubeconfig"
I0629 13:23:08.063941  580350 create_cluster.go:80] "cluster created successfully"
I0629 13:23:08.332099  580350 create_cluster.go:108] "kubeconfig exported successfully"
I0629 13:23:09.076845  580350 create_cluster.go:118] "Docker image built successfully"
I0629 13:23:16.396176  580350 create_cluster.go:127] "Docker image loaded to the cluster successfully"
I0629 13:23:39.179051  580350 create_cluster.go:135] "Greenhouse manager is deployed successfully"

Copy link
Contributor

@uwe-mayer uwe-mayer left a comment

Choose a reason for hiding this comment

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

Nice work!

Take a look at what already exists in /pkg/test namely env.go. This is what we need to use and leverage to be able to easily switch between contexts:

  • env-test
  • local kind
  • remote greenhouse cluster

It provides a lot of tooling that we do not need to duplicate, mainly providing a client, config and kubeconfig when testing for example

go.mod Show resolved Hide resolved
pkg/test/env.go Outdated Show resolved Hide resolved
test/e2e/local-cluster/create_cluster.go Outdated Show resolved Hide resolved
test/e2e/local-cluster/create_cluster.go Outdated Show resolved Hide resolved
test/e2e/local-cluster/create_cluster.go Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
test/e2e/suite_test.go Outdated Show resolved Hide resolved
test/e2e/suite_test.go Outdated Show resolved Hide resolved
test/e2e/suite_test.go Outdated Show resolved Hide resolved
test/e2e/suite_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@IvoGoman IvoGoman left a comment

Choose a reason for hiding this comment

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

I like how this looks now.

go.mod Outdated Show resolved Hide resolved
pkg/test/env.go Outdated Show resolved Hide resolved
test/e2e/suite_test.go Outdated Show resolved Hide resolved
go.mod Show resolved Hide resolved
test/e2e/local-cluster/create_cluster.go Outdated Show resolved Hide resolved
test/e2e/local-cluster/create_cluster.go Show resolved Hide resolved
test/e2e/local-cluster/create_cluster.go Outdated Show resolved Hide resolved
@onuryilmaz onuryilmaz requested review from a team as code owners June 20, 2024 13:14
test/e2e/local-cluster/create_cluster.go Outdated Show resolved Hide resolved
test/e2e/local-cluster/create_cluster.go Outdated Show resolved Hide resolved
test/e2e/local-cluster/create_cluster.go Outdated Show resolved Hide resolved
@onuryilmaz
Copy link
Contributor Author

⎈ /g/s/g/c/greenhouse > docker rmi greenhouse:e2e-latest
Untagged: greenhouse:e2e-latest
Deleted: sha256:0d48f04c01d1d4fec4e2c16dada00c968101b4ac5d22a8bce19e7d62409f4c71

⎈ /g/s/g/c/greenhouse > kind delete clusters greenhouse-e2e
Deleted nodes: ["greenhouse-e2e-control-plane"]
Deleted clusters: ["greenhouse-e2e"]

⎈ /g/s/g/c/greenhouse > make e2e-local-cluster-create
cd test/e2e/local-cluster && go run .
I0711 11:45:22.514215 2340085 create_cluster.go:82] "configuration loaded" kindClusterName="greenhouse-e2e" dockerImageRepository="greenhouse" dockerImageTag="e2e-latest" dockerImageBuildSkip=false kubeconfigName="e2e.kubeconfig" kubeconfigInternalName="e2e.internal.kubeconfig"
I0711 11:45:39.319226 2340085 create_cluster.go:99] "cluster created successfully"
I0711 11:45:39.555364 2340085 create_cluster.go:127] "kubeconfig exported successfully"
I0711 11:46:23.526305 2340085 create_cluster.go:137] "Docker image built successfully"
I0711 11:46:31.278263 2340085 create_cluster.go:146] "Docker image loaded to the cluster successfully"
I0711 11:46:33.850611 2340085 create_cluster.go:154] "idproxy is deployed successfully"
I0711 11:46:46.652780 2340085 create_cluster.go:162] "Greenhouse manager is deployed successfully"

⎈ /g/s/g/c/greenhouse > export KUBECONFIG=./test/e2e/local-cluster/e2e.kubeconfig
⎈ /g/s/g/c/greenhouse > kubectl get pods -n greenhouse
NAME                                            READY   STATUS      RESTARTS   AGE
greenhouse-controller-manager-bb9756c78-z48lr   1/1     Running     0          23s
greenhouse-kube-webhook-certgen-qf7dq           0/2     Completed   0          23s
⎈ /g/s/g/c/greenhouse > 

@uwe-mayer @IvoGoman fyi

@IvoGoman IvoGoman self-requested a review July 23, 2024 07:03
test/e2e/README.md Outdated Show resolved Hide resolved
pkg/test/env.go Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
@uwe-mayer
Copy link
Contributor

@IvoGoman @onuryilmaz Totally agree on changing the kubeconfig env var to run remote tests against.
See 4a8f594
PR is good to go from my side...

@IvoGoman IvoGoman self-requested a review July 31, 2024 07:06
@uwe-mayer uwe-mayer merged commit ca26579 into main Aug 1, 2024
5 checks passed
@uwe-mayer uwe-mayer deleted the feat/e2e-test-setup-v2 branch August 1, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants