diff --git a/jenkins/app.yaml b/jenkins/app.yaml new file mode 100644 index 00000000..a262737f --- /dev/null +++ b/jenkins/app.yaml @@ -0,0 +1,93 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: jenkins-pv + namespace: apps + labels: + name: jenkins-data + type: longhorn +spec: + capacity: + storage: $VOLUME_SIZE + volumeMode: Filesystem + storageClassName: longhorn + accessModes: + - ReadWriteOnce + csi: + driver: io.rancher.longhorn + fsType: ext4 + volumeAttributes: + numberOfReplicates: '2' + staleReplicaTimeout: '20' + volumeHandle: jenkins-data +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: jenkins-pv-claim + labels: + type: longhorn + app: jenkins +spec: + storageClassName: longhorn + accessModes: + - ReadWriteOnce + resources: + requests: + storage: $VOLUME_SIZE +--- +apiVersion: v1 +kind: Service +metadata: + name: jenkins +spec: + ports: + - name: jenkins + port: 8080 + targetPort: 8080 + - name: jenkins-agent + port: 50000 + targetPort: 50000 + selector: + app: jenkins + clusterIP: None +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: jenkins + labels: + app: jenkins +spec: + selector: + matchLabels: + app: jenkins + tier: jenkins + strategy: + type: Recreate + template: + metadata: + labels: + app: jenkins + tier: jenkins + spec: + containers: + - image: bitnami/jenkins:2.190.1-debian-9-r14 + name: jenkins + env: + - name: JENKINS_USERNAME + value: $JENKINS_USERNAME + - name: JENKINS_PASSWORD + value: $JENKINS_PASSWORD + ports: + - containerPort: 8080 + name: jenkins + - containerPort: 50000 + name: jenkins-agent + volumeMounts: + - name: jenkins-persistent-storage + mountPath: /bitnami + volumes: + - name: jenkins-persistent-storage + persistentVolumeClaim: + claimName: jenkins-pv-claim diff --git a/jenkins/logo.png b/jenkins/logo.png new file mode 100644 index 00000000..88cbdd79 Binary files /dev/null and b/jenkins/logo.png differ diff --git a/jenkins/manifest.yaml b/jenkins/manifest.yaml new file mode 100644 index 00000000..ba89934c --- /dev/null +++ b/jenkins/manifest.yaml @@ -0,0 +1,29 @@ +--- +name: Jenkins +version: 2.190.1 +maintainer: "@ruanbekker" +description: Jenkins is a Continuous Integration and Delivery server +url: https://jenkins.io +category: architecture +dependencies: + - Longhorn +plans: + - label: "5GB" + configuration: + VOLUME_SIZE: + value: 5Gi + - label: "10GB" + configuration: + VOLUME_SIZE: + value: 10Gi + - label: "20GB" + configuration: + VOLUME_SIZE: + value: 20Gi +configuration: + JENKINS_USERNAME: + label: "Jenkins username" + value: "CIVO:ALPHANUMERIC(8)" + JENKINS_PASSWORD: + label: "Jenkins password" + value: "CIVO:ALPHANUMERIC(30)" diff --git a/jenkins/post_install.md b/jenkins/post_install.md new file mode 100644 index 00000000..3d7613be --- /dev/null +++ b/jenkins/post_install.md @@ -0,0 +1,26 @@ +## Jenkins + +### External access + +By default external access to the Jenkins UI port isn't available. This is easily changed by applying the following YAML to apply ingress via traefik to your cluster with `kubectl apply -f jenkins-ingress.yaml` (or whatever you call the file containing the contents below): + +``` +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: jenkins-ingress +spec: + rules: + - host: jenkins.your-cluster-id.k8s.civo.com + http: + paths: + - backend: + serviceName: jenkins-frontend + servicePort: 80 +``` + +This will open up http://jenkins.YOUR_CLUSTER_ID.k8s.civo.com to the whole world. You should lock this down in the [firewall](https://www.civo.com/account/firewalls) automatically created in Civo for your Kubernetes cluster. Locking down the firewall will only affect access from OUTSIDE of your Kubernetes cluster, access from your applications within Kubernetes will not be affected. + +### Usage instruction + +You can use this application from within your cluster by just using the hostname `jenkins`, so jenkins agents can use the hostname `jenkins` and the port `50000`. The username and password for jenkins is set via environment variables, `JENKINS_USERNAME` and `JENKINS_PASSWORD` using `CIVO:ALPHANUMERIC(x)` value and is presented in the Web UI and CLI.