drone / drone-runtime

[DEPRECATED] migrated to https://github.com/drone-runners
Other
62 stars 43 forks source link

Kubernetes: pipeline services do not create kubernetes service #40

Closed everflux closed 5 years ago

everflux commented 5 years ago

I have a drone pipeline with a services section. When running on kubernetes a new namespace is created, the steps and services create pods, but there is no service in the namespace. Therefore the steps/pods to not reach the service/pods since no DNS resolution will be successful.

bradrydzewski commented 5 years ago

I am unable to reproduce. Also per our issue template we generally prefer to triage issues in our mailing list before we create issues. The mailing list has thousands of subscribers, and we tend to get more participation and more developer feedback in the mailing list (which is especially important when an issue cannot be directly reproduced).

Regarding Drone for Kubernetes please see the following thread, which includes debug tools and verified examples of using with services: https://discourse.drone.io/t/contributing-to-drone-for-kubernetes/3159

Using the debug tools, you will see in this thread that the following yaml:

kind: pipeline
name: default

steps:
- name: test
  image: redis
  commands:
  - sleep 5
  - redis-cli -h $REDIS_SERVICE_HOST ping

services:
- name: redis
  image: redis
  ports:
  - 6379

Generates the following service definition:

---
kind: Service
metadata:
  creationTimestamp: null
  name: redis
  namespace: b9g01ck695yk7a7x2li10as5kq7m6lii
spec:
  ports:
  - port: 6379
    targetPort: 6379
  selector:
    io.drone.step.name: redis
  type: ClusterIP
status:
  loadBalancer: {}
everflux commented 5 years ago

Thanks for pointing out the thread and providing an example. I was using the documentation from https://docs.drone.io/user-guide/pipeline/services/

I triaged the problem: I did not specify any ports. This lead to no service beeing created, which is self explaining since kubernetes services require a port.

I suggest to remember adding it to the documentation and perhaps even add a safeguard against wrong usage. (Since migrating previous pipeline definitions to kubernetes runtime won't be a 1-to-1 match)