diff --git a/go.mod b/go.mod index 924b710..12a968d 100644 --- a/go.mod +++ b/go.mod @@ -20,12 +20,19 @@ require ( ) require ( - cel.dev/expr v0.24.0 // indirect + github.com/agext/levenshtein v1.2.1 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/mitchellh/go-wordwrap v1.0.1 // indirect + github.com/zclconf/go-cty v1.16.3 // indirect + golang.org/x/mod v0.27.0 // indirect +) + +require cel.dev/expr v0.24.0 // indirect + +require ( github.com/Masterminds/semver/v3 v3.4.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/agext/levenshtein v1.2.1 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect - github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect @@ -55,7 +62,6 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/mailru/easyjson v0.9.0 // indirect - github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect @@ -63,14 +69,13 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_golang v1.22.0 // indirect github.com/prometheus/client_model v0.6.2 // indirect - github.com/prometheus/common v0.63.0 // indirect + github.com/prometheus/common v0.64.0 // indirect github.com/prometheus/procfs v0.16.1 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/spf13/cobra v1.9.1 // indirect github.com/spf13/pflag v1.0.6 // indirect github.com/stoewer/go-strcase v1.3.0 // indirect github.com/x448/float16 v0.8.4 // indirect - github.com/zclconf/go-cty v1.16.3 // indirect go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect go.opentelemetry.io/otel v1.37.0 // indirect @@ -86,7 +91,6 @@ require ( go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.41.0 // indirect golang.org/x/exp v0.0.0-20250506013437-ce4c2cf36ca6 // indirect - golang.org/x/mod v0.27.0 // indirect golang.org/x/net v0.43.0 // indirect golang.org/x/oauth2 v0.30.0 // indirect golang.org/x/sync v0.16.0 // indirect diff --git a/go.sum b/go.sum index 165b4e8..2af2df6 100644 --- a/go.sum +++ b/go.sum @@ -132,8 +132,8 @@ github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/ github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= -github.com/prometheus/common v0.63.0 h1:YR/EIY1o3mEFP/kZCD7iDMnLPlGyuU2Gb3HIcXnA98k= -github.com/prometheus/common v0.63.0/go.mod h1:VVFF/fBIoToEnWRVkYoXEkq3R3paCoxG9PXP74SnV18= +github.com/prometheus/common v0.64.0 h1:pdZeA+g617P7oGv1CzdTzyeShxAGrTBsolKNOLQPGO4= +github.com/prometheus/common v0.64.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= diff --git a/internal/cloudprovider/token.go b/internal/cloudprovider/token.go new file mode 100644 index 0000000..768ab65 --- /dev/null +++ b/internal/cloudprovider/token.go @@ -0,0 +1 @@ +package cloudprovider diff --git a/internal/const/const.go b/internal/const/const.go index 6b35293..b8d9870 100644 --- a/internal/const/const.go +++ b/internal/const/const.go @@ -2,6 +2,8 @@ package constants // Pod annotations const ( + ProviderAnnotation = "spiffe.cofide.io/provider" + ProviderRoleAnnotation = "spiffe.cofide.io/role" InjectAnnotation = "spiffe.cofide.io/inject" DebugAnnotation = "spiffe.cofide.io/debug" EnvoyLogLevelAnnotation = "spiffe.cofide.io/envoy-log-level" diff --git a/internal/webhook/webhook.go b/internal/webhook/webhook.go index 1875d82..b9b415a 100644 --- a/internal/webhook/webhook.go +++ b/internal/webhook/webhook.go @@ -80,6 +80,8 @@ func (a *spiffeEnableWebhook) Handle(ctx context.Context, req admission.Request) constants.InjectAnnotationHelper: true, constants.InjectAnnotationProxy: true, constants.InjectCSIVolume: true, + constants.ProviderAnnotation: true, + constants.ProviderRoleAnnotation: true, } var invalidModes []string @@ -208,7 +210,16 @@ func (a *spiffeEnableWebhook) Handle(ctx context.Context, req admission.Request) logger.Info("Adding init container to inject spiffe-helper config", "initContainerName", helper.SPIFFEHelperInitContainerName) pod.Spec.InitContainers = append([]corev1.Container{spiffeHelper.GetInitContainer()}, pod.Spec.InitContainers...) } + + case constants.ProviderAnnotation: + // Ensure the CSI volume is injected and mounted to containers + ensureCSIVolumeAndMount(pod, logger) + + // Inject an AWS token sidecar container + logger.Info("Applying AWS token mode mutations") + } + } }