Documentation ¶
Index ¶
- Constants
- func BuildConfigFromClusterInfo(ctx context.Context, cluster *containerpb.Cluster, ts oauth2.TokenSource) (*rest.Config, error)
- func ClearIamPolicy(currentPolicy *cloudresourcemanager.Policy, deployName string, project string)
- func CreateKubeconfig(ctx context.Context, project string, loc string, cluster string, ...) (*clientcmdapi.Config, error)
- func CreateResourceFromFile(config *rest.Config, filename string) error
- func GetClusterInfo(ctx context.Context, project string, loc string, cluster string, ...) (*containerpb.Cluster, error)
- func GetIamPolicy(project string, gcpClient *http.Client) (*cloudresourcemanager.Policy, error)
- func PrettyPrint(value interface{}) string
- func ReadIamBindingsYAML(filename string) (*cloudresourcemanager.Policy, error)
- func RewriteIamPolicy(currentPolicy *cloudresourcemanager.Policy, ...)
- func SetIamPolicy(project string, policy *cloudresourcemanager.Policy, gcpClient *http.Client) error
- type Bindings
- type IamBindingsYAML
- type Members
- type Roles
Constants ¶
const RecommendedConfigPathEnvVar = "KUBECONFIG"
RecommendedConfigPathEnvVar is a environment variable for path configuration
Variables ¶
This section is empty.
Functions ¶
func BuildConfigFromClusterInfo ¶
func BuildConfigFromClusterInfo(ctx context.Context, cluster *containerpb.Cluster, ts oauth2.TokenSource) (*rest.Config, error)
BuildConfigFromClusterInfo returns k8s config using gcloud Application Default Credentials typically $HOME/.config/gcloud/application_default_credentials.json
func ClearIamPolicy ¶
Modify currentPolicy: Remove existing bindings associated with service accounts of current deployment
func CreateKubeconfig ¶
func CreateKubeconfig(ctx context.Context, project string, loc string, cluster string, namespace string, ts oauth2.TokenSource) (*clientcmdapi.Config, error)
Create a config that serves as kubeconfig.
func CreateResourceFromFile ¶
CreateResourceFromFile creates resources from a file, just like `kubectl create -f filename` We use some libraries in an old way (e.g. the RestMapper is in discovery instead of restmapper) because ksonnet (one of our dependency) is using the old library version. TODO: it can't handle "kind: list" yet.
func GetClusterInfo ¶
func GetClusterInfo(ctx context.Context, project string, loc string, cluster string, ts oauth2.TokenSource) (*containerpb.Cluster, error)
Use default token source and retrieve cluster information with given project/location/cluster information.
func GetIamPolicy ¶
Gets IAM plicy from GCP for the whole project.
func PrettyPrint ¶
func PrettyPrint(value interface{}) string
PrettyPrint returns a pretty format output of any value.
func ReadIamBindingsYAML ¶
Reads IAM bindings file in YAML format.
func RewriteIamPolicy ¶
func RewriteIamPolicy(currentPolicy *cloudresourcemanager.Policy, adding *cloudresourcemanager.Policy)
Either patch or remove role bindings from `src` policy.
Types ¶
type IamBindingsYAML ¶
type IamBindingsYAML struct {
Bindings []Bindings
}