From ef8fee41ecc577d0eb8d4a20ed1a19a11ad6c2ae Mon Sep 17 00:00:00 2001 From: Ziqi Wang Date: Wed, 14 Aug 2024 11:48:45 -0700 Subject: [PATCH] add new common env paasta_instance_type --- Makefile | 2 +- pkg/environment/environment.go | 8 ++++++++ pkg/environment/environment_test.go | 8 ++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dfb7dec..52900c1 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ UID:=$(shell id -u) GID:=$(shell id -g) GO_VERSION=1.12.7 -VERSION=0.0.20 +VERSION=0.0.21 GOBUILD=CGO_ENABLED=0 GO111MODULE=on go build -ldflags="\ -X github.com/Yelp/paasta-tools-go/pkg/version.Version=$(VERSION) \ diff --git a/pkg/environment/environment.go b/pkg/environment/environment.go index 6ca69d5..37986a6 100644 --- a/pkg/environment/environment.go +++ b/pkg/environment/environment.go @@ -30,6 +30,14 @@ func GetDefaultPaastaKubernetesEnvironment() []corev1.EnvVar { }, }, }, + { + Name: "PAASTA_INSTANCE_TYPE", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.labels['paasta.yelp.com/service']", + }, + }, + }, { Name: "PAASTA_CLUSTER", ValueFrom: &corev1.EnvVarSource{ diff --git a/pkg/environment/environment_test.go b/pkg/environment/environment_test.go index 0142a3a..19eaf94 100644 --- a/pkg/environment/environment_test.go +++ b/pkg/environment/environment_test.go @@ -34,6 +34,14 @@ func TestGetDefaultPaastaKubernetesEnvironment(test *testing.T) { }, }, }, + { + Name: "PAASTA_INSTANCE_TYPE", + ValueFrom: &corev1.EnvVarSource{ + FieldRef: &corev1.ObjectFieldSelector{ + FieldPath: "metadata.labels['paasta.yelp.com/service']", + }, + }, + }, { Name: "PAASTA_CLUSTER", ValueFrom: &corev1.EnvVarSource{