openfrontier / docker-gerrit

Build a Docker image with the Gerrit code review system
Apache License 2.0
197 stars 116 forks source link

Request: Kubernetes objects templates #86

Open novitoll opened 6 years ago

novitoll commented 6 years ago

Please add the basic YAML templates for Deployment, Service, Secrets, PersistentVolume objects in Kubernetes (>= 1.8.2) for Gerrit.

Also Gerrit + Jenkins + SonarQube integration in k8s will be brilliant. (Helm packaging is optional)

thinkernel commented 6 years ago

I'm thinking of this idea, too. However, I've been struggling with the k8s environments for a while.

novitoll commented 6 years ago

OK, I can do it actually but later. The Deployment part might look like

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gerrit
  labels:
    app: gerrit
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gerrit
  template:
    metadata:
      labels:
        app: gerrit
    spec:
      containers:
      - name: gerrit
        image: openfrontier/gerrit:latest
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: env-config
          - secretRef:
              name: secrets
        ports:
        - name: gerrit-web
          containerPort:
            valueFrom:
              configMapKeyRef:
                name: value-config
                key: web_port
        - name: gerrit-ssh-agent
          containerPort:
            valueFrom:
              configMapKeyRef:
                name: value-config
                key: ssh_agent_port
thinkernel commented 6 years ago

The basic deployment is just like what you wrote. Something need to be considered like the pvc, service, statefulset( or not). Also the way to map environment and secret as you wrote.

novitoll commented 6 years ago

@thinkernel FYI, I've managed to get Gerrit, Jenkins with DSL declarative pipelines, Sonar integrated and running as pods in Kubernetes cluster with PVCs etc, and the full CI-CD works. I will try to make this solution public as soon as I have time for it.

thinkernel commented 6 years ago

@Novitoll I'm so glad to hear that. It'd be even better if you can share your works for others including me to reference.

NeVraX182 commented 6 years ago

@Novitoll did you find time to share that ? I was about to do the same from scratch... I can contribute by adding Nexus3 for example ! Or at least rearrange raw scripts & commands.

novitoll commented 6 years ago

Sorry, was busy with work and then vac :) I will probably commit Gerrit deployment to https://github.com/helm/charts/tree/master/stable as well

Sjnahak commented 4 years ago

@Novitoll any updates on this open request? Gerrit on k8s without helm