Documentation ¶
Index ¶
Constants ¶
View Source
const VersionKey = "configVersion"
Variables ¶
View Source
var Schemas = map[string]string{
"v1": `
definitions:
nameSelector:
type: object
additionalProperties: false
required:
- matchNames
properties:
matchNames:
type: array
additionalItems: false
items:
type: string
labelSelector:
type: object
additionalProperties: false
minProperties: 1
maxProperties: 2
properties:
matchLabels:
type: object
additionalProperties:
type: string
matchExpressions:
type: array
items:
type: object
additionalProperties: false
required:
- key
- operator
properties:
key:
type: string
operator:
type: string
enum:
- In
- NotIn
- Exists
- DoesNotExist
values:
type: array
items:
type: string
type: object
additionalProperties: false
required:
- configVersion
minProperties: 2
properties:
configVersion:
type: string
enum:
- v1
onStartup:
title: onStartup binding
description: |
the value is the order to sort onStartup hooks
type: integer
example: 10
schedule:
title: schedule bindings
description: |
configuration of hooks that should run on schedule
type: array
additionalItems: false
minItems: 1
items:
type: object
additionalProperties: false
required:
- crontab
properties:
name:
type: string
crontab:
type: string
allowFailure:
type: boolean
default: false
includeSnapshotsFrom:
type: array
additionalItems: false
minItems: 1
items:
type: string
queue:
type: string
group:
type: string
kubernetes:
title: kubernetes event bindings
type: array
additionalItems: false
minItems: 1
items:
type: object
additionalProperties: false
required:
- kind
patternProperties:
"^(watchEvent|executeHookOnEvent)$":
type: array
additionalItems: false
minItems: 0
items:
type: string
enum:
- Added
- Modified
- Deleted
properties:
name:
type: string
apiVersion:
type: string
kind:
type: string
includeSnapshotsFrom:
type: array
additionalItems: false
minItems: 1
items:
type: string
queue:
type: string
jqFilter:
type: string
example: ".metadata.labels"
allowFailure:
type: boolean
executeHookOnSynchronization:
type: boolean
resynchronizationPeriod:
type: string
nameSelector:
"$ref": "#/definitions/nameSelector"
labelSelector:
"$ref": "#/definitions/labelSelector"
fieldSelector:
type: object
additionalProperties: false
required:
- matchExpressions
properties:
matchExpressions:
type: array
items:
type: object
additionalProperties: false
minProperties: 3
maxProperties: 3
properties:
field:
type: string
operator:
type: string
enum: ["=", "==", "Equals", "!=", "NotEquals"]
value:
type: string
group:
type: string
namespace:
type: object
additionalProperties: false
minProperties: 1
maxProperties: 2
properties:
nameSelector:
"$ref": "#/definitions/nameSelector"
labelSelector:
"$ref": "#/definitions/labelSelector"
`,
"v0": `
type: object
additionalProperties: false
minProperties: 1
properties:
onStartup:
title: onStartup binding
description: |
the value is the order to sort onStartup hooks
type: integer
schedule:
type: array
items:
type: object
onKubernetesEvent:
type: array
items:
type: object
`,
}
View Source
var SchemasCache = map[string]*spec.Schema{}
Functions ¶
func LoadSchema ¶
LoadSchema returns spec.Schema object loaded from yaml in Schemas map.
func ValidateConfig ¶
Types ¶
type VersionedUntyped ¶
type VersionedUntyped struct { Obj map[string]interface{} Version string VersionKey string VersionValidator func(string, bool) (string, error) }
func NewDefaultVersionedUntyped ¶
func NewDefaultVersionedUntyped() *VersionedUntyped
NewDefaultVersionedUntyped is a VersionedUntyper object with default version key and version validator against Schemas map
func (*VersionedUntyped) GetString ¶
func (u *VersionedUntyped) GetString(key string) (value string, found bool, err error)
GetString returns string value by key
func (*VersionedUntyped) Load ¶
func (u *VersionedUntyped) Load(data []byte) error
func (*VersionedUntyped) LoadConfigVersion ¶
func (u *VersionedUntyped) LoadConfigVersion() (string, error)
LoadConfigVersion
Click to show internal directories.
Click to hide internal directories.