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 invalid port name with uppercase characters #1029

Merged
merged 2 commits into from
Jun 5, 2018

Conversation

denverdino
Copy link
Contributor

@denverdino denverdino commented Jun 4, 2018

When there are multiple protocol for one port, the generated port name is invalid which has uppercase chars

E.g.

version: '2'
services:
  bootstrap:
    image: test
    ports:
      - "1234:1234"
      - "1234:1234/udp"

The generated service config is as following

apiVersion: v1
kind: Service
metadata:
  annotations:
    kompose.version: 1.13.0 (84fa826)
  creationTimestamp: null
  labels:
    io.kompose.service: bootstrap
  name: bootstrap
spec:
  ports:
  - name: "1234"
    port: 1234
    targetPort: 1234
  - name: 1234-UDP
    port: 1234
    protocol: UDP
    targetPort: 1234
  selector:
    io.kompose.service: bootstrap

The following exception will be return when creating service

The Service "bootstrap" is invalid: spec.ports[1].name: Invalid value: "1234-UDP": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is 'a-z0-9?')

We should append the lower case of protocol as part of the port name.

Thanks

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 4, 2018
@hangyan hangyan merged commit 6eb1aed into kubernetes:master Jun 5, 2018
@hangyan
Copy link
Contributor

hangyan commented Jun 5, 2018

@denverdino Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants