infrastructure

package
v1.44.1 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 35 Imported by: 2

Documentation

Index

Constants

View Source
const (

	// LatestTag the default name for latest image tag
	LatestTag = "latest"

	//RuntimeTypeKey Env key to switch between the runtime
	RuntimeTypeKey = "RUNTIME_TYPE"
)
View Source
const (

	// InfinispanSecretUsernameKey is the secret username key set in the linked secret
	InfinispanSecretUsernameKey = "username"
	// InfinispanSecretPasswordKey is the secret password key set in the linked secret
	InfinispanSecretPasswordKey = "password"

	// InfinispanIdentityFileName is the name of YAML file containing list of Infinispan credentials
	InfinispanIdentityFileName = "identities.yaml"

	// InfinispanKind CRD Kind for Infinispan server (as defined by Infinispan Operator)
	InfinispanKind = "Infinispan"

	// InfinispanInstanceName is the default name for Infinispan managed by KogitoInfra
	InfinispanInstanceName = "kogito-infinispan"
)
View Source
const (

	// KafkaKind refers to Kafka Kind as defined by Strimzi
	KafkaKind = "Kafka"

	// KafkaInstanceName is the default name for the Kafka cluster managed by KogitoInfra
	KafkaInstanceName = "kogito-kafka"
)
View Source
const (
	// MongoDBOperatorName is the MongoDB Operator default name
	MongoDBOperatorName = "mongodb-kubernetes-operator"

	// DefaultMongoDBAuthDatabase is the default authentication database in MongoDB
	DefaultMongoDBAuthDatabase = "admin"
	// DefaultMongoDBPasswordSecretRef is the default key for the secret reference in MongoDB
	DefaultMongoDBPasswordSecretRef = "password"

	// MongoDBKind refers to MongoDB Kind
	MongoDBKind = "MongoDB"

	// MongoDBAppSecretAuthDatabaseKey is the secret authentication database key set in the linked secret for an application
	MongoDBAppSecretAuthDatabaseKey = "auth-database"
	// MongoDBAppSecretDatabaseKey is the secret database key set in the linked secret for an application
	MongoDBAppSecretDatabaseKey = "database"
	// MongoDBAppSecretUsernameKey is the secret username key set in the linked secret for an application
	MongoDBAppSecretUsernameKey = "username"
	// MongoDBAppSecretPasswordKey is the secret password key set in the linked secret for an application
	MongoDBAppSecretPasswordKey = "password"
)
View Source
const (
	// ReconciliationAfterThreeMinutesDuration ...
	ReconciliationAfterThreeMinutesDuration = time.Minute * 3
	// ReconciliationAfterThirty ...
	ReconciliationAfterThirty = time.Second * 30
	// ReconciliationAfterTen ...
	ReconciliationAfterTen = time.Second * 10
	// ReconciliationAfterFive ...
	ReconciliationAfterFive = time.Second * 5
	// ReconciliationAfterOneMinuteDuration ...
	ReconciliationAfterOneMinuteDuration = time.Minute
)
View Source
const (
	// DefaultFileMountPath ...
	DefaultFileMountPath = operator.KogitoHomeDir + "/config"
)
View Source
const (
	//ImageTagLatest is the default name for the latest image tag
	ImageTagLatest = "latest"
)
View Source
const (
	// KeycloakKind refers to Keycloak Kind
	KeycloakKind = "Keycloak"
)
View Source
const (
	// KnativeEventingBrokerKind is the Kind description for Knative Eventing Brokers
	KnativeEventingBrokerKind = "Broker"
)
View Source
const (
	// RuntimeServiceAccountName ...
	RuntimeServiceAccountName = "kogito-service-viewer"
)

Variables

