Documentation ¶
Index ¶
- Constants
- Variables
- func AddExtVar(key, value string)
- func AddExtVarFile(fs afero.Fs, key, filePath string) error
- func AddJPaths(paths ...string)
- func AddTlaVar(key, value string)
- func AddTlaVarFile(fs afero.Fs, key, filePath string) error
- func Create(a app.App, d Destination, name, k8sSpecFlag string, ...) error
- func Delete(a app.App, name string, override bool) error
- func DeleteParam(a app.App, envName, componentName, paramName string) error
- func Evaluate(a app.App, envName, components, paramsStr string, opts ...jsonnet.VMOpt) (string, error)
- func GetParams(envName, module string, config GetParamsConfig) (map[string]param.Params, error)
- func MainFile(a app.App, envName string) (string, error)
- func Path(a app.App, envName string, path ...string) (string, error)
- func Rename(a app.App, from, to string, override bool) error
- func SetGlobalParams(a app.App, envName string, p param.Params) error
- func SetParams(envName, component string, p param.Params, config SetParamsConfig) error
- func UnsetGlobalParams(a app.App, envName, paramName string) error
- type Destination
- type GetParamsConfig
- type SetParamsConfig
Constants ¶
const (
// ComponentsExtCodeKey is the ExtCode key for component imports
ComponentsExtCodeKey = "__ksonnet/components"
)
const (
// DefaultEnvName is the name of the default environment.
DefaultEnvName = "default"
)
Variables ¶
var DefaultBaseData = []byte(`local components = std.extVar("` + ComponentsExtCodeKey + `");
components + {
// Insert user-specified overrides here.
}
`)
DefaultBaseData generates environment `base.libsonnet`.
var DefaultGlobalsData = []byte(`{
}`)
DefaultGlobalsData generates the contents for an environment's `globals.libsonnet`
var DefaultOverrideData = []byte(`local base = import "base.libsonnet";
// uncomment if you reference ksonnet-lib
// local k = import "k.libsonnet";
// local deployment = k.apps.v1beta2.deployment;
base + {
// Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
// "nginx-deployment"+: deployment.mixin.metadata.withLabels({foo: "bar"})
}
`)
DefaultOverrideData generates the contents for an environment's `main.jsonnet`.
var DefaultParamsData = []byte(`local params = std.extVar("__ksonnet/params");
local globals = import "globals.libsonnet";
local envParams = params + {
components +: {
// Insert component parameter overrides here. Ex:
// guestbook +: {
// name: "guestbook-dev",
// replicas: params.global.replicas,
// },
},
};
{
components: {
[x]: envParams.components[x] + globals, for x in std.objectFields(envParams.components)
},
}
`)
DefaultParamsData generates the contents for an environment's `params.libsonnet`
Functions ¶
func AddExtVar ¶
func AddExtVar(key, value string)
AddExtVar adds an ext var to a component evaluation.
func AddExtVarFile ¶
AddExtVarFile adds an ext var from a file to component evaluation.
func AddJPaths ¶
func AddJPaths(paths ...string)
AddJPaths adds paths to JPath for a component evaluation.
func AddTlaVar ¶
func AddTlaVar(key, value string)
AddTlaVar adds a tla var to a component evaluation.
func AddTlaVarFile ¶
AddTlaVarFile adds a tla var from a file to component evaluation.
func Create ¶
func Create(a app.App, d Destination, name, k8sSpecFlag string, overrideData, paramsData []byte, isOverride bool) error
Create creates a new environment for the project.
func DeleteParam ¶
DeleteParam deletes a param in an environment.
func Evaluate ¶
func Evaluate(a app.App, envName, components, paramsStr string, opts ...jsonnet.VMOpt) (string, error)
Evaluate evaluates an environment.
func GetParams ¶
GetParams gets all parameters for an environment. TODO: this isn't referenced anywhere
func SetGlobalParams ¶
SetGlobalParams sets global params for an environment.
Types ¶
type Destination ¶
type Destination struct {
// contains filtered or unexported fields
}
Destination contains destination information for a cluster.
func NewDestination ¶
func NewDestination(server, namespace string) Destination
NewDestination creates an instance of Destination.
func (*Destination) MarshalJSON ¶
func (d *Destination) MarshalJSON() ([]byte, error)
MarshalJSON marshals a Destination to JSON.
func (*Destination) Namespace ¶
func (d *Destination) Namespace() string
Namespace is the namespace of the Kubernetes server that targets should be deployed.
func (*Destination) Server ¶
func (d *Destination) Server() string
Server is URL to the Kubernetes server that the cluster is running on.
type GetParamsConfig ¶
GetParamsConfig is config items for getting environment params.
type SetParamsConfig ¶
SetParamsConfig is config items for setting environment params.