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

reopen - Missing required Service.spec.ports in Kubernetes #2655

Closed
J-Ha opened this issue Oct 26, 2023 · 0 comments · Fixed by #2656
Closed

reopen - Missing required Service.spec.ports in Kubernetes #2655

J-Ha opened this issue Oct 26, 2023 · 0 comments · Fixed by #2656

Comments

@J-Ha
Copy link
Contributor

J-Ha commented Oct 26, 2023

Originally posted by @J-Ha in #1238 (comment)

this problem still exists.
this problem has nothing todo with the helm-chart.
it is more about the kubernetes backend and the service that should be created by a job

the service of the job awaits a port:
https://github.com/woodpecker-ci/woodpecker/blob/next-release/1.0.3/pipeline/backend/kubernetes/service.go#L26

but there is no option to pass a service port into this by the .woodpecker.yml
and the job terminates on creation with the error of:
is invalid: spec.ports: Required value

there is something within the schema.json defined, nothing in the documentation. But even when setting a port in the array im getting the same error.

https://github.com/woodpecker-ci/woodpecker/blob/v1.0.3/pipeline/schema/schema.json#L580

@6543 6543 closed this as completed in #2656 Nov 2, 2023
6543 pushed a commit that referenced this issue Nov 2, 2023
Closes #2655.


[Pipeline](https://woodpecker-ci.org/docs/next/usage/services#complete-pipeline-example):
```yaml
services:
  database:
    image: mysql
    environment:
      - MYSQL_DATABASE=test
      - MYSQL_ROOT_PASSWORD=example
    ports:
      - 3306

steps:
  get-version:
    image: ubuntu
    commands:
      - ( apt update && apt dist-upgrade -y && apt install -y mysql-client 2>&1 )> /dev/null
      - sleep 60s # need to wait for mysql-server init
      - echo 'SHOW VARIABLES LIKE "version"' | mysql -uroot -hdatabase test -pexample
```

Service:
```yaml
apiVersion: v1
kind: Service
metadata:
  name: wp-01hdq6gbkw1mn6k1655fs3rntf-0-services-0
  namespace: woodpecker-runtime
  ...
  selfLink: >-
    /api/v1/namespaces/woodpecker-runtime/services/wp-01hdq6gbkw1mn6k1655fs3rntf-0-services-0
status:
  loadBalancer: {}
spec:
  ports:
    - protocol: TCP
      port: 3306
      targetPort: 3306
  selector:
    step: database
  clusterIP: 10.43.180.120
  clusterIPs:
    - 10.43.180.120
  type: ClusterIP
  sessionAffinity: None
  ipFamilies:
    - IPv4
  ipFamilyPolicy: SingleStack
  internalTrafficPolicy: Cluster
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant