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

Add kubectl installation to Dockerfile #49

Closed

Conversation

ahanafy
Copy link

@ahanafy ahanafy commented Jan 22, 2024

This pull request adds the installation of kubectl to the gcp section of the Dockerfile. The previous execution of gcloud components install gke-gcloud-auth-plugin supports kubectl authentication to gke clusters. Having the kubectl cli installed allows users to access their clusters.

Usage of this runner image via spacelift requires a user customize the "Applying" workflow phase by adding the command gcloud auth login --cred-file=/mnt/workspace/cred-file.json (or wherever the gcp credentials file is)

Dockerfile Outdated Show resolved Hide resolved
Co-authored-by: Bernd Schorgers <[email protected]>
@peterdeme
Copy link
Contributor

I don't see why not. Opinions @adamconnelly @eliecharra?

@peterdeme peterdeme requested a review from eliecharra February 15, 2024 16:46
@adamconnelly
Copy link
Contributor

I think it's ok. The only concerns I would have would be:

  1. We're adding more to the image.
  2. It's possible that the version of kubectl might not be compatible with all customer's clusters.

But for point 1 the image is already huge compared to our base runner image, presumably because of the overhead of adding gcloud, so I don't think adding kubectl and the auth plugin will be a huge concern here.

And for point 2, given that this is a GCP-specific image, and this is installing the version of kubectl provided by the gcloud command, I think that's fair enough.

So long story short - I don't have any objections here.

@eliecharra
Copy link
Member

eliecharra commented Feb 16, 2024

I'm not strongly against it, but I'm also not super enthusiastic about adding more and more tools to the image, whatever it's actual size.
Is this image meant to be used only for terraform workflows? If yes, I'm not sure to frame why a kubectl binary is useful for terraform workflows.
Correct me if I'm wrong, but it looks like a convenience/debugging move to me? In that case, I think the proper approach is to extends this image and use it instead of making the base image more heavy.
I'm also worried that this will add additional maintenance as we add more tools to the scope.

@peterdeme
Copy link
Contributor

I think I agree with Elie on this one, adding such a tool could make this base image a bit fragile as well. Who knows what breaking change will be introduced in the kubectl.

@ahanafy
Copy link
Author

ahanafy commented Feb 16, 2024

I'm not strongly against it, but I'm also not super enthusiastic about adding more and more tools to the image, whatever it's actual size. Is this image meant to be used only for terraform workflows? If yes, I'm not sure to frame why a kubectl binary is useful for terraform workflows. Correct me if I'm wrong, but it looks like a convenience/debugging move to me? In that case, I think the proper approach is to extends this image and use it instead of making the base image more heavy. I'm also worried that this will add additional maintenance as we add more tools to the scope.

To give you some context as to why this is important for terraform workflows with GCP, you'll notice that the gke autopilot module from terraform-google-modules requires kubectl:
https://registry.terraform.io/modules/terraform-google-modules/kubernetes-engine/google/latest/submodules/beta-autopilot-private-cluster#software-dependencies

I was able to solve this without creating a custom runner so far by adding kubectl installation in the Initialization phase of my stacks, but thought that it made more sense to be in the offical gcp image

@peterdeme
Copy link
Contributor

Let's close this PR for now because of Elie's reasoning (possible breaking changes). I'd recommend building a custom image on top of this one.

@peterdeme peterdeme closed this Apr 18, 2024
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