Skip to content

Allow make e2e-setup-certmanager to work on any cluster #5612

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

Closed
wants to merge 5 commits into from

Conversation

wallrj
Copy link
Member

@wallrj wallrj commented Dec 1, 2022

Modify the e2e make script to allow images to be pushed to a public registry, and install cert-manager to currently configure KUBECONFIG cluster.

This allows me to compile and deploy (redeploy) cert-manager on an Azure AKS cluster for example.

For example:

# An Azure AKS cluster
$ kubectl get nodes -o wide
NAME                                STATUS   ROLES   AGE     VERSION    INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION     CONTAINER-RUNTIME
aks-nodepool1-80906083-vmss000000   Ready    agent   2d21h   v1.23.12   10.224.0.4    <none>        Ubuntu 18.04.6 LTS   5.4.0-1094-azure   containerd://1.6.4+azure-4

# Publish to ttl.sh with a unique repo prefix to avoid clashes with other images
$ export OCI_REGISTRY_BASE=ttl.sh/$(uuidgen)/

# The USE_EXISTING_CLUSTER=true variable makes it so that the e2e-setup-certmanager 
# (and other e2e setup targets) do not depend on there being a deployed kind cluster.
$ make --jobs e2e-setup-certmanager USE_EXISTING_CLUSTER=true

Another example, showing how to deploy to GKE using Docker images pushed to a private GCR registry.

gcloud config  set project jetstack-richard

gcloud container clusters create $CLUSTER --preemptible --num-nodes=1

gcloud container clusters get-credentials $CLUSTER

export OCI_REGISTRY_BASE=eu.gcr.io/jetstack-richard/tmp-$(uuidgen)/

make --jobs e2e-setup-certmanager USE_EXISTING_CLUSTER=true

$ cmctl version -o yaml
clientVersion:
  compiler: gc
  gitCommit: a96bae172ddb1fcd4b57f1859ab9d1a9e94f7451
  gitTreeState: ""
  gitVersion: v1.10.1
  goVersion: go1.19.3
  platform: linux/amd64
serverVersion:
  detected: v1.11.0-alpha.1-1-ga3cb03d19fe94e
  sources:
    crdLabelVersion: v1.11.0-alpha.1-1-ga3cb03d19fe94e

NONE

@jetstack-bot jetstack-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 1, 2022
@jetstack-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: wallrj

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jetstack-bot jetstack-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 1, 2022
@wallrj wallrj force-pushed the e2e-deploy-any-cluster branch from f493b7c to a1de903 Compare December 1, 2022 10:21
@jetstack-bot jetstack-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 6, 2022
@wallrj wallrj force-pushed the e2e-deploy-any-cluster branch from a1de903 to 72f2c24 Compare December 8, 2022 18:07
@jetstack-bot jetstack-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 8, 2022
Modify the e2e make script to allow images to be pushed to a public registry,
and install cert-manager to currently configure KUBECONFIG cluster.

This allows me to compile and deploy cert-manager on an Azure AKS cluster for example.

Signed-off-by: Richard Wall <richard.wall@jetstack.io>
@wallrj wallrj force-pushed the e2e-deploy-any-cluster branch from 72f2c24 to a3cb03d Compare December 9, 2022 12:20
@wallrj
Copy link
Member Author

wallrj commented Dec 9, 2022

@irbekrm Please try this out. The reason for the E2E failures was that I'd accidentally removed the dns01 private networking settings. Fixed now.

  make --jobs e2e-setup-bind USE_EXISTING_CLUSTER=true SERVICE_IP_PREFIX=10.56.0

Signed-off-by: Richard Wall <richard.wall@jetstack.io>
@irbekrm
Copy link
Contributor

irbekrm commented Dec 9, 2022

Thanks @wallrj I've not run this yet, but took a look at the commands, I have a couple optional suggestions:

The USE_EXISTING_CLUSTER=true variable

I find the existing test setup confusing in that does already use the existing cluster, but only as long as it's a Kind cluster named 'kind', maybe it would be good if this PR could make that clearer.
I'd feel that something like

make e2e-setup-certmanager KUBECONTEXT=<an-existing context from kubeconfig- defaults to kind-kind>

or

make e2e-setup-certmanager KUBECONFIG=<path to kubeconfig from where it picks the current context - defaults to a kubeconfig in _bin/ where 'make e2e-cluster' would put it>

would be clearer/more conventional (we have a couple examples of doing it like this in closed source)

What do you think?

export OCI_REGISTRY_BASE=eu.gcr.io/jetstack-richard/tmp-$(uuidgen)/

I am not sure if you agree, but I find the connection between USE_EXISTING_CLUSTER env var and users having to specify a registry a bit unclear. I also think that it's possible to have a kind cluster with a different name that you want to target and do want to load images (I have that use case for kind clusters that are created by another setup script). So I would rather have this split into two steps with an additional command that pushes images to a registry, i.e:

make images-push REGISTRY=<my-registry> we used to have a target like this with Bazel and I found that very useful
make e2e-setup=kind REGISTRY=<my-registry> KIND_LOAD_IMAGES=false // perhaps we don't even need KIND_LOAD_IMAGES, that could be done separately in e2e-setup target

Let me know what you think- I think this PR will be useful in either form.

  make --jobs e2e-setup-ingressnginx USE_EXISTING_CLUSTER=true SERVICE_IP_PREFIX=10.56.0

Signed-off-by: Richard Wall <richard.wall@jetstack.io>
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
@jetstack-bot jetstack-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Dec 15, 2022
@jetstack-bot
Copy link
Contributor

@wallrj: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cert-manager-master-e2e-v1-26-upgrade d22a557 link true /test pull-cert-manager-master-e2e-v1-26-upgrade

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@wallrj
Copy link
Member Author

wallrj commented Dec 20, 2022

@irbekrm I agree with you that the interplay between USE_EXISTING_CLUSTER and OCI_REGISTRY_BASE was not intuitive.
So I have created a new PR with an alternative approach which does not try and overload the existing make targets, but introduces two new dedicated make targets and uses ko to create the images.

I tried but failed to get conditionally use an external OCI registry for the images of all the other e2e requirements, such as pebble, bind, helm etc. Each of those needed to be modified to use different helm chart values, depending on whether the Docker images were being loaded or had been pushed to an external registry.

I'll close this PR and hope that you'll have some time to review and try out #5655

@wallrj wallrj closed this Dec 20, 2022
@wallrj wallrj deleted the e2e-deploy-any-cluster branch December 20, 2022 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants