siddhiprocess

package
v0.2.0-m2 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0 Imports: 36 Imported by: 1

Documentation

Index

Constants

View Source
const (
	SiddhiHome                 string = "/home/siddhi_user/siddhi-runner/"
	SiddhiImage                string = "siddhiio/siddhi-runner-alpine:5.1.0-m2"
	SiddhiProfile              string = "runner"
	SiddhiCMExt                string = "-siddhi"
	SiddhiExt                  string = ".siddhi"
	SiddhiFilesDir             string = "siddhi-files/"
	ContainerName              string = "siddhi-runner-runtime"
	DepConfMountPath           string = "tmp/configs/"
	DepConfParameter           string = "-Dconfig="
	AppConfParameter           string = "-Dapps="
	DepCMExt                   string = "-depyml"
	Shell                      string = "sh"
	SiddhiBin                  string = "bin"
	HostName                   string = "siddhi"
	OperatorName               string = "siddhi-operator"
	OperatorVersion            string = "0.2.0-m2"
	CRDName                    string = "SiddhiProcess"
	ReadWriteOnce              string = "ReadWriteOnce"
	ReadOnlyMany               string = "ReadOnlyMany"
	ReadWriteMany              string = "ReadWriteMany"
	PVCExt                     string = "-pvc"
	FilePersistentDir          string = "siddhi-app-persistence"
	WSO2Dir                    string = "wso2"
	ParserHTTP                 string = "http://"
	ParserContext              string = ".svc.cluster.local:9090/siddhi-parser/parse"
	ParserHealth               string = ".svc.cluster.local:9090/health"
	PVCSize                    string = "1Gi"
	NATSAPIVersion             string = "nats.io/v1alpha2"
	STANAPIVersion             string = "streaming.nats.io/v1alpha1"
	NATSKind                   string = "NatsCluster"
	STANKind                   string = "NatsStreamingCluster"
	NATSExt                    string = "-nats"
	STANExt                    string = "-stan"
	NATSClusterName            string = "siddhi-nats"
	STANClusterName            string = "siddhi-stan"
	NATSDefaultURL             string = "nats://siddhi-nats:4222"
	NATSTCPHost                string = "siddhi-nats:4222"
	NATSMSType                 string = "nats"
	TCP                        string = "tcp"
	IngressTLS                 string = ""
	HealthPortName             string = "hport"
	HealthPath                 string = "/health"
	AutoCreateIngress          bool   = true
	NATSSize                   int    = 1
	NATSTimeout                int    = 5
	DefaultRTime               int    = 1
	DeploymentSize             int32  = 1
	MaxUnavailable             int32  = 0
	MaxSurge                   int32  = 2
	HealthPort                 int32  = 9090
	ReadyPrPeriodSeconds       int32  = 10
	ReadyPrInitialDelaySeconds int32  = 10
	LivePrPeriodSeconds        int32  = 70
	LivePrInitialDelaySeconds  int32  = 20
)

Default configurations stored as constants. Further these constants used by the Configurations() function.

View Source
const (
	StatePersistenceConf string = `` /* 210-byte string literal not displayed */

	StatePersistenceConfTest string = `` /* 200-byte string literal not displayed */

)

State persistence config is the different string constant used by the deployApp() function. This constant holds a YAML object which used to change the deployment.yaml file of the siddhi-runner image.

View Source
const (
	Push            string = "PUSH"
	Pull            string = "PULL"
	Failover        string = "failover"
	Default         string = "default"
	Distributed     string = "distributed"
	ProcessApp      string = "process"
	PassthroughApp  string = "passthrough"
	OperatorCMName  string = "siddhi-operator-config"
	ParserParameter string = "-Dsiddhi-parser "
	ParserName      string = "parser"
	ParserExtension string = "-parser"
	ParserPort      int32  = 9090
	ParserReplicas  int32  = 1
	ParserMinWait   int    = 3
	ParserMaxWait   int    = 5
	ParserMaxRetry  int    = 20
)

These are all other relevant constants that used by the operator. But these constants are not configuration varibles. That is why this has been seperated.

View Source
const (
	Int intstr.Type = iota
	String
)

Int - Type

Variables

View Source
var CMContainer map[string]ConfigMapListner

CMContainer holds the config map name along with CM listner for listen changes of the CM

ER recoder

View Source
var SPContainer map[string][]SiddhiApp

SPContainer holds siddhi apps

Functions

func Add

func Add(mgr manager.Manager) error

Add creates a new SiddhiProcess Controller and adds it to the Manager. The Manager will set fields on the Controller and Start it when the Manager is Started.

func ConfigMapMutateFunc

func ConfigMapMutateFunc(data map[string]string) controllerutil.MutateFn

ConfigMapMutateFunc is the mutate function for k8s config map creation

func DeploymentMutateFunc

func DeploymentMutateFunc(
	replicas int32,
	labels map[string]string,
	image string,
	containerName string,
	command []string,
	args []string,
	ports []corev1.ContainerPort,
	volumeMounts []corev1.VolumeMount,
	envs []corev1.EnvVar,
	sc corev1.SecurityContext,
	ipp corev1.PullPolicy,
	secrets []corev1.LocalObjectReference,
	volumes []corev1.Volume,
) controllerutil.MutateFn

