Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Create one Kubernetes Service per job #367

Closed
5 tasks
viovanov opened this issue Jul 22, 2018 · 4 comments
Closed
5 tasks

Create one Kubernetes Service per job #367

viovanov opened this issue Jul 22, 2018 · 4 comments

Comments

@viovanov
Copy link
Member

  • Change helm charts so they generate one service per job
  • Remove the headless tag from fissile
  • Exposed ports have to be moved to the job section
  • Update fissile doc
  • Update SCF/UAA

Use the following rule to determine the service name (which in turn determines the hostname):

<role-name>-<job-name>

Ports must be exposed like this:

roles:
- name: nats
  jobs:
  - name: nats
    properties:
      bosh_containerization:
        ports:
        - name: nats
          protocol: TCP
          internal: 4222
        - name: nats-routes
          protocol: TCP
          internal: 4223
@alexjh
Copy link
Contributor

alexjh commented Aug 8, 2018

Remove the headless tag from fissile

Can you elaborate on why this is happening?

It looks like we could create up to three services per role right now:

https://github.com/SUSE/fissile/blob/711088fd60db22ace2ad33bd887c91e6f8d4df51/kube/service.go#L16-L36

If the headless tag goes away, does that mean we'll always create three services for each StatefulSet, since the headless tag would never be set?

Edit: Three services for each public role, two for non-public.

@alexjh
Copy link
Contributor

alexjh commented Aug 8, 2018

Also, it looks like we could determine if a service should be public or not with the public: true setting in the port config.

https://github.com/SUSE/scf/blob/b3be225282389bdce24dec05e351f6b697fe5d89/container-host-files/etc/scf/config/role-manifest.yml#L487-L490

@alexjh
Copy link
Contributor

alexjh commented Aug 8, 2018

Right now in our helm templates we have a StatefulSet per role, and that is linked to service via a serviceName called <role-name>-set.

spec: 
  podManagementPolicy: "OrderedReady"
  replicas: {{ if and .Values.config.HA (eq (int .Values.sizing.api.count) 1) -}} 2 {{- else -}} {{ .Values.sizing.api.count }} {{- end }}
  serviceName: "api-set"

I don't see a way to link the newly named service <role-name>-<job-name> to the StatefulSet.

For example, with our new database role, we have two jobs inside it: mysql and mysql-proxy. What service should the database StatefulSet refer to?

@alexjh
Copy link
Contributor

alexjh commented Aug 17, 2018

@viovanov

I've been struggling to find a fix for addressing individual pods with this setup.

We need to access pods for things like this: https://github.com/cloudfoundry/cf-syslog-drain-release/blob/develop/jobs/scheduler/templates/environment.sh.erb#L8

According to the Kube docs (and my testing), in order to get a hostname for a pod, the StatefulSet's serviceName must match a service.

Also note that a service must have ports associated with it. I initially hoped I could make a dummy service with just the instance group name, but I need ports to go along with it.

What I'm looking at now is collecting all of the ports for the jobs inside the instance group, and making a service out of that. If you have any other ideas, please let me know.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants