Documentation ¶
Index ¶
- Constants
- Variables
- func InitConcept(workdir, name string, conceptType ConceptType) error
- type BoolValueType
- type CRDTarget
- type Concept
- type ConceptIdentifier
- type ConceptInputs
- type ConceptMeta
- type ConceptOrigin
- type ConceptRepoInfo
- type ConceptType
- type File
- type InputType
- type InputTypeIdentifier
- type IntValueType
- type MaintainerInfo
- type MapValueType
- type Render
- type RenderInfoV1
- type RenderMeta
- type RenderOpts
- type RenderValues
- type StringValueType
- type Tags
- type Target
- type TargetType
- type ValueType
- type ValueTypeIdentifier
- type YamlTarget
Constants ¶
View Source
const ( ConceptFileName = "concept.json" // _ (underscore) is specifically not part of this list, as this will be our // replacement character for forming URLs ConceptIdentifierRegex = "^([a-z/\\-123456789]+)@([a-z\\-]+)$" ConceptStringInputType InputTypeIdentifier = "string" ConceptSelectionInputType InputTypeIdentifier = "select" ConceptMapInputType InputTypeIdentifier = "map" ConceptIntInputType InputTypeIdentifier = "int" ConceptBoolInputType InputTypeIdentifier = "bool" ConceptJsonnetType ConceptType = "jsonnet" ConceptJsonnetfile = "jsonnetfile.json" ConceptMainJsonnet = "main.jsonnet" ConceptMakefile = "Makefile" ConceptGitignorefile = ".gitignore" ConceptLibDir = "lib/" ConceptVendorDir = "vendor/" ConceptKlibsonnet = "k.libsonnet" ConceptMainlibsonnet = "main.libsonnet" ConceptRenderFileName = "renderinfo.json" )
Variables ¶
View Source
var ( IsValidConceptIdentifier = regexp.MustCompile(ConceptIdentifierRegex).MatchString JsonnetMainTemplate = []byte(`local lib = import 'lib/main.libsonnet'; // Final JSON Output lib.new(std.extVar("instanceName")) `) JsonnetMainLibTemplate = []byte(`local kausal = import "ksonnet-util/kausal.libsonnet"; local deployment = kausal.apps.v1.deployment; local container = kausal.core.v1.container; local port = kausal.core.v1.containerPort; local service = kausal.core.v1.service; local grafanaDeploy(name) = deployment.new( name=name, replicas=2, containers=[ container.new("grafana", "grafana/grafana") + container.withPorts([port.new("ui", 10330)]), ], ); // Final JSON Object { new(name):: [ grafanaDeploy(name), kausal.util.serviceFor(grafanaDeploy(name)) ] } `) JsonnetLibTemplate = []byte(`(import "github.com/jsonnet-libs/k8s-alpha/1.14/main.libsonnet") + (import "github.com/jsonnet-libs/k8s-alpha/1.14/extensions/kausal-shim.libsonnet") `) JsonnetDepTemplate = []byte(`{ "version": 1, "dependencies": [ { "source": { "git": { "remote": "https://github.com/grafana/jsonnet-libs.git", "subdir": "ksonnet-util" } }, "version": "master" }, { "source": { "git": { "remote": "https://github.com/jsonnet-libs/k8s-alpha.git", "subdir": "1.14" } }, "version": "master" } ], "legacyImports": true } `) JsonnetMakeFile = []byte(`render: kable render -l . -o out/ install: jb install `) JsonnetGitignoreFile = []byte(`out/ `) )
View Source
var RenderNameIsValid = regexp.MustCompile(RenderNameRegexString).MatchString
Functions ¶
func InitConcept ¶
func InitConcept(workdir, name string, conceptType ConceptType) error
Types ¶
type BoolValueType ¶
type BoolValueType bool
func (BoolValueType) String ¶
func (vt BoolValueType) String() string
func (BoolValueType) ValueTypeIdentifier ¶
func (vt BoolValueType) ValueTypeIdentifier() string
type CRDTarget ¶
type CRDTarget struct { }
func (CRDTarget) Render ¶
func (c CRDTarget) Render(path string, vals *RenderValues, cpt ConceptType, single bool) (*Render, error)
func (CRDTarget) TargetName ¶
type Concept ¶
type Concept struct { ApiVersion int `json:"apiVersion"` Type ConceptType `json:"type"` Meta ConceptMeta `json:"metadata"` Inputs ConceptInputs `json:"inputs,omitempty"` }
Concept defines model for Concept.
func GetConcept ¶
func GetRepoConcept ¶
func GetRepoConcept(cid ConceptIdentifier) (*Concept, error)
func (*Concept) UnmarshalJSON ¶ added in v0.7.0
type ConceptIdentifier ¶
type ConceptIdentifier string
func ListConcepts ¶
func ListConcepts() ([]ConceptIdentifier, error)
func NewConceptIdentifier ¶
func NewConceptIdentifier(path, repoid string) ConceptIdentifier
func (ConceptIdentifier) Concept ¶
func (ci ConceptIdentifier) Concept() string
func (ConceptIdentifier) IsValid ¶
func (ci ConceptIdentifier) IsValid() bool
func (ConceptIdentifier) Repo ¶
func (ci ConceptIdentifier) Repo() string
func (ConceptIdentifier) String ¶
func (ci ConceptIdentifier) String() string
type ConceptInputs ¶
type ConceptInputs struct { Mandatory map[string]InputType `json:"mandatory,omitempty"` Optional map[string]InputType `json:"optional,omitempty"` }
ConceptInputs defines model for ConceptInputs.
func (ConceptInputs) All ¶ added in v0.6.0
func (ci ConceptInputs) All() map[string]InputType
type ConceptMeta ¶
type ConceptMeta struct { Name string `json:"name"` Tags Tags `json:"tags,omitempty"` Maintainer MaintainerInfo `json:"maintainer,omitempty"` }
ConceptMeta defines model for ConceptMeta.
type ConceptOrigin ¶
Origin defines the git source of origin
func GetConceptOriginFromRepository ¶ added in v0.8.0
func GetConceptOriginFromRepository(repositoryName string) (*ConceptOrigin, error)
type ConceptRepoInfo ¶
type ConceptType ¶
type ConceptType string
func (ConceptType) IsSupported ¶
func (ct ConceptType) IsSupported() bool
func (ConceptType) String ¶ added in v0.6.0
func (ct ConceptType) String() string
type InputType ¶
type InputType struct { Type InputTypeIdentifier `json:"type"` Options []string `json:"options,omitempty"` }
type InputTypeIdentifier ¶
type InputTypeIdentifier string
func (InputTypeIdentifier) IsValid ¶
func (iti InputTypeIdentifier) IsValid() bool
func (InputTypeIdentifier) String ¶
func (iti InputTypeIdentifier) String() string
type IntValueType ¶
type IntValueType int
func (IntValueType) String ¶
func (vt IntValueType) String() string
func (IntValueType) ValueTypeIdentifier ¶
func (vt IntValueType) ValueTypeIdentifier() string
type MaintainerInfo ¶
func (MaintainerInfo) String ¶
func (mi MaintainerInfo) String() string
type MapValueType ¶
type MapValueType map[string]interface{}
func (MapValueType) String ¶
func (vt MapValueType) String() string
func (MapValueType) ValueTypeIdentifier ¶
func (vt MapValueType) ValueTypeIdentifier() string
type Render ¶
func RenderConcept ¶
func RenderConcept(path string, avs *RenderValues, ttype TargetType, opts RenderOpts) (*Render, error)
func (Render) PrintFiles ¶
func (Render) WriteFiles ¶
type RenderInfoV1 ¶
type RenderInfoV1 struct { Version int `json:"version"` Meta RenderMeta `json:"meta"` Origin *ConceptOrigin `json:"origin,omitempty"` Values *RenderValues `json:"values,omitempty"` }
RenderInfoV1 defines model for RenderInfoV1.
func NewRenderV1 ¶
func NewRenderV1(avs *RenderValues, origin *ConceptOrigin) (*RenderInfoV1, error)
func ParseRenderInfoV1FromFile ¶
func ParseRenderInfoV1FromFile(path string) (*RenderInfoV1, error)
type RenderMeta ¶
type RenderMeta struct {
DateCreated string `json:"date"`
}
RenderMeta defines model for RenderMeta.
type RenderOpts ¶
type RenderValues ¶
func (RenderValues) Map ¶
func (rv RenderValues) Map() map[string]ValueType
func (RenderValues) UnmarshalJSON ¶ added in v0.8.0
func (rv RenderValues) UnmarshalJSON(bytes []byte) error
type StringValueType ¶
type StringValueType string
func (StringValueType) String ¶
func (vt StringValueType) String() string
func (StringValueType) ValueTypeIdentifier ¶
func (vt StringValueType) ValueTypeIdentifier() string
type Target ¶
type Target interface { TargetName() string Render(path string, vals *RenderValues, cpt ConceptType, single bool) (*Render, error) }
Target is the interface for all Target implementations
type TargetType ¶
type TargetType string
const ( YamlTargetType TargetType = "yaml" CRDTargetType TargetType = "crd" )
type ValueTypeIdentifier ¶
type ValueTypeIdentifier string
const ( RenderStringValueTypeIdentifier ValueTypeIdentifier = "string" RenderMapValueTypeIdentifier ValueTypeIdentifier = "map" RenderIntValueTypeIdentifier ValueTypeIdentifier = "int" RenderBoolValueTypeIdentifier ValueTypeIdentifier = "bool" RenderNameRegexString = "^[a-z-_]+$" )
type YamlTarget ¶
type YamlTarget struct { }
func (YamlTarget) Render ¶
func (y YamlTarget) Render(path string, vals *RenderValues, cpt ConceptType, single bool) (*Render, error)
func (YamlTarget) TargetName ¶
func (y YamlTarget) TargetName() string
Click to show internal directories.
Click to hide internal directories.