config

package
v1.0.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2020 License: Apache-2.0 Imports: 9 Imported by: 4 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
              - DoesNotExists
            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
        includeKubernetesSnapshotsFrom:
          type: array
          additionalItems: false
          minItems: 1
          items:
            type: string
        queue:
          type: string
  kubernetes:
    title: kubernetes event bindings
    type: array
    additionalItems: false
    minItems: 1
    items:
      type: object
      additionalProperties: false
      required:
      - kind
      properties:
        name:
          type: string
        apiVersion:
          type: string
        kind:
          type: string
        watchEvent:
          type: array
          additionalItems: false
          minItems: 1
          items:
            type: string
            enum:
            - Added
            - Modified
            - Deleted
        includeSnapshotsFrom:
          type: array
          additionalItems: false
          minItems: 1
          items:
            type: string
        queue:
          type: string
        jqFilter:
          type: string
          example: ".metadata.labels"
        allowFailure:
          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
        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 GetSchema

func GetSchema(name string) *spec.Schema

GetSchema returns loaded schema.

func LoadSchema

func LoadSchema(name string) (*spec.Schema, error)

LoadSchema returns spec.Schema object loaded from yaml in Schemas map.

func ValidateConfig

func ValidateConfig(dataObj interface{}, s *spec.Schema, rootName string) (multiErr error)

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

Jump to

Keyboard shortcuts

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