View Source
var (
	// KindService for service
	KindService = DefinitionKind{"Service", false, corev1.SchemeGroupVersion}
	// KindBuildRequest for a BuildRequest
	KindBuildRequest = DefinitionKind{"BuildRequest", true, buildv1.GroupVersion}
	// KindDeployment for Kubernetes Deployment
	KindDeployment = DefinitionKind{"Deployment", false, coreappsv1.SchemeGroupVersion}
)
View Source
var (
	// InfinispanAPIVersion CRD API group version for Infinispan server (as defined by Infinispan Operator)
	InfinispanAPIVersion = ispn.SchemeGroupVersion.String()
)
View Source
var (
	// KafkaAPIVersion refers to kafka APIVersion
	KafkaAPIVersion = v1beta2.SchemeGroupVersion.String()
)
View Source
var (
	// KeycloakAPIVersion refers to kafka APIVersion
	KeycloakAPIVersion = v1alpha1.SchemeGroupVersion.String()
)
View Source
var (
	// KnativeEventingAPIVersion API Group version as defined by Knative Eventing operator
	KnativeEventingAPIVersion = eventingv1.SchemeGroupVersion.String()
)
View Source
var (
	// MongoDBAPIVersion refers to MongoDB APIVersion
	MongoDBAPIVersion = mongodb.SchemeBuilder.GroupVersion.String()
)

Functions

func GetDefaultImageRegistry

func GetDefaultImageRegistry() string

GetDefaultImageRegistry ...

func GetKogitoImageVersion

func GetKogitoImageVersion(v string) string

GetKogitoImageVersion gets the Kogito Runtime latest micro version based on the given version E.g. Operator version is 0.9.0, the latest image version is 0.9.x-latest unit test friendly unexported function in this case we are considering only micro updates, that's 0.9.0 -> 0.9, thus for 1.0.0 => 1.0 in the future this should be managed with carefully if we desire a behavior like 1.0.0 => 1, that's minor upgrades

func IsKafkaResource

func IsKafkaResource(apiVersion, kind string) bool

IsKafkaResource checks if provided KogitoInfra instance is for kafka resource

func IsKnativeEventingResource

func IsKnativeEventingResource(apiVersion, kind string) bool

IsKnativeEventingResource checks if provided KogitoInfra instance is for Knative eventing resource

func ResolveKafkaServerURI added in v1.11.0

func ResolveKafkaServerURI(kafka *v1beta2.Kafka) string

ResolveKafkaServerURI returns the uri of the kafka instance

Types

type ConditionReason added in v1.10.0

type ConditionReason string

ConditionReason is the type of reason

const (
	// CreateResourceFailedReason - Unable to create the requested resources
	CreateResourceFailedReason ConditionReason = "CreateResourceFailed"
	// KogitoInfraNotReadyReason - Unable to deploy Kogito Infra
	KogitoInfraNotReadyReason ConditionReason = "KogitoInfraNotReadyReason"
	// ServiceReconciliationFailure - Unable to determine the error
	ServiceReconciliationFailure ConditionReason = "ReconciliationFailure"
	// MessagingIntegrationFailureReason ...
	MessagingIntegrationFailureReason ConditionReason = "MessagingProvisionFailure"
	// MonitoringIntegrationFailureReason ...
	MonitoringIntegrationFailureReason ConditionReason = "MonitoringIntegrationFailure"
	// InternalServiceNotReachable ...
	InternalServiceNotReachable ConditionReason = "InternalServiceNotReachable"
	// SuccessfulDeployedReason ...
	SuccessfulDeployedReason ConditionReason = "AtLeastOnePodAvailable"
	// FailedDeployedReason ...
	FailedDeployedReason ConditionReason = "NoPodAvailable"
	// ProvisioningInProgressReason ...
	ProvisioningInProgressReason ConditionReason = "RequestedReplicasNotEqualToAvailableReplicas"
	// FailedProvisioningReason ...
	FailedProvisioningReason ConditionReason = "UnrecoverableError"
	// FinishedProvisioningReason ...
	FinishedProvisioningReason ConditionReason = "RequestedReplicasEqualToAvailableReplicas"
	// TrustStoreMountFailureReason happens when the controller tries to mount a given TrustStore in the target service and fails
	TrustStoreMountFailureReason ConditionReason = "TrustStoreMountFailure"
	// ImageStreamNotReadyReason - Unable to deploy Kogito Infra
	ImageStreamNotReadyReason ConditionReason = "ImageStreamNotReadyReason"
	// DeploymentNotAvailable ...
	DeploymentNotAvailable ConditionReason = "DeploymentNotAvailable"
	// ProcessingImageStreamDelta ...
	ProcessingImageStreamDelta ConditionReason = "ProcessingImageStreamDelta"
	// ProcessingProtoBufConfigMapDelta ...
	ProcessingProtoBufConfigMapDelta ConditionReason = "ProcessingProtoBufConfigMapDelta"
	// ImageNotFound ...
	ImageNotFound ConditionReason = "ImageNotFound"
	// RouteProcessed ...
	RouteProcessed ConditionReason = "RouteProcessed"
	// RouteCreationFailureReason - Unable to properly create Route
	RouteCreationFailureReason ConditionReason = "RouteCreationFailure"
)

type ConfigMapHandler

type ConfigMapHandler interface {
	FetchConfigMap(key types.NamespacedName) (*corev1.ConfigMap, error)
	FetchConfigMapsForLabel(namespace string, labels map[string]string) (*corev1.ConfigMapList, error)
	MountAsVolume(deployment *appsv1.Deployment, volumeReference api.VolumeReferenceInterface) error
	MountAsEnvFrom(deployment *appsv1.Deployment, cmName string)
	GetComparator() compare.MapComparator
}

ConfigMapHandler ...

func NewConfigMapHandler

func NewConfigMapHandler(context operator.Context) ConfigMapHandler

NewConfigMapHandler ...

type DefinitionKind added in v1.20.0

type DefinitionKind struct {
	// Name of the resource
	Name string
	// IsFromOpenShift identifies if this Resource only exists on OpenShift cluster
	IsFromOpenShift bool
	// Identifies the group version for the OpenShift APIs
	GroupVersion schema.GroupVersion
}

DefinitionKind is a resource kind representation from a Kubernetes/Openshift cluster

type DeltaProcessor added in v1.10.0

type DeltaProcessor interface {
	ProcessDelta(comparator compare.MapComparator, requestedResources map[reflect.Type][]client.Object, deployedResources map[reflect.Type][]client.Object) (isDeltaProcessed bool, err error)
}

DeltaProcessor ...

func NewDeltaProcessor added in v1.10.0

func NewDeltaProcessor(context operator.Context) DeltaProcessor

NewDeltaProcessor ...

type DeploymentHandler

type DeploymentHandler interface {
	FetchDeployment(key types.NamespacedName) (*appsv1.Deployment, error)
	FetchDeploymentList(namespace string) (*appsv1.DeploymentList, error)
	MustFetchDeployment(key types.NamespacedName) (*appsv1.Deployment, error)
	IsDeploymentAvailable(key types.NamespacedName) (bool, error)
	FetchReadyReplicas(key types.NamespacedName) (int32, error)
	GetComparator() compare.MapComparator
}

DeploymentHandler ...

func NewDeploymentHandler

func NewDeploymentHandler(context operator.Context) DeploymentHandler

NewDeploymentHandler ...

type EndPointConfigMapHandler added in v1.19.0

type EndPointConfigMapHandler interface {
	GetEndPointConfigMapName(serviceName string) string
	FetchEndPointConfigMap(key types.NamespacedName) (*v1.ConfigMap, error)
}

EndPointConfigMapHandler ...

func NewEndPointConfigMapHandler added in v1.19.0

func NewEndPointConfigMapHandler(context operator.Context) EndPointConfigMapHandler

NewEndPointConfigMapHandler ...

type ImageHandler

