Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Make port forward label selector configurable #1727

Merged
merged 2 commits into from
Feb 13, 2019

Conversation

hiddeco
Copy link
Member

@hiddeco hiddeco commented Feb 11, 2019

Make the label selectors fluxctl uses for port forwarding configurable by providing a --k8s-fwd-labels flag or setting a FLUX_FORWARD_LABELS environment variable. The default value of the flag is inherited from the hardcoded value it was before (app=flux).

Fixes #1700

This commit makes the label selectors fluxctl uses for port forwarding
configurable by providing a `--k8s-fwd-labels` flag or setting a
`FLUX_FORWARD_LABELS` environment variable. The default value of the
flag is inherited from the hardcoded value it was before (`app=flux`).
@squaremo
Copy link
Member

If I run flux as usual (for me), and use

fluxctl --k8s-fwd-labels="app=wrong" identity

... I still get a result, rather than a failure to set up the port forward. I think that's because it'll still try the selector name in (flux,fluxd,weave-flux-agent) first. If I had two flux's running, and one of them had a name in that set, I'd never be able to select the other.

@hiddeco
Copy link
Member Author

hiddeco commented Feb 12, 2019

@squaremo fixed by prioritizing configured labels over the 'default' ones.

$ kubectl get pods
NAME                               READY   STATUS    RESTARTS   AGE
flux-b7f875769-pt47z               1/1     Running   0          6m9s
flux2-595894f954-rfvmj             1/1     Running   0          6m1s

$ fluxctl identity
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBzW2o8fej6c+YwS5vWuEeCFNmh2+vExYS7/40UCSynMPumtDlkaa49zvMN+g124KZwc7lrFC+5E21jZEA81OG1i0UER/OwRX/Nla59/jJDASIjKUhE1EnJGj9ZxIUo42ap3Mt5F/bAWkllGlCCAFFzKEcn/DQUdWf6LPQZ5FiM+k0tMOjkMiOyTGIcPD+O13HzR++pOIhFKSYgPKVUI9/MMZuAJCFOKJlgcu770whp9WEDCyq1xHShh8CA9uj/nDzjGz2VAq09/1BifVeoAyusaiNodMHBTqJRbEhfwRGIN6WG2nyUaHbt8VY+P/XHMnEk0S9rCdqhdN/hx7bRDJJ

$ fluxctl identity --k8s-fwd-labels name=flux2
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDawuDr59SWJ5VhVJFPOSRg1L0k6cv1N6esZKdA2OsqU6kdOPaUzTj1NPyNIc65psX2WWqpL77CKMjfdkNZrjMlBETlTBCQIhK44Zi3uI51e7amH8LYvoV3+5xGtyV1tGL72n9gEzRtB8gayzpk5fJ9nFp71bnX/wGfelT8p/5pf9LPLXIh8z5wpU0+Pw4ne5maLuj0zWh270oDEn9TahoJQlu1v3vRuJm8rIWkEEFMymZLw0RFF08KyUlLuHgBeHg4xKPPgpKXfJ0WMAtkTdKAlZUTcBSQ9ke79YEGR827dHwZzO9lN4vdTia6UUO6unkYi9CUKBO1czo/SumI7Fj/

$ fluxctl identity --k8s-fwd-labels name=flux
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBzW2o8fej6c+YwS5vWuEeCFNmh2+vExYS7/40UCSynMPumtDlkaa49zvMN+g124KZwc7lrFC+5E21jZEA81OG1i0UER/OwRX/Nla59/jJDASIjKUhE1EnJGj9ZxIUo42ap3Mt5F/bAWkllGlCCAFFzKEcn/DQUdWf6LPQZ5FiM+k0tMOjkMiOyTGIcPD+O13HzR++pOIhFKSYgPKVUI9/MMZuAJCFOKJlgcu770whp9WEDCyq1xHShh8CA9uj/nDzjGz2VAq09/1BifVeoAyusaiNodMHBTqJRbEhfwRGIN6WG2nyUaHbt8VY+P/XHMnEk0S9rCdqhdN/hx7bRDJJ

Copy link
Member

@squaremo squaremo left a comment

Choose a reason for hiding this comment

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

Cool, that works -- thanks Hidde

@hiddeco hiddeco merged commit 0824e19 into master Feb 13, 2019
@hiddeco hiddeco deleted the 1700-fluxctl-label-selector branch February 13, 2019 10:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants