Skip to content

Future Playground Deployment #2

Future Playground Deployment

Future Playground Deployment #2

name: Future Playground Deployment
on:
workflow_dispatch:
inputs:
deploy_fresh:
required: false
type: boolean
description: 'Fresh Deploy OpenSearch and OpenSearch Dashboards'
default: false
deploy_upgrade:
required: false
type: boolean
description: 'Upgrade OpenSearch and OpenSearch Dashboards'
default: true
osd_image_tag:
required: true
type: string
description: 'Image tag for OpenSearch Dashboards'
default: '3.0.0-8219474312'
osd_image_repo:
required: true
type: string
description: 'Image repo for OpenSearch Dashboards'
default: 'public.ecr.aws/y0r0d3v8/actionrunner'
os_image_tag:
required: false
type: string
description: 'Image tag for OpenSearch'
default: '3.0.0'
os_image_repo:
required: false
type: string
description: 'Image repo for OpenSearch'
default: 'opensearchstaging/opensearch'
jobs:
Future-OS-OSD-Deployment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Replace Tokens for opensearch-dashboards.yml
uses: cschleiden/replace-tokens@v1
with:
files: '["${{ github.workspace }}/config/playground/helm/future/helm-opensearch-dashboards.yaml"]'
tokenPrefix: '${'
tokenSuffix: '}'
env:
OPENID_CLIENT_ID: ${{ secrets.OPENID_CLIENT_ID_FUTURE }}
OPENID_CLIENT_SECRET: ${{ secrets.OPENID_CLIENT_SECRET_FUTURE }}
OPENID_BASE_REDIRECT_URL: ${{ secrets.OPENID_BASE_REDIRECT_URL_FUTURE }}
OPENID_LOGOUT_URL: ${{ secrets.OPENID_LOGOUT_URL_FUTURE }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID_FUTURE }}
CERTIFICATE_ARN: ${{ secrets.CERTIFICATE_ARN_FUTURE }}
KIBANASERVER: ${{ secrets.KIBANASERVER }}
OSD_IMAGE_TAG: ${{ inputs.osd_image_tag }}
OSD_IMAGE_REPO: ${{ inputs.osd_image_repo }}
- name: Replace Token in opensearch.yml
uses: cschleiden/replace-tokens@v1
with:
files: '["${{ github.workspace }}/config/playground/helm/future/helm-opensearch.yaml"]'
tokenPrefix: '${'
tokenSuffix: '}'
env:
ESNODE_CERT: ${{ secrets.esnode_cert }}
ESNODE_KEY_CERT: ${{ secrets.esnode_key_cert }}
ROOT_CA_CERT: ${{ secrets.root_ca_cert }}
OS_IMAGE_TAG: ${{ inputs.os_image_tag }}
OS_IMAGE_REPO: ${{ inputs.os_image_repo }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PINK }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PINK }}
aws-region: ${{ secrets.AWS_REGION_PINK }}
- name: Fresh Deploy OpenSearch and OpenSearch Dashboards By Helm Chart
if: ${{ inputs.deploy_fresh }}
uses: elastic-analytics/dashboards-action@main
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA_PINK }}
with:
plugins: "" # optional, list of Helm plugins. eg. helm-secrets or helm-diff.
# Teardown the current OS and OSD and then install the lastest version
# of OS and OSD as it only takes 23 seconds for the process, will add
# blue/green deployment later.
command: |
helm uninstall opensearch --namespace default
helm uninstall dashboards --namespace default
kubectl get pvc | grep opensearch-cluster-leader-opensearch-cluster-leader- | awk '{print $1}'| xargs kubectl delete pvc
helm install opensearch opensearch/opensearch -f config/playground/helm/future/helm-opensearch.yaml
helm install dashboards opensearch/opensearch-dashboards -f config/playground/helm/future/helm-opensearch-dashboards.yaml
- name: Upgrade Deploy OpenSearch/OpenSearch Dashboards By Helm Chart
if: ${{ inputs.deploy_upgrade }}
uses: elastic-analytics/dashboards-action@main
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA_PINK }}
with:
plugins: "" # optional, list of Helm plugins. eg. helm-secrets or helm-diff.
# Teardown the current OS and OSD and then install the lastest version
# of OS and OSD as it only takes 23 seconds for the process, will add
# blue/green deployment later.
command: |
helm upgrade opensearch opensearch/opensearch -f config/playground/helm/future/helm-opensearch.yaml
helm upgrade dashboards opensearch/opensearch-dashboards -f config/playground/helm/future/helm-opensearch-dashboards.yaml