Skip to content

Commit

Permalink
Created Temp Code for k8s manifests + gh action to apply manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
ausbennett committed Nov 10, 2023
1 parent d22e43b commit 1339358
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 6 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/manual_terraform.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: 'Manual Terraform Deployment'
name: "Manual Terraform Deployment"

on:
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
description: "Target environment"
required: true
default: 'dev'
default: "dev"

jobs:
terraform:
name: 'Deploy to Environment'
name: "Deploy to Environment"
runs-on: ubuntu-latest
environment:
name: ${{ github.event.inputs.environment }}
Expand All @@ -27,7 +27,7 @@ jobs:

- name: Install Terraform
uses: hashicorp/setup-terraform@v1

- name: Decode GCP Credentials
run: |
echo '${{ secrets.GCP_SA_KEY_BASE64 }}' | base64 -d > ${{ github.workspace }}/cloud-infra/automateml-3f20c67d2a0a.json
Expand All @@ -40,7 +40,6 @@ jobs:
terraform init
terraform plan -out=tfplan
- name: Hold for approval
if: github.event_name == 'workflow_dispatch'
uses: softprops/turnstyle@v1
Expand All @@ -55,3 +54,18 @@ jobs:
if: github.event_name == 'workflow_dispatch'
run: |
terraform apply tfplan
# - name: Set up Google Cloud
# uses: google-github-actions/setup-gcloud@master
# with:
# service_account_key: ${{ secrets.GCP_SA_KEY }}
# export_default_credentials: true

# - name: Get GKE credentials
# run: |
# gcloud container clusters get-credentials automl-cluster --region us-east1 --project automateml

# # Now you can use kubectl to interact with your GKE cluster
# - name: Deploy to GKE
# run: |
# kubectl apply -f cloud-infra/k8s/
21 changes: 21 additions & 0 deletions cloud-infra/k8s/frontend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend-deployment
labels:
app: frontend
spec:
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: your-frontend-image:latest
ports:
- containerPort: 80
12 changes: 12 additions & 0 deletions cloud-infra/k8s/frontend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: frontend-service
spec:
selector:
app: frontend
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
21 changes: 21 additions & 0 deletions cloud-infra/k8s/ml-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ml-deployment
labels:
app: ml
spec:
replicas: 1
selector:
matchLabels:
app: ml
template:
metadata:
labels:
app: ml
spec:
containers:
- name: ml
image: your-ml-image:latest
ports:
- containerPort: 5000

0 comments on commit 1339358

Please sign in to comment.