render

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const InstallationStepLabel = "service-mesh-hub.solo.io/installation_step"

Variables

View Source
var (
	NilFlavorError = errors.Errorf("flavor name cannot be nil")

	ExpectedAtMostError = func(item string, desired, found int) error {
		return errors.Errorf("expected at most %d %s, found %d", desired, item, found)
	}

	NoFlavorFoundError = func(name string) error {
		return errors.Errorf("could not find flavor with name: %s", name)
	}
)
View Source
var (
	UnknownLayerTypeError = func(layer *hubv1.Layer) error {
		return errors.Errorf("unknown layer type specified %T", layer.GetType())
	}
	FailedToCalculateValues = func(err error) error {
		return errors.Wrapf(err, "failed to calculate values for layer rendering")
	}
)
View Source
var (
	MissingInstallSpecError = errors.Errorf("missing installation spec")

	FailedToRenderManifestsError = func(err error) error {
		return errors.Wrapf(err, "error rendering manifests")
	}

	FailedToConvertManifestsError = func(err error) error {
		return errors.Wrapf(err, "error converting manifests to raw resources")
	}

	FailedRenderValueTemplatesError = func(err error) error {
		return errors.Wrapf(err, "error rendering input value templates")
	}
)
View Source
var (
	UnableToParseParameterError = func(err error, key, value string) error {
		return errors.Wrapf(err, "Unable to parse parameter with key '%s' and value '%s'", key, value)
	}

	UnableToParseYamlError = func(err error, input string) error {
		return errors.Wrapf(err, "Unable to parse yaml string: %s", input)
	}

	UnableToMarshalYamlError = func(err error, input map[string]interface{}) error {
		return errors.Wrapf(err, "Unable to marshal map to yaml: %v", input)
	}
)

Functions

func ApplyLayers

func ApplyLayers(ctx context.Context, inputs ValuesInputs, installedFlavor *hubv1.Flavor, manifests helmchart.Manifests) (kuberesource.UnstructuredResources, error)

func CoalesceValuesMap

func CoalesceValuesMap(ctx context.Context, initial map[string]interface{}, overrides map[string]interface{}) map[string]interface{}

func ComputeValueOverrides

func ComputeValueOverrides(ctx context.Context, inputs ValuesInputs) (string, error)

Coalesces spec values yaml, params, and user-defined values yaml. User defined values override params which override spec values. If there is an error parsing, it is logged and propagated.

func ConvertNestedMapToYaml

func ConvertNestedMapToYaml(nestedMap map[string]interface{}) (string, error)

func ConvertParamsToNestedMap

func ConvertParamsToNestedMap(params map[string]string) (map[string]interface{}, error)

func ConvertYamlStringToNestedMap

func ConvertYamlStringToNestedMap(yamlString string) (map[string]interface{}, error)

func GetInstalledFlavor

func GetInstalledFlavor(name string, flavors []*v1.Flavor) (*v1.Flavor, error)

func GetManifestsFromApplicationSpec

func GetManifestsFromApplicationSpec(ctx context.Context, inputs ValuesInputs, spec *hubv1.VersionedApplicationSpec) (helmchart.Manifests, error)

func GetResourcesFromManifests

func GetResourcesFromManifests(ctx context.Context, manifests helmchart.Manifests) (kuberesource.UnstructuredResources, error)

func YamlToResources

func YamlToResources(yamlBytes []byte) (kuberesource.UnstructuredResources, error)

Types

type SuperglooInfo

type SuperglooInfo struct {
	Namespace          string
	ServiceAccountName string
	ClusterRoleName    string
}

type ValuesInputs

type ValuesInputs struct {
	Name               string
	InstallNamespace   string
	FlavorName         string
	MeshRef            core.ResourceRef
	SuperglooNamespace string

	UserDefinedValues string
	FlavorParams      map[string]string
	SpecDefinedValues string

	// TODO: remove old value (SuperglooNamespace) after new ones have been wired on the marketplace side
	Supergloo SuperglooInfo
}

func ExecInputValuesTemplates

func ExecInputValuesTemplates(inputs ValuesInputs) (ValuesInputs, error)

The SpecDefinedValues, UserDefinedValues, and FlavorParams inputs can contain template actions (text delimited by "{{" and "}}" ). This function renders the contents of these parameters using the data contained in 'input' and updates 'input' with the results.

Jump to

Keyboard shortcuts

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