Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56650

Kubernetes Pipeline Plugin throws RFC 1123 With Valid Names

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Minor
    • None

    Description

      I've created a build step with the following pod template (with some elided content):

       

      podTemplate(label: label, yaml: """
      apiVersion: v1
      kind: Pod
      spec:
        containers:
          - name: db
            image: mdillon/postgis:10-alpine
          - name: elasticsearch
            image: docker.elastic.co/elasticsearch/elasticsearch:6.1.3
            env:
              - name: discovery.type
                value: single-node
          - name: memcached,
            image: memcached:1.5.10-alpine
          - name: redis,
            image: redis:4.0.6-alpine
          - name: web,
            image: ${info['image']}
      """) {
          node(label) {
              // etc
          }
      }

      When I attempt to run my pipeline, it throws

      Also:   hudson.AbortException: Container Names MUST match RFC 1123 - They can only contain lowercase letters, numbers or dashes: memcached,, redis,, web,
      		at org.csanchez.jenkins.plugins.kubernetes.pipeline.PodTemplateStepExecution.start(PodTemplateStepExecution.java:118)
      		at org.jenkinsci.plugins.workflow.cps.DSL.invokeStep(DSL.java:268)
      		at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:176)
      		at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
      		at jdk.internal.reflect.GeneratedMethodAccessor607.invoke(Unknown Source)
      		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      		at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      		at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      		at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
      		at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
      		at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
      		at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
      		at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
      		at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:157)
      		at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
      		at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:155)
      		at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:142)
      		at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
      		at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
      		at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
      		at WorkflowScript.buildParallelStage(WorkflowScript:155)
      		at WorkflowScript.buildTesters(WorkflowScript:55) 

       

      Just to test things, I used println to output the full yaml string and tossed that at kubectl apply -f which happily accepted the file and deployed my pod.

       

      Am I missing something here, or is the plugin just failing to (for some reason) parse two of my containers' names but not the others?

       

      Attachments

        Activity

          People

            iocanel Ioannis Canellos
            berwyn Jamison Greeley
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: