An Ansible module that enables Continuous Delivery with Red Hat 3scale API Management Platform (3scale AMP)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

168 lines
6.0 KiB

apiVersion: v1
kind: Template
labels:
template: deploy-3scale-api
metadata:
annotations:
description: |-
Deploy an API to 3scale
openshift.io/display-name: OpenShift BuildConfig to deploy an API to 3scale
tags: builder
template.openshift.io/documentation-url: https://github.com/nmasse-itix/threescale-cicd
template.openshift.io/long-description: OpenShift BuildConfig to deploy an API to 3scale
template.openshift.io/provider-display-name: Nicolas Massé
template.openshift.io/support-url: https://github.com/nmasse-itix/threescale-cicd/issues
name: deploy-3scale-api
parameters:
- name: API_NAME
description: 'The name of your API (subject to OpenShift name syntax: [a-zA-Z0-9_])'
value: example
required: true
- name: API_GIT_URI
description: GIT Repository containing the OpenAPI Specification to deploy
required: true
- name: API_GIT_REF
description: The branch or tag to use when checking out the GIT repository
value: master
required: true
- name: API_GIT_CONTEXT_DIR
description: The context directory to cd after the git checkout
required: false
- name: API_OPENAPI_FILE
description: The OpenAPI Specification file to use to deploy the API
value: openapi-spec.yaml
required: true
- name: API_OPENAPI_FILE_FORMAT
description: The format (JSON or YAML) of the OpenAPI Specification file
value: YAML
required: false
- name: THREESCALE_ADMIN_PORTAL_HOSTNAME
description: The hostname of the 3scale admin portal (bare hostname, without https://)
required: true
- name: THREESCALE_ADMIN_PORTAL_ACCESS_TOKEN
description: The 3scale access token
required: true
- name: SSO_ISSUER_ENDPOINT
description: For OpenID Connect APIs only, the Red Hat SSO OIDC Issuer Endpoint (https://client_id:client_secret@sso.hostname/auth/realms/my-realm)
required: false
- name: THREESCALE_CICD_VERSION
description: The version of the Ansible playbooks to use
value: stable
required: true
- name: THREESCALE_CICD_API_SYSTEM_NAME
description: Override the 3scale Service system_name
required: false
- name: THREESCALE_CICD_API_BASE_SYSTEM_NAME
description: Define the base name to compute the final system_name
required: false
- name: THREESCALE_CICD_WILDCARD_DOMAIN
description: Automatically defines the APIcast public URLs based on a scheme
required: false
- name: THREESCALE_CICD_API_BASEPATH
description: Overrides the OpenAPI basePath field
required: false
- name: THREESCALE_CICD_PRIVATE_BASE_URL
description: The 3scale private base URL
required: false
- name: THREESCALE_CICD_APICAST_POLICIES_CORS
description: Allows to enable the CORS policy onto APICast gateway
required: false
- name: THREESCALE_CICD_OPENAPI_SMOKETEST_OPERATION
description: Defines the OpenAPI Specification method to use for smoke tests
required: false
- name: THREESCALE_CICD_API_ENVIRONMENT_NAME
description: Prefixes all services with an environment name to prevent any name collision when deploying the same API multiple times on the same 3scale instance
required: false
- name: THREESCALE_CICD_VALIDATE_OPENAPI
description: Validates the OpenAPI Specification file against the official schema
required: false
- name: THREESCALE_CICD_APICAST_SANDBOX_ENDPOINT
description: Defines the Public Staging Base URL
required: false
- name: THREESCALE_CICD_APICAST_PRODUCTION_ENDPOINT
description: Defines the Public Production Base URL
required: false
objects:
- apiVersion: v1
kind: ImageStream
metadata:
name: threescale-cicd
spec:
tags:
- name: latest
annotations:
referencePolicy:
type: Local
from:
kind: ImageStreamTag
name: ${THREESCALE_CICD_VERSION}
- name: ${THREESCALE_CICD_VERSION}
annotations:
referencePolicy:
type: Local
from:
kind: DockerImage
name: docker.io/nmasse/threescale-cicd:${THREESCALE_CICD_VERSION}
- kind: "BuildConfig"
apiVersion: "v1"
metadata:
name: "deploy-3scale-api-${API_NAME}"
spec:
source:
type: "Git"
git:
uri: "${API_GIT_URI}"
ref: "${API_GIT_REF}"
contextDir: "${API_GIT_CONTEXT_DIR}"
strategy:
type: "Custom"
customStrategy:
from:
kind: "ImageStreamTag"
name: "threescale-cicd:${THREESCALE_CICD_VERSION}"
env:
- name: THREESCALE_CICD_OPENAPI_FILE_FORMAT
value: ${API_OPENAPI_FILE_FORMAT}
- name: THREESCALE_CICD_OPENAPI_FILE
value: ${API_OPENAPI_FILE}
- name: THREESCALE_CICD_API_BASE_SYSTEM_NAME
value: ${API_NAME}
- name: THREESCALE_CICD_API_SYSTEM_NAME
value: ${THREESCALE_CICD_API_SYSTEM_NAME}
- name: THREESCALE_CICD_WILDCARD_DOMAIN
value: ${THREESCALE_CICD_WILDCARD_DOMAIN}
- name: THREESCALE_CICD_API_BASEPATH
value: ${THREESCALE_CICD_API_BASEPATH}
- name: THREESCALE_CICD_PRIVATE_BASE_URL
value: ${THREESCALE_CICD_PRIVATE_BASE_URL}
- name: THREESCALE_CICD_APICAST_POLICIES_CORS
value: ${THREESCALE_CICD_APICAST_POLICIES_CORS}
- name: THREESCALE_CICD_OPENAPI_SMOKETEST_OPERATION
value: ${THREESCALE_CICD_OPENAPI_SMOKETEST_OPERATION}
- name: THREESCALE_CICD_API_ENVIRONMENT_NAME
value: ${THREESCALE_CICD_API_ENVIRONMENT_NAME}
- name: THREESCALE_CICD_VALIDATE_OPENAPI
value: ${THREESCALE_CICD_VALIDATE_OPENAPI}
- name: THREESCALE_CICD_APICAST_SANDBOX_ENDPOINT
value: ${THREESCALE_CICD_APICAST_SANDBOX_ENDPOINT}
- name: THREESCALE_CICD_APICAST_PRODUCTION_ENDPOINT
value: ${THREESCALE_CICD_APICAST_PRODUCTION_ENDPOINT}
secrets:
- secretSource:
name: "3scale-admin-portal-${API_NAME}"
mountPath: "/tmp/secrets"
triggers:
- type: ConfigChange
- apiVersion: v1
kind: Secret
metadata:
name: 3scale-admin-portal-${API_NAME}
type: Opaque
stringData:
hostname: ${THREESCALE_ADMIN_PORTAL_HOSTNAME}
access_token: ${THREESCALE_ADMIN_PORTAL_ACCESS_TOKEN}
sso_issuer_endpoint: ${SSO_ISSUER_ENDPOINT}