crdvalidation

package
v0.0.0-...-a7560c8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CustomResourceDefinitionTypeMeta = metav1.TypeMeta{
	Kind:       "CustomResourceDefinition",
	APIVersion: "apiextensions.k8s.io/v1beta1",
}

CustomResourceDefinitionTypeMeta set the default kind/apiversion of CRD

Functions

func EnumJSON

func EnumJSON(enum []interface{}) []extensionsobj.JSON

EnumJSON converts []interface{} to []JSON

func GetCustomResourceValidation

func GetCustomResourceValidation(name string, fn func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition) *extensionsobj.CustomResourceValidation

GetCustomResourceValidation returns the validation definition for a CRD name

func GetCustomResourceValidations

func GetCustomResourceValidations(fn GetAPIDefinitions) map[string]*extensionsobj.CustomResourceValidation

GetCustomResourceValidations returns a CRD validation spec map. It took the openapi generated definition from kube-openapi as argument

func InitFlags

func InitFlags(cfg *Config, flagset *flag.FlagSet) *flag.FlagSet

InitFlags prepares command line flags parser

func MarshallCrd

func MarshallCrd(crd *extensionsobj.CustomResourceDefinition, outputFormat string)

func NewCustomResourceDefinition

func NewCustomResourceDefinition(config Config) *extensionsobj.CustomResourceDefinition

func OpenAPIRefCallBack

func OpenAPIRefCallBack(name string) spec.Ref

OpenAPIRefCallBack returns a jsonref using the input string without modification

func SchemPropsMapToJSONMap

func SchemPropsMapToJSONMap(schemaMap map[string]spec.Schema, openapiSpec map[string]common.OpenAPIDefinition, nested bool) map[string]extensionsobj.JSONSchemaProps

SchemPropsMapToJSONMap converts map[string]Schema to map[string]JSONSchemaProps

func SchemaOrArrayToJSONItems

func SchemaOrArrayToJSONItems(schemaOrArray *spec.SchemaOrArray, openapiSpec map[string]common.OpenAPIDefinition, nested bool) *extensionsobj.JSONSchemaPropsOrArray

SchemaOrArrayToJSONItems converts *SchemaOrArray to *JSONSchemaPropsOrArray

func SchemaOrBoolToJSONProps

func SchemaOrBoolToJSONProps(schemaOrBool *spec.SchemaOrBool, openapiSpec map[string]common.OpenAPIDefinition, nested bool) *extensionsobj.JSONSchemaPropsOrBool

SchemaOrBoolToJSONProps converts *SchemaOrBool to *JSONSchemaPropsOrBool

func SchemaPropsToJSONProps

func SchemaPropsToJSONProps(schema *spec.Schema, openapiSpec map[string]common.OpenAPIDefinition, nested bool) *extensionsobj.JSONSchemaProps

SchemaPropsToJSONProps converts a SchemaProps to a JSONProps

func SchemaPropsToJSONPropsArray

func SchemaPropsToJSONPropsArray(schemas []spec.Schema, openapiSpec map[string]common.OpenAPIDefinition, nested bool) []extensionsobj.JSONSchemaProps

SchemaPropsToJSONPropsArray converts []Schema to []JSONSchemaProps

func StringOrArrayToString

func StringOrArrayToString(strOrArray spec.StringOrArray) string

StringOrArrayToString converts StringOrArray to string

Types

type Config

type Config struct {
	SpecDefinitionName    string
	EnableValidation      bool
	OutputFormat          string
	Labels                Labels
	Annotations           Labels
	ResourceScope         string
	Group                 string
	Kind                  string
	Version               string
	Plural                string
	GetOpenAPIDefinitions GetAPIDefinitions
}

Config stores the user configuration input

type GetAPIDefinitions

type GetAPIDefinitions func(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition

GetAPIDefinition is a function returning a map with all Definition

type Labels

type Labels struct {
	LabelsString string
	LabelsMap    map[string]string
}

func (*Labels) Merge

func (labels *Labels) Merge(otherLabels map[string]string) map[string]string

Merge labels create a new map with labels merged.

func (*Labels) Set

func (labels *Labels) Set(value string) error

Implement the flag.Set interface

func (*Labels) String

func (labels *Labels) String() string

Implement the flag.Value interface

Jump to

Keyboard shortcuts

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