type ImageHandler interface {
	ResolveImage() (string, error)
	ResolveImageNameTag() string
	ResolveImageStreamTriggerAnnotation(containerName string) (key, value string)
	CreateImageStreamIfNotExists() (*imgv1.ImageStream, error)
	ReconcileImageStream(owner client.Object) error
}

ImageHandler describes the handler structure to handle Kogito Services Images

func NewImageHandler

func NewImageHandler(context operator.Context, image *api.Image, defaultImageName, imageStreamName, namespace string, addFromReference, insecureImageRegistry bool) ImageHandler

NewImageHandler ...

type ImageStreamHandler

type ImageStreamHandler interface {
	// FetchDockerImage fetches a docker image based on a ImageStreamTag with the defined key (namespace and name).
	// Returns nil if not found
	FetchDockerImage(key types.NamespacedName) (*dockerv10.DockerImage, error)
	// FetchTag fetches for a particular ImageStreamTag on OpenShift cluster.
	// If tag is nil or empty, will search for "latest".
	// Returns nil if the object was not found.
	FetchTag(key types.NamespacedName, tag string) (*imgv1.ImageStreamTag, error)
	// CreateTagIfNotExists will create a new ImageStreamTag if not exists
	CreateTagIfNotExists(image *imgv1.ImageStreamTag) (bool, error)
	// CreateImageStream will create a new ImageStream if not exists
	CreateImageStream(is *imgv1.ImageStream) (bool, error)
	FetchImageStream(key types.NamespacedName) (*imgv1.ImageStream, error)
	MustFetchImageStream(key types.NamespacedName) (*imgv1.ImageStream, error)
	CreateImageStreamIfNotExists(key types.NamespacedName, tag string, addFromReference bool, imageName string, insecureImageRegistry bool) (*imgv1.ImageStream, error)
	ResolveImage(key types.NamespacedName, tag string) (string, error)
	RemoveSharedImageStreamOwnerShip(key types.NamespacedName, owner client.Object) error
	FetchImageStreamForOwner(owner client.Object) ([]client.Object, error)
}

ImageStreamHandler ...

func NewImageStreamHandler

func NewImageStreamHandler(context operator.Context) ImageStreamHandler

NewImageStreamHandler ...

type ImageStreamReconciler added in v1.8.0

type ImageStreamReconciler interface {
	Reconcile() error
}

ImageStreamReconciler ...

func NewImageStreamReconciler added in v1.8.0

func NewImageStreamReconciler(context operator.Context, key types.NamespacedName, tag string, addFromReference bool, imageName string, insecureImageRegistry bool, owner client.Object) ImageStreamReconciler

NewImageStreamReconciler ...

type InfinispanCredential

type InfinispanCredential struct {
	Username string `yaml:"username"`
	Password string `yaml:"password"`
}

InfinispanCredential holds the information to authenticate into an infinispan server

type InfinispanHandler

type InfinispanHandler interface {
	FetchInfinispanInstance(key types.NamespacedName) (*ispn.Infinispan, error)
	IsInfinispanAvailable() bool
	FetchInfinispanInstanceURI(key types.NamespacedName) (string, error)
	GetInfinispanCredential(infinispanInstance *ispn.Infinispan) (*InfinispanCredential, error)
}

InfinispanHandler ...

func NewInfinispanHandler

func NewInfinispanHandler(context operator.Context) InfinispanHandler

NewInfinispanHandler ...

type InfinispanIdentity

type InfinispanIdentity struct {
	Credentials []InfinispanCredential `yaml:"credentials"`
}

InfinispanIdentity is the struct for the secret holding the credential for the Infinispan server

type KafkaHandler

type KafkaHandler interface {
	IsStrimziAvailable() bool
	FetchKafkaInstance(key types.NamespacedName) (*v1beta2.Kafka, error)
	FetchKafkaTopic(key types.NamespacedName) (*v1beta2.KafkaTopic, error)
	CreateKafkaTopic(topicName, kafkaName, kafkaNamespace string) (*v1beta2.KafkaTopic, error)
	ResolveKafkaServerURI(kafka *v1beta2.Kafka) (string, error)
}

KafkaHandler ...

func NewKafkaHandler

func NewKafkaHandler(context operator.Context) KafkaHandler

NewKafkaHandler ...

type KeycloakHandler

type KeycloakHandler interface {
	IsKeycloakAvailable() bool
}

KeycloakHandler ...

func NewKeycloakHandler

func NewKeycloakHandler(context operator.Context) KeycloakHandler

NewKeycloakHandler ...

type KnativeHandler

type KnativeHandler interface {
	IsKnativeEventingAvailable() bool
	FetchBroker(key types.NamespacedName) (*eventingv1.Broker, error)
}

KnativeHandler ...

func NewKnativeHandler

func NewKnativeHandler(context operator.Context) KnativeHandler

NewKnativeHandler ...

type MongoDBHandler

type MongoDBHandler interface {
	IsMongoDBAvailable() bool
	IsMongoDBOperatorAvailable(namespace string) (bool, error)
	FetchMongoDBInstance(key types.NamespacedName) (*mongodb.MongoDBCommunity, error)
}

MongoDBHandler ...

func NewMongoDBHandler

func NewMongoDBHandler(context operator.Context) MongoDBHandler

NewMongoDBHandler ...

type RBACHandler

type RBACHandler interface {
	SetupRBAC(namespace string) (err error)
}

RBACHandler ...

func NewRBACHandler

func NewRBACHandler(context operator.Context) RBACHandler

NewRBACHandler ...

type ReconciliationError added in v1.10.0

type ReconciliationError struct {
	// contains filtered or unexported fields
}

ReconciliationError ...

func ErrorForDashboards added in v1.10.0

func ErrorForDashboards(err error) ReconciliationError

ErrorForDashboards ...

func ErrorForDeploymentNotReachable added in v1.10.0

func ErrorForDeploymentNotReachable(instance string) ReconciliationError

ErrorForDeploymentNotReachable ...

func ErrorForImageNotFound added in v1.12.0

func ErrorForImageNotFound() ReconciliationError

ErrorForImageNotFound ...

func ErrorForInfraNotReady added in v1.10.0

func ErrorForInfraNotReady(serviceName string, infraName string, conditionReason string) ReconciliationError

ErrorForInfraNotReady ...

func ErrorForMessaging added in v1.10.0

func ErrorForMessaging(err error) ReconciliationError

ErrorForMessaging ...

func ErrorForMonitoring added in v1.10.0

func ErrorForMonitoring(err error) ReconciliationError

ErrorForMonitoring ...

func ErrorForProcessingImageStreamDelta added in v1.10.0

func ErrorForProcessingImageStreamDelta() ReconciliationError

ErrorForProcessingImageStreamDelta ...

func ErrorForProcessingProtoBufConfigMapDelta added in v1.12.0

func ErrorForProcessingProtoBufConfigMapDelta() ReconciliationError

ErrorForProcessingProtoBufConfigMapDelta ...

func ErrorForRouteCreation added in v1.14.0

func ErrorForRouteCreation(err error) ReconciliationError

ErrorForRouteCreation ...

func ErrorForServiceNotReachable added in v1.10.0

func ErrorForServiceNotReachable(statusCode int, requestURL string, method string) ReconciliationError

ErrorForServiceNotReachable ...

func ErrorForTrustStoreMount added in v1.10.0

func ErrorForTrustStoreMount(message string) ReconciliationError

ErrorForTrustStoreMount ...

func (ReconciliationError) Error added in v1.10.0

func (e ReconciliationError) Error() string

Error error implementation

func (ReconciliationError) String added in v1.10.0

func (e ReconciliationError) String() string

String stringer implementation

type ReconciliationErrorHandler added in v1.10.0

