Repository navigation
Add DomainMapping CRUD commands - #1267
Conversation
knative-prow-robot
left a comment
There was a problem hiding this comment.
@dsimansk: 15 warnings.
Details
In response to this:
Description
This PR adds CRUD operations for
DomainMappingresource.TODO:
I've covered only Knative Service as the only target, but going through the updated docs I should probably reflect the other targets as well.
knative/serving@8eee938I'll take a look into Servings test, if we can do a real world domain E2E test.
Changes
- 🎁 Add top-level cmd
domainwithcreate, update, describe, delete, listopsReference
Fixes #1197
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.
|
@julz FYI. |
113b513 to
ff5f028
Compare
itsmurugappan
left a comment
There was a problem hiding this comment.
I gave it a try and it looks good. Just a few nits.
| err = client.CreateDomainMapping(builder.Build()) | ||
| if err != nil { | ||
| return knerrors.GetError(err) | ||
| } |
There was a problem hiding this comment.
| err = client.CreateDomainMapping(builder.Build()) | |
| if err != nil { | |
| return knerrors.GetError(err) | |
| } | |
| if err := client.CreateDomainMapping(builder.Build()); err != nil { | |
| return knerrors.GetError(err) | |
| } |
There was a problem hiding this comment.
Thanks for the suggestion. However, I recall from some previous PRs that if-s with inline declarations aren't very popular in client's code.
@maximilien or @rhuss wdyt?
There was a problem hiding this comment.
Yeah, I like the simpler none if err := ... but that's just me :)
| err = client.DeleteDomainMapping(name) | ||
| if err != nil { | ||
| return knerrors.GetError(err) | ||
| } |
There was a problem hiding this comment.
| err = client.DeleteDomainMapping(name) | |
| if err != nil { | |
| return knerrors.GetError(err) | |
| } | |
| if err := client.DeleteDomainMapping(name); err != nil { | |
| return knerrors.GetError(err) | |
| } |
| _, err := cl.client.DomainMappings(cl.namespace).Create(context.TODO(), domainMapping, v1.CreateOptions{}) | ||
| if err != nil { | ||
| return knerrors.GetError(err) | ||
| } |
There was a problem hiding this comment.
| _, err := cl.client.DomainMappings(cl.namespace).Create(context.TODO(), domainMapping, v1.CreateOptions{}) | |
| if err != nil { | |
| return knerrors.GetError(err) | |
| } | |
| if _, err := cl.client.DomainMappings(cl.namespace).Create(context.TODO(), domainMapping, v1.CreateOptions{}); err != nil { | |
| return knerrors.GetError(err) | |
| } |
|
Few suggestions
|
FWIW I'm not sure this is what we should do. If the DM is deleted when the ksvc is deleted then it's possible for someone to swoop in and grab a domain mapping that you want to reuse for another ksvc later. I would understand doing this more if we created the ksvc and domain at the same time (eg if we added a field to ksvc to spit out a domainmapping), but it seems a bit surprising to me at first glance for us to do this implicitly. OTOH if this matches the behaviour for things like --sink that'd probably change my mind.. do we automatically set the ksvc as the owner of a source when you pass --sink? |
I have the same concern as @julz that it'd break the reuse use case. In addition to However, such flag can still optional per explicit request to add OwenerRef to the resource. It might prove to be useful elsewhere as well.
Thanks, that's good point I haven't checked the annotations yet. |
maximilien
left a comment
There was a problem hiding this comment.
Various comments... please address. Great contribution BTW
CC: @julz who did the work on serving side as FYI
| Delete a domain mapping | ||
|
|
||
| ``` | ||
| kn domain delete FQDN |
There was a problem hiding this comment.
What’s “FQDN”? Can we use something simpler, e.g., ‘hello’
There was a problem hiding this comment.
I intended to promote that fully qualified domain name is expected. It'd be better to explain in the example description probably.
| if err != nil { | ||
| return err | ||
| } | ||
| destination, err := refFlags.ResolveSink(dynamicClient, namespace) |
There was a problem hiding this comment.
A bit confuse here. Why are we resolving the destination as an event sink?
There was a problem hiding this comment.
I've reused the sink flag handling here, but it's not entirely correct. I'll come up with something better. :)
+1 |
|
From the DomainMapping docs:
Therefore I've added the following handling for 3 reference types.
However, per discussion with @navidshaikh and @itsmurugappan yesterday there're some doubts. The addition of Kubernetes Service wtih Should we only support reference as Knative Service for now to keep it simple. And add additional support if there's request for it? Wdyt? @rhuss @maximilien |
@dsimansk : Let's support knative resources, ksvc and kroute ? If we're planning to support prefix for k8s service, let's do it for sink flag as well? This way we've consistent prefix across flags. |
c7fbd6d to
db96581
Compare
db96581 to
b57b7e3
Compare
Update the resolve func accordingly. In addition the PR is rebased and context param added. |
|
The following is the coverage report on the affected files.
|
|
/lgtm |
|
Let's get that merged now, if now one objects (we can clean up later, but we need to get this in before the release) /approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maximilien, rhuss The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
This PR adds CRUD operations for
DomainMappingresource.TODO:
I've covered only Knative Service as the only target, but going through the updated docs I should probably reflect the other targets as well.
knative/serving@8eee938
I'll take a look into Servings test, if we can do a real world domain E2E test.
Changes
domainwithcreate, update, describe, delete, listopsReference
Fixes #1197