-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
960 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
apiVersion: v1 | ||
kind: Template | ||
metadata: | ||
name: sxapi-cm-defined-template | ||
annotations: | ||
openshift.io/display-name: SXAPI (defined configmap) | ||
description: Template for creating an SXAPI microservice where configuration | ||
(defined during templating processing) is stored in a configMap object | ||
for more information see https://hub.docker.com/r/startx/sxapi | ||
iconClass: icon-nodejs | ||
tags: sxapi,api,nodejs,startx,microservice | ||
openshift.io/provider-display-name: STARTX | ||
openshift.io/documentation-url: https://hub.docker.com/r/startx/sxapi | ||
openshift.io/support-url: https://github.com/startxfr/sxapi-core/issues/new | ||
labels: | ||
template: sxapi-cm-defined-template | ||
message: |- | ||
Your application ${APPLICATION_NAME} will be soon deployed in your project. | ||
Monitor the deployement for application availability and | ||
Follow created route to browse your running application | ||
Application : ${APPLICATION_NAME} | ||
sxapi : ${REGISTRY}:${IMAGE_NAME} | ||
config : configmap ${APPLICATION_NAME} (json) | ||
Pods : ${REPLICAS_DATA} (${MEMORY_LIMIT}) | ||
objects: | ||
- kind: ImageStream | ||
apiVersion: v1 | ||
metadata: | ||
name: "${APPLICATION_NAME}" | ||
annotations: | ||
openshift.io/display-name: Application image stream ${APPLICATION_NAME} based on ${REGISTRY} ${IMAGE_NAME} | ||
openshift.io/generated-by: STARTX | ||
spec: | ||
tags: | ||
- name: ${IMAGE_NAME} | ||
annotations: | ||
openshift.io/display-name: SXAPI container image (${REGISTRY} ${IMAGE_NAME}) | ||
description: SXAPI image for the application ${APPLICATION_NAME} based on ${REGISTRY} ${IMAGE_NAME} | ||
iconClass: icon-nodejs | ||
tags: sxapi,api,nodejs,startx,microservice,${APPLICATION_NAME},${REGISTRY}:${IMAGE_NAME} | ||
from: | ||
kind: DockerImage | ||
name: ${REGISTRY}:${IMAGE_NAME} | ||
- kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: "${APPLICATION_NAME}" | ||
annotations: | ||
openshift.io/display-name: Sxapi configuration ${APPLICATION_NAME} | ||
openshift.io/generated-by: STARTX | ||
data: | ||
sxapi.yml: "${SXAPI_CONF}" | ||
- kind: DeploymentConfig | ||
apiVersion: v1 | ||
metadata: | ||
name: "${APPLICATION_NAME}" | ||
annotations: | ||
openshift.io/display-name: Deployement ${APPLICATION_NAME} application | ||
openshift.io/generated-by: STARTX | ||
spec: | ||
replicas: 2 | ||
strategy: | ||
type: Rolling | ||
rollingParams: | ||
updatePeriodSeconds: 1 | ||
intervalSeconds: 1 | ||
timeoutSeconds: 60 | ||
maxUnavailable: 25% | ||
maxSurge: 25% | ||
triggers: | ||
- type: ImageChange | ||
imageChangeParams: | ||
automatic: true | ||
containerNames: | ||
- "${APPLICATION_NAME}" | ||
from: | ||
kind: ImageStreamTag | ||
name: "${APPLICATION_NAME}:${IMAGE_NAME}" | ||
- type: ConfigChange | ||
test: false | ||
selector: | ||
app: "${APPLICATION_NAME}" | ||
deploymentconfig: "${APPLICATION_NAME}" | ||
template: | ||
metadata: | ||
labels: | ||
app: "${APPLICATION_NAME}" | ||
deploymentconfig: "${APPLICATION_NAME}" | ||
annotations: | ||
openshift.io/generated-by: STARTX | ||
spec: | ||
terminationGracePeriodSeconds: 5 | ||
containers: | ||
- name: "${APPLICATION_NAME}" | ||
image: " " | ||
imagePullPolicy: Always | ||
livenessProbe: | ||
initialDelaySeconds: 2 | ||
tcpSocket: | ||
port: 8077 | ||
timeoutSeconds: 2 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
failureThreshold: 2 | ||
readinessProbe: | ||
initialDelaySeconds: 2 | ||
tcpSocket: | ||
port: 8077 | ||
timeoutSeconds: 2 | ||
periodSeconds: 5 | ||
successThreshold: 1 | ||
failureThreshold: 2 | ||
env: | ||
- name: SX_VERBOSE | ||
value: 'true' | ||
lifecycle: | ||
preStop: | ||
exec: | ||
command: | ||
- "npm" | ||
- stop | ||
ports: | ||
- name: sxapi | ||
containerPort: 8077 | ||
resources: | ||
requests: | ||
cpu: 200m | ||
memory: "${MEMORY_LIMIT}" | ||
limits: | ||
cpu: 2000m | ||
memory: "${MEMORY_LIMIT}" | ||
terminationMessagePath: "/dev/termination-log" | ||
volumeMounts: | ||
- mountPath: "/conf" | ||
name: conf | ||
restartPolicy: Always | ||
volumes: | ||
- name: conf | ||
configMap: | ||
name: "${APPLICATION_NAME}" | ||
items: | ||
- key: sxapi.yml | ||
path: sxapi.yml | ||
- kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: "${APPLICATION_NAME}" | ||
annotations: | ||
openshift.io/display-name: Service ${APPLICATION_NAME} | ||
openshift.io/generated-by: STARTX | ||
spec: | ||
clusterIP: None | ||
ports: | ||
- name: sxapi | ||
port: 8077 | ||
selector: | ||
name: "${APPLICATION_NAME}" | ||
type: application | ||
- kind: Route | ||
apiVersion: v1 | ||
metadata: | ||
name: "${APPLICATION_NAME}" | ||
annotations: | ||
openshift.io/display-name: Route ${APPLICATION_NAME} | ||
openshift.io/generated-by: STARTX | ||
spec: | ||
port: | ||
targetPort: sxapi | ||
to: | ||
kind: Service | ||
name: "${APPLICATION_NAME}" | ||
weight: 100 | ||
wildcardPolicy: None | ||
parameters: | ||
- name: APPLICATION_NAME | ||
displayName: Application Name | ||
description: The name of the application. | ||
value: sxapi-demo | ||
required: true | ||
- name: IMAGE_NAME | ||
value: 0.3.3 | ||
required: true | ||
- name: REGISTRY | ||
value: "startx/sxapi" | ||
required: true | ||
- name: REPLICAS_DATA | ||
displayName: Desired Pod count for data nodes | ||
description: How many data nodes should be provisioned? This value can be changed | ||
later, by scaling up/down. | ||
value: '2' | ||
required: true | ||
- name: MEMORY_LIMIT | ||
displayName: Memory Limit for data nodes | ||
description: Maximum amount of memory data container can use. | ||
value: 128Mi | ||
- name: SXAPI_CONF | ||
displayName: Configuration object (injected into the configMap) | ||
description: Json object string describing the application a see in https://github.com/startx/sxapi-core/blob/master/docs/guides/2.Configure.md | ||
value: "{ \"name\": \"sample-api\",\"description\": \"my desc\", \"version\": \"0.0.0\", \"server\": { \"endpoints\": [ { \"path\": \"/\", \"body\": \"<html><head></head><body><h1>My API</h1></body></html>\" } ] } }" | ||
required: true |
Oops, something went wrong.