type ReconciliationErrorHandler interface {
	IsReconciliationError(err error) bool
	GetReconcileResultFor(err error) (ctrl.Result, error)
	GetReasonForError(err error) ConditionReason
}

ReconciliationErrorHandler ...

func NewReconciliationErrorHandler added in v1.10.0

func NewReconciliationErrorHandler(context operator.Context) ReconciliationErrorHandler

NewReconciliationErrorHandler ...

type RouteHandler

type RouteHandler interface {
	FetchRoute(key types.NamespacedName) (*routev1.Route, error)
	GetHostFromRoute(routeKey types.NamespacedName) (string, error)
	CreateRoute(instance api.KogitoService) *routev1.Route
	GetComparator() compare.MapComparator
	ValidateRouteStatus(routeKey types.NamespacedName) (bool, error)
}

RouteHandler ...

func NewRouteHandler

func NewRouteHandler(context operator.Context) RouteHandler

NewRouteHandler ...

type SecretHandler added in v1.12.0

type SecretHandler interface {
	FetchSecret(key types.NamespacedName) (*corev1.Secret, error)
	MustFetchSecret(key types.NamespacedName) (*corev1.Secret, error)
	GetComparator() compare.MapComparator
	MountAsVolume(deployment *appsv1.Deployment, volumeReference api.VolumeReferenceInterface) error
	MountAsEnvFrom(deployment *appsv1.Deployment, cmName string)
}

SecretHandler ...

func NewSecretHandler added in v1.12.0

func NewSecretHandler(context operator.Context) SecretHandler

NewSecretHandler ...

type ServiceHandler

type ServiceHandler interface {
	FetchService(key types.NamespacedName) (*corev1.Service, error)
	CreateService(instance api.KogitoService) *corev1.Service
	GetComparator() compare.MapComparator
}

ServiceHandler ...

func NewServiceHandler

func NewServiceHandler(context operator.Context) ServiceHandler

NewServiceHandler ...

Directories

Path Synopsis
Package grafana contains grafana API versions.
Package grafana contains grafana API versions.
v1alpha1
Package v1alpha1 contains API Schema definitions for the integreatly v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=integreatly.org
Package v1alpha1 contains API Schema definitions for the integreatly v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=integreatly.org
Package infinispan contains infinispan API versions.
Package infinispan contains infinispan API versions.
v1
Package v1 contains API Schema definitions for the infinispan v1 API group +k8s:deepcopy-gen=package,register +groupName=infinispan.org
Package v1 contains API Schema definitions for the infinispan v1 API group +k8s:deepcopy-gen=package,register +groupName=infinispan.org
Package kafka contains kafka API versions.
Package kafka contains kafka API versions.
v1beta2
Package v1beta2 contains API Schema definitions for the kafka v1beta2 API group +k8s:deepcopy-gen=package,register +groupName=kafka.strimzi.io +kubebuilder:skip
Package v1beta2 contains API Schema definitions for the kafka v1beta2 API group +k8s:deepcopy-gen=package,register +groupName=kafka.strimzi.io +kubebuilder:skip
Package keycloak contains keycloak API versions.
Package keycloak contains keycloak API versions.
v1alpha1
Package v1alpha1 contains API Schema definitions for the keycloak v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=keycloak.org
Package v1alpha1 contains API Schema definitions for the keycloak v1alpha1 API group +k8s:deepcopy-gen=package,register +groupName=keycloak.org
Package mongodb contains mongodb API versions.
Package mongodb contains mongodb API versions.
v1
Package v1 contains API Schema definitions for the mongodb v1 API group +k8s:deepcopy-gen=package,register +groupName=mongodbcommunity.mongodb.com +versionName=v1
Package v1 contains API Schema definitions for the mongodb v1 API group +k8s:deepcopy-gen=package,register +groupName=mongodbcommunity.mongodb.com +versionName=v1

Jump to

Keyboard shortcuts

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