Documentation ¶
Index ¶
- Variables
- func ApplyTextTemplate(source io.Reader, config Config) (io.Reader, error)
- func CreateOrGetTFBackendBucket(ctx context.Context, client *storage.Client) (string, error)
- func GetGKECredentials(out io.Writer, clusterName string, clusterZone string) error
- func GetProjectBillingAccount(ctx context.Context) (string, error)
- func GetProjectID(ctx context.Context) (string, error)
- func IsGrpcNotFound(e error) bool
- func IsValidK8sMetadataName(text string) bool
- func ReadFromStringOrPath(strOrPath string) ([]byte, error)
- type ClusterConfig
- type Config
- type GateConfig
- type NetworkConfig
- type SecretHandle
- type TFDocument
- type TFObject
- type TFTerraform
- type TFTerraformBackend
- type TFVariable
Constants ¶
This section is empty.
Variables ¶
var SubdomainRegexp = regexp.MustCompile(`[A-Za-z](?:[A-Za-z0-9\-]*[A-Za-z0-9])?`)
SubdomainRegexp is regular expression for dns subdomain name; used for k8s resource name. cf. https://tools.ietf.org/html/rfc1035
Functions ¶
func ApplyTextTemplate ¶
ApplyTextTemplate applies template to source Reader with Config as data. Then returns Reader which reads result text.
func CreateOrGetTFBackendBucket ¶
CreateOrGetTFBackendBucket generates Cloud Storage bucket name for terraform backend and create new bucket with that name if it does not exists.
func GetGKECredentials ¶
GetGKECredentials calls `gcloud containers clusters get-credentials`
func GetProjectBillingAccount ¶
GetProjectBillingAccount returns name of billing account for the project.
func GetProjectID ¶
GetProjectID detects GCP project ID from instance metadata (for GCE, GCF, GAE, ...) or gcloud CLI.
func IsGrpcNotFound ¶
IsGrpcNotFound returns true if the error is representing gRPC not found status code. false if not.
func IsValidK8sMetadataName ¶
IsValidK8sMetadataName validates that text is valid subdomain name which can be used as Kubernates resource name.
func ReadFromStringOrPath ¶
ReadFromStringOrPath parses strOrPath and read payload, then return as sequence of bytes. If single hyphen is given, read remaining contents from stdin. If absolute path is given, read all contents from the file. Otherwise, just returns byte representation of the given string.
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { Name string `json:"name"` Location string `json:"location"` VPCConnectorName string `json:"vpc_connector_name"` }
ClusterConfig is schema of cluster block in config.yaml
type Config ¶
type Config struct { Region string `json:"region"` Zone string `json:"zone"` Cluster ClusterConfig `json:"cluster"` Network NetworkConfig `json:"network"` Gate GateConfig `json:"gate"` }
Config is schema of config.yaml
type GateConfig ¶
type GateConfig struct {
ServiceID string `json:"service_id"`
}
GateConfig is schema of gate block in config.yaml
type NetworkConfig ¶
type NetworkConfig struct { PrimaryCidrRange string `json:"primary_cidr_range"` PodCidrRange string `json:"pod_cidr_range"` ServiceCidrRange string `json:"service_cidr_range"` MasterCidrRange string `json:"master_cidr_range"` VPCConnectorCidrRange string `json:"vpc_connector_cidr_range"` IngressIPResourceID string `json:"ingress_ip_resource_id"` }
NetworkConfig is schema of network block in config.yaml
type SecretHandle ¶
SecretHandle hols information that points to the secret data which managed by cloud secret manager.
func NewSecretHandles ¶
func NewSecretHandles(secret corev1.Secret) []SecretHandle
NewSecretHandles builds SecretHandles from k8s Secret.
func (SecretHandle) Exists ¶
func (handle SecretHandle) Exists(ctx context.Context) (bool, error)
Exists tests precense of the secret pointed by the SecretHandle.
func (SecretHandle) Set ¶
func (handle SecretHandle) Set(ctx context.Context, payload []byte) error
Set stores payload to cloud for the secret pointed by the SecretHandle.
func (SecretHandle) String ¶
func (handle SecretHandle) String() string
type TFDocument ¶
type TFDocument struct { Terraform TFTerraform `json:"terraform"` Variable map[string]TFVariable `json:"variable"` }
TFDocument corresponds to terraform source file we are going to generate
type TFTerraform ¶
type TFTerraform struct {
Backend TFTerraformBackend `json:"backend"`
}
TFTerraform is "terraform" block in terraform source file.
type TFTerraformBackend ¶
type TFTerraformBackend struct {
GCS TFObject `json:"gcs"`
}
TFTerraformBackend is backend configuration using GCS.
type TFVariable ¶
type TFVariable struct {
Default interface{} `json:"default"`
}
TFVariable is "variable" block in terraform source file.