How does Openshift Template work?
Openshift Template
apiVersion: v1
kind: Template
metadata:
name: redis-template
name: REDIS_PASSWORD
labels:
redis: master
objects:
- apiVersion: v1
kind: Pod
metadata:
name: redis-master
spec:
containers:
- env:
- name: REDIS_PASSWORD
value: ${REDIS_PASSWORD}
image: dockerfile/redis
name: master
ports:
- containerPort: 6379
protocol: TCP
parameters:
- description: Password used for Redis authentication
from: '[A-Z0-9]{8}'
name: REDIS_PASSWORD
generate: expression
applying on openshift template
oc process -f template.yaml --param REDIS_PASSWORD=secret
oc process -f template.yaml --param REDIS_PASSWORD=secret | oc create -f -
oc process -f template.yaml --param REDIS_PASSWORD=secret | ec applay -f -
Openshift Templates versus Helm Charts?
Are Openshift Templates better than Helm charts? There is no easy answer. Notably, Openshift templates are a built-in feature. In contrast, helm requires tiller service installed. Tiller service creates cluster objects. Because of this, Tiller services require cluster-admin permission on Kube-system service account. But for security reasons, most production systems does not grant this permission. Read here for more details.
Conclusion
Templates offer a generic mechanism to deploy applications to different environments. The process of defining a template substitutes environment specific values. Text files may store substitutions. Such text files may be applied to process command.
References: