api

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// MonitoringDefaultPath default path
	MonitoringDefaultPath = "/metrics"

	// MonitoringDefaultScheme default scheme
	MonitoringDefaultScheme = "http"
)

Variables

This section is empty.

Functions

func GetOpenAPIDefinitions added in v0.1.3

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

Types

type Condition

type Condition struct {
	Type               ConditionType                `json:"type"`
	Status             corev1.ConditionStatus       `json:"status"`
	LastTransitionTime metav1.Time                  `json:"lastTransitionTime,omitempty"`
	Reason             KogitoServiceConditionReason `json:"reason,omitempty"`
	Message            string                       `json:"message,omitempty"`
}

Condition is the detailed condition for the resource

type ConditionMetaInterface

type ConditionMetaInterface interface {
	SetDeployed() bool
	SetProvisioning() bool
	SetFailed(reason KogitoServiceConditionReason, err error)
	GetConditions() []Condition
	SetConditions(conditions []Condition)
}

ConditionMetaInterface defines the base information for kogito services conditions +kubebuilder:object:generate=false

type ConditionType

type ConditionType string

ConditionType is the type of condition

const (
	// DeployedConditionType - The KogitoService is deployed
	DeployedConditionType ConditionType = "Deployed"
	// ProvisioningConditionType - The KogitoService is being provisioned
	ProvisioningConditionType ConditionType = "Provisioning"
	// FailedConditionType - The KogitoService is in a failed state
	FailedConditionType ConditionType = "Failed"
)

type ConditionsMeta

type ConditionsMeta struct {
	// +listType=atomic
	// History of conditions for the resource
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:io.kubernetes.conditions"
	Conditions []Condition `json:"conditions"`
}

ConditionsMeta definition of a Condition structure

func (*ConditionsMeta) GetConditions

func (c *ConditionsMeta) GetConditions() []Condition

GetConditions returns the conditions history

func (*ConditionsMeta) SetConditions

func (c *ConditionsMeta) SetConditions(conditions []Condition)

SetConditions sets the conditions history

func (*ConditionsMeta) SetDeployed

func (c *ConditionsMeta) SetDeployed() bool

SetDeployed Updates the condition with the DeployedCondition and True status

func (*ConditionsMeta) SetFailed

func (c *ConditionsMeta) SetFailed(reason KogitoServiceConditionReason, err error)

SetFailed Sets the failed condition with the error reason and message

func (*ConditionsMeta) SetProvisioning

func (c *ConditionsMeta) SetProvisioning() bool

SetProvisioning Sets the condition type to Provisioning and status True if not yet set.

type KogitoCloudEventInfo

type KogitoCloudEventInfo struct {
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	Type string `json:"type"`
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	Source string `json:"source,omitempty"`
}

KogitoCloudEventInfo describes the CloudEvent information based on the specification

type KogitoCloudEventsStatus

type KogitoCloudEventsStatus struct {
	// +optional
	// +listType=atomic
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	Consumes []KogitoCloudEventInfo `json:"consumes,omitempty"`
	// +optional
	// +listType=atomic
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	Produces []KogitoCloudEventInfo `json:"produces,omitempty"`
}

KogitoCloudEventsStatus describes the CloudEvents that can be produced or consumed by this Kogito Service instance

type KogitoProbe

type KogitoProbe struct {
	// LivenessProbe describes how the Kogito container liveness probe should work
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=false
	// +optional
	LivenessProbe corev1.Probe `json:"livenessProbe,omitempty"`

	// ReadinessProbe describes how the Kogito container readiness probe should work
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=false
	// +optional
	ReadinessProbe corev1.Probe `json:"readinessProbe,omitempty"`
}

KogitoProbe configure liveness, readiness and startup probes for containers

type KogitoService

type KogitoService interface {
	metav1.Object
	runtime.Object
	// GetSpec gets the Kogito Service specification structure.
	GetSpec() KogitoServiceSpecInterface
	// GetStatus gets the Kogito Service Status structure.
	GetStatus() KogitoServiceStatusInterface
}

KogitoService defines the interface for any Kogito service that the operator can handle, e.g. Data Index, Jobs Service, Runtimes, etc. +kubebuilder:object:generate=false

type KogitoServiceConditionReason

type KogitoServiceConditionReason string

KogitoServiceConditionReason is the type of reason

const (
	// CreateResourceFailedReason - Unable to create the requested resources
	CreateResourceFailedReason KogitoServiceConditionReason = "CreateResourceFailed"
	// KogitoInfraNotReadyReason - Unable to deploy Kogito Infra
	KogitoInfraNotReadyReason KogitoServiceConditionReason = "KogitoInfraNotReadyReason"
	// ServiceReconciliationFailure - Unable to determine the error
	ServiceReconciliationFailure KogitoServiceConditionReason = "ReconciliationFailure"
	// MessagingIntegrationFailureReason ...
	MessagingIntegrationFailureReason KogitoServiceConditionReason = "MessagingProvisionFailure"
	// MonitoringIntegrationFailureReason ...
	MonitoringIntegrationFailureReason KogitoServiceConditionReason = "MonitoringIntegrationFailure"
	// InternalServiceNotReachable ...
	InternalServiceNotReachable KogitoServiceConditionReason = "InternalServiceNotReachable"
)

type KogitoServiceList

type KogitoServiceList interface {
	runtime.Object
	// GetItemsCount gets the number of items in the list
	GetItemsCount() int
	// GetItemAt gets the item at the given index
	GetItemAt(index int) KogitoService
}

KogitoServiceList defines a base interface for Kogito Service list. +kubebuilder:object:generate=false

type KogitoServiceSpec

type KogitoServiceSpec struct {
	// Number of replicas that the service will have deployed in the cluster.
	// Default value: 1.
	// +optional
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Replicas"
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:podCount"
	// +kubebuilder:validation:Minimum=0
	Replicas *int32 `json:"replicas,omitempty"`

	// +optional
	// +listType=atomic
	// Environment variables to be added to the runtime container. Keys must be a C_IDENTIFIER.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	Env []corev1.EnvVar `json:"env,omitempty"`

	// +optional
	// Image definition for the service. Example: "quay.io/kiegroup/kogito-service:latest".
	// On OpenShift an ImageStream will be created in the current namespace pointing to the given image.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	Image string `json:"image,omitempty"`

	// +optional
	// A flag indicating that image streams created by Kogito Operator should be configured to allow pulling from insecure registries.
	// Usable just on OpenShift.
	// Defaults to 'false'.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Insecure Image Registry"
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:booleanSwitch"
	InsecureImageRegistry bool `json:"insecureImageRegistry,omitempty"`

	// Defined compute resource requirements for the deployed service.
	// +optional
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:resourceRequirements"
	Resources corev1.ResourceRequirements `json:"resources,omitempty"`

	// Additional labels to be added to the Deployment and Pods managed by the operator.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Additional Deployment Labels"
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
	DeploymentLabels map[string]string `json:"deploymentLabels,omitempty"`

	// Additional labels to be added to the Service managed by the operator.
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Additional Service Labels"
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
	ServiceLabels map[string]string `json:"serviceLabels,omitempty"`

	// +optional
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="ConfigMap Properties"
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
	// Custom ConfigMap with application.properties file to be mounted for the Kogito service.
	// The ConfigMap must be created in the same namespace.
	// Use this property if you need custom properties to be mounted before the application deployment.
	// If left empty, one will be created for you. Later it can be updated to add any custom properties to apply to the service.
	PropertiesConfigMap string `json:"propertiesConfigMap,omitempty"`

	// Infra provides list of dependent KogitoInfra objects.
	// +optional
	Infra []string `json:"infra,omitempty"`

	// Create Service monitor instance to connect with Monitoring service
	// +optional
	Monitoring Monitoring `json:"monitoring,omitempty"`

	// +optional
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Configs"
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.x-descriptors="urn:alm:descriptor:com.tectonic.ui:text"
	// Application properties that will be set to the service. For example 'MY_VAR: my_value'.
	Config map[string]string `json:"config,omitempty"`

	// Configure liveness, readiness and startup probes for containers
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors=false
	// +optional
	Probes KogitoProbe `json:"probes,omitempty"`
}

+kubebuilder:object:root=true +k8s:deepcopy-gen=package,register KogitoServiceSpec is the basic structure for the Kogito Service specification.

func (*KogitoServiceSpec) AddDeploymentLabel

func (k *KogitoServiceSpec) AddDeploymentLabel(name, value string)

AddDeploymentLabel adds new deployment label. Works also on uninitialized DeploymentLabels field.

func (*KogitoServiceSpec) AddEnvironmentVariable

func (k *KogitoServiceSpec) AddEnvironmentVariable(name, value string)

AddEnvironmentVariable adds new environment variable to service environment variables.

func (*KogitoServiceSpec) AddEnvironmentVariableFromSecret

func (k *KogitoServiceSpec) AddEnvironmentVariableFromSecret(variableName, secretName, secretKey string)

AddEnvironmentVariableFromSecret adds a new environment variable from the secret under the key.

func (*KogitoServiceSpec) AddInfra

func (k *KogitoServiceSpec) AddInfra(name string)

AddInfra ...

func (*KogitoServiceSpec) AddResourceLimit

func (k *KogitoServiceSpec) AddResourceLimit(name, value string)

AddResourceLimit adds new resource limit. Works also on uninitialized Limits field.

func (*KogitoServiceSpec) AddResourceRequest

func (k *KogitoServiceSpec) AddResourceRequest(name, value string)

AddResourceRequest adds new resource request. Works also on uninitialized Requests field.

func (*KogitoServiceSpec) AddServiceLabel

func (k *KogitoServiceSpec) AddServiceLabel(name, value string)

AddServiceLabel adds new service label. Works also on uninitialized ServiceLabels field.

func (*KogitoServiceSpec) GetConfig

func (k *KogitoServiceSpec) GetConfig() map[string]string

GetConfig ...

func (*KogitoServiceSpec) GetDeploymentLabels

func (k *KogitoServiceSpec) GetDeploymentLabels() map[string]string

GetDeploymentLabels ...

func (*KogitoServiceSpec) GetEnvs

func (k *KogitoServiceSpec) GetEnvs() []corev1.EnvVar

GetEnvs ...

func (*KogitoServiceSpec) GetImage

func (k *KogitoServiceSpec) GetImage() string

GetImage ...

func (*KogitoServiceSpec) GetInfra

func (k *KogitoServiceSpec) GetInfra() []string

GetInfra ...

func (*KogitoServiceSpec) GetMonitoring

func (k *KogitoServiceSpec) GetMonitoring() Monitoring

GetMonitoring ...

func (*KogitoServiceSpec) GetProbes

func (k *KogitoServiceSpec) GetProbes() KogitoProbe

GetProbes ...

func (*KogitoServiceSpec) GetPropertiesConfigMap

func (k *KogitoServiceSpec) GetPropertiesConfigMap() string

GetPropertiesConfigMap ...

func (*KogitoServiceSpec) GetReplicas

func (k *KogitoServiceSpec) GetReplicas() *int32

GetReplicas ...

func (*KogitoServiceSpec) GetResources

func (k *KogitoServiceSpec) GetResources() corev1.ResourceRequirements

GetResources ...

func (*KogitoServiceSpec) GetServiceLabels

func (k *KogitoServiceSpec) GetServiceLabels() map[string]string

GetServiceLabels ...

func (*KogitoServiceSpec) IsInsecureImageRegistry

func (k *KogitoServiceSpec) IsInsecureImageRegistry() bool

IsInsecureImageRegistry ...

func (*KogitoServiceSpec) SetDeploymentLabels

func (k *KogitoServiceSpec) SetDeploymentLabels(labels map[string]string)

SetDeploymentLabels ...

func (*KogitoServiceSpec) SetEnvs

func (k *KogitoServiceSpec) SetEnvs(envs []corev1.EnvVar)

SetEnvs ...

func (*KogitoServiceSpec) SetImage

func (k *KogitoServiceSpec) SetImage(image string)

SetImage ...

func (*KogitoServiceSpec) SetProbes

func (k *KogitoServiceSpec) SetProbes(probes KogitoProbe)

SetProbes ...

func (*KogitoServiceSpec) SetReplicas

func (k *KogitoServiceSpec) SetReplicas(replicas int32)

SetReplicas ...

func (*KogitoServiceSpec) SetResources

func (k *KogitoServiceSpec) SetResources(resources corev1.ResourceRequirements)

SetResources ...

func (*KogitoServiceSpec) SetServiceLabels

func (k *KogitoServiceSpec) SetServiceLabels(labels map[string]string)

SetServiceLabels ...

type KogitoServiceSpecInterface

