env

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ComponentsExtCodeKey is the ExtCode key for component imports
	ComponentsExtCodeKey = "__ksonnet/components"
)
View Source
const (
	// DefaultEnvName is the name of the default environment.
	DefaultEnvName = "default"
)

Variables

View Source
var DefaultBaseData = []byte(`local components = std.extVar("` + ComponentsExtCodeKey + `");
components + {
  // Insert user-specified overrides here.
}
`)

DefaultBaseData generates environment `base.libsonnet`.

View Source
var DefaultGlobalsData = []byte(`{
}`)

DefaultGlobalsData generates the contents for an environment's `globals.libsonnet`

View Source
var DefaultOverrideData = []byte(`local base = import "base.libsonnet";
// uncomment if you reference ksonnet-lib
// local k = import "k.libsonnet";

base + {
  // Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
  // "nginx-deployment"+: k.deployment.mixin.metadata.labels({foo: "bar"})
}
`)

DefaultOverrideData generates the contents for an environment's `main.jsonnet`.

View Source
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

func AddExtVarFile(a app.App, key, filePath string) error

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

func AddTlaVarFile(a app.App, key, filePath string) error

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 Delete

func Delete(a app.App, name string, override bool) error

Delete deletes an environment.

func DeleteParam

func DeleteParam(a app.App, envName, componentName, paramName string) error

DeleteParam deletes a param in an environment.

func Evaluate

func Evaluate(a app.App, envName, components, paramsStr string) (string, error)

Evaluate evaluates an environment.

func GetParams

func GetParams(envName, module string, config GetParamsConfig) (map[string]param.Params, error)

GetParams gets all parameters for an environment.

func MainFile

func MainFile(a app.App, envName string) (string, error)

MainFile returns the contents of the environment's main source.

func Path

func Path(a app.App, envName string, path ...string) (string, error)

func Rename

func Rename(a app.App, from, to string, override bool) error

Rename renames an environment

func SetGlobalParams

func SetGlobalParams(a app.App, envName string, p param.Params) error

SetGlobalParams sets global params for an environment.

func SetParams

func SetParams(envName, component string, p param.Params, config SetParamsConfig) error

SetParams sets params for an environment.

func UnsetGlobalParams

func UnsetGlobalParams(a app.App, envName, paramName string) error

UnsetGlobalParams un-sets global param 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

type GetParamsConfig struct {
	App app.App
}

GetParamsConfig is config items for getting environment params.

type SetParamsConfig

type SetParamsConfig struct {
	App app.App
}

SetParamsConfig is config items for setting environment params.

Jump to

Keyboard shortcuts

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