Skip to content

feat(nodeadm): add support to configure http-proxy for al2023/nodeadm#2384

Merged
shvbsle merged 28 commits intoawslabs:mainfrom
shvbsle:http-proxy-support
Oct 2, 2025
Merged

feat(nodeadm): add support to configure http-proxy for al2023/nodeadm#2384
shvbsle merged 28 commits intoawslabs:mainfrom
shvbsle:http-proxy-support

Conversation

@shvbsle
Copy link
Copy Markdown
Contributor

@shvbsle shvbsle commented Aug 19, 2025

Issue #, if available:
#2128

Description of changes:
Nodeadm has two phases: 1. Config and 2. Run. Nodeadm has a set of outbound API calls (IMDS, AWS API calls) that could potentially need to be routed through a proxy. Currently, setting proxy configurations would happen after the config phase in user-data. This PR adds support to configure http-proxy in NodeConfigSpec.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Testing Done

  1. Built an AL2023 AMI
make -d k8s=1.33 os_distro=al2023
  1. Set up a proxy and added proxy details in the launch-template:
---
apiVersion: node.eks.aws/v1alpha1
kind: NodeConfig
spec:
  instance:
    environment:
      default:
        HTTP_PROXY: "http://default-proxy:8080"
        HTTPS_PROXY: "https://default-proxy:8080"
        NO_PROXY: "localhost,127.0.0.1,169.254.169.254"
      kubelet:
        KUBELET_SPECIFIC_VAR: "kubelet-value"
        HTTP_PROXY: "http://kubelet-proxy:8080"  # Override default
      containerd:
        CONTAINERD_SPECIFIC_VAR: "containerd-value"
  cluster:
    apiServerEndpoint: https://example.com
    certificateAuthority: Y2VydGlmaWNhdGVBdXRob3JpdHk=
    cidr: 10.100.0.0/16
    name: my-cluster
  1. Confirmed that:
  • Nodes join the cluster
  • IMDS calls don't go through proxy
  • nodeadm (config + run) outbound API calls go through the proxy
  • AWS EC2 API Calls go through the proxy
  • EKS API Server calls (gRPC) go through the proxy
  • Kubelet + containerd outbound calls go through the proxy

See this guide for recommended testing for PRs. Some tests may not apply. Completing tests and providing additional validation steps are not required, but it is recommended and may reduce review time and time to merge.

@shvbsle shvbsle marked this pull request as ready for review August 26, 2025 21:02
@shvbsle shvbsle requested a review from cartermckinnon August 26, 2025 21:02
@shvbsle shvbsle changed the title WIP: feat(nodeadm): add support to configure http-proxy for al2023/nodeadm feat(nodeadm): add support to configure http-proxy for al2023/nodeadm Aug 26, 2025
@shvbsle
Copy link
Copy Markdown
Contributor Author

shvbsle commented Sep 16, 2025

/ci
+workflow:k8s_versions 1.33

@github-actions
Copy link
Copy Markdown
Contributor

@shvbsle roger that! I've dispatched a workflow. 👍

@github-actions
Copy link
Copy Markdown
Contributor

@shvbsle the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.33 / al2023success ✅success ✅

@shvbsle
Copy link
Copy Markdown
Contributor Author

shvbsle commented Sep 16, 2025

/ci

@github-actions
Copy link
Copy Markdown
Contributor

@shvbsle roger that! I've dispatched a workflow. 👍

@github-actions
Copy link
Copy Markdown
Contributor

@shvbsle the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.28 / al2023success ✅success ✅
1.29 / al2023success ✅success ✅
1.30 / al2023success ✅success ✅
1.31 / al2023success ✅success ✅
1.32 / al2023success ✅success ✅
1.33 / al2023success ✅success ✅

@shvbsle shvbsle requested a review from ndbaker1 September 18, 2025 00:13
@github-actions
Copy link
Copy Markdown
Contributor

