kr8_init

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package kr8_init contains logic for initializing a kr8+ starter repo. It is able to generate starter configs for components, clusters, and full repos.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateChartJsonnet added in v0.0.8

func GenerateChartJsonnet(
	compJson kr8_types.Kr8ComponentJsonnet,
	componentOptions Kr8InitOptions,
	folderDir string,
) error

Generates a jsonnet files that references a local helm chart.

func GenerateChartTaskfile added in v0.0.8

func GenerateChartTaskfile(
	comp kr8_types.Kr8ComponentJsonnet,
	componentOptions Kr8InitOptions,
	folderDir string,
) error

Generates a go-task taskfile that's setup to download a helm chart into a local `vendor` directory.

func GenerateClusterJsonnet

func GenerateClusterJsonnet(cSpec kr8_types.Kr8ClusterSpec, dstDir string) error

Generate a cluster.jsonnet file based on the provided Kr8ClusterSpec and store it in the specified directory.

func GenerateComponentJsonnet

func GenerateComponentJsonnet(componentOptions Kr8InitOptions, dstDir string) error

Generate default component kr8_spec values and store in params.jsonnet. Based on the type:

jsonnet: create a component.jsonnet file and reference it from the params.jsonnet file

yml: leave a note in the params.jsonnet file about where and how the yml files can be referenced

chart: generate a simple taskfile that handles vendoring the chart data

func GenerateLib

func GenerateLib(fetch bool, dstDir string) error

Downloads a starter kr8 jsonnet lib from github. If fetch is true, downloads the repo in the /lib directory. If false, prints the git commands to run. Repo: https://github.com/ice-bergtech/kr8-libsonnet . return util.FetchRepoUrl("https://github.com/ice-bergtech/kr8-libsonnet", dstDir+"/kr8-lib", !fetch).

func GenerateReadme

func GenerateReadme(dstDir string, cmdOptions Kr8InitOptions, clusterSpec kr8_types.Kr8ClusterSpec) error

Generates a starter readme for the repo, and writes it to the destination directory.

func InitComponentChart added in v0.0.8

func InitComponentChart(dstDir string, componentOptions Kr8InitOptions, compJson kr8_types.Kr8ComponentJsonnet) error

Initializes the basic parts of a helm chart component.

func InitComponentJsonnet added in v0.0.8

func InitComponentJsonnet(
	compJson kr8_types.Kr8ComponentJsonnet,
	dstDir string,
	componentOptions Kr8InitOptions,
) error

Initializes the basic parts of a jsonnet-based component.

func InitComponentTemplate added in v0.0.8

func InitComponentTemplate(
	compJson kr8_types.Kr8ComponentJsonnet,
	dstDir string,
	componentOptions Kr8InitOptions,
) error

Initializes the based parts of a template-based component.

func InitComponentYaml added in v0.0.8

func InitComponentYaml(compJson kr8_types.Kr8ComponentJsonnet, dstDir string, componentOptions Kr8InitOptions) error

Initializes the basic parts of a yaml-based component.

Types

type Kr8InitOptions

type Kr8InitOptions struct {
	// URL to fetch the skeleton directory from
	InitUrl string
	// Name of the cluster to initialize
	ClusterName string
	// Name of the component to initialize
	ComponentName string
	// Type of component to initialize (e.g. jsonnet, yml, chart, compose)
	ComponentType string
	// Determines whether to run in interactive mode
	Interactive bool
	// Determines whether to fetch remote resources
	Fetch bool
}

Kr8InitOptions defines the options used by the init subcommands.

Jump to

Keyboard shortcuts

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