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

fix: properly propagate flags used for kubeproxyreplacement #2048

Closed
wants to merge 1 commit into from

Conversation

bittermandel
Copy link

@bittermandel bittermandel commented Oct 16, 2023

After the switch to Helm install & upgrade mode rather than classic mode, the flags for kubeProxyReplacement, k8sServiceHost & k8sServicePort was not propagated properly.

These changes makes sure that there's no auto detection done if the kubeProxyReplacement flag has been set, and if it's not set, make sure to prioritze the k8sServiceHost / k8sServicePort flags over getting it from the current context.

fix: properly propagate helm values used for kubeProxyReplacement

@bittermandel bittermandel temporarily deployed to ci October 16, 2023 20:20 — with GitHub Actions Inactive
@bittermandel bittermandel temporarily deployed to ci October 16, 2023 21:03 — with GitHub Actions Inactive
@bittermandel bittermandel temporarily deployed to ci October 16, 2023 21:08 — with GitHub Actions Inactive
@bittermandel bittermandel changed the title fix: lookup normalized flag for kubeproxyreplacement @bittermandel fix: properly propagate flags used for kubeproxyreplacement Oct 16, 2023
@bittermandel bittermandel marked this pull request as ready for review October 16, 2023 21:12
@bittermandel bittermandel requested review from a team as code owners October 16, 2023 21:12
@bittermandel bittermandel temporarily deployed to ci October 16, 2023 21:25 — with GitHub Actions Inactive
@bittermandel bittermandel changed the title @bittermandel fix: properly propagate flags used for kubeproxyreplacement fix: properly propagate flags used for kubeproxyreplacement Oct 17, 2023
@bittermandel bittermandel temporarily deployed to ci October 19, 2023 11:26 — with GitHub Actions Inactive
@bittermandel
Copy link
Author

@squeed with the changes from the last commit, the following flow is enabled:

  • If kube-proxy is installed, no autodetection of apiserver endpoints is needed and helm values are set as expected.
  • If kube-proxy is not installed or replacement flag is set:
    • kubeProxyReplacement is set to true as expected.
    • k8sServiceHost and k8sServicePort is set either from the current kubernetes context or --set flags.
    • if both values could not be determined, return an error and log.

This flow makes sense to me and is compatible with previous versions.

@bittermandel bittermandel temporarily deployed to ci October 19, 2023 11:33 — with GitHub Actions Inactive
@bittermandel bittermandel requested a review from squeed October 24, 2023 11:41
Copy link
Contributor

@squeed squeed left a comment

Choose a reason for hiding this comment

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

looks great, thanks!

Copy link
Member

@asauber asauber left a comment

Choose a reason for hiding this comment

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

@bittermandel, thanks for the PR.

You have some gofmt and revive errors in your latest commit. See the "Go / build (pull_request)" workflow logs. Would you be able to resolve those?

Could you also squash your latest changes into the earlier commits?

In addition, could you reformat your commit messages with a shorter summary line and some additional description of the changes? (See this PR for a good example of our commit message standards https://github.com/cilium/cilium-cli/pull/2035/commits)

@maintainer-s-little-helper
Copy link

Commit de0d407 does not match "Signed-off-by".

Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin

Previously when installing Cilium using cilium-cli on a cluster without kube-proxy installed, the k8sServiceHost and k8sServicePort flags were ignored and instead the current kubernetes context endpoints were used as a default.
This change prioritizes the helm flags over the current kubernetes context, and returns an error if a default cannot be determined.

Signed-off-by: Jonathan Grahl <[email protected]>
@bittermandel bittermandel temporarily deployed to ci October 31, 2023 09:55 — with GitHub Actions Inactive
@bittermandel
Copy link
Author

@asauber I made sure to squash the commits, put a more descriptive commit message and a description!
I am not sure why these CI tests fail though. Doesn't seem related to my changes?

@asauber asauber self-requested a review November 6, 2023 17:11
Copy link
Member

@asauber asauber left a comment

Choose a reason for hiding this comment

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

Re-running CI and taking another look

@@ -266,6 +266,11 @@ cilium install
cilium install --context kind-cluster1 --set cluster.id=1 --set cluster.name=cluster1
`,
RunE: func(cmd *cobra.Command, args []string) error {
cmd.Flags().Visit(func(f *pflag.Flag) {
if f.Name == "set" && strings.Contains(f.Value.String(), "kubeProxyReplacement") {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't sufficient as a test for kubeProxyReplacement, as the value could be kubeProxyReplacement=false. In this case we do not want to set params.UserSetKubeProxyReplacement = true.

Copy link
Member

@asauber asauber left a comment

Choose a reason for hiding this comment

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

The kind workflow is running into an issue with the latest logic:

🔮 Auto-detected kube-proxy has been installed
Error: Unable to install Cilium: could not autodetect API server endpoint, cannot replace kubeproxy
❌ Could not autodetect API server endpoint. Either set a valid kubernetes context or set k8sServerHost & k8sServerPort.

Could you look into why this is the case?

@ti-mo
Copy link
Contributor

ti-mo commented Dec 5, 2023

@bittermandel Looks like this is failing CI, PTAL.

@ti-mo
Copy link
Contributor

ti-mo commented Feb 22, 2024

Looks like the author has abandoned the PR, closing for now.

@ti-mo ti-mo closed this Feb 22, 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.

4 participants