From 912dd60f43abdda672ffa97fe908c314f78e8f24 Mon Sep 17 00:00:00 2001 From: bread <75878656+broadeditz@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:47:57 +0100 Subject: [PATCH] revert deployment to amd64 architecture --- Makefile | 2 +- docker/partial.Dockerfile | 2 +- terraform/deployment.tf | 41 +++++++++++++++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 82e245ed..6a6c0210 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ else endif build: - GOOS=linux GOARCH=arm64 go build -v -ldflags "-X 'main.Version=${VERSION}' -X 'main.Unix=$(shell date +%s)' -X 'main.User=${BUILDER}'" -o out/eventapi cmd/*.go + GOOS=linux GOARCH=amd64 go build -v -ldflags "-X 'main.Version=${VERSION}' -X 'main.Unix=$(shell date +%s)' -X 'main.User=${BUILDER}'" -o out/eventapi cmd/*.go lint: go vet ./... diff --git a/docker/partial.Dockerfile b/docker/partial.Dockerfile index c899ed4f..f4405353 100644 --- a/docker/partial.Dockerfile +++ b/docker/partial.Dockerfile @@ -1,6 +1,6 @@ ARG BASE_IMG=ubuntu:22.04 -FROM --platform=linux/arm64 $BASE_IMG +FROM $BASE_IMG WORKDIR /app RUN apt-get update && \ diff --git a/terraform/deployment.tf b/terraform/deployment.tf index 691463f7..beb17bea 100644 --- a/terraform/deployment.tf +++ b/terraform/deployment.tf @@ -65,14 +65,47 @@ resource "kubernetes_deployment" "app" { } spec { - node_selector = { - "7tv.io/node-pool" = "arm" + // set node affinity preference, prefer medium nodes, then small or traffic nodes as fallback + affinity { + node_affinity { + preferred_during_scheduling_ignored_during_execution { + weight = 50 + preference { + match_expressions { + key = "7tv.io/node-pool" + operator = "In" + values = ["medium"] + } + } + }, + preferred_during_scheduling_ignored_during_execution { + weight = 1 + preference { + match_expressions { + key = "7tv.io/node-pool" + operator = "In" + values = ["small"] + } + } + }, + preferred_during_scheduling_ignored_during_execution{ + weight = 1 + preference { + match_expressions { + key = "7tv.io/node-pool" + operator = "In" + values = ["traffic"] + } + } + } + } } + // tolerate traffic nodes since, but don't prefer them toleration { key = "7tv.io/node-pool" operator = "Equal" - value = "arm" + value = "traffic" effect = "NoSchedule" } @@ -129,7 +162,7 @@ resource "kubernetes_deployment" "app" { memory = local.infra.production ? "1.5Gi" : "500Mi" } limits = { - cpu = local.infra.production ? "500m" : "150m" + cpu = local.infra.production ? "1" : "150m" memory = local.infra.production ? "3Gi" : "500Mi" } }