Description of problem: When creating a template and trying create a parameter for the following: pod.spec.containers[0].readinessProbe.httpGet.port service.spec.ports[0].targetPort Error is seen. “invalid: spec.template.spec.containers[0].readinessProbe.httpGet.port: Invalid value: "3000": must be an IANA_SVC_NAME (at most 15 characters, matching regex [a-z0-9]([a-z0-9-]*[a-z0-9])*” error: Service "test" is invalid: spec.ports[0].targetPort: Invalid value: "800": must be an IANA_SVC_NAME (at most 15 characters, matching regex [a-z0-9]([a-z0-9-]*[a-z0-9])*, it must contain at least one letter [a-z], and hyphens cannot be adjacent to other hyphens): e.g. "http" Version-Release number of selected component (if applicable): OCP 3.1+ OCP 3.3 How reproducible: 100% Steps to Reproduce: 1. Create template $ cat bug1.yaml kind: "Template" apiVersion: "v1" metadata: name: "bug1" creationTimestamp: null annotations: description: "Template for container creation" iconClass: "icon-generic" tags: "generic" objects: - kind: "Service" apiVersion: "v1" metadata: name: "${NODE_TEMPLATE_NAME}" spec: ports: - name: "web" protocol: '${PROTOCOL}' port: '${EXT_PORT}' targetPort: '${CONTAINER_PORT}' selector: name: "${NODE_TEMPLATE_NAME}" type: "ClusterIP" sessionAffinity: "None" parameters: - name: "PROTOCOL" description: "protocol application uses" - name: "CONTAINER_PORT" description: "Container port number" - name: "EXT_PORT" description: "external port to be exposed" - name: "NODE_TEMPLATE_NAME" description: "Template name" 2. $ oc create -f bug1 3. $ oc process bug1 -v PROTOCOL=UDP,CONTAINER_PORT=888,EXT_PORT=999,NODE_TEMPLATE_NAME=bug-param | oc create -f - Actual results: ERROR: The Service "bug-param" is invalid. spec.ports[0].targetPort: Invalid value: "888": must be an IANA_SVC_NAME (at most 15 characters, matching regex [a-z0-9]([a-z0-9-]*[a-z0-9])*, it must contain at least one letter [a-z], and hyphens cannot be adjacent to other hyphens): e.g. "http" Expected results: Create the service. Additional info: https://stackoverflow.com/questions/39281444/how-to-parameterize-ports-in-openshift-json-project-template https://github.com/kubernetes/kubernetes/blob/release-1.3/pkg/api/types.go#L1790 https://github.com/kubernetes/kubernetes/blob/release-1.3/pkg/api/types.go#L883 This proposal would resolve this i think. https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/templates.md
Would this upstream PR fix this issue? https://github.com/openshift/origin/pull/11421 Does this add the functionality to use double curly brackets to drop the quotes?
Port and TargetPort need to both be ints in this example. Moving to Ben's team.
Support for non-string parameter values is coming in this PR: https://github.com/openshift/origin/pull/11421 in the meantime it's not possible to use parameter substitution to define non-string fields in a template. (and port, while an intorstring field, only supports integer values when they are unquoted, which isn't compatible w/ the current template parameter capabilities).
This has been merged into ose and is in OSE v3.4.0.16 or newer.
verified with: openshift v3.4.0.16+cc70b72 kubernetes v1.4.0+776c994 etcd 3.1.0-rc.0
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2017:0066