@mselim00 the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.28 / al2023success ✅success ✅
1.29 / al2023success ✅success ✅
1.30 / al2023success ✅failure ❌
1.31 / al2023success ✅failure ❌
1.32 / al2023success ✅success ✅
1.33 / al2023success ✅failure ❌

@shvbsle
Copy link
Copy Markdown
Contributor Author

shvbsle commented Sep 30, 2025

/ci

@github-actions
Copy link
Copy Markdown
Contributor

@shvbsle roger that! I've dispatched a workflow. 👍

@github-actions
Copy link
Copy Markdown
Contributor

@shvbsle the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.28 / al2023success ✅success ✅
1.29 / al2023success ✅failure ❌
1.30 / al2023success ✅success ✅
1.31 / al2023success ✅failure ❌
1.32 / al2023success ✅failure ❌
1.33 / al2023success ✅failure ❌

@shvbsle
Copy link
Copy Markdown
Contributor Author

shvbsle commented Sep 30, 2025

I'm defining the following system aspect before the config phase is invoked:

	preConfigAspects := []system.SystemAspect{
		system.NewEnvironmentAspect(),
	}

This is because, enrichConfig calls the AWS EC2 API to get instance details and that call could potentially go through the proxy.

@shvbsle
Copy link
Copy Markdown
Contributor Author

shvbsle commented Oct 1, 2025

/ci

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 1, 2025

@shvbsle roger that! I've dispatched a workflow. 👍

@shvbsle shvbsle requested review from fletcherw and ndbaker1 October 1, 2025 03:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 1, 2025

@shvbsle the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.28 / al2023success ✅failure ❌
1.29 / al2023success ✅failure ❌
1.30 / al2023success ✅failure ❌
1.31 / al2023success ✅success ✅
1.32 / al2023success ✅failure ❌
1.33 / al2023success ✅success ✅

system.NewInstanceEnvironmentAspect(),
}

runAspects := []system.SystemAspect{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: should this be defined on line 140 just before it's used?


const (
instanceEnvironmentAspectName = "instance-environment"
nodeamdEnvironmentAspectName = "nodeadm-environment"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: is nodeadmd a typo?

}

// Reload systemd configuration once after all config files are written
zap.L().Info("Reloading systemd configuration")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this will still trigger daemon reload if all the maps within EnvironmentOptions are empty, it's alright if you don't fix this though.


zap.L().Info("All envOpts: ", zap.Any("=", envOpts))
for serviceName, envVars := range envOpts {
if len(envVars) > 0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: invert if condition:

if len(envVars) == 0 {
  continue
}

to reduce indentation

var buf bytes.Buffer
if err := tmpl.Execute(&buf, configData); err != nil {
zap.L().Error("Failed to execute environment config template", zap.Error(err))
return ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why log the error here vs returning it and logging at a higher level
by returning "" here you will write empty configs when you get an error.

@shvbsle
Copy link
Copy Markdown
Contributor Author

shvbsle commented Oct 2, 2025

/ci

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 2, 2025

@shvbsle roger that! I've dispatched a workflow. 👍

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 2, 2025

@shvbsle the workflow that you requested has completed. 🎉

AMI variantBuildTest
1.28 / al2023success ✅success ✅
1.29 / al2023success ✅success ✅
1.30 / al2023success ✅success ✅
1.31 / al2023success ✅success ✅
1.32 / al2023success ✅success ✅
1.33 / al2023success ✅failure ❌
1.34 / al2023success ✅success ✅

@shvbsle shvbsle merged commit 6b33121 into awslabs:main Oct 2, 2025
12 checks passed
@shvbsle
Copy link
Copy Markdown
Contributor Author

shvbsle commented Oct 2, 2025

CI is flaky but hoping its smoother now

/ci

edit: nvm: doesnt work after merging

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Oct 2, 2025

@shvbsle this PR is not currently mergeable, you'll need to rebase it first.

@ndbaker1
Copy link
Copy Markdown
Contributor

ndbaker1 commented Oct 3, 2025

@shvbsle can you add example usage docs for this change?

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