DeploymentMutateFunc is the mutate function for k8s deployment creation

func IngressMutateFunc

func IngressMutateFunc(siddhiApp SiddhiApp, configs Configs) controllerutil.MutateFn

IngressMutateFunc is the mutate function for k8s ingress creation

func PVCMutateFunc

func PVCMutateFunc(
	accessModes []corev1.PersistentVolumeAccessMode,
	storage string,
	class string,
) controllerutil.MutateFn

PVCMutateFunc is the mutate function for k8s pvc creation

func ServiceMutateFunc

func ServiceMutateFunc(labels map[string]string, ports []corev1.ServicePort) controllerutil.MutateFn

ServiceMutateFunc is the mutate function for k8s service creation

Types

type ConfigMapListner

type ConfigMapListner struct {
	SiddhiProcess string `json:"siddhiProcess"`
	Changed       bool   `json:"changed"`
}

ConfigMapListner holds the change details of a config map

type Configs added in v0.1.1

type Configs struct {
	SiddhiHome                 string
	SiddhiImage                string
	SiddhiImageSecret          string
	SiddhiCMExt                string
	SiddhiExt                  string
	SiddhiFilesDir             string
	SiddhiProfile              string
	ContainerName              string
	DepConfMountPath           string
	DepConfParameter           string
	AppConfParameter           string
	DepCMExt                   string
	Shell                      string
	SiddhiBin                  string
	HostName                   string
	OperatorName               string
	OperatorVersion            string
	CRDName                    string
	ReadWriteOnce              string
	ReadOnlyMany               string
	ReadWriteMany              string
	PVCExt                     string
	FilePersistentDir          string
	WSO2Dir                    string
	ParserHTTP                 string
	ParserContext              string
	ParserHealth               string
	PVCSize                    string
	NATSAPIVersion             string
	STANAPIVersion             string
	NATSKind                   string
	STANKind                   string
	NATSExt                    string
	STANExt                    string
	NATSClusterName            string
	STANClusterName            string
	NATSDefaultURL             string
	NATSTCPHost                string
	NATSMSType                 string
	TCP                        string
	IngressTLS                 string
	HealthPortName             string
	HealthPath                 string
	AutoCreateIngress          bool
	NATSSize                   int
	NATSTimeout                int
	DefaultRTime               int
	DeploymentSize             int32
	MaxUnavailable             int32
	MaxSurge                   int32
	HealthPort                 int32
	ReadyPrPeriodSeconds       int32
	ReadyPrInitialDelaySeconds int32
	LivePrPeriodSeconds        int32
	LivePrInitialDelaySeconds  int32
}

Configs is the struct definition of the object which used to bundle the all default configurations

type IntOrString

type IntOrString struct {
	Type   Type   `protobuf:"varint,1,opt,name=type,casttype=Type"`
	IntVal int32  `protobuf:"varint,2,opt,name=intVal"`
	StrVal string `protobuf:"bytes,3,opt,name=strVal"`
}

IntOrString - integer or string

type ReconcileSiddhiProcess

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

ReconcileSiddhiProcess reconciles a SiddhiProcess object

func (*ReconcileSiddhiProcess) Configurations

Configurations function returns the default config object. Here all the configs used as constants and budle together into a object and then returns that object. This object used to differenciate default configs from other variables.

func (*ReconcileSiddhiProcess) CreateNATS

func (rsp *ReconcileSiddhiProcess) CreateNATS(sp *siddhiv1alpha2.SiddhiProcess, configs Configs) error

CreateNATS function creates a NATS cluster and a NATS streaming cluster More about NATS cluster - https://github.com/nats-io/nats-operator More about NATS streaming cluster - https://github.com/nats-io/nats-streaming-operator

func (*ReconcileSiddhiProcess) CreateOrUpdateCM

func (rsp *ReconcileSiddhiProcess) CreateOrUpdateCM(
	sp *siddhiv1alpha2.SiddhiProcess,
	configMapName string,
	data map[string]string,
) error

CreateOrUpdateCM creates a k8s config map for given set of data. This function initialize the config map object, set the controller reference, and then creates the config map.

func (*ReconcileSiddhiProcess) CreateOrUpdateDeployment

func (rsp *ReconcileSiddhiProcess) CreateOrUpdateDeployment(
	sp *siddhiv1alpha2.SiddhiProcess,
	name string,
	namespace string,
	replicas int32,
	labels map[string]string,
	image string,
	containerName string,
	command []string,
	args []string,
	ports []corev1.ContainerPort,
	volumeMounts []corev1.VolumeMount,
	envs []corev1.EnvVar,
	sc corev1.SecurityContext,
	ipp corev1.PullPolicy,
	secrets []corev1.LocalObjectReference,
	volumes []corev1.Volume,
	strategy appsv1.DeploymentStrategy,
	configs Configs,
) (operationResult controllerutil.OperationResult, err error)

