package commands

import "github.com/oslokommune/okctl/pkg/commands"

Package commands contains helper functionality to run various okctl commands.

Index

Constants

const SaveClusterVersionErr = "saving cluster version: %w"

SaveClusterVersionErr contains the error message for error with saving cluster version

const ShowMsg = "" /* 941 byte string literal not displayed */

ShowMsg is the message shown to the user when using show credentials

const ValidateBinaryVsClusterVersionErr = "validating binary against cluster version: %w"

ValidateBinaryVsClusterVersionErr contains the error message for invalid binary vs cluster version

Functions

func CleanOsEnvVars

func CleanOsEnvVars(environ []string) []string

CleanOsEnvVars ensures blacklisted variables are removed from the list

func GetOkctlEnvVars

func GetOkctlEnvVars(opts OkctlEnvironment) (map[string]string, error)

GetOkctlEnvVars converts an okctl environment to a map with environmental variables

func GetVenvEnvVars

func GetVenvEnvVars(okctlEnvironment OkctlEnvironment) (map[string]string, error)

GetVenvEnvVars returns the environmental variables needed by a virtual environment. This contains environment variables from the user's shell merged with those from the okctl.

func GoTemplateToString

func GoTemplateToString(templateString string, data interface{}) (string, error)

GoTemplateToString converts a Go template plus provided data to a string

func InferApplicationFromStdinOrFile

func InferApplicationFromStdinOrFile(declaration v1alpha1.Cluster, stdin io.Reader, fs *afero.Afero, path string) (v1alpha1.Application, error)

InferApplicationFromStdinOrFile returns an okctl application based on input. The function will parse input either from the reader or from the fs based on if path is a path or if it is "-". "-" represents stdin

func InferClusterFromStdinOrFile

func InferClusterFromStdinOrFile(stdin io.Reader, path string) (*v1alpha1.Cluster, error)

InferClusterFromStdinOrFile initializes a v1alpha1.Cluster based on a path. If the path is "-", the Cluster is initialized based on stdin

func MergeEnvVars

func MergeEnvVars(osEnvs []string, venvMap map[string]string) map[string]string

MergeEnvVars first converts the given slice to a map. The provided slice must contain strings on the form "KEY=VALUE. It then merges this map with the other provided map. If both map contains a PATH key, they will be merged.

func ScaffoldApplicationDeclaration

func ScaffoldApplicationDeclaration(out io.Writer, opts ScaffoldApplicationOpts) error

ScaffoldApplicationDeclaration scaffolds an application declaration based on ScaffoldApplicationOpts

func ScaffoldClusterDeclaration

func ScaffoldClusterDeclaration(out io.Writer, opts ScaffoldClusterOpts) error

ScaffoldClusterDeclaration scaffolds a cluster declaration based on ScaffoldClusterOpts

func ValidateBinaryEqualsClusterVersion

func ValidateBinaryEqualsClusterVersion(o *okctl.Okctl) error

ValidateBinaryEqualsClusterVersion is a wrapper for clusterVersioner.ValidateBinaryEqualsClusterVersion

func ValidateBinaryVersionNotLessThanClusterVersion

func ValidateBinaryVersionNotLessThanClusterVersion(o *okctl.Okctl) error

ValidateBinaryVersionNotLessThanClusterVersion is a wrapper for clusterVersioner.ValidateBinaryVersionNotLessThanClusterVersion

func WriteApplyApplicationSuccessMessage

func WriteApplyApplicationSuccessMessage(opts WriteApplyApplicationSucessMessageOpts) error

WriteApplyApplicationSuccessMessage produces a relevant message for successfully reconciling an application

func WriteDeleteApplicationSuccessMessage

func WriteDeleteApplicationSuccessMessage(opts WriteDeleteApplicationSuccessMessageOpts) error

WriteDeleteApplicationSuccessMessage produces a relevant message for successfully deleting an application

Types

type ApplyApplicationSuccessMessageOpts

type ApplyApplicationSuccessMessageOpts struct {
	ApplicationName           string
	OptionalDockerTagPushStep string
	OptionalDockerImageURI    string
	OptionalIngressInfo       string
}

ApplyApplicationSuccessMessageOpts contains the values for customizing the apply application success message

type OkctlEnvironment

type OkctlEnvironment struct {
	AWSAccountID           string
	Region                 string
	AwsProfile             string
	ClusterName            string
	UserDataDir            string
	UserHomeDir            string
	Debug                  bool
	KubectlBinaryDir       string
	KubensBinaryDir        string
	AwsIamAuthenticatorDir string
	ClusterDeclarationPath string
	AWSCredentialsType     string
	GithubCredentialsType  string
}

OkctlEnvironment contains data about the okctl environment

func GetOkctlEnvironment

func GetOkctlEnvironment(o *okctl.Okctl, clusterDeclarationPath string) (OkctlEnvironment, error)

GetOkctlEnvironment returns data needed to connect to an okctl cluster

func (*OkctlEnvironment) Validate

func (o *OkctlEnvironment) Validate() error

Validate the inputs

type ScaffoldApplicationOpts

type ScaffoldApplicationOpts struct {
	PrimaryHostedZone      string
	ClusterDeclarationPath string
}

ScaffoldApplicationOpts contains attributes used in an application declaration

type ScaffoldClusterOpts

type ScaffoldClusterOpts struct {
	Name string

	AWSAccountID    string
	Organization    string
	RepositoryName  string
	OutputDirectory string
}

ScaffoldClusterOpts contains attributes used in a cluster declaration

type ShowMessageOpts

type ShowMessageOpts struct {
	VenvCmd                 string
	KubectlCmd              string
	KubectlPath             string
	AwsIamAuthenticatorCmd  string
	AwsIamAuthenticatorPath string
	K8sClusterVersion       string
	ArgoCD                  string
	ArgoCDURL               string
}

ShowMessageOpts contains the fields used by the Go template for the show credentials user message

type WriteApplyApplicationSucessMessageOpts

type WriteApplyApplicationSucessMessageOpts struct {
	Out io.Writer

	Application v1alpha1.Application
	Cluster     v1alpha1.Cluster
}

WriteApplyApplicationSucessMessageOpts contains necessary information to compile and write a success message

type WriteDeleteApplicationSuccessMessageOpts

type WriteDeleteApplicationSuccessMessageOpts struct {
	Out io.Writer

	Cluster     v1alpha1.Cluster
	Application v1alpha1.Application
}

WriteDeleteApplicationSuccessMessageOpts contains the values for customizing delete application success message

Source Files

apply_application.go applycluster.go cmd.go doc.go scaffoldapplication.go scaffoldcluster.go show.go upgrade.go venv.go

Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
23 packages
Last checked
18 hours ago

Tools for package owners.