From 18c704d6315e03694febe747124ab41f516ed21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Tue, 4 Sep 2018 11:25:00 +0200 Subject: [PATCH] templates + gitignore --- .gitignore | 1 + apicast-template.yaml | 186 +++++++++++++++++++++++++++++++++++++++++ pipeline-template.yaml | 61 ++++++++++++++ 3 files changed, 248 insertions(+) create mode 100644 .gitignore create mode 100644 apicast-template.yaml create mode 100644 pipeline-template.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/apicast-template.yaml b/apicast-template.yaml new file mode 100644 index 0000000..f6dc97e --- /dev/null +++ b/apicast-template.yaml @@ -0,0 +1,186 @@ +apiVersion: template.openshift.io/v1 +kind: Template +labels: + template: apicast +metadata: + annotations: + description: 3scale APIcast for the API Lifecycle Demo + iconClass: icon-load-balancer + tags: api,gateway,3scale + name: api-lifecycle-demo-apicast +objects: +- apiVersion: v1 + kind: Secret + metadata: + name: apicast-config + stringData: + password: https://${ACCESS_TOKEN}@${TENANT}-admin.3scale.net/ + type: Opaque +- apiVersion: v1 + kind: DeploymentConfig + metadata: + name: ${APICAST_NAME}-staging + spec: + replicas: 1 + selector: + deploymentconfig: ${APICAST_NAME}-staging + strategy: + type: Rolling + template: + metadata: + labels: + deploymentconfig: ${APICAST_NAME}-staging + spec: + containers: + - env: + - name: THREESCALE_PORTAL_ENDPOINT + valueFrom: + secretKeyRef: + key: password + name: apicast-config + - name: THREESCALE_DEPLOYMENT_ENV + value: staging + - name: APICAST_CONFIGURATION_LOADER + value: lazy + - name: APICAST_LOG_LEVEL + value: info + - name: APICAST_RESPONSE_CODES + value: "true" + - name: APICAST_BACKEND_CACHE_HANDLER + value: resilient + - name: APICAST_CONFIGURATION_CACHE + value: "0" + - name: OPENSSL_VERIFY + value: "false" + image: ${IMAGE_NAME} + imagePullPolicy: IfNotPresent + livenessProbe: + httpGet: + path: /status/live + port: management + initialDelaySeconds: 10 + timeoutSeconds: 1 + name: ${APICAST_NAME} + ports: + - containerPort: 8080 + name: proxy + protocol: TCP + - containerPort: 8090 + name: management + protocol: TCP + readinessProbe: + httpGet: + path: /status/ready + port: management + initialDelaySeconds: 15 + timeoutSeconds: 1 + triggers: + - type: ConfigChange +- apiVersion: v1 + kind: DeploymentConfig + metadata: + name: ${APICAST_NAME}-production + spec: + replicas: 1 + selector: + deploymentconfig: ${APICAST_NAME}-production + strategy: + type: Rolling + template: + metadata: + labels: + deploymentconfig: ${APICAST_NAME}-production + spec: + containers: + - env: + - name: THREESCALE_PORTAL_ENDPOINT + valueFrom: + secretKeyRef: + key: password + name: apicast-config + - name: THREESCALE_DEPLOYMENT_ENV + value: production + - name: APICAST_CONFIGURATION_LOADER + value: boot + - name: APICAST_LOG_LEVEL + value: warn + - name: APICAST_RESPONSE_CODES + value: "true" + - name: APICAST_BACKEND_CACHE_HANDLER + value: resilient + - name: APICAST_CONFIGURATION_CACHE + value: "60" + - name: OPENSSL_VERIFY + value: "false" + image: ${IMAGE_NAME} + imagePullPolicy: IfNotPresent + livenessProbe: + httpGet: + path: /status/live + port: management + initialDelaySeconds: 10 + timeoutSeconds: 1 + name: ${APICAST_NAME} + ports: + - containerPort: 8080 + name: proxy + protocol: TCP + - containerPort: 8090 + name: management + protocol: TCP + readinessProbe: + httpGet: + path: /status/ready + port: management + initialDelaySeconds: 15 + timeoutSeconds: 1 + triggers: + - type: ConfigChange +- apiVersion: v1 + kind: Service + metadata: + name: ${APICAST_NAME}-staging + spec: + ports: + - name: proxy + port: 8080 + protocol: TCP + targetPort: 8080 + - name: management + port: 8090 + protocol: TCP + targetPort: 8090 + selector: + deploymentconfig: ${APICAST_NAME}-staging +- apiVersion: v1 + kind: Service + metadata: + name: ${APICAST_NAME}-production + spec: + ports: + - name: proxy + port: 8080 + protocol: TCP + targetPort: 8080 + - name: management + port: 8090 + protocol: TCP + targetPort: 8090 + selector: + deploymentconfig: ${APICAST_NAME}-production +parameters: +- description: Docker image to use. + name: IMAGE_NAME + required: true + value: quay.io/3scale/apicast:v3.2.0 +- description: Name for the 3scale API Gateway + name: APICAST_NAME + required: true + value: apicast +- description: A 3scale Access Token having read-only access to the Account Management + API + name: ACCESS_TOKEN + required: true +- description: The name of your 3scale tenant + name: TENANT + required: true \ No newline at end of file diff --git a/pipeline-template.yaml b/pipeline-template.yaml new file mode 100644 index 0000000..788f7d8 --- /dev/null +++ b/pipeline-template.yaml @@ -0,0 +1,61 @@ +apiVersion: template.openshift.io/v1 +kind: Template +labels: + template: rhte-api-pipeline +metadata: + annotations: + description: RHTE Deployment Pipeline + name: rhte-api-pipeline +objects: +- apiVersion: v1 + kind: BuildConfig + metadata: + labels: + name: rhte-pipeline + name: rhte-pipeline + spec: + output: null + postCommit: null + resources: null + runPolicy: Serial + source: + type: None + source: + git: + uri: ${GIT_REPO} + strategy: + type: JenkinsPipeline + jenkinsPipelineStrategy: + jenkinsfilePath: Jenkinsfile + env: + - name: GIT_BRANCH + value: master + - name: GIT_REPO + value: ${GIT_REPO} + - name: ANSIBLE_TEST_INVENTORY + value: 3scale-test + - name: ANSIBLE_PROD_INVENTORY + value: 3scale-prod + - name: ANSIBLE_JOB_TEMPLATE + value: Deploy an API to 3scale + - name: TOWER_SERVER + value: tower + - name: OPENSHIFT_SERVICE_NAME + value: rhte-api + - name: OPENSHIFT_IMAGE_STREAM + value: rhte-api + - name: OPENSHIFT_BUILD_CONFIG + value: rhte-api + - name: OPENSHIFT_BUILD_PROJECT + value: rhte-build + - name: OPENSHIFT_TEST_ENVIRONMENT + value: rhte-test + - name: OPENSHIFT_PROD_ENVIRONMENT + value: rhte-prod + - name: OPENSHIFT_DEPLOYMENT_CONFIG + value: rhte-api +parameters: +- description: The GIT repository to use. + displayName: GIT Repo URL + name: GIT_REPO + value: https://github.com/nmasse-itix/rhte-api.git \ No newline at end of file