-
Notifications
You must be signed in to change notification settings - Fork 41.5k
kubectl create ingress #94327
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
kubectl create ingress #94327
Conversation
Contextualization for a future me: This is really ugly. So Tim suggested some sort of 'positional' creation, with a 'loop' of
It's much like the suggested in #93267 (comment):
So some problems starts to appear:
So the thing here is that keeping the strict order is pretty hard. I"m moving to the next suggestion, of having a SliceVar that splits every "," character (which should not be used in host, servicename, port, etc) and consider the ordering of that, as the following
|
So there's a new version:
This is going to create an Ingress
Still need to create the default-backend and the tls flag, but this seems to cover a lot of cases. |
/priority backlog |
/auto-cc |
/hold cancel |
@soltysh thanks! Removed some leading empty lines, tried to make the regex as much descriptive as possible, and corrected the error. |
|
|
||
ingressExample = templates.Examples(i18n.T(` | ||
# Create a catch all ingress pointing to service svc:port and Ingress Class as "otheringress" | ||
kubectl create ingress catch-all --class=otheringress --rule="_/=svc:port" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe an even simpler first example, mad. a PR for this to your fork . that _
is confusing and, its nice to see quickly that you can add secrets as well since that's usually the thing people need to do (a single service w/ a pls)
minor so feel free to ignore me on this one :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the _ really needed? host.com/foo
and /foo
are not ambiguous...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of _ was exactly to remove the ambiguity before I started using the regex. But yes, this might be an improvement. Putting in my TODO for tomorrow, to check the impact on simply using "/foo" directly and verifying in the code if the len of the hostpath array is bigger than 1 then consider the first field as host and the second as path, otherwise just path :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmdutil.AddValidateFlags(cmd) | ||
cmdutil.AddGeneratorFlags(cmd, "") | ||
cmd.Flags().StringVar(&o.IngressClass, "class", o.IngressClass, "Ingress Class to be used") | ||
cmd.Flags().StringArrayVar(&o.Rules, "rule", o.Rules, "Rule in format host/path=service:port[,tls=secretname]. Paths containing the leading character '*' are considered pathType=Prefix. tls argument is optional.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a quick thought, is it common to look the TLS up or would it be helpful to provide feedback "this secret doesn't exist" yet if its not in the namespace? no strong opinion but if that's valuable I might be able to PR against it. its always a mistake I make, misnaming the secret.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's 'hard' because when the secret doesn't exists Ingress Controllers (don't know if all of them) fallback into the default secret.
Also this would be useless when using dry-run, so IMO create should try to create the object and rely on the apiserver validation. If the api-server does not return an error/warning when you create an YAML with a non-existing secret, it should not return an error/warning when you use kubectl create command either :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this was my first thought also, like 'should we validate the existence of a secret' but then I realized that for me, it doesn't make sense
dd2b1b2
to
806c827
Compare
806c827
to
7d929e6
Compare
e1a0704
to
c7fda59
Compare
/hold cancel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of empty line nits, and generator flags for removal and you're good.
/approve
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary empty line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do like having empty lines at the begining of functions 😉
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rikatz, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
c7fda59
to
c6f298c
Compare
Signed-off-by: Ricardo Pchevuzinske Katz <[email protected]>
c6f298c
to
73aa0a9
Compare
/test pull-kubernetes-node-e2e |
1 similar comment
/test pull-kubernetes-node-e2e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@rikatz: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/test pull-kubernetes-integration |
What type of PR is this?
/kind feature
What this PR does / why we need it: Add
kubectl create ingress
Which issue(s) this PR fixes:
Fixes #93267
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
TODO:
Validate()
method, like if the referenced secret or service exists (otherwise decide if issue a Warning or an Error)/sig cli
/sig network