gcp

package
v0.1.58 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Copyright (C) 2021-2023, Kubefirst

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

This program is licensed under MIT. See the LICENSE file for more details.

Index

Constants

View Source
const (
	CloudProvider          = "gcp"
	GithubHost             = "github.com"
	GitlabHost             = "gitlab.com"
	KubectlClientVersion   = "v1.25.7"
	LocalhostOS            = runtime.GOOS
	LocalhostArch          = runtime.GOARCH
	TerraformClientVersion = "1.3.8"
	ArgocdHelmChartVersion = "4.10.5"

	ArgocdPortForwardURL = pkg.ArgocdPortForwardURL
	VaultPortForwardURL  = pkg.VaultPortForwardURL
)

Variables

This section is empty.

Functions

func AdjustGitopsRepo

func AdjustGitopsRepo(
	cloudProvider string,
	clusterName string,
	clusterType string,
	gitopsRepoDir string,
	gitProvider string,
	k1Dir string,
	apexContentExists bool,
) error

func AdjustMetaphorRepo

func AdjustMetaphorRepo(destinationMetaphorRepoGitURL, gitopsRepoDir, gitProvider, k1Dir string) error

func BootstrapGCPMgmtCluster added in v0.1.50

func BootstrapGCPMgmtCluster(clientset *kubernetes.Clientset, gitProvider string, gitUser string) error

func DetokenizeGitGitops

func DetokenizeGitGitops(path string, tokens *GitOpsDirectoryValues) error

detokenizeDirectoryRecursively - Translate tokens by values on a given path

func DetokenizeGitMetaphor

func DetokenizeGitMetaphor(path string, tokens *MetaphorTokenValues) error

detokenizeGithubMetaphor - Translate tokens by values on a given path

func DownloadTools

func DownloadTools(
	kubectlClientPath string,
	kubectlClientVersion string,
	localOs string,
	localArchitecture string,
	terraformClientVersion string,
	toolsDirPath string,
) error

func GetDomainApexContent added in v0.1.50

func GetDomainApexContent(domainName string) bool

GetDomainApexContent determines whether or not a target domain features a host responding at zone apex

func GetGCPTerraformEnvs

func GetGCPTerraformEnvs(config *GCPConfig, envs map[string]string) map[string]string

func GetGithubTerraformEnvs

func GetGithubTerraformEnvs(config *GCPConfig, envs map[string]string) map[string]string

func GetGitlabTerraformEnvs

func GetGitlabTerraformEnvs(config *GCPConfig, envs map[string]string, gid int) map[string]string

func GetUsersTerraformEnvs

func GetUsersTerraformEnvs(clientset *kubernetes.Clientset, config *GCPConfig, envs map[string]string) map[string]string

func GetVaultTerraformEnvs

func GetVaultTerraformEnvs(clientset *kubernetes.Clientset, config *GCPConfig, envs map[string]string) map[string]string

func PrepareGitRepositories

func PrepareGitRepositories(
	gitProvider string,
	clusterName string,
	clusterType string,
	destinationGitopsRepoGitURL string,
	gitopsDir string,
	gitopsTemplateBranch string,
	gitopsTemplateURL string,
	destinationMetaphorRepoGitURL string,
	k1Dir string,
	gitopsTokens *GitOpsDirectoryValues,
	metaphorDir string,
	metaphorTokens *MetaphorTokenValues,
	apexContentExists bool,
) error

Types

type GCPConfig

type GCPConfig struct {
	GCPAuth     string
	GCPProject  string
	GithubToken string
	GitlabToken string

	ArgoWorkflowsDir                string
	DestinationGitopsRepoHttpsURL   string
	DestinationGitopsRepoGitURL     string
	DestinationMetaphorRepoHttpsURL string
	DestinationMetaphorRepoGitURL   string
	GitopsDir                       string
	GitProvider                     string
	K1Dir                           string
	Kubeconfig                      string
	KubectlClient                   string
	KubefirstBotSSHPrivateKey       string
	KubefirstConfig                 string
	LogsDir                         string
	MetaphorDir                     string
	RegistryAppName                 string
	RegistryYaml                    string
	SSLBackupDir                    string
	TerraformClient                 string
	ToolsDir                        string
}

