Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from static parser to a dynamic parser #71

Merged
merged 4 commits into from
Aug 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
-
name: BASIC_AUTH_ENABLED
value: "false"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m2"

messagingSystem:
type: nats
Expand Down
2 changes: 1 addition & 1 deletion deploy/examples/example-stateful-distributed-log-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
-
name: BASIC_AUTH_ENABLED
value: "false"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m1"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m2"

messagingSystem:
type: nats
Expand Down
2 changes: 1 addition & 1 deletion deploy/examples/example-stateful-distributed-nats-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
-
name: BASIC_AUTH_ENABLED
value: "false"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m1"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m2"

messagingSystem:
type: nats
Expand Down
2 changes: 1 addition & 1 deletion deploy/examples/example-stateful-monolithic-log-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
-
name: BASIC_AUTH_ENABLED
value: "false"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m1"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m2"

persistentVolume:
accessModes:
Expand Down
2 changes: 1 addition & 1 deletion deploy/examples/example-stateless-email-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ spec:
-
name: BASIC_AUTH_ENABLED
value: "false"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m1"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m2"
2 changes: 1 addition & 1 deletion deploy/examples/example-stateless-log-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ spec:
-
name: BASIC_AUTH_ENABLED
value: "false"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m1"
image: "siddhiio/siddhi-runner-ubuntu:5.1.0-m2"
62 changes: 3 additions & 59 deletions deploy/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
data:
siddhiHome: /home/siddhi_user/siddhi-runner/
siddhiProfile: runner
siddhiImage: siddhiio/siddhi-runner-alpine:5.1.0-m1
siddhiImage: siddhiio/siddhi-runner-alpine:5.1.0-m2
autoIngressCreation: "true"
# ingressTLS: siddhi-tls
---
Expand All @@ -30,7 +30,7 @@ spec:
serviceAccountName: siddhi-operator
containers:
- name: siddhi-operator
image: siddhiio/siddhi-operator:0.2.0-m1
image: siddhiio/siddhi-operator:0.2.0-m2
command:
- siddhi-operator
imagePullPolicy: Always
Expand All @@ -46,62 +46,6 @@ spec:
- name: OPERATOR_NAME
value: siddhi-operator
- name: OPERATOR_VERSION
value: 0.2.0-m1
value: 0.2.0-m2
- name: OPERATOR_CONFIGMAP
value: siddhi-operator-config

---

# Deployment of the siddhi parser
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: siddhi-parser
spec:
replicas: 1
selector:
matchLabels:
name: siddhi-parser
version: 0.2.0-m1
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
name: siddhi-parser
version: 0.2.0-m1
spec:
containers:
- image: siddhiio/siddhi-parser:0.2.0-m1
imagePullPolicy: IfNotPresent
name: siddhirunner-msf4j
ports:
- containerPort: 9090
name: port
protocol: TCP

---

# Service of the siddhi parser
apiVersion: v1
kind: Service
metadata:
name: siddhi-parser
spec:
ports:
- name: msf4j
port: 9090
protocol: TCP
targetPort: 9090
selector:
name: siddhi-parser
version: 0.2.0-m1
sessionAffinity: None
type: ClusterIP
status:
loadBalancer: {}

---
80 changes: 80 additions & 0 deletions pkg/controller/siddhiprocess/artifacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,86 @@ func (rsp *ReconcileSiddhiProcess) CreateOrUpdateDeployment(
return
}

// DeleteService delete the service specify by the user
func (rsp *ReconcileSiddhiProcess) DeleteService(
serviceName string,
namespace string,
) (err error) {
service := &corev1.Service{}
er := rsp.client.Get(
context.TODO(),
types.NamespacedName{Name: serviceName, Namespace: namespace},
service,
)
if er == nil {
err = rsp.client.Delete(context.TODO(), service)
if err != nil {
return
}
}
return
}

// DeleteDeployment delete the deployment specify by the user
func (rsp *ReconcileSiddhiProcess) DeleteDeployment(
deploymentName string,
namespace string,
) (err error) {
deployment := &appsv1.Deployment{}
er := rsp.client.Get(
context.TODO(),
types.NamespacedName{Name: deploymentName, Namespace: namespace},
deployment,
)
if er == nil {
err = rsp.client.Delete(context.TODO(), deployment)
if err != nil {
return
}
}
return
}

// DeletePVC delete the PVC specify by the user
func (rsp *ReconcileSiddhiProcess) DeletePVC(
pvcName string,
namespace string,
) (err error) {
pvc := &corev1.PersistentVolumeClaim{}
er := rsp.client.Get(
context.TODO(),
types.NamespacedName{Name: pvcName, Namespace: namespace},
pvc,
)
if er == nil {
err = rsp.client.Delete(context.TODO(), pvc)
if err != nil {
return
}
}
return
}

// DeleteConfigMap delete the CM specify by the user
func (rsp *ReconcileSiddhiProcess) DeleteConfigMap(
cmName string,
namespace string,
) (err error) {
cm := &corev1.ConfigMap{}
er := rsp.client.Get(
context.TODO(),
types.NamespacedName{Name: cmName, Namespace: namespace},
cm,
)
if er == nil {
err = rsp.client.Delete(context.TODO(), cm)
if err != nil {
return
}
}
return
}

// ConfigMapMutateFunc is the mutate function for k8s config map creation
func ConfigMapMutateFunc(data map[string]string) controllerutil.MutateFn {
return func(obj runtime.Object) error {
Expand Down
36 changes: 23 additions & 13 deletions pkg/controller/siddhiprocess/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
// Default configurations stored as constants. Further these constants used by the Configurations() function.
const (
SiddhiHome string = "/home/siddhi_user/siddhi-runner/"
SiddhiImage string = "siddhiio/siddhi-runner-alpine:5.1.0-m1"
SiddhiImage string = "siddhiio/siddhi-runner-alpine:5.1.0-m2"
SiddhiProfile string = "runner"
SiddhiCMExt string = "-siddhi"
SiddhiExt string = ".siddhi"
Expand All @@ -47,16 +47,17 @@ const (
SiddhiBin string = "bin"
HostName string = "siddhi"
OperatorName string = "siddhi-operator"
OperatorVersion string = "0.2.0-m1"
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"
ParserDomain string = "http://siddhi-parser."
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"
Expand Down Expand Up @@ -114,14 +115,21 @@ state.persistence:
// 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.
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"
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"
ParserPort int32 = 9090
ParserReplicas int32 = 1
ParserMinWait int = 5
ParserMaxWait int = 20
ParserMaxRetry int = 15
)

// Int - Type
Expand Down Expand Up @@ -166,8 +174,9 @@ type Configs struct {
PVCExt string
FilePersistentDir string
WSO2Dir string
ParserDomain string
ParserHTTP string
ParserContext string
ParserHealth string
PVCSize string
NATSAPIVersion string
STANAPIVersion string
Expand Down Expand Up @@ -391,8 +400,9 @@ func (rsp *ReconcileSiddhiProcess) Configurations(sp *siddhiv1alpha2.SiddhiProce
PVCExt: PVCExt,
FilePersistentDir: FilePersistentDir,
WSO2Dir: WSO2Dir,
ParserDomain: ParserDomain,
ParserHTTP: ParserHTTP,
ParserContext: ParserContext,
ParserHealth: ParserHealth,
PVCSize: PVCSize,
NATSAPIVersion: NATSAPIVersion,
STANAPIVersion: STANAPIVersion,
Expand Down
Loading