type KogitoServiceSpecInterface interface {
	GetReplicas() *int32
	SetReplicas(replicas int32)
	GetEnvs() []corev1.EnvVar
	SetEnvs(envs []corev1.EnvVar)
	AddEnvironmentVariable(name, value string)
	AddEnvironmentVariableFromSecret(variableName, secretName, secretKey string)
	GetImage() string
	SetImage(image string)
	GetResources() corev1.ResourceRequirements
	SetResources(resources corev1.ResourceRequirements)
	AddResourceRequest(name, value string)
	AddResourceLimit(name, value string)
	GetDeploymentLabels() map[string]string
	SetDeploymentLabels(labels map[string]string)
	AddDeploymentLabel(name, value string)
	GetServiceLabels() map[string]string
	SetServiceLabels(labels map[string]string)
	AddServiceLabel(name, value string)
	GetRuntime() RuntimeType
	IsInsecureImageRegistry() bool
	GetPropertiesConfigMap() string
	GetInfra() []string
	AddInfra(name string)
	GetMonitoring() Monitoring
	GetConfig() map[string]string
	GetProbes() KogitoProbe
	SetProbes(probes KogitoProbe)
}

KogitoServiceSpecInterface defines the interface for the Kogito service specification, it's the basic structure for any Kogito service. +kubebuilder:object:generate=false

type KogitoServiceStatus

type KogitoServiceStatus struct {
	ConditionsMeta `json:",inline"`
	// General conditions for the Kogito Service deployment.
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.specDescriptors.displayName="Deployment Conditions"
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:io.kubernetes.conditions"
	DeploymentConditions []appsv1.DeploymentCondition `json:"deploymentConditions,omitempty"`
	// Image is the resolved image for this service.
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	Image string `json:"image,omitempty"`
	// URI is where the service is exposed.
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors.x-descriptors="urn:alm:descriptor:org.w3:link"
	ExternalURI string `json:"externalURI,omitempty"`
	// Describes the CloudEvents that this instance can consume or produce
	// +operator-sdk:gen-csv:customresourcedefinitions.statusDescriptors=true
	CloudEvents KogitoCloudEventsStatus `json:"cloudEvents,omitempty"`
}

+kubebuilder:object:root=true +k8s:deepcopy-gen=package,register KogitoServiceStatus is the basic structure for any Kogito Service status.

func (*KogitoServiceStatus) GetCloudEvents

func (k *KogitoServiceStatus) GetCloudEvents() KogitoCloudEventsStatus

GetCloudEvents ...

func (*KogitoServiceStatus) GetDeploymentConditions

func (k *KogitoServiceStatus) GetDeploymentConditions() []appsv1.DeploymentCondition

GetDeploymentConditions gets the deployment conditions for the service.

func (*KogitoServiceStatus) GetExternalURI

func (k *KogitoServiceStatus) GetExternalURI() string

GetExternalURI ...

func (*KogitoServiceStatus) GetImage

func (k *KogitoServiceStatus) GetImage() string

GetImage ...

func (*KogitoServiceStatus) SetCloudEvents

func (k *KogitoServiceStatus) SetCloudEvents(cloudEvents KogitoCloudEventsStatus)

SetCloudEvents ...

func (*KogitoServiceStatus) SetDeploymentConditions

func (k *KogitoServiceStatus) SetDeploymentConditions(deploymentConditions []appsv1.DeploymentCondition)

SetDeploymentConditions sets the deployment conditions for the service.

func (*KogitoServiceStatus) SetExternalURI

func (k *KogitoServiceStatus) SetExternalURI(uri string)

SetExternalURI ...

func (*KogitoServiceStatus) SetImage

func (k *KogitoServiceStatus) SetImage(image string)

SetImage ...

type KogitoServiceStatusInterface

type KogitoServiceStatusInterface interface {
	ConditionMetaInterface
	GetDeploymentConditions() []appsv1.DeploymentCondition
	SetDeploymentConditions(deploymentConditions []appsv1.DeploymentCondition)
	GetImage() string
	SetImage(image string)
	GetExternalURI() string
	SetExternalURI(uri string)
	GetCloudEvents() KogitoCloudEventsStatus
	SetCloudEvents(cloudEvents KogitoCloudEventsStatus)
}

KogitoServiceStatusInterface defines the basic interface for the Kogito Service status. +kubebuilder:object:generate=false

type Monitoring

type Monitoring struct {
	// HTTP scheme to use for scraping.
	// +optional
	Scheme string `json:"scheme,omitempty"`

	// HTTP path to scrape for metrics.
	// +optional
	Path string `json:"path,omitempty"`
}

Monitoring properties to connect with Monitoring service

type RuntimeType

type RuntimeType string

RuntimeType - type of condition.

const (
	// QuarkusRuntimeType Runtime for quarkus application
	QuarkusRuntimeType RuntimeType = "quarkus"
	// SpringBootRuntimeType Runtime for springboot application
	SpringBootRuntimeType RuntimeType = "springboot"
)

Jump to

Keyboard shortcuts

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