Skip to content

Invalid revision names are accepted in the revision template #5094

@rhuss

Description

@rhuss

In what area(s)?

/area API

What version of Knative?

0.7.1

0.2.x
0.3.x
Output of git describe --dirty

Expected Behavior

No invalid revision name should be accepted in the revision template of a service.

Actual Behavior

When creating a service and then kubctl edit this to change the revision name to something like hello-@latest, then this gets accepted by the admission controller without error. However, no new revision is created and the service's conditions go into an UNKNOWN state.

The configuration's status indicates the proper invalid name error, though. However the wrong name should not be accepted from the very beginning.

Service
apiVersion: serving.knative.dev/v1alpha1
kind: Service
metadata:
  annotations:
    serving.knative.dev/lastModifier: kube:admin
  creationTimestamp: "2019-08-08T07:49:29Z"
  generation: 3
  name: hello
  namespace: default
  resourceVersion: "586434"
  selfLink: /apis/serving.knative.dev/v1alpha1/namespaces/default/services/hello
  uid: 0d2fd2be-b9b1-11e9-9d3c-026298ea7cc0
spec:
  template:
    metadata:
      creationTimestamp: null
      name: hello-@latest
    spec:
      containers:
      - image: gcr.io/knative-samples/helloworld-go
        name: user-container
        resources:
          limits:
            cpu: "1"
            memory: 200M
          requests:
            cpu: 400m
            memory: 100M
      timeoutSeconds: 300
  traffic:
  - latestRevision: true
    percent: 100
status:
  address:
    url: http://hello.default.svc.cluster.local
  conditions:
  - lastTransitionTime: "2019-08-08T07:54:08Z"
    message: The Configuration is still working to reflect the latest desired specification.
    reason: OutOfDate
    status: Unknown
    type: ConfigurationsReady
  - lastTransitionTime: "2019-08-08T07:54:08Z"
    message: The Configuration is still working to reflect the latest desired specification.
    reason: OutOfDate
    status: Unknown
    type: Ready
  - lastTransitionTime: "2019-08-08T07:53:46Z"
    status: "True"
    type: RoutesReady
  latestCreatedRevisionName: hello-bla
  latestReadyRevisionName: hello-bla
  observedGeneration: 3
  traffic:
  - latestRevision: true
    percent: 100
    revisionName: hello-bla
  url: http://hello.default.apps.rhuss-dev.devcluster.openshift.com
Configuration
apiVersion: serving.knative.dev/v1alpha1
kind: Configuration
metadata:
  annotations:
    serving.knative.dev/lastModifier: kube:admin
  creationTimestamp: "2019-08-08T07:49:56Z"
  generation: 4
  labels:
    serving.knative.dev/route: hello
    serving.knative.dev/service: hello
  name: hello
  namespace: default
  ownerReferences:
  - apiVersion: serving.knative.dev/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: Service
    name: hello
    uid: 0d2fd2be-b9b1-11e9-9d3c-026298ea7cc0
  resourceVersion: "586437"
  selfLink: /apis/serving.knative.dev/v1alpha1/namespaces/default/configurations/hello
  uid: 1d775341-b9b1-11e9-a59a-0e9f6097f502
spec:
  template:
    metadata:
      creationTimestamp: null
      name: hello-@latest
    spec:
      containers:
      - image: gcr.io/knative-samples/helloworld-go
        name: user-container
        resources:
          limits:
            cpu: "1"
            memory: 200M
          requests:
            cpu: 400m
            memory: 100M
      timeoutSeconds: 300
status:
  conditions:
  - lastTransitionTime: "2019-08-08T07:54:08Z"
    message: 'Revision creation failed with message: Internal error occurred: admission
      webhook "webhook.serving.knative.dev" denied the request: mutation failed: not
      a DNS 1035 label: [a DNS-1035 label must consist of lower case alphanumeric
      characters or ''-'', start with an alphabetic character, and end with an alphanumeric
      character (e.g. ''my-name'',  or ''abc-123'', regex used for validation is ''[a-z]([-a-z0-9]*[a-z0-9])?'')]:
      metadata.name.'
    reason: RevisionFailed
    status: "False"
    type: Ready
  latestCreatedRevisionName: hello-bla
  latestReadyRevisionName: hello-bla
  observedGeneration: 3

Steps to Reproduce the Problem

  • Create a service e.g. with kn service create hello --image gcr.io/knative-samples/helloworld-go
  • Edit the service (kubectl edit kscv hello) and insert a name: hello-@latest into the revision template's metadata

Metadata

Metadata

Assignees

Labels

area/APIAPI objects and controllerskind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions