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 HOST_IP environment variable to consul_dataplane_sidecar.go #3916

Closed
wants to merge 9 commits into from

Conversation

woz5999
Copy link
Contributor

@woz5999 woz5999 commented Apr 16, 2024

Changes proposed in this PR

  • Add HOST_IP environment variable to consul_dataplane_sidecar.go

This environment variable must be set in order to utilize HOST_IP as part of statsd or dogstatsd sinks. If this variable is unset and the sink is configured to use HOST_IP, the sidecar won't start and pods won't come up healthy.

How I've tested this PR

  • Unit tests
  • Deployed and tested a local build to our cluster and confirmed that injected pods now come up healthy and have the HOST_IP variable set as expected

How I expect reviewers to test this PR

  • The unit tests should do it

    Reference to similar change for mesh-gateway deployments:

Checklist

woz5999 and others added 7 commits April 16, 2024 14:07
This environment variable must be set in order to utilize HOST_IP as part of statsd or dogstatsd sinks. If this variable is unset and the sink is configured to use HOST_IP, the sidecar won't start and pods won't coe up healthy.
@woz5999 woz5999 marked this pull request as ready for review April 16, 2024 21:37
@woz5999
Copy link
Contributor Author

woz5999 commented Apr 16, 2024

@t-eckert @david-yu You guys reviewed a similar change previously about a year ago: #1808 (comment)

We're just now circling back to try this upgrade and ran into this issue where the code supports the var expansion, but it seems like the env var isn't being set in the injected dataplane pods. This PR fixes that.

Note that I'm not sure why the pr/test and backport checks are failing, but I'm happy to make any changes given proper guidance. We've been waiting a year to get this going, so would love to do anything we can to speed this fix along and finally get onto 1.x. ❤️

@t-eckert
Copy link
Contributor

@woz5999, this is excellent work! Overall, the PR seems right. I would definitely encourage you to run this build in a K8s deployment in order to verify it works correctly with *statsd.

I no longer work at HashiCorp so I don't think it's right for me to approve the change, but from a spot check, this is how adding the env var would be done.

@david-yu
Copy link
Contributor

@woz5999 We'll try to get a review, but we also have a few more PRs in the queue from our community that we need to review. Thank you for the PR! And thanks for looking out @t-eckert !

@woz5999
Copy link
Contributor Author

woz5999 commented Apr 18, 2024

I just wanted to update that I was able to successfully deploy and confirm this fix in our cluster today.

@woz5999
Copy link
Contributor Author

woz5999 commented Aug 13, 2024

Any update on this?

@t-eckert
Copy link
Contributor

@nathancoleman, I checked this awhile back. I think it's good.

.changelog/3916.txt Outdated Show resolved Hide resolved
{
Name: "HOST_IP",
ValueFrom: &corev1.EnvVarSource{
FieldRef: &corev1.ObjectFieldSelector{FieldPath: "status.hostIP"},
Copy link
Member

Choose a reason for hiding this comment

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

Confirmed that this matches the documentation for the Downward API

@nathancoleman
Copy link
Member

Looks like this needs a rebase and some backport labels. I can handle that by EOD today

Copy link
Member

@nathancoleman nathancoleman left a comment

Choose a reason for hiding this comment

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

Thanks for the heads up @t-eckert !

@woz5999 I don't have permissions to rebase these changes in your fork. Can you please rebase onto the current state of hashicorp:main? The webhookv2 package was deleted is all.

@nathancoleman nathancoleman self-assigned this Aug 29, 2024
@woz5999
Copy link
Contributor Author

woz5999 commented Aug 29, 2024

Thanks @nathancoleman This is updated now

@nathancoleman
Copy link
Member

@woz5999 I reopened this PR using a branch in hashicorp/consul-k8s since there is some required CI that can't run in forks. I made sure to keep your exact commits in tact so that you're still credited as a contributor by GitHub. Apologies for the back and forth. Will merge once a colleague of mine approves the PR below.

#4277

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants