spec

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BuildLabelKey = "build"
)

allLabelKey is the key that Kedge injects in every Kubernetes resource that it generates as an ObjectMeta label

Variables

This section is empty.

Functions

func CoreOperations added in v0.2.0

func CoreOperations(data []byte) ([]runtime.Object, []string, error)

The "core operations" is important to Kedge as it unmarshals, validates the artifacts as well as return the correct transformation of said artifact.

Returns the converted Kubernetes objects, extra resources and an error, if any.

func GetScheme added in v0.2.0

func GetScheme() (*runtime.Scheme, error)

GetScheme() returns runtime.Scheme with supported Kubernetes API resource definitions which Kedge supports right now. The core v1 scheme is first initialized and then other controllers' scheme is added to that scheme, e.g. batch/v1 scheme is added to add support for Jobs controller to the v1 Scheme. Also, (from upstream) Scheme defines methods for serializing and deserializing API objects, a type registry for converting group, version, and kind information to and from Go schemas, and mappings between Go schemas of different versions. A scheme is the foundation for a versioned API and versioned configuration over time.

func PrettyPrintObjects added in v0.10.0

func PrettyPrintObjects(v interface{}) string

func SetGVK added in v0.2.0

func SetGVK(runtimeObject runtime.Object, scheme *runtime.Scheme) error

SetGVK() sets Group, Version and Kind for the generated Kubernetes resources. This takes in a generated Kubernetes API resource's runtime object and runtime scheme based on which the GVK will be set.

Types

type App

type App struct {
	// Field to specify the version of application
	// +optional
	Appversion string `json:"appversion,omitempty"`

	// ref: io.kedge.DeploymentSpecMod
	// +optional
	Deployments []DeploymentSpecMod `json:"deployments,omitempty"`

	// ref: io.kedge.JobSpecMod
	// +optional
	Jobs []JobSpecMod `json:"jobs,omitempty"`

	// ref: io.kedge.DeploymentConfigSpecMod
	// +optional
	DeploymentConfigs []DeploymentConfigSpecMod `json:"deploymentConfigs,omitempty"`

	// List of volume that should be mounted on the pod.
	// ref: io.kedge.VolumeClaim
	// +optional
	VolumeClaims []VolumeClaim `json:"volumeClaims,omitempty"`
	// List of configMaps
	// ref: io.kedge.ConfigMap
	// +optional
	ConfigMaps []ConfigMapMod `json:"configMaps,omitempty"`
	// List of Kubernetes Services
	// ref: io.kedge.ServiceSpec
	// +optional
	Services []ServiceSpecMod `json:"services,omitempty"`
	// List of Kubernetes Ingress
	// ref: io.kedge.IngressSpec
	// +optional
	Ingresses []IngressSpecMod `json:"ingresses,omitempty"`
	// List of OpenShift Routes
	// ref: io.kedge.RouteSpec
	// +optional
	Routes []RouteSpecMod `json:"routes,omitempty"`
	// List of Kubernetes Secrets
	// ref: io.kedge.SecretSpec
	// +optional
	Secrets []SecretMod `json:"secrets,omitempty"`
	// List of OpenShift ImageStreams
	// ref: io.kedge.ImageStreamSpec
	// +optional
	ImageStreams []ImageStreamSpecMod `json:"imageStreams,omitempty"`
	// List of OpenShift BuildConfigs
	// ref: io.kedge.BuildConfigSpec
	// +optional
	BuildConfigs []BuildConfigSpecMod `json:"buildConfigs,omitempty"`
	// List of Kubernetes resource files, that can be directly given to Kubernetes
	// +optional
	IncludeResources []string `json:"includeResources,omitempty"`

	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`
}

Main kedge file structure defining whole application kedgeSpec: io.kedge.App

func (*App) CreateK8sObjects added in v0.8.0

func (app *App) CreateK8sObjects() ([]runtime.Object, error)

CreateK8sObjects, if given object DeploymentSpecMod, this function reads them and returns kubernetes objects as list of runtime.Object If the deployment is using field 'includeResources' then it will also return file names mentioned there as list of string

func (*App) Fix added in v0.8.0

func (app *App) Fix() error

func (*App) LoadData added in v0.8.0

func (app *App) LoadData(data []byte) error

LoadData - unmarshal data into App struct

func (*App) Validate added in v0.8.0

func (app *App) Validate() error

type BuildConfigSpecMod added in v0.5.0

type BuildConfigSpecMod struct {
	// k8s: v1.BuildConfigSpec
	build_v1.BuildConfigSpec `json:",inline"`
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`
}

