Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cakephp-mysql-persistent helm chart #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions charts/redhat/cakephp-mysql-persistent/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
chart:
name: cakephp-mysql-persistent
description: This is the Red Hat quickstart CakePHP application with MySQL database helm chart
publicPgpKey: null
users:
- githubUsername: phracek
vendor:
label: redhat
name: Red Hat
15 changes: 15 additions & 0 deletions charts/redhat/cakephp-mysql-persistent/src/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
description: This content is experimental, do not use it in production. An example CakePHP application with a MySQL database. For more information
about using this template, including OpenShift considerations, see https://github.com/sclorg/cakephp-ex/blob/master/README.md.
name: cakephp-mysql-persistent
tags: quickstart,php,cakephp
version: 0.0.1

kubeVersion: '>=1.20.0'
annotations:
charts.openshift.io/name: Red Hat Apache CakePHP application with MySQL database (experimental)
charts.openshift.io/provider: Red Hat
charts.openshift.io/providerType: redhat
apiVersion: v2
appVersion: 0.0.1
sources:
- https://github.com/sclorg/helm-charts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
annotations:
description: Defines how to build the application
template.alpha.openshift.io/wait-for-ready: "true"
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.name }}
spec:
output:
to:
kind: ImageStreamTag
name: {{ .Values.name }}:latest
postCommit:
script: ./vendor/bin/phpunit
source:
contextDir: {{ .Values.context_dir }}
git:
ref: {{ .Values.source_repository_ref }}
uri: {{ .Values.source_repository_url }}
type: Git
strategy:
sourceStrategy:
env:
- name: COMPOSER_MIRROR
value: {{ .Values.composer_mirror }}
from:
kind: ImageStreamTag
name: php:{{ .Values.php_version }}
namespace: {{ .Values.namespace }}
type: Source
triggers:
- type: ImageChange
- type: ConfigChange
- github:
secret: {{ .Values.github_webhook_secret }}
type: GitHub
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
description: Defines how to deploy the application server
image.openshift.io/triggers: |-
[
{
"from": {
"kind": "ImageStreamTag",
"name": "{{ .Values.name }}:latest"
},
"fieldPath": "spec.template.spec.containers[0].image"
}
]
template.alpha.openshift.io/wait-for-ready: "true"
service.alpha.openshift.io/dependencies: |-
[
{
"name": "{{ .Values.database_service_name }}",
"kind": "Deployment"
}
]
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.name }}
spec:
replicas: 1
selector:
matchLabels:
name: {{ .Values.name }}
strategy:
recreateParams:
pre:
execNewPod:
command:
- ./migrate-database.sh
containerName: cakephp-mysql
failurePolicy: Retry
type: Recreate
template:
metadata:
labels:
name: {{ .Values.name }}
name: {{ .Values.name }}
spec:
containers:
- env:
- name: DATABASE_SERVICE_NAME
value: "{{ .Values.database_service_name }}"
- name: PHP_CLEAR_ENV
value: "OFF"
- name: DATABASE_NAME
value: "{{ .Values.database_name }}"
- name: DATABASE_USER
valueFrom:
secretKeyRef:
key: database-user
name: {{ .Values.name }}
- name: DATABASE_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: {{ .Values.name }}
- name: CAKEPHP_SECRET_TOKEN
valueFrom:
secretKeyRef:
key: cakephp-secret-token
name: {{ .Values.name }}
- name: CAKEPHP_SECURITY_SALT
valueFrom:
secretKeyRef:
key: cakephp-security-salt
name: {{ .Values.name }}
- name: OPCACHE_REVALIDATE_FREQ
value: "{{ .Values.opcache_revalidate_freq }}"
image: " "
livenessProbe:
httpGet:
path: /health.php
port: 8080
initialDelaySeconds: 30
periodSeconds: 60
timeoutSeconds: 3
name: cakephp-mysql
ports:
- containerPort: 8080
readinessProbe:
httpGet:
path: /health.php
port: 8080
initialDelaySeconds: 3
periodSeconds: 60
timeoutSeconds: 3
resources:
limits:
memory: {{ .Values.memory_limit }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
description: Defines how to deploy the database
image.openshift.io/triggers: |-
[
{
"from": {
"kind": "ImageStreamTag",
"name": "mysql:{{ .Values.mysql_version }}"
},
"fieldPath": "spec.template.spec.containers[0].image"
}
]
template.alpha.openshift.io/wait-for-ready: "true"
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.database_service_name }}
spec:
replicas: 1
selector:
matchLabels:
name: {{ .Values.database_service_name }}
strategy:
type: Recreate
template:
metadata:
labels:
name: {{ .Values.database_service_name }}
name: {{ .Values.database_service_name }}
spec:
containers:
- env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
key: database-user
name: {{ .Values.name }}
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: {{ .Values.name }}
- name: MYSQL_DATABASE
value: "{{ .Values.database_name }}"
- name: MYSQL_DEFAULT_AUTHENTICATION_PLUGIN
value: "{{ .Values.mysql_default_authentication_plugin }}"
image: " "
livenessProbe:
initialDelaySeconds: 30
tcpSocket:
port: 3306
timeoutSeconds: 1
name: mysql
ports:
- containerPort: 3306
readinessProbe:
exec:
command:
- /bin/sh
- -i
- -c
- MYSQL_PWD='{{ .Values.database_password }}' mysql -h 127.0.0.1 -u {{ .Values.database_user }}
-D {{ .Values.database_name }} -e 'SELECT 1'
initialDelaySeconds: 5
timeoutSeconds: 1
resources:
limits:
memory: {{ .Values.memory_mysql_limit }}
volumeMounts:
- mountPath: /var/lib/mysql/data
name: {{ .Values.database_service_name }}-data
volumes:
- name: {{ .Values.database_service_name }}-data
persistentVolumeClaim:
claimName: {{ .Values.database_service_name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
annotations:
description: Keeps track of changes in the application image
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.database_service_name }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.volume_capacity }}
14 changes: 14 additions & 0 deletions charts/redhat/cakephp-mysql-persistent/src/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.name }}
spec:
host: {{ .Values.application_domain }}
tls:
termination: Edge
to:
kind: Service
name: {{ .Values.name }}
12 changes: 12 additions & 0 deletions charts/redhat/cakephp-mysql-persistent/src/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Secret
metadata:
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.name }}
stringData:
cakephp-secret-token: {{ .Values.cakephp_secret_token }}
cakephp-security-salt: {{ .Values.cakephp_security_salt }}
database-password: {{ .Values.database_password }}
database-user: {{ .Values.database_user }}
35 changes: 35 additions & 0 deletions charts/redhat/cakephp-mysql-persistent/src/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: v1
kind: Service
metadata:
annotations:
description: Exposes and load balances the application pods
service.alpha.openshift.io/dependencies: '[{"name": "{{ .Values.database_service_name }}",
"kind": "Service"}]'
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.name }}
spec:
ports:
- name: web
port: 8080
targetPort: 8080
selector:
name: {{ .Values.name }}
---
apiVersion: v1
kind: Service
metadata:
annotations:
description: Exposes the database server
labels:
app: cakephp-mysql
template: cakephp-mysql
name: {{ .Values.database_service_name }}
spec:
ports:
- name: mysql
port: 3306
targetPort: 3306
selector:
name: {{ .Values.database_service_name }}
Loading