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

Fetch Region and CLUSTER_ID information from cni-metrics-helper env #1715

Merged
merged 12 commits into from
Jan 27, 2022

Conversation

cgchinmay
Copy link
Contributor

@cgchinmay cgchinmay commented Oct 28, 2021

What type of PR is this?
feature

Which issue does this PR fix:
Allows Customers to use cni-metrics-helper by completely blocking access to IMDS

What does this PR do / Why do we need it:
Removes hard dependency of cni-metrics-helper on IMDS

If an issue # is not available please add repro steps and logs from IPAMD/CNI showing the issue:
#1287

Testing done on this change:
Automation added to e2e:
Added Unit test
Manually tested on sample cluster

Tested by disabling pod-imds

"MetadataOptions": {
                        "State": "applied",
                        "HttpTokens": "required",
                        "HttpPutResponseHopLimit": 1,
                        "HttpEndpoint": "enabled"
                    },

Will this break upgrades or downgrades. Has updating a running cluster been tested?:
No

Does this change require updates to the CNI daemonset config files to work?:

Yes, if IMDS access needs to be blocked

Does this PR introduce any user-facing change?:
Yes

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

Copy link
Contributor

@jayanthvn jayanthvn left a comment

Choose a reason for hiding this comment

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

Can you also add a section here - https://github.com/aws/amazon-vpc-cni-k8s/tree/master/cmd/cni-metrics-helper. We can give steps on how to enable IRSA for cni-metrics helper and include this -

Case 1: Cx not using IRSA, we need to get region and clusterID using IMDS (existing approach)
 	// Case 2: Cx using IRSA but not specified clusterID, we can still get this info if IMDS is not blocked
 	// Case 3: Cx blocked IMDS access and not using IRSA (which means region == "") OR
 	// not specified clusterID then its a Cx error

@jayanthvn
Copy link
Contributor

Also as part of this, lets update https://docs.aws.amazon.com/eks/latest/userguide/cni-metrics-helper.html for IRSA support.

@jayanthvn jayanthvn added this to the v1.10.1 milestone Nov 2, 2021
pkg/publisher/publisher.go Outdated Show resolved Hide resolved
@cgchinmay
Copy link
Contributor Author

Can you also add a section here - https://github.com/aws/amazon-vpc-cni-k8s/tree/master/cmd/cni-metrics-helper. We can give steps on how to enable IRSA for cni-metrics helper and include this -

Case 1: Cx not using IRSA, we need to get region and clusterID using IMDS (existing approach)
 	// Case 2: Cx using IRSA but not specified clusterID, we can still get this info if IMDS is not blocked
 	// Case 3: Cx blocked IMDS access and not using IRSA (which means region == "") OR
 	// not specified clusterID then its a Cx error

Updated Readme

