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

Use controllerruntime to discover CABundle #636

Merged
merged 34 commits into from
Sep 2, 2021

Conversation

JacobGabrielson
Copy link
Contributor

@JacobGabrielson JacobGabrielson commented Aug 24, 2021

Issue, if available:

N/A

Description of changes:

Apologies for the churn folks, after talking to @ellistarn offline, it seems like the best path forward, given some other changes coming soon, is to explicitly call GetCABundle() from the cloudprovider, rather than dynamically default it in.

Also, this change now uses client-go to discover the CABundle contents (effectively it's still doing the same thing
as before, just using their library code now).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@netlify
Copy link

netlify bot commented Aug 24, 2021

✔️ Deploy Preview for karpenter-docs-prod canceled.

🔨 Explore the source changes: 85a721d

🔍 Inspect the deploy log: https://app.netlify.com/sites/karpenter-docs-prod/deploys/61303df7a6caed0007f5addf

@bwagner5
Copy link
Contributor

bwagner5 commented Aug 24, 2021

looks like the toolchain install is broken because this link does not work to download kubebuilder 2.3.1 anymore:

https://go.kubebuilder.io/dl/2.3.1/linux/amd64

Not sure why that one doesn't work, but https://go.kubebuilder.io/releases/latest/linux/amd64 does work.

The github assets link does work though, so maybe we just change to that (the go.kubebuilder.io/releases just redirects to github):
https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_linux_amd64.tar.gz

@JacobGabrielson JacobGabrielson changed the title [WIP][EXPERIMENTAL] support fake filesystems in unit tests Support fake filesystems in unit tests Aug 29, 2021
@JacobGabrielson JacobGabrielson changed the title Support fake filesystems in unit tests Add additional spec validations for AWS cloudprovider Aug 29, 2021
ellistarn
ellistarn previously approved these changes Aug 30, 2021
Copy link
Contributor

@ellistarn ellistarn left a comment

Choose a reason for hiding this comment

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

Feel free to merge. Comments are optional and nonblocking.

errs = errs.Also(apis.ErrMissingField("name")).ViaField("cluster")
}
if ptr.StringValue(spec.Cluster.CABundle) == "" {
Copy link

@rustrial rustrial Aug 30, 2021

Choose a reason for hiding this comment

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

FYI: I deliberately skipped this check in my initial version of CABundle handling, to support the use-case where there is no CABundle (e.g. if the k8s API endpoint is served in plain-text without TLS). I know this might not be possible with EKS (which is always TLS), but it can still happen with non EKS clusters hosted on EC2.

Personally, I don't care to much, as I only use TLS protected k8s API endpoints and plain-text endpoints are a bad practice anyway. However, I still prefer to have secure defaults while still allowing others to opt-out (for whatever reasons they might have).

Maybe, we can make this check conditional, based on the protocol (scheme) part for the cluster endpoint.

  • https -> apply this check
  • http -> ignore this check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rustrial thanks! That makes sense to me, I'll make the change and see what everyone thinks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, for now I've changed the code back to the way it was before - it won't complain if CABundle is missing. I'll add the http/https nuance back in in a future change.

@JacobGabrielson JacobGabrielson force-pushed the fstest branch 2 times, most recently from ea33ba6 to 05a211e Compare August 30, 2021 21:37
ellistarn
ellistarn previously approved these changes Aug 30, 2021
@JacobGabrielson JacobGabrielson changed the title Add additional spec validations for AWS cloudprovider [WIP] Add additional spec validations for AWS cloudprovider Aug 31, 2021
@JacobGabrielson JacobGabrielson marked this pull request as draft August 31, 2021 00:30
@JacobGabrielson JacobGabrielson changed the title Use client-go to discover CABundle [WIP] Use client-go to discover CABundle Sep 1, 2021
... instead of rest.InClusterConfig() - this will work in more
scenarios, such as when Karpenter is not running inside of the
cluster
@JacobGabrielson JacobGabrielson changed the title [WIP] Use client-go to discover CABundle [WIP] Use controllerruntime to discover CABundle Sep 2, 2021
@JacobGabrielson JacobGabrielson changed the title [WIP] Use controllerruntime to discover CABundle Use controllerruntime to discover CABundle Sep 2, 2021
Copy link
Contributor

@bwagner5 bwagner5 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@ellistarn ellistarn left a comment

Choose a reason for hiding this comment

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

Curious why we move away from gotemplates for userdata. I find it a bit more difficult to parse.

@JacobGabrielson
Copy link
Contributor Author

Curious why we move away from gotemplates for userdata. I find it a bit more difficult to parse.

It started getting complicated trying to call a function from the templates, so it seemed easier overall to switch to the more clunky old school method.

@JacobGabrielson JacobGabrielson merged commit 7012c92 into aws:main Sep 2, 2021
JacobGabrielson added a commit that referenced this pull request Sep 2, 2021
JacobGabrielson added a commit that referenced this pull request Sep 2, 2021
JacobGabrielson pushed a commit that referenced this pull request Sep 3, 2021
gfcroft pushed a commit to gfcroft/karpenter-provider-aws that referenced this pull request Nov 25, 2023
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.

4 participants