func GetConfig

func GetConfig(clusterName string, domainName string, gitProvider string, gitOwner string) *GCPConfig

GetConfig - load default values from kubefirst installer

type GCPConfiguration

type GCPConfiguration struct {
	Context context.Context
	Project string
	Region  string
}

GCPConfiguration stores session data to organize all GCP functions into a single struct

func (*GCPConfiguration) CreateBucket

func (conf *GCPConfiguration) CreateBucket(bucketName string) (*storage.BucketAttrs, error)

CreateBucket creates a GCS bucket

func (*GCPConfiguration) DeleteBucket

func (conf *GCPConfiguration) DeleteBucket(bucketName string) error

DeleteBucket deletes a GCS bucket

func (*GCPConfiguration) GetContainerCluster

func (conf *GCPConfiguration) GetContainerCluster(clusterName string) (*containerpb.Cluster, error)

GetContainerCluster

func (*GCPConfiguration) GetContainerClusterAuth

func (conf *GCPConfiguration) GetContainerClusterAuth(clusterName string) (*k8s.KubernetesClient, error)

GetContainerClusterAuth

func (*GCPConfiguration) GetRegions

func (conf *GCPConfiguration) GetRegions() ([]string, error)

GetRegions lists all available regions

func (*GCPConfiguration) ListBuckets

func (conf *GCPConfiguration) ListBuckets() ([]*storage.BucketAttrs, error)

ListBuckets lists all GCS buckets for a project

func (*GCPConfiguration) ListContainerClusters

func (conf *GCPConfiguration) ListContainerClusters() (*containerpb.ListClustersResponse, error)

ListContainerClusters

func (*GCPConfiguration) TestHostedZoneLiveness

func (conf *GCPConfiguration) TestHostedZoneLiveness(hostedZoneName string) bool

TestHostedZoneLiveness checks DNS for the liveness test record

type GitOpsDirectoryValues

type GitOpsDirectoryValues struct {
	AlertsEmail               string
	AtlantisAllowList         string
	CloudProvider             string
	CloudRegion               string
	ClusterId                 string
	ClusterName               string
	ClusterType               string
	DomainName                string
	KubeconfigPath            string
	KubefirstArtifactsBucket  string
	KubefirstStateStoreBucket string
	KubefirstTeam             string
	KubefirstVersion          string
	StateStoreBucketHostname  string

	ArgoCDIngressURL               string
	ArgoCDIngressNoHTTPSURL        string
	ArgoWorkflowsIngressURL        string
	ArgoWorkflowsIngressNoHTTPSURL string
	ArgoWorkflowsDir               string
	AtlantisIngressURL             string
	AtlantisIngressNoHTTPSURL      string
	ChartMuseumIngressURL          string
	VaultIngressURL                string
	VaultIngressNoHTTPSURL         string
	VaultDataBucketName            string
	VouchIngressURL                string

	GCPAuth    string
	GCPProject string

	GitDescription       string
	GitNamespace         string
	GitProvider          string
	GitRunner            string
	GitRunnerDescription string
	GitRunnerNS          string
	GitURL               string

	GitHubHost  string
	GitHubOwner string
	GitHubUser  string

	GitlabHost         string
	GitlabOwner        string
	GitlabOwnerGroupID int
	GitlabUser         string

	GitOpsRepoAtlantisWebhookURL string
	GitOpsRepoGitURL             string
	GitOpsRepoNoHTTPSURL         string

	UseTelemetry string
}

type MetaphorTokenValues

type MetaphorTokenValues struct {
	CheckoutCWFTTemplate          string
	CloudRegion                   string
	ClusterName                   string
	CommitCWFTTemplate            string
	ContainerRegistryURL          string
	DomainName                    string
	MetaphorDevelopmentIngressURL string
	MetaphorProductionIngressURL  string
	MetaphorStagingIngressURL     string
}

Jump to

Keyboard shortcuts

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