cluster

package
v0.0.0-...-7aafccc Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServiceAccountFmt = `%s@%s.iam.gserviceaccount.com`
	StorageBucketFmt  = `gs://%s`
)

Variables

This section is empty.

Functions

func BindServiceAccToBucket

func BindServiceAccToBucket(serviceAccount, bucket, permission string) error

func BindServiceAccountToRole

func BindServiceAccountToRole(gcloudProject, serviceAccount, role string) error

func CreateServiceAccount

func CreateServiceAccount(name string) error

func GenerateServiceAccountKey

func GenerateServiceAccountKey(serviceAccount, path string) error

func RunCommand

func RunCommand(ctx context.Context, name, rootCmd string, args ...string) (output string, err error)

Types

type App

type App struct {
	Deprecated bool   `yaml:"deprecated"`
	Path       string `yaml:"path"`
	Name       string `yaml:"name"`
}

type Cluster

type Cluster struct {
	Name              string         `json:"cluster_name" survey:"clusterName"`
	GcloudProjectName string         `json:"project_name" survey:"project"`
	Account           string         `json:"account"`
	Region            string         `json:"region"`
	Zone              string         `json:"zone"`
	DNSName           string         `json:"dns_name" survey:"dnsName"`
	Storage           Storage        `json:"storage"`
	ServiceAccount    ServiceAccount `json:"service_account"`
	KubeAppConfig     *KubeApp       `json:"kubeapp"`
	KubeAppMap        map[string]App `json:"-"`
	ConfPath          string         `json:"config_path"`
}

func Get

func Get(name string) (Cluster, error)

func (*Cluster) ConfigKubernetes

func (c *Cluster) ConfigKubernetes() error

func (Cluster) CreateFakeSecret

func (c Cluster) CreateFakeSecret() error

func (Cluster) GenerateConfig

func (c Cluster) GenerateConfig() error

func (*Cluster) GetServiceAccountOpts

func (c *Cluster) GetServiceAccountOpts() ServiceAccount

func (*Cluster) GetStorageOpts

func (c *Cluster) GetStorageOpts() Storage

func (*Cluster) InitGCloudCmdSet

func (c *Cluster) InitGCloudCmdSet() (*CmdSet, error)

func (*Cluster) InitKubeCmdSet

func (c *Cluster) InitKubeCmdSet() (*CmdSet, error)

type CmdSet

type CmdSet struct {
	Name   string
	CmdMap map[string]Command
	Cmds   []Command
	C      *Cluster
}

func NewCmdSet

func NewCmdSet(cc *Cluster, name string) *CmdSet

func (*CmdSet) AddCmd

func (cs *CmdSet) AddCmd(cmd Command) error

func (*CmdSet) GetCommand

func (cs *CmdSet) GetCommand(cmdName string) (Command, error)

type Command

type Command struct {
	Name         string
	RootCmd      string
	Args         []string
	Stderr       error
	Stdout       string
	Internal     bool
	InterActive  bool
	Succeed      bool
	GenerateArgs func(*Cluster) []string
	AfterFn      func(*Command) error
}

func (*Command) Execute

func (c *Command) Execute(ctx context.Context, cc *Cluster)

type DNSRecords

type DNSRecords []struct {
	Kind    string   `json:"kind"`
	Name    string   `json:"name"`
	Rrdatas []string `json:"rrdatas"`
	TTL     int      `json:"ttl"`
	Type    string   `json:"type"`
}

type GcloudAccount

type GcloudAccount struct {
	Compute struct {
		Region string `json:"region"`
		Zone   string `json:"zone"`
	} `json:"compute"`
	Core struct {
		Account               string `json:"account"`
		DisableUsageReporting string `json:"disable_usage_reporting"`
		Project               string `json:"project"`
	} `json:"core"`
}

type KubeApp

type KubeApp struct {
	APIVersion string   `yaml:"apiVersion"`
	Kind       string   `yaml:"kind"`
	Metadata   Metadata `yaml:"metadata"`
	Apps       []App    `yaml:"apps"`
}

type Metadata

type Metadata struct {
	Name    string `yaml:"name"`
	Version string `yaml:"version"`
}

type ProjectList

type ProjectList []struct {
	CreateTime     time.Time `json:"createTime"`
	LifecycleState string    `json:"lifecycleState"`
	Name           string    `json:"name"`
	ProjectID      string    `json:"projectId"`
	ProjectNumber  string    `json:"projectNumber"`
}

type ServiceAccount

type ServiceAccount struct {
	CloudBuildName string `json:"cloudbuild_serviceaccount_name"`
	CloudBuild     string `json:"cloudbuild_serviceaccount"`
	StorageName    string `json:"storage_serviceaccount_name"`
	Storage        string `json:"storage_serviceaccount"`
	DNSName        string `json:"clouddns_serviceaccount_name"`
	DNS            string `json:"clouddns_serviceaccount"`
}

type Storage

type Storage struct {
	CloudBuildBucket string `json:"cloudbuild_bucket_name"`
	SourceCodeBucket string `json:"sourcecode_bucket_name"`
}

Jump to

Keyboard shortcuts

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