From 1339358eb5b5a6253cdee24a07083d0119b4d6c9 Mon Sep 17 00:00:00 2001 From: Austin Bennett Date: Fri, 10 Nov 2023 17:11:52 -0500 Subject: [PATCH] Created Temp Code for k8s manifests + gh action to apply manifests --- .github/workflows/manual_terraform.yml | 26 ++++++++++++++++++------ cloud-infra/k8s/frontend-deployment.yaml | 21 +++++++++++++++++++ cloud-infra/k8s/frontend-service.yaml | 12 +++++++++++ cloud-infra/k8s/ml-deployment.yaml | 21 +++++++++++++++++++ 4 files changed, 74 insertions(+), 6 deletions(-) create mode 100644 cloud-infra/k8s/frontend-deployment.yaml create mode 100644 cloud-infra/k8s/frontend-service.yaml create mode 100644 cloud-infra/k8s/ml-deployment.yaml diff --git a/.github/workflows/manual_terraform.yml b/.github/workflows/manual_terraform.yml index f42b131..0c6aeeb 100644 --- a/.github/workflows/manual_terraform.yml +++ b/.github/workflows/manual_terraform.yml @@ -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 }} @@ -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 @@ -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 @@ -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/ diff --git a/cloud-infra/k8s/frontend-deployment.yaml b/cloud-infra/k8s/frontend-deployment.yaml new file mode 100644 index 0000000..b1c3cb8 --- /dev/null +++ b/cloud-infra/k8s/frontend-deployment.yaml @@ -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 diff --git a/cloud-infra/k8s/frontend-service.yaml b/cloud-infra/k8s/frontend-service.yaml new file mode 100644 index 0000000..c41f3d6 --- /dev/null +++ b/cloud-infra/k8s/frontend-service.yaml @@ -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 diff --git a/cloud-infra/k8s/ml-deployment.yaml b/cloud-infra/k8s/ml-deployment.yaml new file mode 100644 index 0000000..6d926df --- /dev/null +++ b/cloud-infra/k8s/ml-deployment.yaml @@ -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