gke

package
v1.3.970 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2019 License: Apache-2.0 Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const KmsLocation = "global"

KmsLocation indicates the location used by the Google KMS service

Variables

View Source
var (
	// RequiredServiceAccountRoles the roles required to create a cluster with terraform
	RequiredServiceAccountRoles = []string{"roles/compute.instanceAdmin.v1",
		"roles/iam.serviceAccountActor",
		"roles/container.clusterAdmin",
		"roles/container.admin",
		"roles/container.developer",
		"roles/storage.objectAdmin",
		"roles/editor"}

	// KanikoServiceAccountRoles the roles required to run kaniko with GCS
	KanikoServiceAccountRoles = []string{"roles/storage.admin",
		"roles/storage.objectAdmin",
		"roles/storage.objectCreator"}
)
View Source
var PROJECT_LIST_HEADER = "PROJECT_ID"

Functions

func BucketExists

func BucketExists(projectID string, bucketName string) (bool, error)

BucketExists checks if a Google Storage bucket exists

func CheckPermission

func CheckPermission(perm string, projectID string) (bool, error)

CheckPermission checks permission on the given project

func CleanupServiceAccountKeys

func CleanupServiceAccountKeys(serviceAccount string, projectID string) error

CleanupServiceAccountKeys remove all keys from given service account

func ClusterZone

func ClusterZone(cluster string) (string, error)

ClusterZone retrives the zone of GKE cluster description

func CreateBucket

func CreateBucket(projectID string, bucketName string, location string) error

CreateBucket creates a new Google Storage bucket

func CreateKmsKey

func CreateKmsKey(keyName string, keyringName string, projectID string) error

CreateKmsKey creates a new KMS key in the given keyring

func CreateKmsKeyring

func CreateKmsKeyring(keyringName string, projectID string) error

CreateKmsKeyring creates a new KMS keyring

func CreateServiceAccountKey

func CreateServiceAccountKey(serviceAccount string, projectID string, keyPath string) error

CreateServiceAccountKey creates a new service account key and downloads into the given file

func DeleteAllObjectsInBucket

func DeleteAllObjectsInBucket(bucketName string) error

DeleteAllObjectsInBucket deletes all objects in a Google Storage bucket

func DeleteBucket

func DeleteBucket(bucketName string) error

DeleteBucket deletes a Google storage bucket

func DeleteServiceAccount

func DeleteServiceAccount(serviceAccount string, projectID string, roles []string) error

DeleteServiceAccount deletes a service account and its role bindings

func DeleteServiceAccountKey

func DeleteServiceAccountKey(serviceAccount string, projectID string, key string) error

DeleteServiceAccountKey deletes a service account key

func EnableAPIs

func EnableAPIs(projectID string, apis ...string) error

EnableAPIs enables APIs for the given services

func FindBucket

func FindBucket(bucketName string) bool

FindBucket finds a Google Storage bucket

func FindServiceAccount

func FindServiceAccount(serviceAccount string, projectID string) bool

FindServiceAccount checks if a service account exists

func GetCurrentProject

func GetCurrentProject() (string, error)

func GetEnabledApis

func GetEnabledApis(projectID string) ([]string, error)

GetEnabledApis returns which services have the API enabled

func GetGoogleMachineTypes

func GetGoogleMachineTypes() []string

func GetGoogleProjects

func GetGoogleProjects() ([]string, error)

func GetGoogleZones

func GetGoogleZones(project string) ([]string, error)

func GetOrCreateServiceAccount

func GetOrCreateServiceAccount(serviceAccount string, projectID string, clusterConfigDir string, roles []string) (string, error)

GetOrCreateServiceAccount retrieves or creates a GCP service account. It will return the path to the file where the service account token is stored

func GetRegionFromZone

func GetRegionFromZone(zone string) string

GetRegionFromZone parses the region from a GCP zone name

func GetServiceAccountKeys

func GetServiceAccountKeys(serviceAccount string, projectID string) ([]string, error)

GetServiceAccountKeys returns all keys of a service account

func IsKmsKeyAvailable

func IsKmsKeyAvailable(keyName string, keyringName string, projectID string) bool

IsKmsKeyAvailable checks if the KMS key is already available

func IsKmsKeyringAvailable

func IsKmsKeyringAvailable(keyringName string, projectID string) bool

IsKmsKeyringAvailable checks if the KMS keyring is already available

func Login

func Login(serviceAccountKeyPath string, skipLogin bool) error

Login login an user into Google account. It skips the interactive login using the browser when the skipLogin flag is active

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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