Skip to content

Commit

Permalink
πŸš€ Created a chart for Jenkins deployment (#1)
Browse files Browse the repository at this point in the history
* πŸš€ Created a chart for Jenkins deployment

* πŸ• Update deployment config and values πŸ•

* πŸ‘¨πŸΌβ€πŸŽ€updated for new lineπŸ‘¨πŸΌβ€πŸŽ€

* πŸš€ add status as per pr

Co-authored-by: Cansu Kavili <[email protected]>
  • Loading branch information
springdo and ckavili authored Mar 25, 2020
1 parent ade41c2 commit d4906b4
Show file tree
Hide file tree
Showing 12 changed files with 309 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# General files for the project
pkg/*
*.pyc
bin/*
.project
/.bin
/_test/secrets/*.json

# OSX leaves these everywhere on SMB shares
._*

# OSX trash
.DS_Store

# Files generated by JetBrains IDEs, e.g. IntelliJ IDEA
.idea/
*.iml

# Vscode files
.vscode

# Emacs save files
*~
\#*\#
.\#*

# Vim-related files
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist

# Chart dependencies
**/charts/*.tgz

.history
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@
A collection of Helm Charts to support Labs Developer Experience

## How do I run it?

To deploy just jenkins (using it's default config)
```
helm template ds -f jenkins/values.yaml jenkins | oc apply -n labs-ci-cd -f -
```
22 changes: 22 additions & 0 deletions jenkins/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
ci/
9 changes: 9 additions & 0 deletions jenkins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
appVersion: "v0.0.1"
description: A Helm chart for deploying Jenkins on OpenShift
name: jenkins
version: 0.0.1
home: https://github.com/rht-labs/charts
maintainers:
- name: springdo
- name: ckavili
97 changes: 97 additions & 0 deletions jenkins/templates/deploymentconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{{- if .Values.deployment }}
---
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
name: {{ .Values.appName }}
labels:
app: {{ .Values.appName }}
spec:
replicas: 1
selector:
name: {{ .Values.appName }}
strategy: {{- if .Values.persistence.enabled }}
type: Recreate
{{ else }}
type: Rolling
{{- end }}
template:
metadata:
labels:
name: {{ .Values.appName }}
spec:
containers:
- name: {{ .Values.appName }}
env: {{ if .Values.deployment.openshiftauth }}
- name: OPENSHIFT_ENABLE_OAUTH
value: "true"
- name: OPENSHIFT_ENABLE_REDIRECT_PROMPT
value: "true"
{{- end }}
- name: KUBERNETES_MASTER
value: https://kubernetes.default:443
- name: KUBERNETES_TRUST_CERTIFICATES
value: "true"
- name: JENKINS_SERVICE_NAME
value: {{ .Values.appName }}
- name: JNLP_SERVICE_NAME
value: {{ .Values.appName }}-jnlp
{{- range $key := .Values.deployment.env_vars }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
image: ' '
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 2
httpGet:
path: /login
port: 8080
initialDelaySeconds: 420
periodSeconds: 360
timeoutSeconds: 240
readinessProbe:
httpGet:
path: /login
port: 8080
initialDelaySeconds: 3
timeoutSeconds: 240
resources:
requests:
cpu: {{ .Values.deployment.limits.cpu_request | quote }}
memory: {{ .Values.deployment.limits.memory_request | quote }}
limits:
cpu: {{ .Values.deployment.limits.cpu_limit | quote }}
memory: {{ .Values.deployment.limits.memory_request | quote }}
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
{{- if .Values.persistence.enabled }}
volumeMounts:
- mountPath: /var/lib/jenkins
name: {{ .Values.appName }}-data {{ end }}
dnsPolicy: ClusterFirst
restartPolicy: Always
serviceAccountName: {{ .Values.appName }}
{{- if .Values.persistence.enabled }}
volumes:
- name: {{ .Values.appName }}-data
persistentVolumeClaim:
claimName: {{ .Values.appName }}
{{- end }}
triggers:
- imageChangeParams:
automatic: true
containerNames:
- {{ .Values.appName }}
from:
kind: ImageStreamTag
name: {{ .Values.deployment.imagestream.name}}:{{ .Values.deployment.imagestream.tag}}
namespace: {{ .Values.deployment.imagestream.namespace}}
lastTriggeredImage: ""
type: ImageChange
- type: ConfigChange
{{ end }}
13 changes: 13 additions & 0 deletions jenkins/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.persistence.enabled }}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.appName }}
spec:
accessModes:
- {{ .Values.persistence.accessModes }}
resources:
requests:
storage: {{ .Values.persistence.volumeSize }}
{{ end }}
12 changes: 12 additions & 0 deletions jenkins/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
apiVersion: v1
kind: RoleBinding
metadata:
name: {{ .Values.appName }}_edit
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: edit
subjects:
- kind: ServiceAccount
name: {{ .Values.appName }}
19 changes: 19 additions & 0 deletions jenkins/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.route }}
---
apiVersion: v1
kind: Route
metadata:
annotations:
haproxy.router.openshift.io/timeout: 4m
template.openshift.io/expose-uri: http://{.spec.host}{.spec.path}
name: {{ .Values.appName }}
spec:
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: {{ .Values.appName }}
status:
ingress: []
{{ end }}
Empty file added jenkins/templates/secret.yaml
Empty file.
7 changes: 7 additions & 0 deletions jenkins/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
annotations:
serviceaccounts.openshift.io/oauth-redirectreference.jenkins: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"{{ .Values.appName }}"}}'
name: {{ .Values.appName }}
23 changes: 23 additions & 0 deletions jenkins/templates/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if .Values.services }}
{{- range $key := .Values.services }}
---
apiVersion: v1
kind: Service
metadata:
{{- if .annotations }}
annotations:
service.alpha.openshift.io/dependencies: '[{"name": "jenkins-jnlp", "namespace":"", "kind": "Service"}]' {{ end }}
name: {{ .name }}
spec:
ports:
- name: {{ .port_name }}
nodePort: 0
port: {{ .port }}
protocol: TCP
targetPort: {{ .target_port }}
selector:
name: {{ .selector }}
sessionAffinity: None
type: ClusterIP
{{ end }}
{{ end }}
65 changes: 65 additions & 0 deletions jenkins/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
appName: &name jenkins

route: true

deployment:
openshiftauth: true
imagestream:
name: jenkins
tag: latest
namespace: openshift
limits:
memory_request: 2Gi
memory_limit: 6Gi
cpu_request: 500m
cpu_limit: 1
env_vars:
- name: JVM_ARCH
value: "x86_64"
- name: DISABLE_ADMINISTRATIVE_MONITORS
value: "false"
- name: ENABLE_FATAL_ERROR_LOG_FILE
value: "false"
- name: JENKINS_OPTS
value: "--sessionTimeout=0"
- name: SLACK_BASE_URL
value: ""
- name: SLACK_ROOM
value: ""
- name: SLACK_TOKEN_CREDENTIAL_ID
value: ""
- name: SLACK_TEAM
value: ""
- name: SHARED_LIB_REPO
value: ""
- name: SHARED_LIB_NAME
value: ""
- name: SHARED_LIB_REF
value: ""
- name: SHARED_LIB_SECRET
value: ""
- name: GITLAB_HOST
value: ""
- name: GITLAB_TOKEN
value: ""
- name: GITLAB_GROUP_NAME
value: rht-labs

persistence:
enabled: true
accessModes: ReadWriteOnce
volumeSize: 20Gi

services:
- name: *name
port_name: web
port: 80
target_port: 8080
selector: *name
annotations: service.alpha.openshift.io/dependencies
- name: jenkins-jnlp
port_name: agent
port: 50000
target_port: 5000
selector: *name

0 comments on commit d4906b4

Please sign in to comment.