-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (62 loc) · 2.23 KB
/
deploy.yml
File metadata and controls
68 lines (62 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Kubernetes Deployment
on:
workflow_dispatch:
workflow_call:
inputs:
cluster_name:
description: 'EKS Cluster Name'
required: true
type: string
app_namespace:
description: 'Kubernetes Namespace for the Application'
required: true
type: string
monitoring_namespace:
description: 'Kubernetes Namespace for Monitoring'
required: true
type: string
argocd_namespace:
description: 'Kubernetes Namespace for ArgoCD'
required: true
type: string
app_name:
description: 'Name of the Application'
required: true
type: string
image_tag:
description: 'Docker image tag to deploy'
required: false
default: ''
type: string
jobs:
deploy:
name: Deploy to Kubernetes
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Configure AWS credentials via OIDC
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GitHubActionsInfraRole
aws-region: us-east-1
- name: Update kubeconfig
run: |
aws eks update-kubeconfig --name ${{ inputs.cluster_name }} --region us-east-1
- name: Create Application Namespace
run: |
kubectl create namespace ${{ inputs.app_namespace }} --dry-run=client -o yaml | kubectl apply -f -
- name: Deploy ArgoCD Applications
run: |
export APP_NAME=${{ inputs.app_name }}
export APP_NAMESPACE=${{ inputs.app_namespace }}
export ARGOCD_NAMESPACE=${{ inputs.argocd_namespace }}
envsubst < ./argocd/application.yml | kubectl apply -f -
- name: Apply Secrets
run: |
kubectl create secret generic mongo-secrets \
--from-literal=MONGO_URI="${{ secrets.MONGO_URI }}" \
--from-literal=MONGO_USERNAME="${{ secrets.MONGO_USERNAME }}" \
--from-literal=MONGO_PASSWORD="${{ secrets.MONGO_PASSWORD }}" \
-n ${{ inputs.app_namespace }} --dry-run=client -o yaml | kubectl apply -f -