I’m facing to a strange issue with the last version of Drone with Kubernetes mode.
Here is the simple pipeline :
- name: nats
- name: postgres
- name: build
- go build
- go test
The Drone itself has been of course deployed with :
- name: DRONE_KUBERNETES_ENABLED
- name: DRONE_KUBERNETES_NAMESPACE
- name: DRONE_KUBERNETES_SERVICE_ACCOUNT
The services are spawned but when my tests begins :
2019/04/08 18:31:54 connecting to PostgreSQL database
2019/04/08 18:31:54 error when trying to connect to PostgreSQL : dial tcp: lookup postgres on
10.96.0.10:53: no such host
10.96.0.10 is the K8s DNS server.
I’ve I missed something ?
With kubernetes native you need to define ports for your service. See https://docs.drone.io/examples/service/nats/
But it seems the syntax has changed :
default: Service "nats" is invalid: [spec.ports.name: Required value, spec.ports.name: Required value]
With the syntax used in your sample.
I’ve tried with a K8s syntax:
- name: nats
- port: 4222
- port: 8222
But same result.
Not sure, but we have a thread that you can use to help debug issues with the Kubernetes runtime and recommend changes/ improvements. See Contributing to Drone for Kubernetes
The code seems clear.
I will take a look tomorrow.
Thanks! Please let me know what you find and how I can help
Ok, I’ve checked :
drone-yaml code : everything looks good
drone-runtime code : everything looks good
spec.ports.name is well filled via
func toService(spec *engine.Spec, step *engine.Step) *v1.Service on util.go.
If I take my .chrono.yml file, I translate them with drone-yaml into a json file and I use this json file through
drone-runtime and pointing to my current Kubernetes cluster, everything run fine…
But fail on my drone server deployed with the latest docker image available yesterday.
The only suspect could be the old version of
k8s.io/client-go (v9) you use, incompatible with my cluster version (v1.13.4).
The only suggestion I can do is to try to build a a docker version that use k8s.io/client-go v11.0.0 (the last available)…
P.S. This only fail for service(s) that had more than one listen port (because in this case, the port name is mandatory in K8s)
I have the same issue.
- name: mongo
- name: mailcatcher
- name: smtp
- name: api
Mongo service works fine, while mailcatcher fails with
default: Service “mailcatcher” is invalid: [spec.ports.name: Required value, spec.ports.name: Required value]