Documentation ¶
Index ¶
- Constants
- Variables
- func CreateConfigDoc(pathToHelmfile string) ([]byte, error)
- func CreateDefaultValueFiles(pathToHelmfile, pathToValues string)
- func CreateJobEnvironment(bbProjectID int, bbVersion string, environment string, ...) ([]byte, error)
- func CreateJobTemplate(bbProjectID int, bbVersion string) ([]byte, error)
- func GenerateK3sYaml(versions []string, defaultVersion string) []byte
- func GenerateK8sVersionsConfigFile() []byte
- func GenerateLicenseFile(pathToLicensesJson string) ([]byte, error)
- func GenerateLicensesJson(pathToHelmfile string, pathToTemplate string) ([]byte, error)
- func GenerateReadme(bbName string, k8sVersions []string, docsPage string, ...) ([]byte, error)
- func GenerateUpstreamComponentsTables(pathToHelmfile string) ([]byte, error)
- func GetDefault(pathToK8sVersions string) string
- func GetK3sDefaultImage(k8sVersions []string, defaultVersion string) string
- func GetK3sImages(k8sVersions []string) []string
- func GetNamespaceWithAnnotations(pathToKubeconfig string, bbProjectID int) (string, map[string]string, error)
- func GetTags(pID int) (s []string)
- func GetUpstreamComponentsJson(pathToHelmfile string) ([]byte, error)
- func GetVersions(pathToK8sVersions string) []string
- func InitializeLicensesJsonTmpl(pathToHelmfile string) ([]byte, error)
- func SortTags(versions []string) v.Collection
- func UpdateScript(versionFrom, versionTo string, p *RepoRef) ([]byte, error)
- type BuildingBlock
- type ChartValueOpts
- type ChartValues
- type Component
- type ComponentInfo
- type DockerImages
- type HelmChart
- type Helmfile
- type HelmfileHelmDefaults
- type HelmfileRelease
- type HelmfileReleaseHook
- type HelmfileRepository
- type K3sJson
- type K3sVersions
- type K3sYaml
- type K8sJson
- type K8sVersionsConfig
- type License
- type Matrix
- type Parallel
- type ReleaseValues
- func (vals *ReleaseValues) AllExtraValues(release string) []byte
- func (vals *ReleaseValues) Consolidated() (*ReleaseValues, error)
- func (vals *ReleaseValues) Filter(predicate func(*ChartValues) bool) *ReleaseValues
- func (vals *ReleaseValues) Releases() []string
- func (vals *ReleaseValues) Write(dir string)
- type RepoRef
- type UpstreamComponents
- type Variables
Constants ¶
const (
GitProtocolPrefix = "git+"
)
Variables ¶
var ( // to signal empty result sets ErrNoResult = errors.New("nothing found") )
var LICENSETmpl string
Functions ¶
func CreateConfigDoc ¶ added in v0.17.0
TODO refactor
func CreateDefaultValueFiles ¶ added in v0.25.0
func CreateDefaultValueFiles(pathToHelmfile, pathToValues string)
Creates dir with all chart value files including only the default values. NB: side-effects (filesystem, panics)
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
CreateJobTemplate will generate the job template for the given building block defined by the arguments Output: JobTemplate
func GenerateK3sYaml ¶ added in v0.19.0
GenerateK3sYaml creates the k3s.yaml references for gitlab-ci-templates including the k3s versions matrix and the default k3s version
func GenerateK8sVersionsConfigFile ¶ added in v0.25.5
func GenerateK8sVersionsConfigFile() []byte
Create k8sVersions.json file based on the metakube supported versions
func GenerateLicenseFile ¶ added in v0.23.0
Generate bb's LICENSE file according to licenses.json of each bb
func GenerateLicensesJson ¶ added in v0.23.0
Generates licenses.json out of the given bb's helmfile, images and template
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
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
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
GetK3sDefaultImage returns the corresponding k3s image of the given default k8s version
func GetK3sImages ¶ added in v0.19.0
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 GetNamespaceWithAnnotations ¶ added in v0.21.0
func GetNamespaceWithAnnotations(pathToKubeconfig string, bbProjectID int) (string, map[string]string, error)
GetNamespaceWithAnnotations will return the following info about the requested namespace: * Name: according to env vars set * Annotations: Any annotations attached to the namespace (atm, bbs have project-id and version) * Error: Error on extracting information NOTE 1 Error alone does not indicate the non-existence of the namespace The non-existence of namespace can be caught by checking the error AND the name of ns whether it's "" or not NOTE 2: The function was created to be executed from within control-repo's bb jobs (diff/deploy) So the namespace depends on the env vars set on these jobs
func GetUpstreamComponentsJson ¶ added in v0.20.0
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
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 InitializeLicensesJsonTmpl ¶ added in v0.23.1
Generates initial licenses.json.tmpl out of the given bb's helmfile, images This is a starting point to add the licenses information for a bb
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
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 ChartValueOpts ¶ added in v0.25.0
type ChartValueOpts struct { NoDefaults, NoReleaseValues, NoReduce bool }
for controlling chart value creation or filtering
type ChartValues ¶ added in v0.24.0
encapsulates chart values
type ComponentInfo ¶ added in v0.23.0
type ComponentInfo struct { Name string `json:"component"` Version string `json:"version"` SpdxLicenseID string `json:"spdx-licenseId"` LicenseText string `json:"license"` Source string `json:"source"` }
Component info of licenses.json
type DockerImages ¶ added in v0.20.0
type DockerImages struct { Component string `json:"component"` Repository string `json:"repository"` Tag string `json:"tag"` }
Docker Images struct
type HelmChart ¶ added in v0.20.0
type HelmChart struct { Component string `json:"component"` RepoUrl string `json:"repoUrl"` Name string `json:"name"` Version string `json:"version"` }
Helm Chart struct
type Helmfile ¶ added in v0.25.0
type Helmfile struct { Repositories []HelmfileRepository `yaml:"repositories"` HelmDefaults HelmfileHelmDefaults `yaml:"helmDefaults"` Values []any `yaml:"values"` Releases []HelmfileRelease `yaml:"releases"` }
Helmfile top level elements.
func PrepareHelmfile ¶ added in v0.25.0
type HelmfileHelmDefaults ¶ added in v0.25.0
Helmfile HelmfileHelmDefaults element.
type HelmfileRelease ¶ added in v0.25.0
type HelmfileRelease 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 []HelmfileReleaseHook `yaml:"hooks"` Needs []string `yaml:"needs"` }
Helmfile HelmfileRelease element (Helm Charts).
func (*HelmfileRelease) ExtraChartValues ¶ added in v0.25.0
func (r *HelmfileRelease) ExtraChartValues(pathToHelmfile string, hfValues map[string]any) (ReleaseValues, error)
will render extra chart golang template value files for the given helmfile path and optional helmfile values to take into account for template rendering.
func (*HelmfileRelease) LocalChartValues ¶ added in v0.25.0
func (r *HelmfileRelease) LocalChartValues(pathToHelmfile string) (ReleaseValues, error)
type HelmfileReleaseHook ¶ added in v0.25.0
type HelmfileReleaseHook struct { Command string `yaml:"command"` Args []string `yaml:"args"` Events []string `yaml:"events"` }
Helmfile HelmfileReleaseHook element.
type HelmfileRepository ¶ added in v0.25.0
Helmfile HelmfileRepository 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 ReleaseValues ¶ added in v0.24.0
type ReleaseValues []*ChartValues
encapsulates collections of chart values
func GenerateChartValues ¶ added in v0.25.0
func GenerateChartValues(pathToHelmfile string, opts ...*ChartValueOpts) (*ReleaseValues, error)
generates all possible chart values for the given helmfile the result is consolidated by default skip fetching chart default values via optional NoDefaults skip fetching chart extra values via optional NoReleaseValues skip value consolidation via optional NoReduce
func (*ReleaseValues) AllExtraValues ¶ added in v0.25.0
func (vals *ReleaseValues) AllExtraValues(release string) []byte
returns the combined content of all extra values for the given release name.
func (*ReleaseValues) Consolidated ¶ added in v0.25.0
func (vals *ReleaseValues) Consolidated() (*ReleaseValues, error)
consolidates values for the same release into one chart value object, returns a copy of this instance
func (*ReleaseValues) Filter ¶ added in v0.25.0
func (vals *ReleaseValues) Filter(predicate func(*ChartValues) bool) *ReleaseValues
Filter returns the subset of this release values object according to the provided predicate.
func (*ReleaseValues) Releases ¶ added in v0.25.0
func (vals *ReleaseValues) Releases() []string
returns the list of (unique) release names for the given set of chart values.
func (*ReleaseValues) Write ¶ added in v0.24.0
func (vals *ReleaseValues) Write(dir string)
writes all chart values to their respective (value) files within dir
type UpstreamComponents ¶ added in v0.20.0
type UpstreamComponents struct { HelmChart []HelmChart `json:"helmCharts"` DockerImages []DockerImages `json:"dockerImages"` }
Upstream components struct