buildingblocks

package
v0.20.6 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateConfigDoc added in v0.17.0

func CreateConfigDoc(pathToBB, pathToValues, pathToBestPractices string) ([]byte, error)

func CreateJobEnvironment added in v0.18.0

func CreateJobEnvironment(bbProjectID int, bbVersion string, environment string, ciTemplatesVersion string) ([]byte, error)

CreateJobEnvironment will generate the job template for the given building block defined by the arguments, fully extended for the specified environment Output: JobEnvironment

func CreateJobTemplate added in v0.18.0

func CreateJobTemplate(bbProjectID int, bbVersion string) ([]byte, error)

CreateJobTemplate will generate the job template for the given building block defined by the arguments Output: JobTemplate

func CreateValueFiles added in v0.17.0

func CreateValueFiles(pathToHelmfile, pathToValues string)

CreateValueFiles requires helmfile's path as input It parses the helmfiles and creates a directory with all the value files from the upstream helm charts

func GenerateK3sYaml added in v0.19.0

func GenerateK3sYaml(versions []string, defaultVersion string) []byte

GenerateK3sYaml creates the k3s.yaml references for gitlab-ci-templates including the k3s versions matrix and the default k3s version

func GenerateReadme added in v0.19.0

func GenerateReadme(bbName string, k8sVersions []string, docsPage string, upstreamComponents string, customNotes string, helmChartConfig string) ([]byte, error)

This functions generates a BB's readme

func GenerateUpstreamComponentsTables added in v0.20.0

func GenerateUpstreamComponentsTables(pathToHelmfile string, pathToImagesTxt string) ([]byte, error)

GenerateUpstreamComponentsTables generates a markdown file for a building block that includes a table for each upstream component used by it with their versions: helm charts and docker images

func GetDefault added in v0.19.0

func GetDefault(pathToK8sVersions string) string

GetDefault returns the default K8s version defined in k8sVersions.json If the default version doesn't follow the K8s schema (x.yz), the function will fail with the relevant error message Also, the default version needs to be one of the supported versions of the config otherwise the function will fail with the relevant error message

func GetK3sDefaultImage added in v0.19.0

func GetK3sDefaultImage(k8sVersions []string, defaultVersion string) string

GetK3sDefaultImage returns the corresponding k3s image of the given default k8s version

func GetK3sImages added in v0.19.0

func GetK3sImages(k8sVersions []string) []string

GetK3sImages returns the corresponding k3s images to the given k8s versions If there are multiple patch images for one k8s version, the latest patch is chosen If there is no corresponding k3s image for a given k8s version, the function will fail with the relevant message

func GetLocalReleases added in v0.20.0

func GetLocalReleases(pathToHelmfile string) []string

GetLocalReleases returns the list of local helmfile's releases in the order they appear in helmfile

func GetReleases added in v0.17.0

func GetReleases(pathToHelmfile string) []string

GetReleases returns the list of helmfile's releases in the order they appear in helmfile

func GetTags added in v0.15.3

func GetTags(pID int) (s []string)

returns the list of tags for the given gitlab project.

func GetUpstreamComponentsJson added in v0.20.0

func GetUpstreamComponentsJson(pathToHelmfile string, pathToImagesTxt string) ([]byte, error)

GetUpstreamComponentsJson generates a json file for a building block that includes all the upstream components used by it with their versions: helm charts and docker images

func GetVersions added in v0.19.0

func GetVersions(pathToK8sVersions string) []string

GetVersions returns the list of k8sVersions.json versions in the order they appear in the file If a version of the config doesn't follow the K8s schema (x.yz), the function will fail with the relevant error message

func RenderHelmfile added in v0.17.0

func RenderHelmfile(path string) []byte

renderHelmfile requires helmfile's path as input its content is treated as a gotemplate, which is executed and the result returned

func SortTags added in v0.15.3

func SortTags(versions []string) v.Collection

sorts a list of semantic versions, ascending.

func UpdateScript added in v0.15.0

func UpdateScript(versionFrom, versionTo string, p *RepoRef) ([]byte, error)

UpdateScript will generate a script containing a series of update scripts if there are any for the update of one version (versionFrom) to another (versionTo) of the given building block project ref.

Types

type BuildingBlock added in v0.18.0

type BuildingBlock struct {
	Name      string
	Version   string
	ProjectID int
}

type DockerImages added in v0.20.0

type DockerImages struct {
	Repository string `json:"repository"`
	Tag        string `json:"tag"`
}

Docker Images struct

type HelmChart added in v0.20.0

type HelmChart struct {
	RepoUrl string `json:"repo-url"`
	Name    string `json:"name"`
	Version string `json:"version"`
}

Helm Chart struct

type HelmDefaults added in v0.17.0

type HelmDefaults struct {
	Timeout int  `yaml:"timeout"`
	Wait    bool `yaml:"wait"`
}

Helmfile HelmDefaults element

type HelmfileConfig added in v0.17.0

type HelmfileConfig struct {
	Repositories []Repository `yaml:"repositories"`
	HelmDefaults HelmDefaults `yaml:"helmDefaults"`
	Releases     []Release    `yaml:"releases"`
}

Helmfile top level elements.

type Hook added in v0.17.0

type Hook struct {
	Command string   `yaml:"command"`
	Args    []string `yaml:"args"`
	Events  []string `yaml:"events"`
}

Helmfile Hook element

type K3sJson added in v0.19.0

type K3sJson []struct {
	Name string `json:"name"`
}

k3s container registry json

type K3sVersions added in v0.19.0

type K3sVersions struct {
	Matrix []Matrix `yaml:"matrix"`
}

K3sVersions element

type K3sYaml added in v0.19.0

type K3sYaml struct {
	Variables Variables `yaml:".variables"`
	Parallel  Parallel  `yaml:".parallel"`
}

k3s.yaml into struct k3s top level elements.

type K8sVersionsConfig added in v0.19.0

type K8sVersionsConfig struct {
	K8sVersions []string `json:"K8sVersions"`
	Default     string   `json:"Default"`
}

k8sVersions.json into struct

type Matrix added in v0.19.0

type Matrix struct {
	K3sVersion []string `yaml:"K3S_VERSION"`
}

Matrix element

type Parallel added in v0.19.0

type Parallel struct {
	K3sVersions K3sVersions `yaml:"k3s_versions"`
}

Parallel element (Helm Charts)

type Release added in v0.17.0

type Release struct {
	Name               string   `yaml:"name"`
	Namespace          string   `yaml:"namespace"`
	Chart              string   `yaml:"chart"`
	Version            string   `yaml:"version"`
	DisableValidation  bool     `yaml:"disableValidation"`
	MissingFileHandler string   `yaml:"missingFileHandler"`
	Values             []string `yaml:"values"`
	Hooks              []Hook   `yaml:"hooks"`
	Needs              []string `yaml:"needs"`
}

Helmfile Release element (Helm Charts)

type RepoRef added in v0.15.0

type RepoRef struct {
	ID  int
	Ref string
}

type Repository added in v0.17.0

type Repository struct {
	Name string `yaml:"name"`
	Url  string `yaml:"url"`
}

Helmfile Repository element

type UpstreamComponents added in v0.20.0

type UpstreamComponents struct {
	HelmChart    []HelmChart    `json:"helm-charts"`
	DockerImages []DockerImages `json:"docker-images"`
}

Upstream components struct

type Variables added in v0.19.0

type Variables struct {
	DefaultVersion string `yaml:"DEFAULT_K3S_VERSION"`
}

Variables element

Jump to

Keyboard shortcuts

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