Skip to content

When trying to set several ports in k8s, they must be named #2931

@allanger

Description

@allanger

Component

agent

Describe the bug

When you use kubernetes backend and need to have several ports exposed from a service, the pipeline is getting canceled (that is actually also not very obvious, because there is no error in UI, you can see it only when checking logs from the agent directly)

The error is caused by a requirement to have ports names if there are more than one. So this configuration won't work:

services:
  docker:
    image: docker:dind
    commands: dockerd -H tcp://0.0.0.0:2375 --tls=false
    privileged: true
    ports:
      - 2375
      - 16443

Error:

{"level":"error","error":"rpc error: code = Unknown desc = Step finished with exit code 1, Service \"wp-01hhdbk671qq8d5hewnmp98f3e-0-services-0\" is invalid: [spec.ports[0].name: Required value, spec.ports[1].name: Required value]","time":"2023-12-11T21:12:46Z","message":"grpc error: wait(): code: Unknown: rpc error: code = Unknown desc = Step finished with exit code 1, Service \"wp-01hhdbk671qq8d5hewnmp98f3e-0-services-0\" is invalid: [spec.ports[0].name: Required value, spec.ports[1].name: Required value]"}

I think that the easiest solution would be to give random names to ports, since they are used by woodpecker only, so k8s users should actually not care about them. Then the pipeline syntax won't have to be updated, and it won't be a breaking change. If this solution sounds reasonable, I can implement it myself.

UPD: Or put a port number to the port name too, I think it's even easier, we just need to make sure it's a string

System Info

I'm using Woodpecker 2.0.0 installed by the official helm chart.

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Check that this is a concrete bug. For Q&A join our Discord Chat Server or the Matrix room.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions