repo

package
v0.0.0-...-274850b Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReconciledWithWarning = errors.New("reconciled with warning")
)

Functions

func Clone

func Clone(options *CloneOptions) (*gogit.GoGit, error)

func CommitPush

func CommitPush(
	g *gogit.GoGit,
	authorName string,
	authorEmail string,
	message string,
	destinationUrl string,
	destinationBranch string,
	timeout time.Duration,
) error

func Create

func Create(options *CreateOptions, status *cli.Status) (string, gitprovider.UserRepository, error)

func DecodeUniversalURL

func DecodeUniversalURL(URL string, transport gitprovider.TransportType) (string, error)

func GetValueFromMap

func GetValueFromMap(obj map[interface{}]interface{}, keys []string) (interface{}, error)

func OpenApplicationFile

func OpenApplicationFile(path string) (map[interface{}]interface{}, error)

func UniversalURL

func UniversalURL(URL string) (string, gitprovider.TransportType, error)

Types

type Application

type Application struct {
	Name          string            `json:"name"`
	Repository    Repository        `json:"repository"`
	Configuration ApplicationConfig `json:"configuration"`
}

type ApplicationConfig

type ApplicationConfig struct {
	Name                string                           `json:"name"`
	Namespace           string                           `json:"namespace"`
	ServiceAccountName  string                           `json:"serviceAccountName"`
	Repository          string                           `json:"repository"`
	TransportType       gitprovider.TransportType        `json:"transportType"`
	Sha                 string                           `json:"sha"`
	Values              Values                           `json:"values,omitempty"`
	TemplatingBlackList []string                         `json:"templatingBlackList,omitempty"`
	Encryption          Encryption                       `json:"encryption,omitempty"`
	Dependencies        []bool                           `json:"dependencies,omitempty"`
	DependsOn           []meta.NamespacedObjectReference `json:"dependsOn,omitempty"`
}

func OpenApplicationConfig

func OpenApplicationConfig(path string) (*ApplicationConfig, error)

func RenderApplicationConfig

func RenderApplicationConfig(
	path string,
	values []string,
	clusterConfig *ClusterConfig,
	cloneOptions *CloneOptions,
	status *cli.Status,
) (*ApplicationConfig, error)

func (*ApplicationConfig) Check

func (c *ApplicationConfig) Check(clusterConfig *ClusterConfig, alreadyInstalled bool, status *cli.Status) error

func (*ApplicationConfig) GetSha

func (c *ApplicationConfig) GetSha() (string, error)

func (*ApplicationConfig) GetUrl

func (c *ApplicationConfig) GetUrl() (string, error)

func (*ApplicationConfig) Save

func (c *ApplicationConfig) Save(path string) error

type ApplicationDependency

type ApplicationDependency struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Print       bool   `json:"print,omitempty"`
	Repository  string `json:"repository,omitempty"`
	ShaRange    string `json:"shaRange,omitempty"`
	Value       bool   `json:"value,omitempty"`
}

type ApplicationRepo

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

func CloneApplicationRepo

func CloneApplicationRepo(options *CloneOptions, status *cli.Status) (*ApplicationRepo, error)

func (*ApplicationRepo) CommitPush

func (r *ApplicationRepo) CommitPush(
	authorName string,
	authorEmail string,
	message string,
	destinationUrl string,
	destinationBranch string,
	timeout time.Duration,
	status *cli.Status,
) error

func (*ApplicationRepo) Config

func (r *ApplicationRepo) Config() *ApplicationConfig

func (*ApplicationRepo) Encrypt

func (r *ApplicationRepo) Encrypt(clusterConfig *ClusterConfig, status *cli.Status) error

func (*ApplicationRepo) GetFilesFromAnotherRepo

func (r *ApplicationRepo) GetFilesFromAnotherRepo(repo *ApplicationRepo) error

Replace all the files from r by the ones from repo except the .git folder

func (*ApplicationRepo) Git

func (r *ApplicationRepo) Git() *gogit.GoGit

func (*ApplicationRepo) OpenApplicationConfig

func (r *ApplicationRepo) OpenApplicationConfig() error

func (*ApplicationRepo) Render

func (r *ApplicationRepo) Render(destinationRepo Repository, username, pwd string, status *cli.Status) error

func (*ApplicationRepo) RenderApplicationConfig

func (r *ApplicationRepo) RenderApplicationConfig(values []string, clusterConfig *ClusterConfig, cloneOptions *CloneOptions, status *cli.Status) error

type ApplicationSecret

type ApplicationSecret struct {
	Repository        string                      `json:"repository,omitempty"`
	OriginPath        string                      `json:"originPath,omitempty"`
	DestinationPath   string                      `json:"destinationPath,omitempty"`
	KustomizationPath string                      `json:"kustomizationPath,omitempty"`
	Secret            map[interface{}]interface{} `json:"-"`
}

type ApplicationValue

type ApplicationValue struct {
	Name       string      `json:"name"`
	Required   bool        `json:"required,omitempty"`
	Repository string      `json:"repository,omitempty"`
	Path       string      `json:"path,omitempty"`
	Keys       []string    `json:"keys,omitempty"`
	Value      interface{} `json:"value,omitempty"`
}

type CloneOptions

type CloneOptions struct {
	URL            string
	RepositoryName string
	Owner          string
	TransportType  gitprovider.TransportType
	Branch         string
	Sha            string
	Username       string
	Password       string
	PrivateKeyFile string
	Timeout        time.Duration
	Personal       bool
	Description    string
	Visibility     string
	Reconcile      bool
	Teams          map[string]string
	ReadWriteKey   bool
	CaBundle       []byte
	SshHostname    string
	Provider       gitprovider.Client
}

type ClusterConfig

type ClusterConfig struct {
	Repository    string        `json:"repository"`
	Sha           string        `json:"sha"`
	AgeKey        string        `json:"ageKey,omitempty"`
	SopsAgeSecret string        `json:"sopsAgeSecret,omitempty"`
	Applications  []Application `json:"applications,omitempty"`
}

func NewClusterConfig

func NewClusterConfig(repository string, sha string) *ClusterConfig

func OpenClusterConfig

func OpenClusterConfig(path string) (*ClusterConfig, error)

func (*ClusterConfig) AddApplication

func (c *ClusterConfig) AddApplication(repository Repository, applicationConfig *ApplicationConfig)

func (*ClusterConfig) GetApplicationConfig

func (c *ClusterConfig) GetApplicationConfig(name string) (ApplicationConfig, error)

func (*ClusterConfig) GetApplicationRepository

func (c *ClusterConfig) GetApplicationRepository(name string) (Repository, error)

func (*ClusterConfig) RemoveApplication

func (c *ClusterConfig) RemoveApplication(name string)

func (*ClusterConfig) Save

func (c *ClusterConfig) Save(path string) error

type ClusterRepo

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

func CloneClusterRepo

func CloneClusterRepo(options *CloneOptions, status *cli.Status) (*ClusterRepo, error)

func (*ClusterRepo) AddApplication

func (r *ClusterRepo) AddApplication(
	URL string,
	branch string,
	provider string,
	destinationPrivate bool,
	applicationConfig *ApplicationConfig,
	clusterRole bool,
	decryptionSecret string,
	path string,
	sourceSecretOptions *yaml.SourceSecretOptions,
	status *cli.Status,
) (string, error)

func (*ClusterRepo) CommitPush

func (r *ClusterRepo) CommitPush(
	authorName string,
	authorEmail string,
	message string,
	destinationUrl string,
	destinationBranch string,
	timeout time.Duration,
	status *cli.Status,
) error

func (*ClusterRepo) Config

func (r *ClusterRepo) Config() *ClusterConfig

func (*ClusterRepo) ConfigureSecretManagement

func (r *ClusterRepo) ConfigureSecretManagement(secretName string, output string, path string, status *cli.Status) error

func (*ClusterRepo) Git

func (r *ClusterRepo) Git() *gogit.GoGit

func (*ClusterRepo) NewClusterConfig

func (r *ClusterRepo) NewClusterConfig(repository string, sha string, status *cli.Status) error

func (*ClusterRepo) OpenClusterConfig

func (r *ClusterRepo) OpenClusterConfig(status *cli.Status) error

func (*ClusterRepo) RefreshApplication

func (r *ClusterRepo) RefreshApplication(name string, applicationConfig *ApplicationConfig, status *cli.Status) error

func (*ClusterRepo) RemoveApplication

func (r *ClusterRepo) RemoveApplication(name string, status *cli.Status) error

func (*ClusterRepo) SaveClusterConfig

func (r *ClusterRepo) SaveClusterConfig() error

type ClusterValue

type ClusterValue struct {
	Name        string      `json:"name"`
	Required    bool        `json:"required,omitempty"`
	Description string      `json:"description,omitempty"`
	Print       bool        `json:"print,omitempty"`
	Template    string      `json:"template,omitempty"`
	Value       interface{} `json:"value,omitempty"`
}

type Configuration

type Configuration struct {
	Repository string `json:"repository"`
	Sha        string `json:"sha"`
}

type CreateOptions

type CreateOptions struct {
	RepositoryName string
	Owner          string
	TransportType  gitprovider.TransportType
	Branch         string
	Timeout        time.Duration
	Personal       bool
	Description    string
	Visibility     string
	Reconcile      bool
	Teams          map[string]string
	SshHostname    string
	Provider       gitprovider.Client
}

type Encryption

type Encryption struct {
	Enabled    bool     `json:"enabled,omitempty"`
	InputPaths []string `json:"inputPaths,omitempty"`
}

type Password

type Password struct {
	Name        string      `json:"name"`
	Description string      `json:"description,omitempty"`
	Print       bool        `json:"print,omitempty"`
	Lenght      int         `json:"length,omitempty"`
	NumDigits   int         `json:"numDigits,omitempty"`
	NumSymbols  int         `json:"numSymbols,omitempty"`
	NoUpper     bool        `json:"noUpper,omitempty"`
	AllowRepeat bool        `json:"allowRepeat,omitempty"`
	Base64      bool        `json:"base64,omitempty"`
	Value       interface{} `json:"value,omitempty"`
}

type Repository

type Repository struct {
	URL    string `json:"url,omitempty"`
	Owner  string `json:"owner,omitempty"`
	Name   string `json:"name,omitempty"`
	Branch string `json:"branch,omitempty"`
	Path   string `json:"path,omitempty"`
}

func CreateRepository

func CreateRepository(URL, branch, provider, path string) (Repository, error)

type UserValue

type UserValue struct {
	Name     string      `json:"name"`
	Required bool        `json:"required,omitempty"`
	Value    interface{} `json:"value,omitempty"`
}

type Values

type Values struct {
	ApplicationDependencies []ApplicationDependency `json:"applicationDependencies,omitempty"`
	UserValues              []UserValue             `json:"userValues,omitempty"`
	ClusterValues           []ClusterValue          `json:"clusterValues,omitempty"`
	ApplicationValues       []ApplicationValue      `json:"applicationValues,omitempty"`
	ApplicationSecrets      []ApplicationSecret     `json:"applicationSecrets,omitempty"`
	Passwords               []Password              `json:"passwords,omitempty"`
}

Jump to

Keyboard shortcuts

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