BuildConfigSpecMod defines OpenShift BuildConfig object kedgeSpec: io.kedge.BuildConfigSpec

type ConfigMapMod

type ConfigMapMod struct {
	// k8s: io.k8s.kubernetes.pkg.api.v1.ConfigMap
	api_v1.ConfigMap `json:",inline"`
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	// We need ObjectMeta here, even though it is present in api.ConfigMap
	// because the one upstream has a JSON tag "metadata" due to which it
	// cannot be merged at ConfigMap's root level. The ObjectMeta here
	// overwrites the one in upstream and lets us merge ObjectMeta at
	// ConfigMap's root YAML syntax
	meta_v1.ObjectMeta `json:",inline"`
}

ConfigMapMod holds configuration data for pods to consume. kedgeSpec: io.kedge.ConfigMap

type Container

type Container struct {
	// One common definitions for 'livenessProbe' and 'readinessProbe'
	// this allows to have only one place to define both probes (if they are the same)
	// Periodic probe of container liveness and readiness. Container will be restarted
	// if the probe fails. Cannot be updated. More info:
	// https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes
	// ref: io.k8s.kubernetes.pkg.api.v1.Probe
	// +optional
	Health *api_v1.Probe `json:"health,omitempty"`
	// k8s: io.k8s.kubernetes.pkg.api.v1.Container
	api_v1.Container `json:",inline"`
}

Container defines a single application container that you want to run within a pod. kedgeSpec: io.kedge.ContainerSpec

type DeploymentConfigSpecMod added in v0.4.0

type DeploymentConfigSpecMod struct {
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`

	// k8s: v1.DeploymentConfigSpec
	os_deploy_v1.DeploymentConfigSpec `json:",inline"`

	// Replicas is the number of desired replicas.
	// We need to add this field here despite being in v1.DeploymentConfigSpec
	// because the one in v1.DeploymentConfigSpec has the type as int32, which
	// does not let us check if the set value is 0, is it set by the user or not
	// since this field's value with default to 0. We need the default value as
	// 1. Hence, we need to check if the user has set it or not.Making the type
	// *int32 helps us do it, followed by substitution later on.
	Replicas *int32 `json:"replicas,omitempty"`

	PodSpecMod `json:",inline"`
}

Ochestrator: OpenShift DeploymentConfigSpecMod is Kedge's extension of OpenShift DeploymentConfig kedgeSpec: io.kedge.DeploymentConfigSpecMod

type DeploymentSpecMod added in v0.2.0

type DeploymentSpecMod struct {
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`

	// k8s: io.k8s.kubernetes.pkg.apis.apps.v1beta1.DeploymentSpec
	ext_v1beta1.DeploymentSpec `json:",inline"`

	PodSpecMod `json:",inline"`
}

DeploymentSpecMod is Kedge's extension of Kubernetes DeploymentSpec kedgeSpec: io.kedge.DeploymentSpecMod

type ImageStreamSpecMod added in v0.5.0

type ImageStreamSpecMod struct {
	// k8s: v1.ImageStreamSpec
	image_v1.ImageStreamSpec `json:",inline"`
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`
}

ImageStreamSpec defines OpenShift ImageStream Object kedgeSpec: io.kedge.ImageStreamSpec

type IngressSpecMod

type IngressSpecMod struct {
	// k8s: io.k8s.kubernetes.pkg.apis.extensions.v1beta1.IngressSpec
	ext_v1beta1.IngressSpec `json:",inline"`
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`
}

IngressSpecMod defines Kubernetes Ingress object kedgeSpec: io.kedge.IngressSpec

type JobSpecMod added in v0.2.0

type JobSpecMod struct {
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`

	// k8s: io.k8s.kubernetes.pkg.apis.batch.v1.JobSpec
	batch_v1.JobSpec `json:",inline"`
	// Optional duration in seconds relative to the startTime that the job may be active
	// before the system tries to terminate it; value must be positive integer
	// This only sets ActiveDeadlineSeconds in JobSpec, not PodSpec
	// +optional
	ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,conflicting,omitempty"`

	PodSpecMod `json:",inline"`
}

JobSpecMod is Kedge's extension of Kubernetes JobSpec kedgeSpec: io.kedge.JobSpecMod

type PodSpecMod

type PodSpecMod struct {
	// List of containers belonging to the pod. Containers cannot currently be
	// added or removed. There must be at least one container in a Pod. Cannot be updated.
	// ref: io.kedge.ContainerSpec
	Containers []Container `json:"containers,conflicting,omitempty"`
	// List of initialization containers belonging to the pod. Init containers are
	// executed in order prior to containers being started. If any init container
	// fails, the pod is considered to have failed and is handled according to its
	// restartPolicy. The name for an init container or normal container must be
	// unique among all containers.
	// ref: io.kedge.ContainerSpec
	// +optional
	InitContainers []Container `json:"initContainers,conflicting,omitempty"`
	// k8s: io.k8s.kubernetes.pkg.api.v1.PodSpec
	api_v1.PodSpec `json:",inline"`
}

PodSpecMod is a description of a pod

type RouteSpecMod added in v0.4.0

type RouteSpecMod struct {
	// k8s: v1.RouteSpec
	os_route_v1.RouteSpec `json:",inline"`
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`
}

kedgeSpec: io.kedge.RouteSpec

type SecretMod

type SecretMod struct {
	// k8s: io.k8s.kubernetes.pkg.api.v1.Secret
	api_v1.Secret `json:",inline"`
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	// We need ObjectMeta here, even though it is present in api.Secret
	// because the one upstream has a JSON tag "metadata" due to which it
	// cannot be merged at Secret's root level. The ObjectMeta here
	// overwrites the one in upstream and lets us merge ObjectMeta at
	// Secret's root YAML syntax
	meta_v1.ObjectMeta `json:",inline"`
}

SecretMod defines secret that will be consumed by application kedgeSpec: io.kedge.SecretSpec

type ServicePortMod

type ServicePortMod struct {
	// k8s: io.k8s.kubernetes.pkg.api.v1.ServicePort
	api_v1.ServicePort `json:",inline"`
	// Host to create ingress automatically. IngressEndpoint allows specifying an
	// ingress resource in the format '<Host>/<Path>'
	// +optional
	IngressEndpoint string `json:"ingressEndpoint"`
	// Host to create routes automatically. RouteEndpoint allows specifying an
	// route resource in the format URL or simply boolean.
	// +optional
	RouteEndpoint string `json:"routeEndpoint"`
}

ServicePortMod is used to define Kubernetes service's port kedgeSpec: io.kedge.ServicePort

type ServiceSpecMod

type ServiceSpecMod struct {
	// k8s: io.k8s.kubernetes.pkg.api.v1.ServiceSpec
	api_v1.ServiceSpec `json:",inline"`
	// The list of ports that are exposed by this service. More info:
	// https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
	// ref: io.kedge.ServicePort
	// +optional
	Ports []ServicePortMod `json:"ports,conflicting"`
	// The list of portMappings, where each portMapping allows specifying port,
	// targetPort and protocol in the format '<port>:<targetPort>/<protocol>'
	// +optional
	PortMappings []intstr.IntOrString `json:"portMappings,omitempty"`
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`
}

ServiceSpecMod is used to define Kubernetes service kedgeSpec: io.kedge.ServiceSpec

type VolumeClaim

type VolumeClaim struct {
	// Data from the kubernetes persistent volume claim spec
	// k8s: io.k8s.kubernetes.pkg.api.v1.PersistentVolumeClaimSpec
	api_v1.PersistentVolumeClaimSpec `json:",inline"`
	// Size of persistent volume
	// +optional
	Size string `json:"size"`
	// k8s: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
	meta_v1.ObjectMeta `json:",inline"`
}

VolumeClaim is used to define Persistent Volumes for app kedgeSpec: io.kedge.VolumeClaim

Jump to

Keyboard shortcuts

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