Skip to content

Commit

Permalink
Merge branch 'apache:dev' into Refactor_the_lifecycle_control_of_Flin…
Browse files Browse the repository at this point in the history
…k_application-mode_
  • Loading branch information
caicancai authored Aug 30, 2023
2 parents 32076c8 + 5fd0760 commit d2b3c7a
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 36 deletions.
19 changes: 19 additions & 0 deletions deploy/helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Deploy StreamPark on k8s

### 1. create template

```shell
helm template streampark/ -n default -f streampark/values.yaml --output-dir ./result
```

### 2. apply

```shell
kubectl apply -f result/streampark/templates
```

### 3. open WebUI

http://${host}:10000

#### [more detail](streampark/templates/NOTES.txt)
20 changes: 12 additions & 8 deletions deploy/helm/streampark/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,27 @@
# limitations under the License.
#
{{- if .Values.ingress.enabled }}
apiVersion: networking.k8s.io/v1beta1
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "streampark.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "streampark.labels" . | nindent 4 }}
annotations:
nginx.ingress.kubernetes.io/configuration-snippet: {{ .Values.nginx.ingress.kubernetes.configurationSnippet }}
nginx.ingress.kubernetes.io/proxy-body-size: {{ .Values.nginx.ingress.kubernetes.proxyBbodySize }}
nginx.ingress.kubernetes.io/rewrite-target: {{ .Values.nginx.ingress.kubernetes.rewriteTarget }}
{{- with .Values.ingress.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- backend:
serviceName: {{ .Values.service.name }}
servicePort: {{ .Values.spec.name }}
path: {{ .Values.ingress.path }}
- backend:
service:
name: {{ .Values.service.name }}
port:
name: {{ .Values.spec.name }}
path: {{ .Values.ingress.path }}
pathType: {{ .Values.ingress.pathType }}
{{- end }}
19 changes: 7 additions & 12 deletions deploy/helm/streampark/templates/streampark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
labels:
{{- include "streampark.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount}}
replicas: {{ .Values.spec.replicaCount }}
selector:
matchLabels:
{{- include "streampark.selectorLabels" . | nindent 6 }}
Expand Down Expand Up @@ -57,11 +57,10 @@ spec:
containerPort: {{ .Values.spec.containerPort }}
protocol: TCP
env:
- name: TZ
value: {{ .Values.timezone }}
{{- toYaml .Values.spec.container.env | nindent 12 }}
securityContext:
privileged: false
command: ["bash","-c","bash bin/startup.sh"]
command: ["bash","-c","bash ./bin/streampark.sh start_docker"]
{{- if .Values.spec.livenessProbe.enabled }}
livenessProbe:
exec:
Expand All @@ -83,11 +82,10 @@ spec:
failureThreshold: {{ .Values.spec.readinessProbe.failureThreshold }}
{{- end }}
volumeMounts:
- name: volume-docker
mountPath: /var/run/docker.sock
readOnly: true
- name: streampark-default-config-volume
mountPath: /streampark/conf
mountPath: /usr/local/service/streampark/conf
resources:
{{- toYaml .Values.spec.resources | nindent 12 }}
volumes:
- name: streampark-default-config-volume
configMap:
Expand All @@ -109,9 +107,6 @@ spec:
path: spy.properties
- key: ValidationMessages.properties
path: ValidationMessages.properties
- name: volume-docker
hostPath:
path: /var/run/docker.sock
type: ""



60 changes: 47 additions & 13 deletions deploy/helm/streampark/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,40 @@
# When enabled RBAC is only created for said namespaces, otherwise it is done for the cluster scope.
# watchNamespaces: ["streampark"]

timezone: "Asia/Shanghai"

image:
repository: "apache/streampark"
pullPolicy: "IfNotPresent"
tag: "2.2.0-SNAPSHOT"
tag: "2.1.1"
pullSecret: ""

rbac:
create: true

spec:
container:
env: [
{
name: TZ,
value: "Asia/Shanghai"
},
{
name: DOCKER_HOST,
value: "tcp://localhost:2375"
},
{
name: LANG,
value: en_US.UTF-8
},
{
name: LANGUAGE,
value: en_US:en
},
{
name: LC_ALL,
value: en_US.UTF-8
}
]

replicaCount: 1
containerPort: 10000
name: rest
Expand All @@ -42,7 +64,17 @@ spec:
tolerations: [ ]
## Affinity is a group of affinity scheduling rules. If specified, the pod's scheduling constraints.
## More info: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#affinity-v1-core
resources: { }
resources: {
limits: {
memory: "1Gi",
cpu: "1"
},
requests: {
memory: "1Gi",
cpu: "1"
}
}

# resources:
# limits:
# memory: "2Gi"
Expand Down Expand Up @@ -72,10 +104,18 @@ spec:
successThreshold: "1"

ingress:
enabled: false
enabled: true
host: "streampark.apache.org"
path: "/streampark"
annotations: {}
path: "/streampark(/|$)(.*)"
pathType: "ImplementationSpecific"
annotations: {
nginx.ingress.kubernetes.io/rewrite-target: "/$2",
nginx.ingress.kubernetes.io/proxy-body-size: "1024m",
## fix swagger 404: https://github.com/springdoc/springdoc-openapi/issues/1741
## add rewrite ^/v3/(.*)$ /streampark/v3/$1 redirect;
nginx.ingress.kubernetes.io/configuration-snippet: 'rewrite ^(/streampark)$ $1/ permanent;',
kubernetes.io/ingress.class: "nginx"
}

service:
## type determines how the Service is exposed. Defaults to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort, and LoadBalancer
Expand All @@ -96,9 +136,3 @@ streamParkServiceAccount:
annotations: {}
name: "streampark"

nginx:
ingress:
kubernetes:
configurationSnippet: "rewrite ^(/streampark)$ $1/ permanent;"
proxyBbodySize: "1024m"
rewriteTarget: "/$2"
Original file line number Diff line number Diff line change
Expand Up @@ -622,11 +622,12 @@ main() {
echo_r "Unknown command: $1"
echo_w "Usage: streampark.sh ( commands ... )"
echo_w "commands:"
echo_w " start \$conf Start StreamPark with application config."
echo_w " start \$conf Start StreamPark with application config."
echo_w " stop Stop StreamPark, wait up to 3 seconds and then use kill -KILL if still running"
echo_w " start_docker start in docker or k8s mode"
echo_w " status StreamPark status"
echo_w " debug StreamPark start with debug mode,start debug mode, like: bash streampark.sh debug 10002"
echo_w " restart \$conf restart StreamPark with application config."
echo_w " restart \$conf restart StreamPark with application config."
exit 0
;;
esac
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ object KubernetesDeploymentHelper extends Logger {
def getDeploymentStatusChanges(nameSpace: String, deploymentName: String): Boolean = {
Try {
val pods = getPods(nameSpace, deploymentName)
pods.head.getStatus.getContainerStatuses.head.getLastState.getTerminated != null
val podStatus = pods.head.getStatus
podStatus.getPhase match {
case "Unknown" => return true
case "Failed" => return true
case "Pending" => return false
case _ => podStatus.getContainerStatuses.head.getLastState.getTerminated != null
}
}.getOrElse(true)
}

Expand Down

0 comments on commit d2b3c7a

Please sign in to comment.