metagraf

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Store added in v0.0.16

func Store(filepath string, mg *MetaGraf)

Types

type Config

type Config struct {
	Name        string        `json:"name"`
	Type        string        `json:"type"`
	Global      bool          `json:"global,omitempty"`
	Description string        `json:"description,omitempty"`
	Options     []ConfigParam `json:"options,omitempty"`
}

type ConfigParam

type ConfigParam struct {
	Name        string `json:"name"`
	Required    bool   `json:"required"`
	Dynamic     bool   `json:"dynamic,omitempty"`
	Description string `json:"description"`
	Type        string `json:"type"`
	Default     string `json:"default"`
	SecretFrom  string `json:"secretfrom,omitempty"` // References a value from a k8s secret resource
}

type EnvironmentVar

type EnvironmentVar struct {
	Name        string `json:"name"`
	Required    bool   `json:"required"`
	Type        string `json:"type,omitempty"`
	EnvFrom     string `json:"envfrom,omitempty"`    // Looks for a globally named configmap.
	SecretFrom  string `json:"secretfrom,omitempty"` // References a k8s Secret resource.
	Description string `json:"description"`
	Default     string `json:"default,omitempty"`
	Example     string `json:"example,omitempty"`
}

type MGVars

type MGVars map[string]string

Map to hold all variables from a specification

type MetaGraf

type MetaGraf struct {
	Kind     string `json:"kind"`
	Metadata struct {
		Name              string            `json:"name"`
		ResourceVersion   string            `json:"resourceversion"`
		Namespace         string            `json:"namespace"`
		CreationTimestamp string            `json:"creationtimestamp,omitempty"`
		Labels            map[string]string `json:"labels,omitempty"`
		Annotations       map[string]string `json:"annotations,omitempty"`
	} `json:"metadata"`
	Spec struct {
		Type           string   `json:"type"`
		Version        string   `json:"version"`
		Description    string   `json:"description"`
		Repository     string   `json:"repository,omitempty"`
		RepSecRef      string   `json:"repsecref,omitempty"`
		Branch         string   `json:"branch,omitempty"`
		BuildImage     string   `json:"buildimage,omitempty"`     // Builder Image for s2i builds.
		BaseRunImage   string   `json:"baserunimage,omitempty"`   // Runtime Container Image for binary build.
		Image          string   `json:"image,omitempty"`          // Container Image URL, for wrapping upstream images.
		LivenessProbe  v1.Probe `json:"livenessProbe,omitempty"`  // Using the k8s Probe type
		ReadinessProbe v1.Probe `json:"readinessProbe,omitempty"` // Using the k8s Probe type

		Resources   []Resource `json:"resources,omitempty"`
		Environment struct {
			Build    []EnvironmentVar `json:"build,omitempty"`
			Local    []EnvironmentVar `json:"local,omitempty"`
			External struct {
				Introduces []EnvironmentVar `json:"introduces,omitempty"`
				Consumes   []EnvironmentVar `json:"consumes,omitempty"`
			} `json:"external,omitempty"`
		} `json:"environment,omitempty"`
		Config []Config `json:"config,omitempty"`
		Secret []Secret `json:"secret,omitempty"`
	} `json:"spec"`
}

JSON structure for a MetaGraf entity

func Parse

func Parse(filepath string) MetaGraf

func (*MetaGraf) GetConfigByName added in v0.0.18

func (mg *MetaGraf) GetConfigByName(name string) (Config, error)

func (*MetaGraf) GetResourceByName added in v0.0.18

func (mg *MetaGraf) GetResourceByName(name string) (Resource, error)

func (*MetaGraf) GetSecretByName added in v0.0.18

func (mg *MetaGraf) GetSecretByName(name string) (Secret, error)

func (*MetaGraf) GetVars

func (mg *MetaGraf) GetVars() MGVars

Returns a map of all parameterized fields in a metaGraf specification. @todo need to look for parameterized fields in more places?

func (*MetaGraf) GetVarsFromSource added in v0.0.18

func (mg *MetaGraf) GetVarsFromSource(defaults bool) MGVars

type Resource

type Resource struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type"`
	Required    bool   `json:"required"`
	External    bool   `json:"external"`
	Semop       string `json:"semop,omitempty"`  // Semantic operator, how to evaluate version match/requirements.
	Semver      string `json:"semver,omitempty"` // Semantic version to evaluate for attached resource
	EnvRef      string `json:"envref,omitempty"` // Reference an Environment variable

	// Used when we need to generate configuration for connection to the described attached resource.
	Template    string `json:"template,omitempty"`    // Go txt template string for generating resource configuration.
	TemplateRef string `json:"templateref,omitempty"` // ConfigMap Reference, OUTDATED Use ConfigRef
	ConfigRef   string `json:"configref,omitempty"`   // ConfigMap Reference, Replaces TemplateRef which was not a good name.
	User        string `json:"user,omitempty"`
	Secret      string `json:"secret,omitempty"` // k8s Secret reference
}

* Describes attached resources for a component. Ref, 12 factor app.

type Secret added in v0.0.12

type Secret struct {
	Name        string `json:"name"`
	Global      bool   `json:"global,omitempty"`
	Description string `json:"description,omitempty"`
	Value       string `json:"value,omitempty"` // Never use this!
}

Jump to

Keyboard shortcuts

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