Documentation
¶
Overview ¶
Copyright (C) 2021-2023, Kubefirst
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Copyright (C) 2021-2023, Kubefirst ¶
This program is licensed under MIT. See the LICENSE file for more details.
Index ¶
- Constants
- Variables
- func AwaitHostNTimes(url string, times int, gracePeriod time.Duration)
- func CreateDirIfNotExist(dir string) error
- func CreateFile(fileName string, fileContent []byte) error
- func CreateFullPath(p string) (*os.File, error)
- func CreateTracker(title string, total int64) *progress.Tracker
- func ExecShellReturnStrings(command string, args ...string) (string, string, error)
- func ExecShellReturnStringsV2(command string, args ...string) (string, error)
- func ExecShellWithVars(osvars map[string]string, command string, args ...string) error
- func FindStringInSlice(s []string, str string) bool
- func GenerateClusterID() string
- func GetAvailableDiskSize() (uint64, error)
- func GetFileContent(filePath string) ([]byte, error)
- func GetLogLevelByString(logLevel string) zerolog.Level
- func GetTrackers() map[string]*ActionTracker
- func InformUser(message string, silentMode bool)
- func IsAppAvailable(url string, appname string) error
- func IsConsoleUIAvailable(url string) error
- func IsValidURL(rawURL string) error
- func OpenBrowser(url string) error
- func OpenLogFile(path string) (*os.File, error)
- func Random(seq int) string
- func RemoveSubDomain(fullURL string) (string, error)
- func RemoveSubdomainV2(domainName string) (string, error)
- func ReplaceFileContent(filPath string, oldContent string, newContent string) error
- func ResetK1Dir(k1Dir string) error
- func SetupProgress(numTrackers int)
- func SetupViper(config *configs.Config, silent bool) error
- func StringWithCharset(length int, charset string) string
- func UpdateTerraformS3BackendForK8sAddress(k1Dir string) error
- func UpdateTerraformS3BackendForLocalhostAddress() error
- func ValidateK1Folder(folderPath string) error
- func ZerologSetup(logFile *os.File, level zerolog.Level) zerolog.Logger
- type ActionTracker
- type CertificateAppList
- type HTTPDoer
- type HTTPMock
- type SegmentIOMock
Constants ¶
const ( JSONContentType = "application/json" SoftServerURI = "ssh://127.0.0.1:8022/config" GitHubOAuthClientId = "2ced340927e0a6c49a45" CloudK3d = "k3d" CloudAws = "aws" DefaultS3Region = "us-east-1" GitHubProviderName = "github" GitHubHost = "github.com" LocalClusterName = "kubefirst" MinimumAvailableDiskSize = 10 // 10 GB KubefirstGitopsRepository = "gitops" KubefirstGitopsRepositoryURL = "https://github.com/kubefirst/gitops-template" LocalDomainName = "kubefirst.dev" LocalhostARCH = runtime.GOARCH LocalhostOS = runtime.GOOS AwsECRUsername = "AWS" RegistryAppName = "registry" MinioDefaultUsername = "k-ray" MinioDefaultPassword = "feedkraystars" // github.com/kubefirst/manifests ref ver KubefirstManifestRepoRef = "0.1.0" )
const ( VaultPodName = "vault-0" VaultNamespace = "vault" VaultPodPort = 8200 VaultPodLocalPort = 8200 VaultPortForwardURL = "http://localhost:8200" )
Vault
const ( ArgoPodName = "argo-server" ArgoNamespace = "argo" ArgoPodPort = 2746 ArgoPodLocalPort = 2746 ArgocdPortForwardURL = "http://localhost:8080" )
Argo
const ( ArgoCDPodName = "argocd-server" ArgoCDNamespace = "argocd" ArgoCDPodPort = 8080 ArgoCDPodLocalPort = 8080 ArgoCDLocalBaseURL = "https://localhost:8080/api/v1" )
ArgoCD
const ( ChartmuseumPodName = "chartmuseum" ChartmuseumNamespace = "chartmuseum" ChartmuseumPodPort = 8080 ChartmuseumPodLocalPort = 8181 ChartmuseumLocalURL = "http://localhost:8181" )
ChartMuseum
const ( MinioPodName = "minio" MinioNamespace = "minio" MinioPodPort = 9000 MinioPodLocalPort = 9000 MinioPortForwardEndpoint = "localhost:9000" MinioRegion = "us-k3d-1" )
Minio
const ( MinioConsolePodName = "minio" MinioConsoleNamespace = "minio" MinioConsolePodPort = 9001 MinioConsolePodLocalPort = 9001 )
Minio Console
const ( KubefirstConsolePodName = "kubefirst-console" KubefirstConsoleNamespace = "kubefirst" KubefirstConsolePodPort = 80 KubefirstConsolePodLocalPort = 9094 KubefirstConsoleLocalURLCloud = "http://localhost:9094" )
Kubefirst Console
const ( AtlantisPodPort = 4141 AtlantisPodName = "atlantis-0" AtlantisNamespace = "atlantis" AtlantisPodLocalPort = 4141 LocalAtlantisURLTEMPORARY = "localhost:4141" // todo: )
Atlantis
const ( MetaphorFrontendDevelopmentServiceName = "metaphor-development" MetaphorFrontendDevelopmentNamespace = "development" MetaphorFrontendDevelopmentServicePort = 443 MetaphorFrontendDevelopmentServiceLocalPort = 4000 MetaphorFrontendDevelopmentLocalURL = "http://localhost:4000" )
MetaphorFrontendDevelopment
const ( MetaphorGoDevelopmentServiceName = "metaphor-go-development" MetaphorGoDevelopmentNamespace = "development" MetaphorGoDevelopmentServicePort = 443 MetaphorGoDevelopmentServiceLocalPort = 5000 MetaphorGoDevelopmentLocalURL = "http://localhost:5000" )
MetaphorGoDevelopment
const ( MetaphorDevelopmentServiceName = "metaphor-development" MetaphorDevelopmentNamespace = "development" MetaphorDevelopmentServicePort = 443 MetaphorDevelopmentServiceLocalPort = 3000 MetaphorDevelopmentLocalURL = "http://localhost:3000" )
MetaphorDevelopment
const CloneAndDetokenizeGitopsTemplate = "Clone and Detokenize (Gitops)"
const CloneAndDetokenizeMetaphorTemplate = "Clone and Detokenize (Metaphor)"
const CreateBuckets = "Create Buckets"
const CreateSSHKey = "Create SSH keys"
const DownloadDependencies = "Download dependencies"
const GetAccountInfo = "Get Account Info"
const GetDNSInfo = "Get DNS Info"
const SendTelemetry = "Send Telemetry"
const TestHostedZoneLiveness = "Test Domain Liveness"
Variables ¶
var ( VaultLocalURL = fmt.Sprintf("http://vault.%s", LocalDomainName) VaultLocalURLTLS = fmt.Sprintf("https://vault.%s", LocalDomainName) )
var ( ArgoCDLocalURL = fmt.Sprintf("http://argocd.%s", LocalDomainName) ArgoCDLocalURLTLS = fmt.Sprintf("https://argocd.%s", LocalDomainName) )
var ( KubefirstConsoleLocalURL = fmt.Sprintf("http://kubefirst.%s", LocalDomainName) KubefirstConsoleLocalURLTLS = fmt.Sprintf("https://kubefirst.%s", LocalDomainName) )
var ( AtlantisLocalURLTEST = fmt.Sprintf("atlantis.%s", LocalDomainName) AtlantisLocalURL = fmt.Sprintf("http://atlantis.%s", LocalDomainName) AtlantisLocalURLTLS = fmt.Sprintf("https://atlantis.%s", LocalDomainName) )
var ( MetaphorFrontendSlimTLSDev = fmt.Sprintf("https://metaphor-development.%s", LocalDomainName) MetaphorFrontendSlimTLSStaging = fmt.Sprintf("https://metaphor-staging.%s", LocalDomainName) MetaphorFrontendSlimTLSProd = fmt.Sprintf("https://metaphor-production.%s", LocalDomainName) )
var (
ArgoLocalURLTLS = fmt.Sprintf("https://argo.%s", LocalDomainName)
)
var (
BetaProviders []string = []string{"digitalocean", "google", "vultr"}
)
var (
ChartmuseumLocalURLTLS = fmt.Sprintf("https://chartmuseum.%s", LocalDomainName)
)
var (
MinioConsoleURLTLS = fmt.Sprintf("https://minio-console.%s", LocalDomainName)
)
var (
MinioURL = fmt.Sprintf("https://minio.%s", LocalDomainName)
)
var SupportedPlatforms = []string{
"akamai-github",
"aws-github",
"aws-gitlab",
"civo-github",
"civo-gitlab",
"digitalocean-github",
"digitalocean-gitlab",
"google-github",
"google-gitlab",
"k3d-github",
"k3d-gitlab",
"k3s-gitlab",
"vultr-github",
"vultr-gitlab",
}
var (
Trackers map[string]*ActionTracker
)
Functions ¶
func AwaitHostNTimes ¶
AwaitHostNTimes - Wait for a Host to return a 200 - To return 200 - To return true if host is ready, or false if not - Supports a number of times to test an endpoint - Supports the grace period after status 200 to wait before returning
func CreateDirIfNotExist ¶
func CreateFile ¶
CreateFile - Create a file with its contents
func CreateFullPath ¶
CreateFullPath - Create path and its parents
func CreateTracker ¶
CreateTracker receives Tracker data and return a new Tracker.
func ExecShellReturnStrings ¶
ExecShellReturnStrings Exec shell actions returning a string for use by the caller.
func ExecShellReturnStringsV2 ¶
ExecShellReturnStringsV2 exec shell, discard stdout
func ExecShellWithVars ¶
ExecShellWithVars Exec shell actions supporting:
- On-the-fly logging of result
- Map of Vars loaded
func FindStringInSlice ¶
FindStringInSlice takes []string and returns true if the supplied string is in the slice.
func GenerateClusterID ¶
func GenerateClusterID() string
func GetAvailableDiskSize ¶
GetAvailableDiskSize returns the available disk size in the user machine. In that way Kubefirst can validate if the available disk size is enough to start a installation.
func GetFileContent ¶
GetFileContent receives a file path, and return its content.
func GetLogLevelByString ¶
GetLogLevelByString receives a log level string, and returns it's related zerolog Level iota panic (zerolog.PanicLevel, 5) fatal (zerolog.FatalLevel, 4) error (zerolog.ErrorLevel, 3) warn (zerolog.WarnLevel, 2) info (zerolog.InfoLevel, 1) debug (zerolog.DebugLevel, 0) trace (zerolog.TraceLevel, -1)
func GetTrackers ¶
func GetTrackers() map[string]*ActionTracker
GetTrackers keeps one single instance of Trackers alive using singleton pattern.
func IsAppAvailable ¶ added in v0.3.5
func OpenBrowser ¶
OpenBrowser opens the browser with the given URL At this time, support is limited to darwin platforms
func RemoveSubDomain ¶
RemoveSubDomain receives a host and remove its subdomain, if exists.
func RemoveSubdomainV2 ¶
func ReplaceFileContent ¶
ReplaceFileContent receives a file path, oldContent and newContent. oldContent is the previous value that is in the file, newContent is the new content you want to replace.
Example:
err := ReplaceFileContent(vaultMainFile, "http://127.0.0.1:9000", "http://minio.minio.svc.cluster.local:9000")
func ResetK1Dir ¶
func SetupProgress ¶
func SetupProgress(numTrackers int)
SetupProgress prepare the progress bar setting its initial configuration
func SetupViper ¶
SetupViper handles Viper config file. If config file doesn't exist, create, in case the file is available, use it.
func StringWithCharset ¶
func UpdateTerraformS3BackendForK8sAddress ¶
UpdateTerraformS3BackendForK8sAddress during the installation process, Terraform must reach port-forwarded resources to be able to communicate with the services. When Kubefirst finish the installation, and Terraform needs to communicate with the services, it must use the internal Kubernetes addresses.
func UpdateTerraformS3BackendForLocalhostAddress ¶
func UpdateTerraformS3BackendForLocalhostAddress() error
UpdateTerraformS3BackendForLocalhostAddress during the destroy process, Terraform must reach port-forwarded resources to be able to communicate with the services.
func ValidateK1Folder ¶
ValidateK1Folder receives a folder path, and expects the Kubefirst configuration folder doesn't contain "argocd-init-values.yaml" and/or "gitops/" folder. It follows this validation order:
- If folder doesn't exist, try to create it (happy path)
- If folder exists, and has "argocd-init-values.yaml" and/or "gitops/", abort and return error describing the issue and what should be done
Types ¶
type ActionTracker ¶
type CertificateAppList ¶
func GetCertificateAppList ¶
func GetCertificateAppList() []CertificateAppList
type SegmentIOMock ¶
type SegmentIOMock struct{}
func (SegmentIOMock) Close ¶
func (segmentIOMock SegmentIOMock) Close() error
func (SegmentIOMock) Enqueue ¶
func (segmentIOMock SegmentIOMock) Enqueue(message analytics.Message) error