serviceaccounts

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGKEAnnotationInvalid = fmt.Errorf("gke annotation %q has invalid google service account email", gkeAnnotation)

Functions

func GoogleEmail

func GoogleEmail(sa *corev1.ServiceAccount) (*string, error)

GoogleEmail returns the Google service account email from the same annotation used in native GCP Workload Identity Federation for GKE. The annotation is:

iam.gke.io/gcp-service-account

Types

type Provider

type Provider interface {
	Get(ctx context.Context, ref *Reference) (*corev1.ServiceAccount, error)
}

type Reference added in v0.7.0

type Reference struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}

func ReferenceFromNode added in v0.7.0

func ReferenceFromNode(node *corev1.Node, defaultRef *Reference) *Reference

ReferenceFromNode returns a ServiceAccount reference from the Node object annotations or labels. Annotations take precedence over labels because we encourage users to use annotations instead of labels in this case since. Labels are more impactful to etcd since they are indexed, and we don't need indexing here so we prefer annotations.

The ServiceAccount reference is retrieved from the following pair of annotations or labels:

gke-metadata-server.matheuscscp.io/serviceAccountName

gke-metadata-server.matheuscscp.io/serviceAccountNamespace

If the annotations or labels are not found, defaultRef is returned.

func ReferenceFromObject added in v0.7.0

func ReferenceFromObject(sa *corev1.ServiceAccount) *Reference

ReferenceFromObject returns a ServiceAccount reference from a ServiceAccount object.

func ReferenceFromPod added in v0.7.0

func ReferenceFromPod(pod *corev1.Pod) *Reference

ReferenceFromPod returns a ServiceAccount reference from a Pod object.

func ReferenceFromToken added in v0.8.2

func ReferenceFromToken(token string) *Reference

ReferenceFromToken returns a ServiceAccount reference from a ServiceAccount Token.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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