-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 doc for admission webhooks #776
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mengqiy 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 |
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Outdated
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Outdated
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Outdated
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Outdated
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Outdated
Show resolved
Hide resolved
allErrs := c.validateCronJobSpec() | ||
if len(c.ObjectMeta.Name) > apimachineryutilvalidation.DNS1035LabelMaxLength-11 { | ||
// The cronjob controller appends a 11-character suffix to the cronjob (`-$TIMESTAMP`) when | ||
// creating a job. The job name length limit is 63 characters. |
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.
say why -- the job name length is 63 character like all Kubernetes objects (which must fit in a DNS subdomain)
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.
Add a note that we could validate this declaratively, but we keep it here as an example
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.
Add a note that we could validate this declaratively
This is ObjectMeta.Name
which is not owned by the user. Not sure if it's doable through validation schema. Thoughts?
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.
it's explicitly doable, in fact. GenerateName
and Name
are the only things that are allowed to have validation, going forward. Unfortunately, we don't have a good way to accomplish it in KB, but it's doable in in Kubernetes.
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.
Yes, that's what I meant.
Upstream k/k can add a marker for ObjectMeta.Name
to have maximum 63 length. But as a downstream user, if I can't change the marker in upstream to accomplish my need which is 52 max length.
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Show resolved
Hide resolved
PTAL |
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 have a few minor comments, otherwise looks good.
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Outdated
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/config/default/kustomization.yaml
Outdated
Show resolved
Hide resolved
spec := c.Spec | ||
fldPath := field.NewPath("spec") | ||
|
||
if len(spec.Schedule) == 0 { |
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.
perhaps put an example of actually parsing the schedule and seeing if it has an error?
PTAL |
Rebased to resolve conflict. |
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 bunch a minor grammar or wording comments, and a couple of structure comments
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Outdated
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Show resolved
Hide resolved
docs/book/src/cronjob-tutorial/testdata/project/api/v1/cronjob_webhook.go
Outdated
Show resolved
Hide resolved
PTAL |
Shouldn't automated tests (ginkgo/gomega) be a part of this? |
@cassianoleal kubebuilder v2 ATM doesn't scaffold much testing files, since we are trying to figure out what is the best way to scaffold tests. We do have plan to support it soon after we have resolve our v2 release blockers :) |
This should be ready to go. |
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.
Looks good. Noticed config not being rendered properly on the kind reference.
Ready to ship. |
Thanks for raising this. |
filed kubernetes-sigs/controller-tools#256 to track |
@gautamkmr #857 fixed it. |
There is a section about suggested development workflow with
kind
, so this fixes #400