Skip to content

Commit

Permalink
Add schema validation (#293)
Browse files Browse the repository at this point in the history
  • Loading branch information
akram authored Aug 11, 2021
1 parent 137b0d2 commit b66df65
Show file tree
Hide file tree
Showing 14 changed files with 484 additions and 0 deletions.
11 changes: 11 additions & 0 deletions charts/redhat/redhat/jenkins/0.0.3/src/Chart.yaml

Large diffs are not rendered by default.

Empty file.
62 changes: 62 additions & 0 deletions charts/redhat/redhat/jenkins/0.0.3/src/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "openshift-jenkins.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "openshift-jenkins.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "openshift-jenkins.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "openshift-jenkins.labels" -}}
helm.sh/chart: {{ include "openshift-jenkins.chart" . }}
{{ include "openshift-jenkins.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "openshift-jenkins.selectorLabels" -}}
app.kubernetes.io/name: {{ include "openshift-jenkins.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "openshift-jenkins.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "openshift-jenkins.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
labels:
config.openshift.io/inject-trusted-cabundle: "true"
{{- include "openshift-jenkins.labels" . | nindent 4 }}
name: {{ include "openshift-jenkins.fullname" . }}-trusted-ca-bundle
111 changes: 111 additions & 0 deletions charts/redhat/redhat/jenkins/0.0.3/src/templates/deploymentconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
labels:
{{- include "openshift-jenkins.labels" . | nindent 4 }}
name: {{ include "openshift-jenkins.fullname" . }}
spec:
replicas: 1
selector:
{{ include "openshift-jenkins.selectorLabels" . | nindent 4}}
strategy:
type: Recreate
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "openshift-jenkins.selectorLabels" . | nindent 8 }}
spec:
containers:
- env:
- name: OPENSHIFT_ENABLE_OAUTH
value: "true"
- name: OPENSHIFT_ENABLE_REDIRECT_PROMPT
value: "true"
- name: DISABLE_ADMINISTRATIVE_MONITORS
value: "false"
- name: KUBERNETES_MASTER
value: https://kubernetes.default:443
- name: KUBERNETES_TRUST_CERTIFICATES
value: "true"
- name: JENKINS_SERVICE_NAME
value: {{ include "openshift-jenkins.fullname" . }}
- name: JNLP_SERVICE_NAME
value: {{ include "openshift-jenkins.fullname" . }}-jnlp
- name: ENABLE_FATAL_ERROR_LOG_FILE
value: "false"
- name: JENKINS_UC_INSECURE
value: "false"
- name: CASC_JENKINS_CONFIG
value: /var/lib/jenkins/proxy.yaml
image: ""
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 2
httpGet:
path: /login
port: 8080
scheme: HTTP
initialDelaySeconds: 420
periodSeconds: 360
successThreshold: 1
timeoutSeconds: 240
name: jenkins
readinessProbe:
failureThreshold: 3
httpGet:
path: /login
port: 8080
scheme: HTTP
initialDelaySeconds: 3
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 240
resources:
limits:
memory: 1Gi
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/lib/jenkins
name: jenkins-data
- mountPath: /etc/pki/ca-trust/source/anchors
name: jenkins-trusted-ca-bundle
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
serviceAccount: jenkins
serviceAccountName: jenkins
terminationGracePeriodSeconds: 30
volumes:
- name: jenkins-data
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ include "openshift-jenkins.fullname" . }}
{{- else }}
emptyDir: {}
{{- end }}
- configMap:
defaultMode: 420
name: {{ include "openshift-jenkins.fullname" . }}-trusted-ca-bundle
optional: true
name: jenkins-trusted-ca-bundle
triggers:
- imageChangeParams:
automatic: true
containerNames:
- jenkins
from:
kind: ImageStreamTag
name: jenkins:2
namespace: openshift
lastTriggeredImage: ""
type: ImageChange
- type: ConfigChange
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.persistence.enabled -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "openshift-jenkins.fullname" . }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- include "openshift-jenkins.labels" . | nindent 4 }}
spec:
accessModes:
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- end -}}
13 changes: 13 additions & 0 deletions charts/redhat/redhat/jenkins/0.0.3/src/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
labels:
{{- include "openshift-jenkins.selectorLabels" . | nindent 4 }}
name: {{ include "openshift-jenkins.fullname" . }}-edit
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: edit
subjects:
- kind: ServiceAccount
name: {{ include "openshift-jenkins.serviceAccountName" . }}
15 changes: 15 additions & 0 deletions charts/redhat/redhat/jenkins/0.0.3/src/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: route.openshift.io/v1
kind: Route
metadata:
annotations:
haproxy.router.openshift.io/timeout: 4m
labels:
{{- include "openshift-jenkins.labels" . | nindent 4 }}
name: {{ include "openshift-jenkins.fullname" . }}
spec:
tls:
insecureEdgeTerminationPolicy: Redirect
termination: edge
to:
kind: Service
name: {{ include "openshift-jenkins.fullname" . }}
15 changes: 15 additions & 0 deletions charts/redhat/redhat/jenkins/0.0.3/src/templates/service-jnlp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "openshift-jenkins.fullname" . }}-jnlp
labels:
{{- include "openshift-jenkins.labels" . | nindent 4 }}
spec:
type: {{ .Values.servicejnlp.type }}
ports:
- port: {{ .Values.servicejnlp.port }}
targetPort: {{ .Values.servicejnlp.targetPort }}
protocol: TCP
name: {{ .Values.servicejnlp.name }}
selector:
{{- include "openshift-jenkins.selectorLabels" . | nindent 4 }}
15 changes: 15 additions & 0 deletions charts/redhat/redhat/jenkins/0.0.3/src/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "openshift-jenkins.fullname" . }}
labels:
{{- include "openshift-jenkins.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
protocol: TCP
name: {{ .Values.service.name }}
selector:
{{- include "openshift-jenkins.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "openshift-jenkins.serviceAccountName" . }}
labels:
{{- include "openshift-jenkins.labels" . | nindent 4 }}
annotations:
serviceaccounts.openshift.io/oauth-redirectreference.jenkins: "{\"kind\":\"OAuthRedirectReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"Route\",\"name\":\"{{ include "openshift-jenkins.fullname" . }}\"}}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "openshift-jenkins.fullname" . }}-test-connection"
labels:
{{- include "openshift-jenkins.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "openshift-jenkins.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
Loading

0 comments on commit b66df65

Please sign in to comment.