Fix compilation errors (aws#1751)

add support for running canary script in different regions (aws#1752)

Regenerate pod eni values for new instance types (aws#1754)

* Regenerate pod eni values for new instance types

Co-authored-by: Senthil Kumaran <senthilx@amazon.com>

Closed issue message (aws#1761)

* closed issue message

* update message

fix typo in upload script (aws#1763)

Update calico file path

Use an unique s3 bucket name (aws#1760)

Update region

Workflow to build arm and x86 images (aws#1764)

DataStore.GetStats() refactoring to simplify adding new fields (aws#1704)

* DataStore.GetStats() refactoring to simplify adding new fields

* cleanup

* cleanup

* cleanup

* goimports

* rename test to TestGetStatsV4

* address comments

* fix typo

* update

* update "IP pool is too low" logging

* GetStats() -> GetIpStats()

* GetStats() -> GetIpStats() in tests and comments

* update test

* cleanup test

* add logPoolStats comment

Fix KOPS_STATE_STORE (aws#1770)

Automation script for running IT  (aws#1759)

Update issue template

Update issue template with email address

Update issue template

Update go.mod for integration folder (aws#1741)

* Update go.mod for integration folder

- Update go.mod for integration folder

* Change integration test to use new K8s test framework

* Modify server pod image

* Switch to Nginx port 80 for server pod

* Switch server port in client test

* Remove custom command directive for Nginx pod

* Added ping command for host checks

README: mention arn:aws:iam::aws:policy/AmazonEKS_CNI_Policy (aws#1768)

Co-authored-by: Shreya027 <shrenaik@amazon.com>

Add dl1.24xlarge to ENILimits override list (aws#1777)

Chart and Manifest updates (aws#1771)

* Chart and Manifest updates

* Update probe timeout values

Change workflow to use git install (aws#1785)

- Change workflow to use git install as the go get command was
  altering go.mod file without updating go.sum file

Add HostNetworking Test for PPSG in test agent  (aws#1720)

* Add HostNetworking Test for PPSG in test agent

* Updated PPSG test to validate vlan.eth link
@groodt
Copy link
Contributor

groodt commented Jan 10, 2022

Nice! Any ETA on v1.10.2 being GA?

@cgchinmay
Copy link
Contributor Author

cgchinmay commented Jan 10, 2022

Nice! Any ETA on v1.10.2 being GA?

Will soon have one, but will be around mid February. If you want to use this change then we do have private image release. Change the image tag to v1.10.2-rc1 in this manifest and then apply this manifest

@groodt
Copy link
Contributor

groodt commented Jan 10, 2022

Change the image tag to v1.10.2-rc1 and apply this manifest.

I've tried upgrading amazon-vpc-cni-k8s to v1.10.2-rc1 and unfortunately aws-node fails to start.

{"level":"info","ts":"2022-01-10T11:17:44.242Z","caller":"entrypoint.sh","msg":"Validating env variables ..."}
{"level":"info","ts":"2022-01-10T11:17:44.339Z","caller":"entrypoint.sh","msg":"Install CNI binaries.."}
{"level":"info","ts":"2022-01-10T11:17:44.644Z","caller":"entrypoint.sh","msg":"Starting IPAM daemon in the background ... "}
{"level":"info","ts":"2022-01-10T11:17:44.739Z","caller":"entrypoint.sh","msg":"Checking for IPAM connectivity ... "}
{"level":"info","ts":"2022-01-10T11:17:47.041Z","caller":"entrypoint.sh","msg":"Retrying waiting for IPAM-D"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x39 pc=0x55ed00eac7c8]

goroutine 552 [running]:
github.com/aws/amazon-vpc-cni-k8s/pkg/ipamd.(*IPAMContext).StartNodeIPPoolManager(0x0)
	/go/src/github.com/aws/amazon-vpc-cni-k8s/pkg/ipamd/ipamd.go:633 +0x28
created by main._main
	/go/src/github.com/aws/amazon-vpc-cni-k8s/cmd/aws-k8s-agent/main.go:64 +0x32c
{"level":"info","ts":"2022-01-10T11:17:49.540Z","caller":"entrypoint.sh","msg":"Retrying waiting for IPAM-D"}

@cgchinmay
Copy link
Contributor Author

Change the image tag to v1.10.2-rc1 and apply this manifest.

I've tried upgrading amazon-vpc-cni-k8s to v1.10.2-rc1 and unfortunately aws-node fails to start.

{"level":"info","ts":"2022-01-10T11:17:44.242Z","caller":"entrypoint.sh","msg":"Validating env variables ..."}
{"level":"info","ts":"2022-01-10T11:17:44.339Z","caller":"entrypoint.sh","msg":"Install CNI binaries.."}
{"level":"info","ts":"2022-01-10T11:17:44.644Z","caller":"entrypoint.sh","msg":"Starting IPAM daemon in the background ... "}
{"level":"info","ts":"2022-01-10T11:17:44.739Z","caller":"entrypoint.sh","msg":"Checking for IPAM connectivity ... "}
{"level":"info","ts":"2022-01-10T11:17:47.041Z","caller":"entrypoint.sh","msg":"Retrying waiting for IPAM-D"}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x39 pc=0x55ed00eac7c8]

goroutine 552 [running]:
github.com/aws/amazon-vpc-cni-k8s/pkg/ipamd.(*IPAMContext).StartNodeIPPoolManager(0x0)
	/go/src/github.com/aws/amazon-vpc-cni-k8s/pkg/ipamd/ipamd.go:633 +0x28
created by main._main
	/go/src/github.com/aws/amazon-vpc-cni-k8s/cmd/aws-k8s-agent/main.go:64 +0x32c
{"level":"info","ts":"2022-01-10T11:17:49.540Z","caller":"entrypoint.sh","msg":"Retrying waiting for IPAM-D"}

Add these env vars to your aws-node ds

  • name: ENABLE_IPv4
    value: "true"
  • name: ENABLE_IPv6
    value: "false"

Or instead apply the manifest for v1.10.1 first and then change the image tag.

@groodt
Copy link
Contributor

groodt commented Jan 10, 2022

Or instead apply the manifest for v1.10.1 first and then change the image tag.

Thanks! It worked.

@jayanthvn
Copy link
Contributor

@cgchinmay - Can you update your branch? We can finish the review this week.

Copy link
Contributor

@jayanthvn jayanthvn left a comment

Choose a reason for hiding this comment

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

Just one minor nit, rest lgtm.

@cgchinmay cgchinmay merged commit 852d811 into aws:master Jan 27, 2022
@cgchinmay cgchinmay mentioned this pull request Jan 28, 2022
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.

None yet

4 participants