CreateOrUpdateDeployment creates a deployment for given set of configuration data

func (*ReconcileSiddhiProcess) CreateOrUpdateIngress

func (rsp *ReconcileSiddhiProcess) CreateOrUpdateIngress(
	sp *siddhiv1alpha2.SiddhiProcess,
	siddhiApp SiddhiApp,
	configs Configs,
) (operationResult controllerutil.OperationResult, err error)

CreateOrUpdateIngress creates a NGINX Ingress load balancer object called siddhi

func (*ReconcileSiddhiProcess) CreateOrUpdatePVC

func (rsp *ReconcileSiddhiProcess) CreateOrUpdatePVC(
	sp *siddhiv1alpha2.SiddhiProcess,
	configs Configs,
	pvcName string,
) error

CreateOrUpdatePVC function creates a persistence volume claim for a K8s cluster

func (*ReconcileSiddhiProcess) CreateOrUpdateService

func (rsp *ReconcileSiddhiProcess) CreateOrUpdateService(
	sp *siddhiv1alpha2.SiddhiProcess,
	siddhiApp SiddhiApp,
	configs Configs,
) (operationResult controllerutil.OperationResult, err error)

CreateOrUpdateService returns a Service object for a deployment

func (*ReconcileSiddhiProcess) DeleteConfigMap

func (rsp *ReconcileSiddhiProcess) DeleteConfigMap(
	cmName string,
	namespace string,
) (err error)

DeleteConfigMap delete the CM specify by the user

func (*ReconcileSiddhiProcess) DeleteDeployment

func (rsp *ReconcileSiddhiProcess) DeleteDeployment(
	deploymentName string,
	namespace string,
) (err error)

DeleteDeployment delete the deployment specify by the user

func (*ReconcileSiddhiProcess) DeletePVC

func (rsp *ReconcileSiddhiProcess) DeletePVC(
	pvcName string,
	namespace string,
) (err error)

DeletePVC delete the PVC specify by the user

func (*ReconcileSiddhiProcess) DeleteService

func (rsp *ReconcileSiddhiProcess) DeleteService(
	serviceName string,
	namespace string,
) (err error)

DeleteService delete the service specify by the user

func (*ReconcileSiddhiProcess) Reconcile

func (rsp *ReconcileSiddhiProcess) Reconcile(request reconcile.Request) (reconcile.Result, error)

Reconcile reads that state of the cluster for a SiddhiProcess object and makes changes based on the state read and what is in the SiddhiProcess.Spec

type SPConfig

type SPConfig struct {
	Location string `yaml:"location"`
}

SPConfig contains the state persistence configs

type SiddhiApp

type SiddhiApp struct {
	Name               string                 `json:"appName"`
	ContainerPorts     []corev1.ContainerPort `json:"containerPorts"`
	Apps               map[string]string      `json:"apps"`
	ServiceEnabled     bool                   `json:"serviceEnabled"`
	PersistenceEnabled bool                   `json:"persistenceEnabled"`
	Replicas           int32                  `json:"replicas"`
}

SiddhiApp contains details about the siddhi app which need in the K8s deployment

type SiddhiAppConfig

type SiddhiAppConfig struct {
	SiddhiApp               string                   `json:"siddhiApp"`
	SourceDeploymentConfigs []SourceDeploymentConfig `json:"sourceDeploymentConfigs"`
	PersistenceEnabled      bool                     `json:"persistenceEnabled"`
	Replicas                int32                    `json:"replicas"`
}

SiddhiAppConfig holds siddhi app and the relevant SourceList

type SiddhiConfig

type SiddhiConfig struct {
	StatePersistence StatePersistence `yaml:"state.persistence"`
}

SiddhiConfig contains the siddhi config block

type SiddhiParserRequest

type SiddhiParserRequest struct {
	SiddhiApps      []string                        `json:"siddhiApps"`
	PropertyMap     map[string]string               `json:"propertyMap"`
	MessagingSystem *siddhiv1alpha2.MessagingSystem `json:"messagingSystem,omitempty"`
}

SiddhiParserRequest is request struct of the siddhi-parser

type SourceDeploymentConfig

type SourceDeploymentConfig struct {
	ServiceProtocol string `json:"serviceProtocol"`
	Secured         bool   `json:"secured"`
	Port            int    `json:"port"`
	IsPulling       bool   `json:"isPulling"`
}

SourceDeploymentConfig hold deployment configs of a particular siddhi app

type StatePersistence

type StatePersistence struct {
	SPConfig SPConfig `yaml:"config"`
}

StatePersistence contains the StatePersistence config block

type Status

type Status int

Status of a Siddhi process

const (
	PENDING Status = iota
	READY
	RUNNING
	ERROR
	WARNING
	NORMAL
)

Type of status as list of integer constans

type TemplatedApp

type TemplatedApp struct {
	App         string            `json:"siddhiApp"`
	PropertyMap map[string]string `json:"propertyMap"`
}

TemplatedApp contains the templated siddhi app and relevant properties to pass into the parser service

type Type

type Type int

Type represents the stored type of IntOrString.

Jump to

Keyboard shortcuts

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