Help us shape the future of Go! Take the 2026 Go Developer Survey

webhook

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnnotationServiceAccountEmail is the ServiceAccount annotation that holds the email of the STACKIT service account to impersonate.
	AnnotationServiceAccountEmail = "workload-identity.stackit.cloud/service-account-email"
	// AnnotationAudience is the ServiceAccount annotation that sets the audience of the projected service account token.
	AnnotationAudience = "workload-identity.stackit.cloud/audience"
	// AnnotationServiceAccountTokenExpiration is the ServiceAccount annotation that sets the lifetime of the projected service account token in seconds.
	AnnotationServiceAccountTokenExpiration = "workload-identity.stackit.cloud/service-account-token-expiration-seconds"
	// AnnotationIDPTokenExpiration is the ServiceAccount annotation that sets the lifetime of the token issued by the identity provider in seconds.
	AnnotationIDPTokenExpiration = "workload-identity.stackit.cloud/idp-token-expiration-seconds"
	// AnnotationIDPTokenEndpoint is the ServiceAccount annotation that overrides the identity provider's token endpoint.
	AnnotationIDPTokenEndpoint = "workload-identity.stackit.cloud/idp-token-endpoint"
	// AnnotationFederatedTokenFile is the ServiceAccount annotation that overrides the path of the federated token file inside the container.
	AnnotationFederatedTokenFile = "workload-identity.stackit.cloud/federated-token-file"

	// AnnotationSkipWebhook is the Pod annotation that, when set, makes the webhook skip mutating the Pod.
	AnnotationSkipWebhook = "workload-identity.stackit.cloud/skip-pod-identity-webhook"
)

Annotations

View Source
const (
	// DefaultAudience is the audience used when AnnotationAudience is not set.
	DefaultAudience = "sts.accounts.stackit.cloud"
	// DefaultServiceAccountTokenExpiration is the token lifetime in seconds used when AnnotationServiceAccountTokenExpiration is not set.
	DefaultServiceAccountTokenExpiration = "600"
	// DefaultVolumeName is the name of the projected volume that holds the service account token.
	DefaultVolumeName = "stackit-workload-identity"
	// DefaultMountPath is the directory where the token volume is mounted in the container.
	DefaultMountPath = "/var/run/secrets/stackit.cloud/serviceaccount"
	// DefaultTokenPath is the file name of the token within DefaultMountPath.
	DefaultTokenPath = "token"
)

Defaults

View Source
const (
	// EnvFederatedTokenFile is the environment variable that holds the path of the federated token file.
	EnvFederatedTokenFile = "STACKIT_FEDERATED_TOKEN_FILE"
	// EnvServiceAccountEmail is the environment variable that holds the email of the STACKIT service account.
	EnvServiceAccountEmail = "STACKIT_SERVICE_ACCOUNT_EMAIL"
	// EnvIDPTokenEndpoint is the environment variable that holds the identity provider's token endpoint.
	EnvIDPTokenEndpoint = "STACKIT_IDP_TOKEN_ENDPOINT"
	// EnvIDPTokenExpirationSeconds is the environment variable that holds the lifetime of the identity provider token in seconds.
	EnvIDPTokenExpirationSeconds = "STACKIT_IDP_TOKEN_EXPIRATION_SECONDS"
)

Environment variable names

Variables

This section is empty.

Functions

This section is empty.

Types

type PodMutator

type PodMutator struct {
	Client    client.Reader
	APIReader client.Reader
}

PodMutator mutates Pods

func (*PodMutator) Default

func (m *PodMutator) Default(ctx context.Context, pod *corev1.Pod) error

Default implements admission.Defaulter so a webhook will be registered for the type

func (*PodMutator) HandleMutatePod

func (m *PodMutator) HandleMutatePod(pod *corev1.Pod, sa *corev1.ServiceAccount) error

HandleMutatePod applies the mutation logic to the pod spec

func (*PodMutator) SetupWithManager

func (m *PodMutator) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the webhook with the Manager.

type ValidatedAnnotations

type ValidatedAnnotations struct {
	ServiceAccountEmail           string
	Audience                      string
	ServiceAccountTokenExpiration int64
	IDPTokenExpiration            string
	IDPTokenEndpoint              string
	FederatedTokenFile            string
}

ValidatedAnnotations holds the parsed and validated values from the ServiceAccount annotations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL