utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: MIT Imports: 25 Imported by: 25

Documentation

Index

Constants

View Source
const AppNamespaceEnvName = "app"

AppNamespaceEnvName Name of environment for app namespace

Variables

This section is empty.

Functions

func ArrayEqual

func ArrayEqual(a, b []string) bool

ArrayEqual tells whether a and b contain the same elements at the same index. A nil argument is equivalent to an empty slice.

func ArrayEqualElements

func ArrayEqualElements(a, b []string) bool

ArrayEqualElements tells whether a and b contain the same elements. Elements does not need to be in same index A nil argument is equivalent to an empty slice.

func GetAppAndTagPairFromName

func GetAppAndTagPairFromName(name string) (string, string)

GetAppAndTagPairFromName Reverse engineer deployment name

func GetAppNamespace

func GetAppNamespace(appName string) string

GetAppNamespace Function to get namespace from app name

func GetComponentSecretName

func GetComponentSecretName(componentame string) string

GetComponentSecretName Gets unique name of the component secret

func GetDeploymentName

func GetDeploymentName(appName, env, tag string) string

GetDeploymentName Function to get deployment name

func GetEnvironmentNamespace

func GetEnvironmentNamespace(appName, environment string) string

GetEnvironmentNamespace Function to get namespace from app name and environment

func GetGithubCloneURLFromRepo

func GetGithubCloneURLFromRepo(repo string) string

GetGithubCloneURLFromRepo Takes a https repo string as input and converts to a git clone url

func GetGithubRepositoryURLFromCloneURL

func GetGithubRepositoryURLFromCloneURL(cloneURL string) string

GetGithubRepositoryURLFromCloneURL Takes git clone url as input and converts to a https repo string

func GetImagePath

func GetImagePath(containerRegistry, appName, componentName, imageTag string) string

GetImagePath Returns a container image path given container registry, app, component and tag

func GetKubernetesClient

GetKubernetesClient Gets clients to talk to the API

func GetRadixApplication

func GetRadixApplication(filename string) (*v1.RadixApplication, error)

GetRadixApplication Reads radix config from file

func GetRadixDeploy

func GetRadixDeploy(filename string) (*v1.RadixDeployment, error)

GetRadixDeploy Reads radix deployment from file

func GetRadixRegistrationFromFile

func GetRadixRegistrationFromFile(file string) (*v1.RadixRegistration, error)

GetRadixRegistrationFromFile Reads radix registration from file

func RandString

func RandString(length int) string

RandString Returns a random string of given length

func RandStringSeed

func RandStringSeed(length int, src rand.Source) string

RandStringSeed Returns a random string of given length from seed

func RandStringStrSeed

func RandStringStrSeed(length int, src string) string

RandStringStrSeed Returns a random string of given length from seed

Types

type ApplicationBuilder

type ApplicationBuilder interface {
	WithRadixRegistration(RegistrationBuilder) ApplicationBuilder
	WithAppName(string) ApplicationBuilder
	WithEnvironment(string, string) ApplicationBuilder
	WithEnvironmentNoBranch(string) ApplicationBuilder
	WithComponent(RadixApplicationComponentBuilder) ApplicationBuilder
	WithComponents(...RadixApplicationComponentBuilder) ApplicationBuilder
	WithDNSAppAlias(string, string) ApplicationBuilder
	WithDNSExternalAlias(string, string, string) ApplicationBuilder
	WithPrivateImageRegistry(string, string, string) ApplicationBuilder
	GetRegistrationBuilder() RegistrationBuilder
	BuildRA() *v1.RadixApplication
}

ApplicationBuilder Handles construction of RA

func ARadixApplication

func ARadixApplication() ApplicationBuilder

ARadixApplication Constructor for application builder containing test data

func NewRadixApplicationBuilder

func NewRadixApplicationBuilder() ApplicationBuilder

NewRadixApplicationBuilder Constructor for config builder

type ApplicationBuilderStruct

type ApplicationBuilderStruct struct {
	// contains filtered or unexported fields
}

ApplicationBuilderStruct Instance variables

func (*ApplicationBuilderStruct) BuildRA

BuildRA Builds RA

func (*ApplicationBuilderStruct) GetRegistrationBuilder

func (ap *ApplicationBuilderStruct) GetRegistrationBuilder() RegistrationBuilder

GetRegistrationBuilder Gets associated registration builder

func (*ApplicationBuilderStruct) WithAppName

func (ap *ApplicationBuilderStruct) WithAppName(appName string) ApplicationBuilder

WithAppName Sets app name

func (*ApplicationBuilderStruct) WithComponent

WithComponent Appends application component to list of existing components

func (*ApplicationBuilderStruct) WithComponents

WithComponents Sets application components to application

func (*ApplicationBuilderStruct) WithDNSAppAlias

func (ap *ApplicationBuilderStruct) WithDNSAppAlias(env string, component string) ApplicationBuilder

WithDNSAppAlias Sets env + component to be the app alias

func (*ApplicationBuilderStruct) WithDNSExternalAlias

func (ap *ApplicationBuilderStruct) WithDNSExternalAlias(alias, env, component string) ApplicationBuilder

WithDNSExternalAlias Sets env + component to the the external alias

func (*ApplicationBuilderStruct) WithEnvironment

func (ap *ApplicationBuilderStruct) WithEnvironment(environment, buildFrom string) ApplicationBuilder

WithEnvironment Appends to environment-build list

func (*ApplicationBuilderStruct) WithEnvironmentNoBranch

func (ap *ApplicationBuilderStruct) WithEnvironmentNoBranch(environment string) ApplicationBuilder

WithEnvironmentNoBranch Appends environment with no branch mapping to config

func (*ApplicationBuilderStruct) WithPrivateImageRegistry added in v1.0.1

func (ap *ApplicationBuilderStruct) WithPrivateImageRegistry(server, username, email string) ApplicationBuilder

WithPrivateImageRegistry adds a private image hub to application

func (*ApplicationBuilderStruct) WithRadixRegistration

func (ap *ApplicationBuilderStruct) WithRadixRegistration(registrationBuilder RegistrationBuilder) ApplicationBuilder

WithRadixRegistration Associates this builder with a registration builder

type DeployComponentBuilder

type DeployComponentBuilder interface {
	WithName(string) DeployComponentBuilder
	WithImage(string) DeployComponentBuilder
	WithPort(string, int32) DeployComponentBuilder
	WithEnvironmentVariable(string, string) DeployComponentBuilder
	WithEnvironmentVariables(map[string]string) DeployComponentBuilder
	// Deprecated: For backwards comptibility WithPublic is still supported, new code should use WithPublicPort instead
	WithPublic(bool) DeployComponentBuilder
	WithPublicPort(string) DeployComponentBuilder
	WithMonitoring(bool) DeployComponentBuilder
	WithReplicas(*int) DeployComponentBuilder
	WithResourceRequestsOnly(map[string]string) DeployComponentBuilder
	WithResource(map[string]string, map[string]string) DeployComponentBuilder
	WithIngressConfiguration(...string) DeployComponentBuilder
	WithSecrets([]string) DeployComponentBuilder
	WithDNSAppAlias(bool) DeployComponentBuilder
	WithDNSExternalAlias(string) DeployComponentBuilder
	BuildComponent() v1.RadixDeployComponent
}

DeployComponentBuilder Handles construction of RD component

func NewDeployComponentBuilder

func NewDeployComponentBuilder() DeployComponentBuilder

NewDeployComponentBuilder Constructor for component builder

type DeploymentBuilder

type DeploymentBuilder interface {
	WithRadixApplication(ApplicationBuilder) DeploymentBuilder
	WithRadixDeployment(*v1.RadixDeployment) DeploymentBuilder
	WithDeploymentName(string) DeploymentBuilder
	WithImageTag(string) DeploymentBuilder
	WithAppName(string) DeploymentBuilder
	WithLabel(label, value string) DeploymentBuilder
	WithEnvironment(string) DeploymentBuilder
	WithCreated(time.Time) DeploymentBuilder
	WithUID(types.UID) DeploymentBuilder
	WithCondition(v1.RadixDeployCondition) DeploymentBuilder
	WithActiveFrom(time.Time) DeploymentBuilder
	WithActiveTo(time.Time) DeploymentBuilder
	WithEmptyStatus() DeploymentBuilder
	WithComponent(DeployComponentBuilder) DeploymentBuilder
	WithComponents(...DeployComponentBuilder) DeploymentBuilder
	GetApplicationBuilder() ApplicationBuilder
	BuildRD() *v1.RadixDeployment
}

DeploymentBuilder Handles construction of RD

func ARadixDeployment

func ARadixDeployment() DeploymentBuilder

ARadixDeployment Constructor for deployment builder containing test data

func NewDeploymentBuilder

func NewDeploymentBuilder() DeploymentBuilder

NewDeploymentBuilder Constructor for deployment builder

type DeploymentBuilderStruct

type DeploymentBuilderStruct struct {
	DeploymentName string
	AppName        string

	Labels          map[string]string
	ImageTag        string
	Environment     string
	Created         time.Time
	Condition       v1.RadixDeployCondition
	ActiveFrom      metav1.Time
	ActiveTo        metav1.Time
	ResourceVersion string
	UID             types.UID
	// contains filtered or unexported fields
}

DeploymentBuilderStruct Holds instance variables

func (*DeploymentBuilderStruct) BuildRD

BuildRD Builds RD structure based on set variables

func (*DeploymentBuilderStruct) GetApplicationBuilder

func (db *DeploymentBuilderStruct) GetApplicationBuilder() ApplicationBuilder

GetApplicationBuilder Obtains the builder for the corresponding RA, if exists (used for testing)

func (*DeploymentBuilderStruct) WithActiveFrom

func (db *DeploymentBuilderStruct) WithActiveFrom(activeFrom time.Time) DeploymentBuilder

WithActiveFrom Sets active from

func (*DeploymentBuilderStruct) WithActiveTo

func (db *DeploymentBuilderStruct) WithActiveTo(activeTo time.Time) DeploymentBuilder

WithActiveTo Sets active to

func (*DeploymentBuilderStruct) WithAppName

func (db *DeploymentBuilderStruct) WithAppName(appName string) DeploymentBuilder

WithAppName Sets app name

func (*DeploymentBuilderStruct) WithComponent

WithComponent Appends component to list of components

func (*DeploymentBuilderStruct) WithComponents

func (db *DeploymentBuilderStruct) WithComponents(components ...DeployComponentBuilder) DeploymentBuilder

WithComponents Sets list of components

func (*DeploymentBuilderStruct) WithCondition

WithCondition Sets the condition of the deployment

func (*DeploymentBuilderStruct) WithCreated

func (db *DeploymentBuilderStruct) WithCreated(created time.Time) DeploymentBuilder

WithCreated Sets timestamp

func (*DeploymentBuilderStruct) WithDeploymentName

func (db *DeploymentBuilderStruct) WithDeploymentName(name string) DeploymentBuilder

WithDeploymentName Sets name of the deployment

func (*DeploymentBuilderStruct) WithEmptyStatus

func (db *DeploymentBuilderStruct) WithEmptyStatus() DeploymentBuilder

WithEmptyStatus Indicates that the RD has no reconciled status

func (*DeploymentBuilderStruct) WithEnvironment

func (db *DeploymentBuilderStruct) WithEnvironment(environment string) DeploymentBuilder

WithEnvironment Sets environment name

func (*DeploymentBuilderStruct) WithImageTag

func (db *DeploymentBuilderStruct) WithImageTag(imageTag string) DeploymentBuilder

WithImageTag Sets deployment tag to be appended to name

func (*DeploymentBuilderStruct) WithLabel

func (db *DeploymentBuilderStruct) WithLabel(label, value string) DeploymentBuilder

WithLabel Appends label

func (*DeploymentBuilderStruct) WithRadixApplication

func (db *DeploymentBuilderStruct) WithRadixApplication(applicationBuilder ApplicationBuilder) DeploymentBuilder

WithRadixApplication Links to RA builder

func (*DeploymentBuilderStruct) WithRadixDeployment

func (db *DeploymentBuilderStruct) WithRadixDeployment(radixDeployment *v1.RadixDeployment) DeploymentBuilder

WithRadixDeployment Reverse engineers RD

func (*DeploymentBuilderStruct) WithUID

WithUID Sets UUID

type JobBuilder

type JobBuilder interface {
	WithRadixApplication(ApplicationBuilder) JobBuilder
	WithJobName(string) JobBuilder
	WithAppName(string) JobBuilder
	WithPipeline(v1.RadixPipelineType) JobBuilder
	WithBranch(string) JobBuilder
	WithDeploymentName(string) JobBuilder
	WithStatusOnAnnotation(JobStatusBuilder) JobBuilder
	WithEmptyStatus() JobBuilder
	WithStatus(JobStatusBuilder) JobBuilder
	WithCreated(time.Time) JobBuilder
	GetApplicationBuilder() ApplicationBuilder
	BuildRJ() *v1.RadixJob
}

JobBuilder Handles construction of RJ

func ARadixBuildDeployJob

func ARadixBuildDeployJob() JobBuilder

ARadixBuildDeployJob Constructor for radix job builder containing test data

func AStartedBuildDeployJob

func AStartedBuildDeployJob() JobBuilder

AStartedBuildDeployJob Constructor for radix job builder containing test data

func NewJobBuilder

func NewJobBuilder() JobBuilder

NewJobBuilder Constructor for radixjob builder

type JobBuilderStruct

type JobBuilderStruct struct {
	// contains filtered or unexported fields
}

JobBuilderStruct Holds instance variables

func (*JobBuilderStruct) BuildRJ

func (jb *JobBuilderStruct) BuildRJ() *v1.RadixJob

BuildRJ Builds RJ structure based on set variables

func (*JobBuilderStruct) GetApplicationBuilder

func (jb *JobBuilderStruct) GetApplicationBuilder() ApplicationBuilder

GetApplicationBuilder Obtains the builder for the corresponding RA, if exists (used for testing)

func (*JobBuilderStruct) WithAppName

func (jb *JobBuilderStruct) WithAppName(name string) JobBuilder

WithAppName Sets name of the application

func (*JobBuilderStruct) WithBranch

func (jb *JobBuilderStruct) WithBranch(branch string) JobBuilder

WithBranch Sets branch

func (*JobBuilderStruct) WithCreated

func (jb *JobBuilderStruct) WithCreated(created time.Time) JobBuilder

WithCreated Sets timestamp

func (*JobBuilderStruct) WithDeploymentName

func (jb *JobBuilderStruct) WithDeploymentName(deploymentName string) JobBuilder

WithDeploymentName Sets deployment name

func (*JobBuilderStruct) WithEmptyStatus

func (jb *JobBuilderStruct) WithEmptyStatus() JobBuilder

WithEmptyStatus Indicates that the RJ has no reconciled status

func (*JobBuilderStruct) WithJobName

func (jb *JobBuilderStruct) WithJobName(name string) JobBuilder

WithJobName Sets name of the radix job

func (*JobBuilderStruct) WithPipeline

func (jb *JobBuilderStruct) WithPipeline(pipeline v1.RadixPipelineType) JobBuilder

WithPipeline Sets pipeline

func (*JobBuilderStruct) WithRadixApplication

func (jb *JobBuilderStruct) WithRadixApplication(applicationBuilder ApplicationBuilder) JobBuilder

WithRadixApplication Links to RA builder

func (*JobBuilderStruct) WithStatus

func (jb *JobBuilderStruct) WithStatus(jobStatus JobStatusBuilder) JobBuilder

WithStatus Sets status on job

func (*JobBuilderStruct) WithStatusOnAnnotation

func (jb *JobBuilderStruct) WithStatusOnAnnotation(jobStatus JobStatusBuilder) JobBuilder

WithStatusOnAnnotation Emulates velero plugin

type JobStatusBuilder

type JobStatusBuilder interface {
	WithCondition(v1.RadixJobCondition) JobStatusBuilder
	WithSteps(...JobStepBuilder) JobStatusBuilder
	Build() v1.RadixJobStatus
}

JobStatusBuilder Handles construction of job status

func AStartedJobStatus

func AStartedJobStatus() JobStatusBuilder

AStartedJobStatus Constructor build-app

func NewJobStatusBuilder

func NewJobStatusBuilder() JobStatusBuilder

NewJobStatusBuilder Constructor for job status builder

type JobStepBuilder

type JobStepBuilder interface {
	WithCondition(v1.RadixJobCondition) JobStepBuilder
	WithName(string) JobStepBuilder
	WithStarted(time.Time) JobStepBuilder
	WithEnded(time.Time) JobStepBuilder
	Build() v1.RadixJobStep
}

JobStepBuilder Handles construction of job status step

func ABuildAppStep

func ABuildAppStep() JobStepBuilder

ABuildAppStep Constructor build-app

func ACloneConfigStep

func ACloneConfigStep() JobStepBuilder

ACloneConfigStep Constructor clone-config

func ACloneStep

func ACloneStep() JobStepBuilder

ACloneStep Constructor radix-pipeline

func ARadixPipelineStep

func ARadixPipelineStep() JobStepBuilder

ARadixPipelineStep Constructor radix-pipeline

func NewJobStepBuilder

func NewJobStepBuilder() JobStepBuilder

NewJobStepBuilder Constructor for job step builder

type RadixApplicationComponentBuilder

type RadixApplicationComponentBuilder interface {
	WithName(string) RadixApplicationComponentBuilder
	// Deprecated: For backwards comptibility WithPublic is still supported, new code should use WithPublicPort instead
	WithPublic(bool) RadixApplicationComponentBuilder
	WithPublicPort(string) RadixApplicationComponentBuilder
	WithPort(string, int32) RadixApplicationComponentBuilder
	WithSecrets(...string) RadixApplicationComponentBuilder
	WithIngressConfiguration(...string) RadixApplicationComponentBuilder
	WithEnvironmentConfig(RadixEnvironmentConfigBuilder) RadixApplicationComponentBuilder
	WithEnvironmentConfigs(...RadixEnvironmentConfigBuilder) RadixApplicationComponentBuilder
	BuildComponent() v1.RadixComponent
}

RadixApplicationComponentBuilder Handles construction of RA component

func AnApplicationComponent

func AnApplicationComponent() RadixApplicationComponentBuilder

AnApplicationComponent Constructor for component builder builder containing test data

func NewApplicationComponentBuilder

func NewApplicationComponentBuilder() RadixApplicationComponentBuilder

NewApplicationComponentBuilder Constructor for component builder

type RadixEnvironmentConfigBuilder

type RadixEnvironmentConfigBuilder interface {
	WithEnvironment(string) RadixEnvironmentConfigBuilder
	WithReplicas(*int) RadixEnvironmentConfigBuilder
	WithEnvironmentVariable(string, string) RadixEnvironmentConfigBuilder
	WithResource(map[string]string, map[string]string) RadixEnvironmentConfigBuilder
	BuildEnvironmentConfig() v1.RadixEnvironmentConfig
}

RadixEnvironmentConfigBuilder Handles construction of RA component environment

func AnEnvironmentConfig

func AnEnvironmentConfig() RadixEnvironmentConfigBuilder

AnEnvironmentConfig Constructor for component environment builder containing test data

func NewComponentEnvironmentBuilder

func NewComponentEnvironmentBuilder() RadixEnvironmentConfigBuilder

NewComponentEnvironmentBuilder Constructor for component environment builder

type RegistrationBuilder

type RegistrationBuilder interface {
	WithUID(types.UID) RegistrationBuilder
	WithName(name string) RegistrationBuilder
	WithRepository(string) RegistrationBuilder
	WithSharedSecret(string) RegistrationBuilder
	WithAdGroups([]string) RegistrationBuilder
	WithPublicKey(string) RegistrationBuilder
	WithPrivateKey(string) RegistrationBuilder
	WithCloneURL(string) RegistrationBuilder
	WithRadixRegistration(*v1.RadixRegistration) RegistrationBuilder
	BuildRR() *v1.RadixRegistration
}

RegistrationBuilder Handles construction of RR or applicationRegistation

func ARadixRegistration

func ARadixRegistration() RegistrationBuilder

ARadixRegistration Constructor for registration builder containing test data

func NewRegistrationBuilder

func NewRegistrationBuilder() RegistrationBuilder

NewRegistrationBuilder Constructor for registration builder

type RegistrationBuilderStruct

type RegistrationBuilderStruct struct {
	// contains filtered or unexported fields
}

RegistrationBuilderStruct Instance variables

func (*RegistrationBuilderStruct) BuildRR

BuildRR Builds the radix registration

func (*RegistrationBuilderStruct) WithAdGroups

func (rb *RegistrationBuilderStruct) WithAdGroups(adGroups []string) RegistrationBuilder

WithAdGroups Sets ad group

func (*RegistrationBuilderStruct) WithCloneURL

func (rb *RegistrationBuilderStruct) WithCloneURL(cloneURL string) RegistrationBuilder

WithCloneURL Sets clone url

func (*RegistrationBuilderStruct) WithName

WithName Sets name

func (*RegistrationBuilderStruct) WithPrivateKey

func (rb *RegistrationBuilderStruct) WithPrivateKey(privateKey string) RegistrationBuilder

WithPrivateKey Sets private key

func (*RegistrationBuilderStruct) WithPublicKey

func (rb *RegistrationBuilderStruct) WithPublicKey(publicKey string) RegistrationBuilder

WithPublicKey Sets public key

func (*RegistrationBuilderStruct) WithRadixRegistration

func (rb *RegistrationBuilderStruct) WithRadixRegistration(radixRegistration *v1.RadixRegistration) RegistrationBuilder

WithRadixRegistration Re-enginers a builder from a registration

func (*RegistrationBuilderStruct) WithRepository

func (rb *RegistrationBuilderStruct) WithRepository(repository string) RegistrationBuilder

WithRepository Sets repository

func (*RegistrationBuilderStruct) WithSharedSecret

func (rb *RegistrationBuilderStruct) WithSharedSecret(sharedSecret string) RegistrationBuilder

WithSharedSecret Sets shared secret

func (*RegistrationBuilderStruct) WithUID

WithUID Sets UID

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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