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(volume): Generate volume name compliant with DNS Label names #975

Merged
merged 2 commits into from
Aug 14, 2020

Conversation

navidshaikh
Copy link
Collaborator

@navidshaikh navidshaikh commented Aug 10, 2020

Description

  • Fix client side volume name generation
  • Generate volume name compliant with DNS Label names
    Volume names to follow the DNS label standard as defined in RFC 1123. This means the name must:
    • contain at most 63 characters
    • contain only lowercase alphanumeric characters or '-'
    • start with an alphanumeric character
    • end with an alphanumeric character

Changes

Reference

Fixes #961

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Aug 10, 2020
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: navidshaikh

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 10, 2020
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@navidshaikh: 0 warnings.

In response to this:

Description

  • Fix client side volume name generation

Changes

Reference

Fixes #961

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.

@knative-prow-robot knative-prow-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 10, 2020
Copy link
Contributor

@maximilien maximilien left a comment

Choose a reason for hiding this comment

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

Nice catch. Some comments. Best.

pkg/serving/config_changes.go Show resolved Hide resolved
@@ -507,13 +507,13 @@ func GenerateVolumeName(path string) string {
builder := &strings.Builder{}
for idx, r := range path {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is the code to guard against volume names matching the DNS label name restrictions 1, 3, and 4. That is the bullet points, from spec:

Some resource types require their names to follow the DNS label standard as defined in RFC 1123. This means the name must:

1. contain at most 63 characters
2. contain only lowercase alphanumeric characters or '-'
3. start with an alphanumeric character
4. end with an alphanumeric character

There is clearly code to take care of bullet 2 but not the others.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated util to generate volume name to adhere to the requirements

 Volume names to follow the DNS label standard as defined in RFC 1123. This means the name must:
 - contain at most 63 characters
 - contain only lowercase alphanumeric characters or '-'
 - start with an alphanumeric character
 - end with an alphanumeric character
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 11, 2020
@navidshaikh navidshaikh changed the title fix(volume): Volume names to not contain dots fix(volume): Generate volume name compliant with DNS Label names Aug 11, 2020
@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/serving/config_changes.go 76.3% 76.7% 0.3

@navidshaikh
Copy link
Collaborator Author

/retest

   result_collector.go:75: ERROR: Error: ReconcileIngressFailed: Ingress reconciliation failed

@maximilien
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 14, 2020
@knative-prow-robot knative-prow-robot merged commit 350d883 into knative:master Aug 14, 2020
@navidshaikh navidshaikh added the backport/candidate Consider this PR to be backported to the release branch label Aug 18, 2020
navidshaikh added a commit to navidshaikh/client that referenced this pull request Aug 18, 2020
…tive#975)

* fix(volume): Volume names to not contain dots

 Replace non alphanumberic characters with hyphen as the
 volumen name must be a DNS_LABEL (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names)
 ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volume-v1-core

* Generate volume name compliant with DNS Label names

 Volume names to follow the DNS label standard as defined in RFC 1123. This means the name must:
 - contain at most 63 characters
 - contain only lowercase alphanumeric characters or '-'
 - start with an alphanumeric character
 - end with an alphanumeric character
knative-prow-robot pushed a commit that referenced this pull request Aug 19, 2020
* fix(docs): Fix tekton task link in README (#934)

* Fix missing NAMESPACE column header (#951)

* Fix missing NAMESPACE column header

* Fix missing namespace column header for 'kn source list -A'

* List inbuilt sources if CRD access is restricted (#948)

* List inbuilt sources if CRD access is restricted

 Fixes #947
 - Identify restricted access error
 - If server returns restricted access error, fallback to listing
   only eventing inbuilt sources using their GVKs.
 - List any inbuilt source (ApiServerSource) object and read the error
   to know if eventing is installed for `kn source list-types`.

* Fix golint warnings

* Remove unused imports

* Verify each built in source before listing source types

* Improve the check if sources are not installed in the cluster

* Update finding forbidden error

* Update finding errors

* Add unit tests for IsForbiddenError util

* Add unit tests

* Add tests for dynamic pkg library

* Add unit tests for case when no sources are installed

* Update test name

* Use Tekton Catalog GA structure for tasks (#966)

* fix: `kn source list` command print spelling problems (#963)

* Fix exit code on service delete and revision delete (#971)

* Fix exit code 0 upon service delete

* Mentioned bug fix in CHANGELOG.adoc

* Add error check test for service not found

* Fix for kn revision delete failure exit code and add test cases

* Testing changes in test cases for failure in intergration tests

* Fix test case error causing integration test failure

* fix(volume): Generate volume name compliant with DNS Label names (#975)

* fix(volume): Volume names to not contain dots

 Replace non alphanumberic characters with hyphen as the
 volumen name must be a DNS_LABEL (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names)
 ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volume-v1-core

* Generate volume name compliant with DNS Label names

 Volume names to follow the DNS label standard as defined in RFC 1123. This means the name must:
 - contain at most 63 characters
 - contain only lowercase alphanumeric characters or '-'
 - start with an alphanumeric character
 - end with an alphanumeric character

* Set client custom GVK for source list for machine readable output (#980)

- Use custom GVK {Group: client.knative.dev, Version: v1alpha1, Kind: SourceList}
 - Source list may contain different source types CO and machine readable output (using -o)
   requires List object to have GVK set, since the list contains different types of source COs,
   we set a custom client GVK on it.

 Fixes #953

* Update CHANGELOG for v0.16.1

Co-authored-by: kaustubh <[email protected]>
Co-authored-by: Chris Suszynski <[email protected]>
Co-authored-by: tianfeiyu <[email protected]>
Co-authored-by: Himanshu Ranjan <[email protected]>
rhuss pushed a commit to rhuss/knative-client that referenced this pull request Sep 9, 2020
…tive#975)

* fix(volume): Volume names to not contain dots

 Replace non alphanumberic characters with hyphen as the
 volumen name must be a DNS_LABEL (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#dns-label-names)
 ref: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#volume-v1-core

* Generate volume name compliant with DNS Label names

 Volume names to follow the DNS label standard as defined in RFC 1123. This means the name must:
 - contain at most 63 characters
 - contain only lowercase alphanumeric characters or '-'
 - start with an alphanumeric character
 - end with an alphanumeric character
@navidshaikh navidshaikh added backported-to/0.16 and removed backport/candidate Consider this PR to be backported to the release branch labels Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--mount flag in update command failed with more than one level of directory
5 participants