deployclient

package
v0.0.0-...-96e757f Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRef           = "master"
	DefaultOwner         = "navikt"
	DefaultDeployServer  = "deploy.nav.cloud.nais.io:443"
	DefaultDeployTimeout = time.Minute * 10

	ResourceRequiredMsg = "at least one Kubernetes resource is required to make sense of the deployment"
	AuthRequiredMsg     = "Github token or API key required"
	ClusterRequiredMsg  = "cluster required; see reference section in the documentation for available environments"
	MalformedAPIKeyMsg  = "API key must be a hex encoded string"
)
View Source
const (
	DeployClientVersion  = "deploy.nais.io/client-version"
	GithubWorkflowRunURL = "deploy.nais.io/github-workflow-run-url"
)

Variables

This section is empty.

Functions

func ErrorStatus

func ErrorStatus(status *pb.DeploymentStatus) error

func InitConfig

func InitConfig(cfg *Config)

func InjectAnnotations

func InjectAnnotations(resource json.RawMessage, annotations map[string]string) (json.RawMessage, error)

func MakeDeploymentRequest

func MakeDeploymentRequest(cfg Config, deadline time.Time, kubernetes *pb.Kubernetes) *pb.DeploymentRequest

func MultiDocumentFileAsJSON

func MultiDocumentFileAsJSON(path string, ctx TemplateVariables) ([]json.RawMessage, error)

func NewGrpcConnection

func NewGrpcConnection(cfg Config) (*grpc.ClientConn, error)

func Prepare

func Prepare(ctx context.Context, cfg *Config) (*pb.DeploymentRequest, error)

func SetupLogging

func SetupLogging(cfg Config)

Types

type ActionsFormatter

type ActionsFormatter struct{}

func (*ActionsFormatter) Format

func (a *ActionsFormatter) Format(e *log.Entry) ([]byte, error)

type Config

type Config struct {
	APIKey             string
	Actions            bool
	Cluster            string
	DeployServerURL    string
	DryRun             bool
	Environment        string
	GithubToken        string
	GrpcAuthentication bool
	GrpcUseTLS         bool
	Owner              string
	PollInterval       time.Duration
	PrintPayload       bool
	Quiet              bool
	Ref                string
	Repository         string
	Resource           []string
	Retry              bool
	RetryInterval      time.Duration
	Team               string
	Timeout            time.Duration
	Variables          []string
	VariablesFile      string
	Wait               bool
}

func NewConfig

func NewConfig() *Config

config return user input and default values as Config. Values will be resolved with the following precedence: flags > environment variables > default values.

func (*Config) Validate

func (cfg *Config) Validate() error

type Deployer

type Deployer struct {
	Client pb.DeployClient
}

func (*Deployer) Deploy

func (d *Deployer) Deploy(ctx context.Context, cfg *Config, deployRequest *pb.DeploymentRequest) error

type Error

type Error struct {
	Code ExitCode
	Err  error
}

func ErrorWrap

func ErrorWrap(exitCode ExitCode, err error) *Error

func Errorf

func Errorf(exitCode ExitCode, format string, args ...interface{}) *Error

func (*Error) Error

func (err *Error) Error() string

type ExitCode

type ExitCode int
const (
	ExitSuccess ExitCode = iota
	ExitDeploymentFailure
	ExitDeploymentError
	ExitDeploymentInactive
	ExitNoDeployment
	ExitUnavailable
	ExitInvocationFailure
	ExitInternalError
	ExitTemplateError
	ExitTimeout
)

Keep separate to avoid skewing exit codes

func ErrorExitCode

func ErrorExitCode(err error) ExitCode

type TemplateVariables

type TemplateVariables map[string]interface{}

Jump to

Keyboard shortcuts

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