gcp

package module
v0.0.0-...-bc71568 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GCPInitTime time.Duration
)

Functions

func InitGCP

func InitGCP(ctx context.Context, kr *k8s.K8S) error

func MergeKubeConfig

func MergeKubeConfig(dst *kubeconfig.Config, src *kubeconfig.Config)

func ProjectNumber

func ProjectNumber(p string) string

func RegionFromMetadata

func RegionFromMetadata() (string, error)

func SaveKubeConfig

func SaveKubeConfig(kc *kubeconfig.Config, dir, file string) error

SaveKubeConfig saves the KUBECONFIG to ./var/run/.kube/config The assumption is that on a read-only image, /var/run will be writeable and not backed up.

func Token

func Token(ctx context.Context, aud string) (string, error)

func TokenGKE

func TokenGKE(ctx context.Context, aud string) (string, error)

Types

type Cluster

type Cluster struct {
	ClusterName     string
	ClusterLocation string
	ProjectId       string

	GKECluster *containerpb.Cluster
	HubCluster *gkehubpb.Membership

	KubeConfig *kubeconfig.Config
}

Cluster wraps cluster information for a discovered hub or gke cluster.

func AllClusters

func AllClusters(ctx context.Context, kr *k8s.K8S, defCluster string, label string, meshID string) ([]*Cluster, error)

func AllHub

func AllHub(ctx context.Context, kr *k8s.K8S) ([]*Cluster, error)

AllHub connects to GKE Hub and gets all clusters registered in the hub. TODO: document/validate GKE Connect auth mode

func GKECluster

func GKECluster(ctx context.Context, p, l, clusterName string) (*Cluster, error)

type JwtPayload

type JwtPayload struct {
	// Aud is the expected audience, defaults to istio-ca - but is based on istiod.yaml configuration.
	// If set to a different value - use the value defined by istiod.yaml. Env variable can
	// still override
	Aud []string `json:"aud"`

	// Exp is not currently used - we don't use the token for authn, just to determine k8s settings
	Exp int `json:"exp"`

	// Issuer - configured by K8S admin for projected tokens. Will be used to verify all tokens.
	Iss string `json:"iss"`

	Sub string `json:"sub"`
}

Jump to

Keyboard shortcuts

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