Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions pkg/clouds/pulumi/api/tagging.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

// Tag keys for consistent resource identification across clouds
const (
// AWS tags - can contain dots
// StackTag identifies the stack name
StackTag = "simple-container.com/stack"

Expand All @@ -19,6 +20,19 @@ const (

// ClientStackTag identifies the client stack for nested stacks
ClientStackTag = "simple-container.com/client-stack"

// GCP labels - cannot contain dots, using hyphens instead
// GCPStackTag identifies the stack name
GCPStackTag = "simple-container-com/stack"

// GCPEnvironmentTag identifies the environment (e.g., production, staging)
GCPEnvironmentTag = "simple-container-com/env"

// GCPParentStackTag identifies the parent stack for nested stacks
GCPParentStackTag = "simple-container-com/parent-stack"

// GCPClientStackTag identifies the client stack for nested stacks
GCPClientStackTag = "simple-container-com/client-stack"
)

// Tags represents a set of tags/labels that can be applied to cloud resources
Expand Down Expand Up @@ -50,16 +64,16 @@ func (t *Tags) ToAWSTags() sdk.StringMap {
// ToGCPLabels converts Tags to GCP label format
func (t *Tags) ToGCPLabels() map[string]string {
labels := map[string]string{
StackTag: t.StackName,
EnvironmentTag: t.Environment,
GCPStackTag: t.StackName,
GCPEnvironmentTag: t.Environment,
}

if t.ParentStack != nil && *t.ParentStack != "" {
labels[ParentStackTag] = *t.ParentStack
labels[GCPParentStackTag] = *t.ParentStack
}

if t.ClientStack != nil && *t.ClientStack != "" {
labels[ClientStackTag] = *t.ClientStack
labels[GCPClientStackTag] = *t.ClientStack
}

return labels
Expand Down
17 changes: 9 additions & 8 deletions pkg/clouds/pulumi/kubernetes/simple_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ const (
AnnotationPort = "simple-container.com/port"
AnnotationEnv = "simple-container.com/env"

// Standard Kubernetes labels following simple-container.com convention
LabelAppType = "simple-container.com/app-type"
LabelAppName = "simple-container.com/app-name"
LabelScEnv = "simple-container.com/env"
LabelParentEnv = "simple-container.com/parent-env"
LabelParentStack = "simple-container.com/parent-stack"
LabelClientStack = "simple-container.com/client-stack"
LabelCustomStack = "simple-container.com/custom-stack"
// Standard Kubernetes labels - using hyphens instead of dots for GCP compatibility
// Kubernetes allows dots in label prefixes, but GCP labels do not
LabelAppType = "simple-container-com/app-type"
LabelAppName = "simple-container-com/app-name"
LabelScEnv = "simple-container-com/env"
LabelParentEnv = "simple-container-com/parent-env"
LabelParentStack = "simple-container-com/parent-stack"
LabelClientStack = "simple-container-com/client-stack"
LabelCustomStack = "simple-container-com/custom-stack"
)

// sanitizeK8sResourceName converts a name to be RFC 1123 compliant for Kubernetes resources
Expand Down