diff --git a/.gitignore b/.gitignore index 918ed9330e..c67b020ec6 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ workspace/ /srp*gz /observer/* +src/helm/output/ diff --git a/build-full.sh b/build-full.sh new file mode 100755 index 0000000000..52e227e1ed --- /dev/null +++ b/build-full.sh @@ -0,0 +1,9 @@ +#!/bin/bash +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +pushd "$SCDIR" > /dev/null || exit 1 +./mvnw -s .settings.xml install -Pfull,asciidoctordocs,restdocs -B $* +popd > /dev/null || exit 1 diff --git a/src/add-deps/gradle.properties b/src/add-deps/gradle.properties index de5a378657..3b46adaa4d 100644 --- a/src/add-deps/gradle.properties +++ b/src/add-deps/gradle.properties @@ -1,6 +1,6 @@ appGroup=org.springframework.cloud appName=spring-cloud-dataflow-server -appVersion=2.11.3 +appVersion=2.11.4 appFolder=. repoUrl=https://my.private.repo repoUser=repoUserName diff --git a/src/deploy/helm/add-local-registry-secrets.sh b/src/deploy/helm/add-local-registry-secrets.sh new file mode 100755 index 0000000000..0121f0a06f --- /dev/null +++ b/src/deploy/helm/add-local-registry-secrets.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +function check_env() { + eval ev='$'$1 + if [ "$ev" == "" ]; then + echo "env var $1 not defined" + exit 1 + fi +} + + +if [ "$4" = "" ]; then + echo "Arguments: " + exit 1 +fi +SECRET_NAME=$1 +REGISTRY_NAME=$2 +REGISTRY_USER=$3 +REGISTRY_PWD=$4 +SECRET_NS=$NS +if [ "$5" != "" ]; then + SECRET_NS=$5 +fi +check_env SECRET_NAME +check_env SECRET_NS + +kubectl create secret docker-registry "$SECRET_NAME" \ + --docker-server="$REGISTRY_NAME" \ + --docker-username="$REGISTRY_USER" \ + --docker-password="$REGISTRY_PWD" \ + --namespace "$SECRET_NS" + + +if [ -f ./scdf-helm-values.yml ]; then + REG_SECRET=$(yq '.global.registry.secret.ref' ./scdf-helm-values.yml) + if [ "$REG_SECRET" = "" ]; then + yq '.global.registry.secret.ref = strenv(SECRET_NAME)' -i ./scdf-helm-values.yml + fi + PULL_SECRET=$(yq '.global.imagePullSecrets | .[] | select(. == strenv(SECRET_NAME))' ./scdf-helm-values.yml) + if [ "$PULL_SECRET" = "" ]; then + PULL_SECRET=$(yq '.global.imagePullSecrets += strenv(SECRET_NAME)' ./scdf-helm-values.yml) + fi +fi \ No newline at end of file diff --git a/src/deploy/helm/add-roles.sh b/src/deploy/helm/add-roles.sh new file mode 100755 index 0000000000..dd1d0f9096 --- /dev/null +++ b/src/deploy/helm/add-roles.sh @@ -0,0 +1,26 @@ +#!/bin/bash +function add_role() { + ROLE=$1 + ROLE_NAME=$(echo "rolebinding-$NS-default-$ROLE" | sed 's/:/-/g') + echo "ROLE_NAME=$ROLE_NAME into $NS" + set +e + kubectl create rolebinding "$ROLE_NAME" \ + --namespace $NS \ + "--clusterrole=$ROLE" \ + "--user=system:serviceaccount:$NS:default" + + CROLE_NAME=$(echo "cluster-$NS-$ROLE" | sed 's/:/-/g') + echo "CROLE_NAME=$CROLE_NAME into $NS" + kubectl delete clusterrolebinding "cluster-$NS-${ROLE/:/-}" + kubectl create clusterrolebinding "$CROLE_NAME" \ + --clusterrole=$ROLE \ + --group=system:authenticated --namespace $NS +} +if [ "$NS" == "" ]; then + echo "NS not defined" + exit 1 +fi +for role in "$@"; do + echo "Adding Role: $role" + add_role "$role" +done \ No newline at end of file diff --git a/src/deploy/helm/configure-database.sh b/src/deploy/helm/configure-database.sh new file mode 100755 index 0000000000..fd05dc2527 --- /dev/null +++ b/src/deploy/helm/configure-database.sh @@ -0,0 +1,162 @@ +#!/usr/bin/env bash +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +if [ "$DEBUG" == "true" ]; then + echo "DEBUG: configure-database.sh $*" +fi +if [ "$4" = "" ]; then + echo " " + echo " OR" + echo " [secret-username-key] [secret-password-key]" + echo " - app: dataflow|skipper|global" + echo " - secret-username-key: key name in secret. The default is username" + echo " - secret-password-key: key name in secret. The default is password" + echo " If username / password is provided it will be assigned to the values file." + exit 1 +fi + +case $1 in +"dataflow") + APP=server + ;; +"skipper") + APP=skipper + ;; +"global") + APP=global + ;; +*) + echo "Invalid application: $1" + exit 1 + ;; +esac +if [ "$DEBUG" == "true" ]; then + echo "DEBUG: APP=$APP" +fi +case $2 in +"postgresql" | "postgres") + DATABASE=postgresql + ;; +"mariadb" | "maria") + DATABASE=mariadb + ;; +"mysql57") + DATABASE=mysql57 + ;; +"oracle") + DATABASE=oracle + ;; +*) + echo "Unsupported or invalid database $2" + exit 1 + ;; +esac +set +e +export JDBC_URL="$3" +if [ "$APP" = "global" ]; then + yq '.configuration.database.url = strenv(JDBC_URL)' -i ./scdf-helm-values.yml +else + yq ".${APP}.config.database.url = strenv(JDBC_URL)" -i ./scdf-helm-values.yml +fi + +if [ "$DEBUG" == "true" ]; then + echo "DEBUG: DATABASE=$DATABASE" +fi +case $DATABASE in +"mariadb" | "mysql57") + JDBC_DRIVER_CLASS=org.mariadb.jdbc.Driver + ;; +"postgresql") + JDBC_DRIVER_CLASS=org.postgresql.Driver + ;; +"oracle") + JDBC_DRIVER_CLASS=oracle.jdbc.OracleDriver + ;; +*) + echo "Unsupported $DATABASE." + ;; +esac +if [ "$DEBUG" == "true" ]; then + echo "DEBUG: JDBC_DRIVER_CLASS=$JDBC_DRIVER_CLASS" +fi + +if [ "$JDBC_DRIVER_CLASS" != "" ]; then + export JDBC_DRIVER_CLASS + if [ "$APP" = "global" ]; then + yq '.configuration.database.driverClassName = strenv(JDBC_DRIVER_CLASS)' -i ./scdf-helm-values.yml + else + yq ".${APP}.config.database.driverClassName = strenv(JDBC_DRIVER_CLASS)" -i ./scdf-helm-values.yml + fi +fi + +if [ "$DIALECT" = "" ] && [ "$DATABASE" = "mariadb" ]; then + DIALECT="org.hibernate.dialect.MariaDB106Dialect" +fi +if [ "$DIALECT" != "" ]; then + if [ "$DEBUG" == "true" ]; then + echo "DEBUG: DIALECT=$DIALECT" + fi + export DIALECT + if [ "$APP" = "global" ]; then + yq '.configuration.database.dialect = strenv(DIALECT)' -i ./scdf-helm-values.yml + else + yq ".${APP}.config.database.dialect = strenv(DIALECT)" -i ./scdf-helm-values.yml + fi +fi +if [ "$6" != "" ]; then + SECRET_NAME=$4 + SECRET_USERNAME_KEY="$5" + SECRET_PASSWORD_KEY="$6" +elif [ "$5" != "" ]; then + USERNAME="$4" + PASSWORD="$5" +else + SECRET_NAME=$4 + SECRET_USERNAME_KEY=username + SECRET_PASSWORD_KEY=password +fi +if [ "$SECRET_NAME" != "" ]; then + if [ "$DEBUG" == "true" ]; then + echo "DEBUG: SECRET_NAME=$SECRET_NAME, SECRET_USERNAME_KEY=$SECRET_USERNAME_KEY, SECRET_PASSWORD_KEY=$SECRET_PASSWORD_KEY" + fi + export SECRET_NAME + export SECRET_USERNAME_KEY + export SECRET_PASSWORD_KEY + if [ "$APP" = "global" ]; then + yq '.configuration.database.usernameSecret.name = strenv(SECRET_NAME)' -i ./scdf-helm-values.yml + yq '.configuration.database.usernameSecret.key = strenv(SECRET_USERNAME_KEY)' -i ./scdf-helm-values.yml + yq '.configuration.database.passwordSecret.name = strenv(SECRET_NAME)' -i ./scdf-helm-values.yml + yq '.configuration.database.passwordSecret.key = strenv(SECRET_PASSWORD_KEY)' -i ./scdf-helm-values.yml + else + yq ".${APP}.config.database.usernameSecret.name = strenv(SECRET_NAME)" -i ./scdf-helm-values.yml + yq ".${APP}.config.database.usernameSecret.key = strenv(SECRET_USERNAME_KEY)" -i ./scdf-helm-values.yml + yq ".${APP}.config.database.passwordSecret.name = strenv(SECRET_NAME)" -i ./scdf-helm-values.yml + yq ".${APP}.config.database.passwordSecret.key = strenv(SECRET_PASSWORD_KEY)" -i ./scdf-helm-values.yml + fi +else + if [ "$USERNAME" = "" ]; then + echo "Expected $USERNAME" + exit 1 + fi + if [ "$PASSWORD" = "" ]; then + echo "Expected $PASSWORD" + exit 1 + fi + export USERNAME + export PASSWORD + if [ "$APP" = "global" ]; then + yq '.configuration.database.username = strenv(USERNAME)' -i ./scdf-helm-values.yml + yq '.configuration.database.password = strenv(PASSWORD)' -i ./scdf-helm-values.yml + else + yq ".${APP}.config.database.username = strenv(USERNAME)" -i ./scdf-helm-values.yml + yq ".${APP}.config.database.password = strenv(PASSWORD)" -i ./scdf-helm-values.yml + + fi +fi + +echo "Set ${APP} JDBC url: $JDBC_URL" +echo "Set ${APP} JDBC class: $JDBC_DRIVER_CLASS" +echo "Configured ${APP} $DATABASE" diff --git a/src/deploy/helm/configure-prometheus-proxy.sh b/src/deploy/helm/configure-prometheus-proxy.sh new file mode 100755 index 0000000000..6d0ea38582 --- /dev/null +++ b/src/deploy/helm/configure-prometheus-proxy.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +if [ "$2" = "" ]; then + echo "Usage is: [step]" + echo "Where is the frequency of published metrics. Default is 10s" + exit 1 +fi +export HOST=$1 +export PORT=$2 +if [ "$3" != "" ]; then + STEP=$3 +else + STEP=10s +fi +export PROMETHEUS_URL="http://$HOST:$PORT" +yq "global.management.metrics.export.prometheus.rsocket.host = strenv(HOST)" -i ./scdf-helm-values.yml +yq "global.management.metrics.export.prometheus.pushgateway.base-url = strenv(PROMETHEUS_URL)" -i ./scdf-helm-values.yml +yq "global.management.metrics.export.prometheus.pushgateway.enabled = true" -i ./scdf-helm-values.yml +yq "global.management.metrics.export.prometheus.pushgateway.shutdown-operation = \"PUSH\"" -i ./scdf-helm-values.yml +yq "global.management.metrics.export.prometheus.step = \"$STEP\"" -i ./scdf-helm-values.yml diff --git a/src/deploy/helm/create-image-pull-secrets.sh b/src/deploy/helm/create-image-pull-secrets.sh new file mode 100755 index 0000000000..8475bf1f38 --- /dev/null +++ b/src/deploy/helm/create-image-pull-secrets.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") + +function check_env() { + eval ev='$'$1 + if [ "$ev" == "" ]; then + echo "env var $1 not defined" + exit 1 + fi +} +check_env DOCKER_HUB_USERNAME +check_env DOCKER_HUB_PASSWORD + +$SCDIR/add-local-registry-secret.sh reg-creds-dockerhub docker.io "$DOCKER_HUB_USERNAME" "$DOCKER_HUB_PASSWORD" "$NS" + +if [ "$SCDF_TYPE" = "pro" ]; then + check_env TANZU_DOCKER_USERNAME + check_env TANZU_DOCKER_PASSWORD + $SCDIR/add-local-registry-secret.sh reg-creds-dev-registry dev.registry.tanzu.vmware.com "$TANZU_DOCKER_USERNAME" "$TANZU_DOCKER_PASSWORD" +fi diff --git a/src/deploy/helm/delete-scdf.sh b/src/deploy/helm/delete-scdf.sh new file mode 100755 index 0000000000..d92c11e2b5 --- /dev/null +++ b/src/deploy/helm/delete-scdf.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +function check_env() { + eval ev='$'$1 + if [ "$ev" == "" ]; then + echo "env var $1 not defined" + if ((sourced != 0)); then + return 1 + else + exit 1 + fi + fi +} +check_env NS +check_env PACKAGE_VERSION +if [ "$1" != "" ]; then + RELEASE_NAME="$1" +else + RELEASE_NAME=dataflow +fi + +echo "Deleting $RELEASE_NAME from $NS" +helm uninstall $RELEASE_NAME --namespace $NS --wait + +kubectl delete apps --all --namespace="$NS" +kubectl delete deployments --all --namespace="$NS" +kubectl delete statefulsets --all --namespace="$NS" +kubectl delete svc --all --namespace="$NS" +kubectl delete all --all --namespace="$NS" +kubectl delete pods --all --namespace="$NS" +kubectl delete pvc --all --namespace="$NS" +kubectl delete configmaps --all --namespace="$NS" +kubectl delete secrets --all --namespace="$NS" +kubectl delete namespace $NS diff --git a/src/deploy/helm/deploy-local-broker.sh b/src/deploy/helm/deploy-local-broker.sh new file mode 100755 index 0000000000..099df0fd8a --- /dev/null +++ b/src/deploy/helm/deploy-local-broker.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash +bold="\033[1m" +dim="\033[2m" +end="\033[0m" +function count_kind() { + jq --arg kind $1 --arg name $2 '.items | .[] | select(.kind == $kind) | .metadata | select(.name == $name) | .name' | grep -c -F "$2" +} +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +if [ "$BROKER" = "" ]; then + echo "BROKER must be defined" + exit 1 +fi +start_time=$(date +%s) +case $BROKER in +"kafka") + BINDER_NAME=kafka + ;; +"rabbit" | "rabbitmq") + BROKER=rabbitmq + BINDER_NAME=rabbit + ;; +*) + echo "Invalid broker type $1" + exit 1 + ;; +esac +K8S=$(realpath $SCDIR/../kubernetes) +if [ ! -d "$K8S" ]; then + K8S=$(realpath $SCDIR/../../kubernetes) +fi +$SCDIR/prepare-local-namespace.sh "$BROKER-sa" $BROKER +kubectl create --namespace $BROKER -f $K8S/$BROKER/ +if [ "$BROKER" = "rabbitmq" ]; then + kubectl rollout status deployment --namespace "rabbitmq" rabbitmq +else + kubectl rollout status deployment --namespace "kafka" kafka-zk + kubectl rollout status sts --namespace "kafka" kafka-broker +fi + +echo "Deployed $BROKER" +export BROKER + +yq '.configuration.broker.type = strenv(BINDER_NAME)' -i ./scdf-helm-values.yml + +if [ "$BROKER" = "rabbitmq" ]; then + # RABBITMQ_HOST=$(kubectl get --namespace rabbitmq services rabbitmq | grep -F rabbitmq | awk '{ print $3 }') + export RABBITMQ_HOST='rabbitmq.rabbitmq' + yq '.configuration.broker.rabbit.host= strenv(RABBITMQ_HOST)' -i ./scdf-helm-values.yml + yq ".configuration.broker.rabbit.port=5672" -i ./scdf-helm-values.yml +else + # KAFKA_HOST=$(kubectl get --namespace kafka services kafka | grep -F kafka | awk '{ print $3 }') + export KAFKA_HOST="kafka.kafka:9092" + yq '.configuration.broker.kafka.brokers = strenv(KAFKA_HOST)' -i ./scdf-helm-values.yml +fi +end_time=$(date +%s) +elapsed=$((end_time - start_time)) +echo -e "Deployed $BROKER in ${bold}$elapsed${end} seconds" diff --git a/src/deploy/helm/deploy-local-database.sh b/src/deploy/helm/deploy-local-database.sh new file mode 100755 index 0000000000..85163728fe --- /dev/null +++ b/src/deploy/helm/deploy-local-database.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +bold="\033[1m" +dim="\033[2m" +end="\033[0m" +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +start_time=$(date +%s) +if [ "$1" = "" ]; then + echo " must be provided. Choose one of postgresql or mariadb" + exit 1 +fi +JDBC_URL="jdbc:$DATABASE://$DATABASE.$DATABASE/dataflow" +case $1 in +"postgresql" | "postgres") + DATABASE=postgresql + ;; +"mariadb" | "maria") + DATABASE=mariadb + ;; +#"oracle") +# DATABASE=oracle +# JDBC_URL="jdbc:oracle:thin:@oracle.oracle:1521" +# ;; +"mysql57") + DATABASE=mysql57 + JDBC_URL="jdbc:mysql://$DATABASE.$DATABASE/dataflow?permitMysqlScheme" + ;; +*) + echo "Unsupported or invalid database $1" + exit 1 + ;; +esac + +K8S=$(realpath $SCDIR/../kubernetes) +if [ ! -d "$K8S" ]; then + K8S=$(realpath $SCDIR/../../kubernetes) +fi +set +e +$SCDIR/prepare-local-namespace.sh "$DATABASE-sa" $DATABASE + +kubectl create --namespace $DATABASE -f $K8S/$DATABASE/ +set -e +kubectl rollout status deployment --namespace "$DATABASE" $DATABASE +set +e + +"$SCDIR/configure-database.sh" global $DATABASE "$JDBC_URL" $DATABASE database-username database-password +export DATABASE +echo "Deployed $DATABASE. Host:$DATABASE.$DATABASE" +end_time=$(date +%s) +elapsed=$((end_time - start_time)) +echo -e "Deployed $DATABASE in ${bold}$elapsed${end} seconds" diff --git a/src/deploy/helm/deploy-local-prometheus.sh b/src/deploy/helm/deploy-local-prometheus.sh new file mode 100755 index 0000000000..05f7470661 --- /dev/null +++ b/src/deploy/helm/deploy-local-prometheus.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +bold="\033[1m" +dim="\033[2m" +end="\033[0m" +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +start_time=$(date +%s) +K8S=$(realpath $SCDIR/../kubernetes) +if [ ! -d "$K8S" ]; then + K8S=$(realpath $SCDIR/../../kubernetes) +fi + +$SCDIR/prepare-local-namespace.sh prometheus prometheus +kubectl create serviceaccount prometheus-rsocket-proxy --namespace prometheus + +kubectl create --namespace prometheus -f $K8S/prometheus/ +kubectl create --namespace prometheus -f $K8S/prometheus-proxy/ +kubectl create --namespace prometheus -f $K8S/grafana/ + +kubectl rollout status deployment --namespace prometheus grafana +kubectl rollout status deployment --namespace prometheus prometheus +kubectl rollout status deployment --namespace prometheus prometheus-rsocket-proxy +GRAFANA_HOST=$(kubectl get --namespace prometheus services grafana | grep -F grafana | awk '{ print $3 }') +echo "Set dashboard url=$GRAFANA_HOST:3000" +export GRAFANA_URL="http://$GRAFANA_HOST:3000" +yq '.global.management.metrics.export.prometheus.enabled=true' -i ./scdf-helm-values.yml +yq '.configuration.metrics.dashboard.url = strenv(GRAFANA_URL)' -i ./scdf-helm-values.yml +yq '.global.management.metrics.export.prometheus.rsocket.enabled = true' -i ./scdf-helm-values.yml +yq '.global.management.defaults.metrics.export.enabled = true' -i ./scdf-helm-values.yml + +$SCDIR/configure-prometheus-proxy.sh prometheus-rsocket-proxy.prometheus 7001 + +end_time=$(date +%s) +elapsed=$((end_time - start_time)) +echo -e "Deployed Prometheus, Prometheus proxy and Grafana in ${bold}$elapsed${end} seconds" diff --git a/src/deploy/helm/deploy-scdf.sh b/src/deploy/helm/deploy-scdf.sh new file mode 100644 index 0000000000..b3780e8372 --- /dev/null +++ b/src/deploy/helm/deploy-scdf.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +(return 0 2>/dev/null) && sourced=1 || sourced=0 +if ((sourced != 0)); then + echo "Do not source this script $0" + exit 0 +fi + +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +function print_usage() { + echo "Usage: [release-name]" + echo "Where:" + echo " release-name: Optional name for helm release. Default is dataflow" +} + +if [ ! -f ./scdf-helm-values.yml ]; then + echo "Cannot find scdf-helm-values.yml. Run helm-values-template.sh and populate the values for database and broker." + exit 1 +fi +if [ "$1" != "" ]; then + RELEASE_NAME="$1" +else + RELEASE_NAME=dataflow +fi +echo "Release name: $RELEASE_NAME" +if [ "$SCDF_TYPE" = "pro" ]; then + HELM_PACKAGE=oci://docker.io/springcloud/spring-cloud-dataflow-helm +else + HELM_PACKAGE=oci://dev.registry.tanzu.vmware.com/p-scdf-kubernetes/spring-pro-helm +fi +helm install "$RELEASE_NAME" "$HELM_PACKAGE" \ + --version "$PACKAGE_VERSION" \ + --create-namespace --namespace $NS \ + --values ./scdf-helm-values.yml + +echo "Waiting for Skipper" +kubectl rollout status deployment --namespace "$NS" scdf-skipper +echo "Waiting for Data Flow" +kubectl rollout status deployment --namespace "$NS" scdf-server + +source "$SCDIR/export-dataflow-ip.sh" +sh "$SCDIR/k8s/register-apps.sh" +echo "Access Data Flow at $DATAFLOW_URL/dashboard" diff --git a/src/deploy/helm/export-dataflow-ip.sh b/src/deploy/helm/export-dataflow-ip.sh new file mode 100755 index 0000000000..240dd8b383 --- /dev/null +++ b/src/deploy/helm/export-dataflow-ip.sh @@ -0,0 +1,31 @@ +#!/bin/bash +(return 0 2>/dev/null) && sourced=1 || sourced=0 + +if [ "$NS" = "" ]; then + echo "NS not defined" >&2 + if ((sourced != 0)); then + return 2 + else + exit 2 + fi +fi +EXTERNAL_IP=$(kubectl get --namespace "$NS" services scdf-server | grep -F "scdf-server" | awk '{ print $4 }') +LB_IP=$(kubectl get --namespace "$NS" svc/scdf-server -o=jsonpath='{.status.loadBalancer.ingress[0].ip}') +if [ "$EXTERNAL_IP" = "" ]; then + echo "The Loadbalancer is still pending" + if ((sourced != 0)); then + return 1 + else + exit 1 + fi +fi +export PLATFORM_TYPE=kubernetes +if [ "$EXTERNAL_IP" != "" ]; then + export DATAFLOW_IP=http://$EXTERNAL_IP:9393 + echo "DATAFLOW_IP=$DATAFLOW_IP" + export DATAFLOW_URL="$DATAFLOW_IP" + echo "DATAFLOW_URL=$DATAFLOW_IP" +else + echo "EXTERNAL_IP not found" + kubectl get --namespace "$NS" services scdf-server +fi diff --git a/src/deploy/helm/helm-values-template.sh b/src/deploy/helm/helm-values-template.sh new file mode 100755 index 0000000000..76217e1c00 --- /dev/null +++ b/src/deploy/helm/helm-values-template.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") + +if [ "$SCDF_TYPE" = "" ]; then + echo "SCDF_TYPE must be configured" + exit 1 +fi +echo "Copying scdf-$SCDF_TYPE-values.yml to ./scdf-helm-values.yml" +cp "$SCDIR/scdf-${SCDF_TYPE}-values.yml" ./scdf-helm-values.yml diff --git a/src/deploy/helm/prepare-local-namespace.sh b/src/deploy/helm/prepare-local-namespace.sh new file mode 100755 index 0000000000..42d024f0a6 --- /dev/null +++ b/src/deploy/helm/prepare-local-namespace.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") + +function check_env() { + eval ev='$'$1 + if [ "$ev" == "" ]; then + echo "env var $1 not defined" + exit 1 + fi +} +function count_kind() { + jq --arg kind $1 --arg name $2 '.items | .[] | select(.kind == $kind) | .metadata | select(.name == $name) | .name' | grep -c -F "$2" +} + +function patch_serviceaccount() { + kubectl patch serviceaccount $SA -p "$1" --namespace "$NS" + kubectl patch serviceaccount default -p "$1" --namespace "$NS" +} +if [ "$1" = "" ]; then + echo "Usage: [namespace]" + exit 1 +fi +if [ "$2" != "" ]; then + NS=$2 +fi + +check_env NS +SA=$1 +kubectl create namespace $NS + +$SCDIR/add-roles.sh "system:aggregate-to-edit" "system:aggregate-to-admin" "system:aggregate-to-view" + +kubectl create serviceaccount "$SA" --namespace $NS diff --git a/src/deploy/helm/register-apps.sh b/src/deploy/helm/register-apps.sh new file mode 100755 index 0000000000..1dbb0ac14d --- /dev/null +++ b/src/deploy/helm/register-apps.sh @@ -0,0 +1,80 @@ +#!/bin/bash +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +set -e +function dataflow_post() { + echo "Invoking POST $1 >> $2" + result=$(curl -s -d "$1" -X POST "$2") + rc=$? + if ((rc != 0 )); then + echo "$rc : $result" + echo "" + exit $rc + fi +} + +PLATFORM_TYPE=kubernetes +if [ "$DATAFLOW_URL" = "" ]; then + source "$SCDIR/export-dataflow-ip.sh" +fi +if [ "$DATAFLOW_URL" = "" ]; then + echo "Cannot find DATAFLOW_URL" + exit 1 +fi +case $BROKER in +"" | "kafka") + export BROKER=kafka + ;; +"rabbit" | "rabbitmq") + export BROKER=rabbitmq + ;; +*) + echo "BROKER=$BROKER not supported" + ;; +esac + +if [ "$BROKER" = "rabbitmq" ]; then + BROKER_NAME=rabbit +else + BROKER_NAME=$BROKER +fi +if [ "$STREAM_APPS_VERSION" = "" ]; then + export STREAM_APPS_VERSION=2024.0.0 +fi +echo "STREAM_APPS_VERSION=$STREAM_APPS_VERSION" +if [ "$PLATFORM_TYPE" != "kubernetes" ]; then + TYPE=maven +else + TYPE=docker +fi + +if [[ "$STREAM_APPS_VERSION" = *"-SNAPSHOT"* ]]; then + STREAM_APPS_DL_VERSION=$STREAM_APPS_VERSION + META_DATA="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/maven-metadata.xml" + echo "Downloading $META_DATA" + curl -o maven-metadata.xml -s $META_DATA + DL_TS=$(xmllint --xpath "/metadata/versioning/snapshot/timestamp/text()" maven-metadata.xml | sed 's/\.//') + STREAM_APPS_DL_VERSION=$(xmllint --xpath "/metadata/versioning/snapshotVersions/snapshotVersion[extension/text() = 'pom' and updated/text() = '$DL_TS']/value/text()" maven-metadata.xml) + DESCRIPTORS="https://repo.spring.io/snapshot/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_DL_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}" +else + REL_TYPE= + if [[ "$STREAM_APPS_VERSION" = *"-M"* ]] || [[ "$STREAM_APPS_VERSION" = *"-RC"* ]]; then + REL_TYPE=milestone + fi + if [ "$REL_TYPE" != "" ]; then + DESCRIPTORS="https://repo.spring.io/$REL_TYPE/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}" + else + DESCRIPTORS="https://repo.maven.apache.org/maven2/org/springframework/cloud/stream/app/stream-applications-descriptor/${STREAM_APPS_VERSION}/stream-applications-descriptor-${STREAM_APPS_VERSION}.stream-apps-${BROKER_NAME}-${TYPE}" + fi +fi +echo "DATAFLOW_URL=$DATAFLOW_URL" +dataflow_post "uri=$DESCRIPTORS" "$DATAFLOW_URL/apps" + +dataflow_post "uri=docker:springcloudtask/timestamp-task:2.0.2" "$DATAFLOW_URL/apps/task/timestamp" +dataflow_post "uri=docker:springcloudtask/timestamp-batch-task:2.0.2" "$DATAFLOW_URL/apps/task/timestamp-batch" +dataflow_post "uri=docker:springcloudtask/timestamp-task:3.0.0" "$DATAFLOW_URL/apps/task/timestamp3?bootVersion=3" +dataflow_post "uri=docker:springcloudtask/timestamp-batch-task:3.0.0" "$DATAFLOW_URL/apps/task/timestamp-batch3?bootVersion=3" +dataflow_post "uri=docker:springcloudtask/scenario-task:0.0.1-SNAPSHOT" "$DATAFLOW_URL/apps/task/scenario/0.0.1-SNAPSHOT" +dataflow_post "uri=docker:springcloud/batch-remote-partition:0.0.2-SNAPSHOT" "$DATAFLOW_URL/apps/task/batch-remote-partition/0.0.2-SNAPSHOT" +dataflow_post "uri=docker:springcloudstream/log-sink-$BROKER_NAME:3.0.1" "$DATAFLOW_URL/apps/sink/ver-log/3.0.1" +dataflow_post "uri=docker:springcloudstream/log-sink-$BROKER_NAME:2.1.5.RELEASE" "$DATAFLOW_URL/apps/sink/ver-log/2.1.5.RELEASE" +dataflow_post "uri=docker:springcloudtask/task-demo-metrics-prometheus:2.0.1-SNAPSHOT" "$DATAFLOW_URL/apps/task/task-demo-metrics-prometheus/2.0.1-SNAPSHOT" diff --git a/src/deploy/helm/scdf-oss-values.yml b/src/deploy/helm/scdf-oss-values.yml new file mode 100644 index 0000000000..136d748427 --- /dev/null +++ b/src/deploy/helm/scdf-oss-values.yml @@ -0,0 +1,9 @@ +configuration: + streamsEnabled: true + tasksEnabled: true + schedulesEnabled: true + +serviceAccount: + create: true + automount: true + name: 'scdf-sa' diff --git a/src/deploy/helm/scdf-pro-values.yml b/src/deploy/helm/scdf-pro-values.yml new file mode 100644 index 0000000000..646e6f96ff --- /dev/null +++ b/src/deploy/helm/scdf-pro-values.yml @@ -0,0 +1,24 @@ +configuration: + streamsEnabled: true + tasksEnabled: true + schedulesEnabled: true + +serviceAccount: + create: true + automount: true + name: 'scdf-sa' + +global: + registry: + secret: + ref: 'reg-creds-dev-registry' + +server: + image: + repository: dev.registry.tanzu.vmware.com/p-scdf-for-kubernetes/scdf-pro-server + tag: 1.6.3-SNAPSHOT + +skipper: + image: + repository: dev.registry.tanzu.vmware.com/p-scdf-for-kubernetes/scdf-pro-skipper + tag: 1.6.3-SNAPSHOT \ No newline at end of file diff --git a/src/deploy/helm/start-deploy.sh b/src/deploy/helm/start-deploy.sh new file mode 100755 index 0000000000..f35fd4e2a6 --- /dev/null +++ b/src/deploy/helm/start-deploy.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash +(return 0 2>/dev/null) && sourced=1 || sourced=0 + +if [ -z "$BASH_VERSION" ]; then + echo "This script requires Bash. Use: bash $0 $*" + if ((sourced = 0)); then + return 1 + else + exit 1 + fi +fi +if ((sourced = 0)); then + echo "This script must be invoked using: source $0 $*" + exit 1 +fi +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +bold="\033[1m" +dim="\033[2m" +end="\033[0m" + +PLATFORM_TYPE=kubernetes +SCDF_TYPE=$(yq '.default.scdf-type' $SCDIR/../versions.yaml) +SCDF_REL=$(yq '.default.version' $SCDIR/../versions.yaml) +NS=scdf +DEFAULT_PACKAGE_VERSION=$(yq ".default.package-version" "$SCDIR/../versions.yaml") +if [ "$DEFAULT_PACKAGE_VERSION" = "" ] || [ "$DEFAULT_PACKAGE_VERSION" = "null" ]; then + DEFAULT_PACKAGE_VERSION=$(yq ".scdf-type.$SCDF_TYPE.$SCDF_REL" "$SCDIR/../versions.yaml") +fi + +if [ "$1" = "" ]; then + echo "Usage: [scdf-type] [release|snapshot|maintenance-snapshot] [namespace]" + echo "Where:" + echo " broker: one of kafka or rabbitmq" + echo " scdf-type: one of oss or pro. The default is '$SCDF_TYPE'" + echo " namespace: is a valid k8s namespace other than 'default'. The default is ${NS:'scdf'}." + echo " release-type: release, snapshot or maintenance-snapshot and scdf-type will determine PACKAGE_VERSION if not provided" + if ((sourced = 0)); then + return 1 + else + exit 1 + fi +fi +while [ "$1" != "" ]; do + case $1 in + "snapshot" | "release" | "maintenance-snapshot") + SCDF_REL=$1 + export PACKAGE_VERSION= + ;; + "rabbitmq" | "rabbit") + BROKER=rabbitmq + ;; + "kafka") + BROKER=kafka + ;; + "pro" | "oss") + SCDF_TYPE=$1 + export PACKAGE_VERSION= + ;; + *) + NS=$1 + ;; + esac + shift +done +if [ "$NS" = "" ]; then + NS=scdf +fi +if [ "$BROKER" = "" ]; then + echo "Broker must be provided" + return 0 +fi +if [ "$DEBUG" = "true" ]; then + echo "yq '.scdf-type.$SCDF_TYPE.$SCDF_REL' $SCDIR/../versions.yaml" +fi +if [ "$PACKAGE_VERSION" = "" ]; then + PACKAGE_VERSION=$(yq ".default.package-version" "$SCDIR/../versions.yaml") +fi +if [ "$PACKAGE_VERSION" = "null" ] || [ "$PACKAGE_VERSION" = "" ]; then + PACKAGE_VERSION="$(yq ".scdf-type.$SCDF_TYPE.$SCDF_REL" "$SCDIR/../versions.yaml")" +fi +export PACKAGE_VERSION +export BROKER +export SCDF_TYPE +export NS +export PLATFORM_TYPE + +echo "Broker: $BROKER" +echo "SCDF Type: $SCDF_TYPE" +if [ "$PACKAGE_VERSION" = "" ]; then + echo "Package version: N/A" + echo -e "${bold}Configure environmental variable PACKAGE_VERSION to specific value.${end}" +else + echo "Package version: $PACKAGE_VERSION" +fi +echo "NS: $NS" +echo "PLATFORM_TYPE: $PLATFORM_TYPE" diff --git a/src/deploy/k8s/yaml/server-config.yaml b/src/deploy/k8s/yaml/server-config.yaml index 7eb79d1057..503e523ef2 100644 --- a/src/deploy/k8s/yaml/server-config.yaml +++ b/src/deploy/k8s/yaml/server-config.yaml @@ -12,7 +12,7 @@ data: org.springframework: debug management: defaults: - metrics: + metrics: export: enabled: false maven: diff --git a/src/deploy/k8s/yaml/server-deployment.yaml b/src/deploy/k8s/yaml/server-deployment.yaml index a19b4d916a..9991a8fe92 100644 --- a/src/deploy/k8s/yaml/server-deployment.yaml +++ b/src/deploy/k8s/yaml/server-deployment.yaml @@ -140,12 +140,12 @@ spec: value: 'GRAFANA' serviceAccountName: scdf-sa volumes: - - name: config - configMap: - name: scdf-server - items: - - key: 'application-kubernetes.yaml' - path: 'application-kubernetes.yaml' - - name: database - secret: - secretName: ${DATABASE} + - name: config + configMap: + name: scdf-server + items: + - key: 'application-kubernetes.yaml' + path: 'application-kubernetes.yaml' + - name: database + secret: + secretName: ${DATABASE} diff --git a/src/helm/generate-schema.sh b/src/helm/generate-schema.sh new file mode 100755 index 0000000000..5d53259c71 --- /dev/null +++ b/src/helm/generate-schema.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +pushd "$SCDIR" > /dev/null || exit +helm schema --input scdf/values.yaml --output scdf/values.schema.json +popd > /dev/null || exit \ No newline at end of file diff --git a/src/helm/scdf/.helmignore b/src/helm/scdf/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /dev/null +++ b/src/helm/scdf/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/src/helm/scdf/Chart.yaml b/src/helm/scdf/Chart.yaml new file mode 100644 index 0000000000..7d56129550 --- /dev/null +++ b/src/helm/scdf/Chart.yaml @@ -0,0 +1,26 @@ +apiVersion: v2 +name: scdf +description: Spring Cloud Data Flow Helm chart for Kubernetes + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +# Versions are expected to follow Semantic Versioning (https://semver.org/) +version: "2.11.5-SNAPSHOT" + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. Versions are not expected to +# follow Semantic Versioning. They should reflect the version the application is using. +# It is recommended to use it with quotes. +appVersion: "2.11.5-SNAPSHOT" + +icon: data:image/svg+xml;base64, PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOTguMjEgMTMxLjA5Ij48ZGVmcz48c3R5bGU+LmNscy0xe2ZpbGw6IzZiYjM0NDt9PC9zdHlsZT48L2RlZnM+PHRpdGxlPmljb24tZGF0YS1mbG93PC90aXRsZT48ZyBpZD0iTGF5ZXJfMiIgZGF0YS1uYW1lPSJMYXllciAyIj48ZyBpZD0iTGF5ZXJfMS0yIiBkYXRhLW5hbWU9IkxheWVyIDEiPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTEwMy4xNyw1LjE2YzI3LjYyLDAsNTMuMTMsMTkuMzMsNTkuMzYsNDVsLjcxLDIuOTMsMi45MS44MmEzNy4wNiwzNy4wNiwwLDAsMSwyNi45MSwzNS42MSwzNiwzNiwwLDAsMS0xMC43OCwyNS44MywzNi45LDM2LjksMCwwLDEtMjYuMDksMTAuNjFoLTEwOGMtMjQuMTQsMC00My0xOC41Mi00My00Mi4xNywwLTIyLjExLDE2LjkxLTQwLjIyLDM5LjM0LTQyLjE0bDMtLjI2LDEuMjMtMi44YzguNjMtMTkuNjcsMzEtMzMuNCw1NC4zOS0zMy40bTAtNS4xNkM3Ny43LDAsNTMuMzksMTUuMjMsNDQuMDYsMzYuNDksMTkuMzcsMzguNTksMCw1OC41MywwLDgzLjc2YzAsMjYuNjIsMjEuNTksNDcuMzMsNDguMjEsNDcuMzNoMTA4YTQxLjY3LDQxLjY3LDAsMCwwLDQyLTQxLjYsNDIuMiw0Mi4yLDAsMCwwLTMwLjY3LTQwLjU4QzE2MC41MSwyMCwxMzIuMjksMCwxMDMuMTcsMFoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik02Mi43MiwxMDEuNDVjMS45MywwLDIuODYuMjMsMy42MS45MywxLC45MywxLjg4LDIuNzYsMS44OCw3Ljg0cy0uODUsNi44OS0xLjg4LDcuODVjLS43NS42Ny0xLjY4LjkyLTMuNjEuOTJINTguNjRjLTEuOTMsMC0yLjgzLS4yNS0zLjU4LS45Mi0xLjA1LTEtMS44OC0yLjc5LTEuODgtNy44NXMuODMtNi45MSwxLjg4LTcuODRjLjc1LS43LDEuNjUtLjkzLDMuNTgtLjkzWm0tMy4xOCwzLjI0Yy0uOTIsMC0xLjIyLjEtMS40My4yN3MtLjY3LjkzLS42Nyw1LjI2LjQsNSwuNjcsNS4yNC41MS4yOCwxLjQzLjI4aDIuMjhjMSwwLDEuMjMtLjA4LDEuNDYtLjI4cy42Ny0uOS42Ny01LjI0LS40LTUtLjY3LTUuMjYtLjUxLS4yNy0xLjQ2LS4yN1oiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik03OC4xNywxMTUuMjNWMTAyLjg0bC0yLjQ5Ljg2LS45LTIuNjUsNC4xNS0xLjU1SDgxLjh2MTUuNzNaIi8+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNOTcuNTcsOTUuODhjMS40NSwwLDIuMTUuMTcsMi43Mi42OS43Ny43LDEuNDEsMi4wOCwxLjQxLDUuOTFzLS42NCw1LjE5LTEuNDEsNS45YTMuNjksMy42OSwwLDAsMS0yLjcyLjdIOTQuNWMtMS40NiwwLTIuMTQtLjE5LTIuNy0uNy0uNzktLjcxLTEuNDItMi4wOS0xLjQyLTUuOXMuNjMtNS4yMSwxLjQyLTUuOTFjLjU2LS41MiwxLjI0LS42OSwyLjctLjY5Wm0tMi40LDIuNDNjLS42OSwwLS45Mi4wNy0xLjA3LjIxcy0uNTEuNjktLjUxLDQsLjMsMy43Ny41MSwzLjk0LjM4LjIxLDEuMDcuMjFoMS43MmMuNzIsMCwuOTMtLjA2LDEuMS0uMjFzLjUtLjY4LjUtMy45NC0uMy0zLjc3LS41LTQtLjM4LS4yMS0xLjEtLjIxWiIvPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTEwOS42MiwxMDIuNjdWOTMuMjlsLTEuODguNjUtLjY4LTIsMy4xNC0xLjE4aDIuMTd2MTEuOTFaIi8+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNMTIwLjUyLDk1LjkyVjg3LjNsLTEuNzQuNi0uNjItMS44NUwxMjEuMDUsODVoMlY5NS45MloiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xMzIuMSw3OC4wOWEyLjMxLDIuMzEsMCwwLDEsMS43Ny40NmMuNS40NS45MiwxLjM1LjkyLDMuODRzLS40MiwzLjM3LS45MiwzLjg0YTIuNCwyLjQsMCwwLDEtMS43Ny40NWgtMmEyLjM2LDIuMzYsMCwwLDEtMS43NS0uNDVjLS41Mi0uNDctLjkyLTEuMzYtLjkyLTMuODRzLjQtMy4zOS45Mi0zLjg0YTIuMjcsMi4yNywwLDAsMSwxLjc1LS40NlptLTEuNTYsMS41OWMtLjQ1LDAtLjYsMC0uNjkuMTNzLS4zNC40Ni0uMzQsMi41OC4yLDIuNDUuMzQsMi41Ni4yNC4xNC42OS4xNGgxLjEyYy40NywwLC42LDAsLjcxLS4xNHMuMzMtLjQ0LjMzLTIuNTYtLjE5LTIuNDYtLjMzLTIuNTgtLjI0LS4xMy0uNzEtLjEzWiIvPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTEzOS45Myw2OS43OGEyLDIsMCwwLDEsMS40Ni4zN2MuNDIuMzguNzYsMS4xMi43NiwzLjE5cy0uMzQsMi43OS0uNzYsMy4xOGEyLDIsMCwwLDEtMS40Ni4zN2gtMS42NmEyLDIsMCwwLDEtMS40NS0uMzdjLS40My0uMzktLjc3LTEuMTMtLjc3LTMuMThzLjM0LTIuODEuNzctMy4xOWExLjkyLDEuOTIsMCwwLDEsMS40NS0uMzdabS0xLjI5LDEuMzFjLS4zOCwwLS41LDAtLjU4LjExcy0uMjguMzgtLjI4LDIuMTQuMTYsMiwuMjgsMi4xMi4yLjExLjU4LjExaC45MmMuMzksMCwuNSwwLC41OS0uMTFzLjI3LS4zNy4yNy0yLjEyLS4xNi0yLS4yNy0yLjE0LS4yLS4xMS0uNTktLjExWiIvPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTE0NS41Nyw2MmExLjQyLDEuNDIsMCwwLDEsMS4wNi4yN2MuMzEuMjguNTYuODIuNTYsMi4zMnMtLjI1LDItLjU2LDIuMzFhMS40MiwxLjQyLDAsMCwxLTEuMDYuMjhoLTEuMjFhMS40MSwxLjQxLDAsMCwxLTEuMDUtLjI4Yy0uMzEtLjI4LS41Ni0uODItLjU2LTIuMzFzLjI1LTIsLjU2LTIuMzJhMS40MSwxLjQxLDAsMCwxLDEuMDUtLjI3Wm0tLjk0Ljk1Yy0uMjcsMC0uMzYsMC0uNDIuMDhzLS4yLjI4LS4yLDEuNTYuMTIsMS40OC4yLDEuNTQuMTUuMDguNDIuMDhoLjY3Yy4yOCwwLC4zNywwLC40My0uMDhzLjItLjI2LjItMS41NC0uMTItMS40OC0uMi0xLjU2LS4xNS0uMDgtLjQzLS4wOFoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNTguMjMsNy44OGMtNS42OSwxNi40OS0yNS42NiwyOS40LTQxLjg0LDMzLjI1LTE1LjE3LDMuNjEtMjguNTkuNjUtNDIuNjMsNi0yNy4xNSwxMC40NC0yOSwzNi0xOS44Myw1MC44My43MSwxLjE2LDM2LTEuNjUsNTMuMzktOS4wOSwyMy4xLTkuOSwzNi44OS0yOC41OCw0MC40Ny0zNS41NGEyLjM2LDIuMzYsMCwwLDEsMi41NC0uNTksMiwyLDAsMCwxLDEuNTIsMi4wNyw3NC42OSw3NC42OSwwLDAsMS0zNS4xNCw0OGMtMTIuMiw3LjItMjEuNTUsMTAuNzUtMjguMzgsMTIuNjEtMS4xNS4zMS0xLjEsMS4xNi4yMSwxLjE1LDE2LjczLS4xMyw1NC44OSwyLjMxLDcwLjc4LTE3Ljg4QzE3Ny43Miw3NC4yNSwxNjgsMzUuNjMsMTU4LjIzLDcuODhaIi8+PC9nPjwvZz48L3N2Zz4= diff --git a/src/helm/scdf/templates/NOTES.txt b/src/helm/scdf/templates/NOTES.txt new file mode 100644 index 0000000000..8770429e46 --- /dev/null +++ b/src/helm/scdf/templates/NOTES.txt @@ -0,0 +1,27 @@ +1. Get the application URL by running these commands: +{{- if contains "NodePort" .Values.server.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services scdf-server) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.server.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w scdf-server' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} scdf-server --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.server.service.port }} +{{- else if contains "ClusterIP" .Values.server.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name=scdf-server,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:$CONTAINER_PORT to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME {{ .Values.server.containerPort | default 9393 }}:$CONTAINER_PORT +{{- end }} +{{- if contains "LoadBalancer" .Values.skipper.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w scdf-skipper' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} scdf-skipper --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.skipper.service.port }} +{{- else if contains "ClusterIP" .Values.skipper.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name=scdf-skipper,app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") + echo "Visit http://127.0.0.1:$CONTAINER_PORT to use your application" + kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME {{ .Values.skipper.containerPort | default 7577 }}:$CONTAINER_PORT +{{- end }} diff --git a/src/helm/scdf/templates/_helpers.tpl b/src/helm/scdf/templates/_helpers.tpl new file mode 100644 index 0000000000..31d8078963 --- /dev/null +++ b/src/helm/scdf/templates/_helpers.tpl @@ -0,0 +1,53 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "scdf.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "scdf.fullname" -}} +{{- if .Values.fullnameOverride }} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} +{{- else }} +{{- default .Chart.Name .Values.nameOverride }} +{{- end }} +{{- end }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "scdf.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "scdf.labels" -}} +helm.sh/chart: {{ include "scdf.chart" . }} +{{ include "scdf.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "scdf.selectorLabels" -}} +app.kubernetes.io/name: {{ include "scdf.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "scdf.serviceAccountName" -}} +{{- default .Values.serviceAccount.name "scdf-sa" }} +{{- end }} diff --git a/src/helm/scdf/templates/server/config.yaml b/src/helm/scdf/templates/server/config.yaml new file mode 100644 index 0000000000..adf84ccf28 --- /dev/null +++ b/src/helm/scdf/templates/server/config.yaml @@ -0,0 +1,68 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: scdf-server + labels: + app: scdf-server +data: + application-kubernetes.yaml: |- + logging: + level: + root: info + {{- with mergeOverwrite .Values.global.management .Values.server.config.management }} + management: + {{- toYaml . | nindent 6 }} + {{- end }} + {{/* create properties from various configuration spring values to be merged with server.config.spring */}} + {{- define "server.spring.properties" }} + output: + ansi: + enabled: NEVER + cloud: + {{- with .Values.configuration.task.deployer.kubernetes }} + deployer: + kubernetes: + {{- toYaml . | nindent 10 }} + {{- end }} + dataflow: + features: + streams: + enabled: {{ .Values.configuration.streamsEnabled | default true }} + tasks: + enabled: {{ .Values.configuration.tasksEnabled | default true }} + schedules: + enabled: {{ .Values.configuration.schedulesEnabled | default true }} + {{- with .Values.configuration.metrics.dashboard.url }} + metrics: + dashboard: + url: {{ . | squote }} + {{- end }} + {{- with .Values.configuration.task.platform.kubernetes }} + task: + platform: + kubernetes: + {{- toYaml . | nindent 14 }} + {{- end }} + {{- end }} + {{- $localServerSpring := include "server.spring.properties" . | fromYaml }} + {{- with .Values.server.config.spring }} + {{- with mergeOverwrite $localServerSpring $.Values.server.config.spring }} + spring: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- else }} + {{- with $localServerSpring }} + spring: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- end }} + {{- define "server.server.properties" }} + {{- with .Values.server.contextPath }} + contextPath: {{ . }} + {{- end }} + {{- end }} + {{- $localServerServer := include "server.server.properties" . | fromYaml }} + {{- with mergeOverwrite .Values.server.config.server $localServerServer }} + server: + {{- toYaml . | nindent 6 }} + {{- end }} diff --git a/src/helm/scdf/templates/server/deployment.yaml b/src/helm/scdf/templates/server/deployment.yaml new file mode 100644 index 0000000000..b807ced66e --- /dev/null +++ b/src/helm/scdf/templates/server/deployment.yaml @@ -0,0 +1,177 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: scdf-server + labels: + app: scdf-server + {{- include "scdf.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "scdf.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.server.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "scdf.labels" . | nindent 8 }} + {{- with .Values.server.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "scdf.serviceAccountName" . }} + {{- with mergeOverwrite .Values.global.podSecurityContext .Values.server.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: scdf-server + {{- with mergeOverwrite .Values.global.securityContext .Values.server.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- $serverImage := .Values.server.image.repository | default "springcloud/spring-cloud-dataflow-server" }} + {{- $serverTag := .Values.server.image.tag | default .Chart.AppVersion }} + image: {{ print $serverImage ":" $serverTag | squote }} + {{- $GlobalImagePullPolicy := .Values.global.imagePullPolicy | default "IfNotPresent" }} + imagePullPolicy: {{ .Values.server.image.pullPolicy | default $GlobalImagePullPolicy }} + ports: + - name: http + containerPort: {{ .Values.server.containerPort | default 9393 }} + protocol: {{ .Values.server.protocol | default "TCP" }} + env: + - name: SERVER_PORT + value: {{ .Values.server.containerPort | default 9393 | squote }} + - name: KUBERNETES_NAMESPACE + valueFrom: + fieldRef: + fieldPath: "metadata.namespace" + - name: SPRING_CLOUD_CONFIG_ENABLED + value: {{ .Values.server.config.springCloudConfigEnabled | default false | squote }} + - name: SPRING_CLOUD_KUBERNETES_CONFIG_ENABLE_API + value: {{ .Values.server.config.springCloudKubernetesEnableApi | default false | squote }} + - name: SPRING_CLOUD_KUBERNETES_SECRETS_ENABLE_API + value: {{ .Values.server.config.springCloudKubernetesSecretsEnableApi | default false | squote }} + - name: SPRING_CLOUD_KUBERNETES_SECRETS_PATHS + value: '/workspace/runtime/secrets' + - name: SPRING_CLOUD_DATAFLOW_FEATURES_ANALYTICS_ENABLED + value: {{ .Values.configuration.analytics.enabled | default false | squote }} + - name: SPRING_CLOUD_DATAFLOW_FEATURES_SCHEDULES_ENABLED + value: {{ .Values.configuration.schedules.enabled | default true | squote }} + - name: SPRING_CLOUD_DATAFLOW_TASK_COMPOSEDTASKRUNNER_URI + {{- $ctrImageRepository := .Values.configuration.composedTaskRunner.image.repository | default "springcloud/spring-cloud-dataflow-composed-task-runner" }} + {{- if .Values.configuration.composedTaskRunner.image.digest }} + value: {{ print "docker://" $ctrImageRepository ":" .Values.configuration.composedTaskRunner.image.digest | squote }} + {{- else }} + {{- $ctrImageTag := .Values.configuration.composedTaskRunner.image.tag | default "2.11.5-SNAPSHOT" }} + value: {{ print "docker://" $ctrImageRepository ":" $ctrImageTag | squote }} + {{- end }} + - name: SPRING_CLOUD_DATAFLOW_SERVER_URI + value: {{ .Values.server.config.serverUri | default "http://${SCDF_SERVER_SERVICE_HOST}:${SCDF_SERVER_SERVICE_PORT}" | squote }} + - name: SPRING_CLOUD_SKIPPER_CLIENT_SERVER_URI + value: {{ .Values.server.config.skipperUri | default "http://${SCDF_SKIPPER_SERVICE_HOST}:${SCDF_SKIPPER_SERVICE_PORT}/api" | squote }} + {{- $databaseDialect := .Values.server.config.database.dialect | default .Values.configuration.database.dialect }} + {{- if $databaseDialect }} + - name: SPRING_JPA_DATABASE_PLATFORM + value: {{ $databaseDialect | squote }} + {{- end }} + {{- $databaseUrl := .Values.server.config.database.url | default .Values.configuration.database.url }} + {{- if $databaseUrl }} + - name: SPRING_DATASOURCE_URL + value: {{ $databaseUrl | squote }} + {{- end }} + {{- $databaseDriverClassName := .Values.server.config.database.driverClassName | default .Values.configuration.database.driverClassName }} + {{- if $databaseDriverClassName }} + - name: SPRING_DATASOURCE_DRIVER_CLASS_NAME + value: {{ $databaseDriverClassName | squote }} + {{- end }} + {{- with .Values.server.config.database.testOnBorrow | default .Values.configuration.database.testOnBorrow }} + - name: SPRING_DATASOURCE_TEST_ON_BORROW + value: {{ . | squote }} + {{- end }} + {{- $databaseUserNameSecret := .Values.server.config.database.usernameSecret | default .Values.configuration.database.usernameSecret }} + {{- if $databaseUserNameSecret }} + - name: SPRING_DATASOURCE_USERNAME + valueFrom: + secretKeyRef: + name: {{ $databaseUserNameSecret.name | squote }} + key: {{ $databaseUserNameSecret.key | squote }} + {{- else }} + {{- with .Values.server.config.database.username | default .Values.configuration.database.username }} + - name: SPRING_DATASOURCE_USERNAME + value: {{ . | squote }} + {{- end }} + {{- end }} + {{- $databasePasswordSecret := .Values.server.config.database.passwordSecret | default .Values.configuration.database.passwordSecret }} + {{- if $databasePasswordSecret }} + - name: SPRING_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ $databasePasswordSecret.name | squote}} + key: {{ $databasePasswordSecret.key | squote }} + {{- else }} + {{- with .Values.server.config.database.password | default .Values.configuration.database.password }} + - name: SPRING_DATASOURCE_PASSWORD + value: {{ . | squote }} + {{- end }} + {{- end }} + {{- with mergeOverwrite .Values.global.startupProbe .Values.server.startupProbe }} + startupProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with mergeOverwrite .Values.global.livenessProbe .Values.server.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with mergeOverwrite .Values.global.readinessProbe .Values.server.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with mergeOverwrite .Values.global.resources .Values.server.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + - name: config + mountPath: '/workspace/config' + readOnly: true + {{- with .Values.server.volumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range . }} + - name: {{ . }} + {{- end }} + {{- else }} + {{- with .Values.server.image.pullSecrets }} + imagePullSecrets: + {{- range . }} + - name: {{ . }} + {{- end }} + {{- end }} + {{- end }} + volumes: + - name: config + configMap: + name: scdf-server + items: + - key: 'application-kubernetes.yaml' + path: 'application-kubernetes.yaml' + {{- with .Values.server.volumes }} + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.server.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/src/helm/scdf/templates/server/service.yaml b/src/helm/scdf/templates/server/service.yaml new file mode 100644 index 0000000000..352791c93b --- /dev/null +++ b/src/helm/scdf/templates/server/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: scdf-server + labels: + {{- include "scdf.labels" . | nindent 4 }} +spec: + type: {{ .Values.server.service.type }} + ports: + - port: {{ default .Values.server.service.port 9393 }} + targetPort: {{ default .Values.server.service.port 9393 }} + protocol: TCP + name: http + selector: + {{- include "scdf.selectorLabels" . | nindent 4 }} diff --git a/src/helm/scdf/templates/serviceaccount.yaml b/src/helm/scdf/templates/serviceaccount.yaml new file mode 100644 index 0000000000..381551a2f0 --- /dev/null +++ b/src/helm/scdf/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "scdf.serviceAccountName" . }} + labels: + {{- include "scdf.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/src/helm/scdf/templates/skipper/config.yaml b/src/helm/scdf/templates/skipper/config.yaml new file mode 100644 index 0000000000..81aefb919c --- /dev/null +++ b/src/helm/scdf/templates/skipper/config.yaml @@ -0,0 +1,50 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: scdf-skipper + labels: + app: scdf-skipper +data: + application-kubernetes.yaml: |- + logging: + level: + root: info + {{- with mergeOverwrite .Values.global.management .Values.skipper.config.management }} + management: + {{- toYaml . | nindent 6 }} + {{- end }} + {{/* create properties from various configuration spring values to be merged with server.config.spring */}} + {{- define "skipper.spring.properties" }} + output: + ansi: + enabled: NEVER + cloud: + {{- with .Values.configuration.stream.deployer.kubernetes }} + deployer: + kubernetes: + {{- toYaml . | nindent 10 }} + {{- end }} + {{- with .Values.configuration.stream.platform.kubernetes }} + skipper: + server: + platform: + kubernetes: + {{- toYaml . | nindent 14 }} + {{- end }} + {{- end }} + {{- $localServerSpring := include "server.spring.properties" . | fromYaml }} + {{- with .Values.server.config.spring }} + {{- with mergeOverwrite $localServerSpring $.Values.server.config.spring }} + spring: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- else }} + {{- with $localServerSpring }} + spring: + {{- toYaml . | nindent 6 }} + {{- end }} + {{- end }} + {{- with .Values.skipper.config.server }} + server: + {{- toYaml . | nindent 6 }} + {{- end }} \ No newline at end of file diff --git a/src/helm/scdf/templates/skipper/deployment.yaml b/src/helm/scdf/templates/skipper/deployment.yaml new file mode 100644 index 0000000000..439de3ed7f --- /dev/null +++ b/src/helm/scdf/templates/skipper/deployment.yaml @@ -0,0 +1,199 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: scdf-skipper + labels: + app: scdf-skipper + {{- include "scdf.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "scdf.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "scdf.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + serviceAccountName: {{ include "scdf.serviceAccountName" . }} + {{- with mergeOverwrite .Values.global.podSecurityContext .Values.skipper.podSecurityContext }} + securityContext: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: {{ include "scdf.fullname" . }}-skipper + {{- with mergeOverwrite .Values.global.securityContext .Values.server.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- $skipperImage := .Values.skipper.image.repository | default "springcloud/spring-cloud-skipper-server" }} + {{- $skipperTag := .Values.skipper.image.tag | default .Chart.AppVersion }} + image: {{ print $skipperImage ":" $skipperTag | squote }} + {{- $GlobalImagePullPolicy := .Values.global.imagePullPolicy | default "IfNotPresent" }} + imagePullPolicy: {{ .Values.skipper.image.pullPolicy | default $GlobalImagePullPolicy }} + ports: + - name: http + containerPort: {{ .Values.skipper.containerPort | default 7577 }} + protocol: {{ .Values.skipper.protocol | default "TCP" }} + env: + - name: SERVER_PORT + value: {{ .Values.skipper.containerPort | default 7577 }} + - name: KUBERNETES_NAMESPACE + valueFrom: + fieldRef: + fieldPath: "metadata.namespace" + - name: SPRING_CLOUD_CONFIG_ENABLED + value: {{ .Values.skipper.config.springCloudConfigEnabled | default false | squote }} + - name: SPRING_CLOUD_KUBERNETES_CONFIG_ENABLE_API + value: {{ .Values.skipper.config.springCloudKubernetesEnableApi | default false | squote }} + - name: SPRING_CLOUD_KUBERNETES_SECRETS_ENABLE_API + value: {{ .Values.skipper.config.springCloudKubernetesSecretsEnableApi | default false | squote }} + - name: SPRING_CLOUD_KUBERNETES_SECRETS_PATHS + value: '/workspace/runtime/secrets' + {{- $databaseDialect := .Values.skipper.config.database.dialect | default .Values.configuration.database.dialect }} + {{- if $databaseDialect }} + - name: SPRING_JPA_DATABASE_PLATFORM + value: {{ $databaseDialect | squote }} + {{- end }} + {{- $databaseUrl := .Values.skipper.config.database.url | default .Values.configuration.database.url }} + {{- if $databaseUrl }} + - name: SPRING_DATASOURCE_URL + value: {{ $databaseUrl | squote }} + {{- end }} + {{- $databaseDriverClassName := .Values.skipper.config.database.driverClassName | default .Values.configuration.database.driverClassName }} + {{- if $databaseDriverClassName }} + - name: SPRING_DATASOURCE_DRIVER_CLASS_NAME + value: {{ $databaseDriverClassName | squote }} + {{- end }} + {{- with .Values.skipper.config.database.testOnBorrow | default .Values.configuration.database.testOnBorrow }} + - name: SPRING_DATASOURCE_TEST_ON_BORROW + value: {{ . | squote }} + {{- end }} + {{- $databaseUserNameSecret := .Values.skipper.config.database.usernameSecret | default .Values.configuration.database.usernameSecret }} + {{- if $databaseUserNameSecret }} + - name: SPRING_DATASOURCE_USERNAME + valueFrom: + secretKeyRef: + name: {{ $databaseUserNameSecret.name | squote }} + key: {{ $databaseUserNameSecret.key | squote }} + {{- else }} + {{- with .Values.skipper.config.database.username | default .Values.configuration.database.username }} + - name: SPRING_DATASOURCE_USERNAME + value: {{ . | squote }} + {{- end }} + {{- end }} + {{- $databasePasswordSecret := .Values.skipper.config.database.passwordSecret | default .Values.configuration.database.passwordSecret }} + {{- if $databasePasswordSecret }} + - name: SPRING_DATASOURCE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ $databasePasswordSecret.name | squote }} + key: {{ $databasePasswordSecret.key | squote }} + {{- else }} + {{- with .Values.skipper.config.database.password | default .Values.configuration.database.password }} + - name: SPRING_DATASOURCE_PASSWORD + value: {{ . | squote }} + {{- end }} + {{- end }} + {{- if eq .Values.configuration.broker.type "rabbit" }} + - name: SPRING_RABBITMQ_HOST + value: {{ .Values.configuration.broker.rabbit.host | squote }} + - name: SPRING_RABBITMQ_PORT + value: {{ .Values.configuration.broker.rabbit.port | default 5672 | squote }} + {{- with .Values.configuration.broker.rabbit.usernameSecret }} + - name: SPRING_RABBITMQ_USERNAME + valueFrom: + secretKeyRef: + name: {{ .name | squote }} + key: {{ .key | squote }} + {{- else }} + {{- with .Values.configuration.broker.rabbit.username }} + - name: SPRING_RABBITMQ_USERNAME + value: {{ . | squote }} + {{- end }} + {{- end }} + {{- with .Values.configuration.broker.rabbit.passwordSecret }} + - name: SPRING_RABBITMQ_PASSWORD + valueFrom: + secretKeyRef: + name: {{ .name | squote }} + key: {{ .key | squote }} + {{- else }} + {{- with .Values.configuration.broker.rabbit.username }} + - name: SPRING_RABBITMQ_PASSWORD + value: {{ . | squote }} + {{- end }} + {{- end }} + {{- end }} + {{- if eq .Values.configuration.broker.type "kafka" }} + - name: SPRING_CLOUD_STREAM_KAFKA_BINDER_BROKERS + value: {{ .Values.configuration.broker.kafka.brokers | squote }} + {{- end }} + {{- with mergeOverwrite .Values.global.startupProbe .Values.skipper.startupProbe }} + startupProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with mergeOverwrite .Values.global.livenessProbe .Values.skipper.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with mergeOverwrite .Values.global.readinessProbe .Values.skipper.readinessProbe }} + readinessProbe: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with mergeOverwrite .Values.global.resources .Values.skipper.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.skipper.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- else }} + volumeMounts: + - name: config + mountPath: '/workspace/config' + readOnly: true + {{- end }} + {{- with .Values.global.imagePullSecrets }} + imagePullSecrets: + {{- range . }} + - name: {{ . }} + {{- end }} + {{- else }} + {{- with .Values.skipper.image.pullSecrets }} + imagePullSecrets: + {{- range . }} + - name: {{ . }} + {{- end }} + {{- end }} + {{- end }} + {{- with .Values.skipper.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- else }} + volumes: + - name: config + configMap: + name: scdf-skipper + items: + - key: 'application-kubernetes.yaml' + path: 'application-kubernetes.yaml' + {{- end }} + {{- with .Values.skipper.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/src/helm/scdf/templates/skipper/service.yaml b/src/helm/scdf/templates/skipper/service.yaml new file mode 100644 index 0000000000..90d8623c16 --- /dev/null +++ b/src/helm/scdf/templates/skipper/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: scdf-skipper + labels: + {{- include "scdf.labels" . | nindent 4 }} +spec: + type: {{ .Values.skipper.service.type }} + ports: + - port: {{ default .Values.skipper.service.port 7577 }} + targetPort: {{ default .Values.skipper.service.port 7577 }} + protocol: TCP + name: http + selector: + {{- include "scdf.selectorLabels" . | nindent 4 }} diff --git a/src/helm/scdf/templates/tests/test-connection.yaml b/src/helm/scdf/templates/tests/test-connection.yaml new file mode 100644 index 0000000000..d6b1473a34 --- /dev/null +++ b/src/helm/scdf/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "scdf.fullname" . }}-test-connection" + labels: + {{- include "scdf.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['scdf-server:{{ .Values.server.service.port }}'] + restartPolicy: Never diff --git a/src/helm/scdf/test-values.yaml b/src/helm/scdf/test-values.yaml new file mode 100644 index 0000000000..123ecd97a3 --- /dev/null +++ b/src/helm/scdf/test-values.yaml @@ -0,0 +1,101 @@ +configuration: + streamsEnabled: true + tasksEnabled: true + composedTaskRunner: + image: + tag: 2.11.5-SNAPSHOT + stream: + deployer: + kubernetes: + imagePullPolicy: IfNotPresent + imagePullSecrets: [ private-registry-key, docker-registry-key ] + task: + deployer: + kubernetes: + imagePullPolicy: IfNotPresent + imagePullSecrets: [ private-registry-key, docker-registry-key ] + platform: + kubernetes: + accounts: + default: + containerSecurityContext: + allowPrivilegeEscalation: true + environmentVariables: 'JAVA_TOOL_OPTIONS=-XX:ActiveProcessorCount=-1' + imagePullPolicy: IfNotPresent + imagePullSecret: registry-key + requests: + cpu: 1500m + memory: 1024Mi + metrics: + dashboard: + url: 'http://grafana:3000' + broker: + type: kafka + rabbit: + host: rabbitmq.rabbitmq + kafka: + brokers: "kafka.kafka:9092" + database: + usernameSecret: + name: postgres + key: database-username + passwordSecret: + name: postgres + key: database-password + url: jdbc://postgresql.postgresql:5432/dataflow + driverClassName: org.postgresql.Driver + dialect: org.hibernate.dialect.PostgreSQLDialect + +# Global values +global: + registry: + secret: + ref: 'docker-reg-cred' + imagePullPolicy: IfNotPresent + imagePullSecrets: [ docker-reg-cred ] + startupProbe: + tcpSocket: + port: http + failureThreshold: 4 + initialDelaySeconds: 10 + timeoutSeconds: 3 + periodSeconds: 15 + livenessProbe: + httpGet: + path: '/actuator/health/liveness' + port: http + failureThreshold: 4 + initialDelaySeconds: 1 + timeoutSeconds: 3 + periodSeconds: 15 + readinessProbe: + httpGet: + path: '/actuator/health/readiness' + port: http + failureThreshold: 3 + initialDelaySeconds: 1 + timeoutSeconds: 3 + periodSeconds: 15 +serviceAccount: + create: true + automount: true + name: "scdf-sa" + +server: + livenessProbe: + httpGet: + path: '/management/health/liveness' + readinessProbe: + httpGet: + path: '/management/health/readiness' + + service: + type: LoadBalancer + config: + server: + forward-headers-strategy: framework + +skipper: + config: + springCloudConfigEnabled: false + diff --git a/src/helm/scdf/values.schema.json b/src/helm/scdf/values.schema.json new file mode 100644 index 0000000000..8eadf86415 --- /dev/null +++ b/src/helm/scdf/values.schema.json @@ -0,0 +1,785 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "configuration": { + "properties": { + "analytics": { + "properties": { + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "broker": { + "properties": { + "kafka": { + "properties": { + "brokers": { + "type": "string" + } + }, + "type": "object" + }, + "rabbit": { + "properties": { + "host": { + "type": "string" + }, + "password": { + "type": "string" + }, + "passwordSecret": { + "properties": {}, + "type": "object" + }, + "port": { + "type": "integer" + }, + "username": { + "type": "string" + }, + "usernameSecret": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "composedTaskRunner": { + "properties": { + "image": { + "properties": { + "digest": { + "type": "string" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "database": { + "properties": { + "dialect": { + "type": "string" + }, + "driverClassName": { + "type": "string" + }, + "password": { + "type": "string" + }, + "passwordSecret": { + "properties": {}, + "type": "object" + }, + "testOnBorrow": { + "type": "boolean" + }, + "url": { + "type": "string" + }, + "username": { + "type": "string" + }, + "usernameSecret": { + "properties": {}, + "type": "object" + }, + "validationQuery": { + "type": "string" + } + }, + "type": "object" + }, + "metrics": { + "properties": { + "dashboard": { + "properties": { + "url": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "schedules": { + "properties": { + "enabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "schedulesEnabled": { + "type": "boolean" + }, + "stream": { + "properties": { + "deployer": { + "properties": { + "kubernetes": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "platform": { + "properties": { + "kubernetes": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "streamsEnabled": { + "type": "boolean" + }, + "task": { + "properties": { + "deployer": { + "properties": { + "kubernetes": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "platform": { + "properties": { + "kubernetes": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "tasksEnabled": { + "type": "boolean" + } + }, + "type": "object" + }, + "global": { + "properties": { + "imagePullPolicy": { + "type": "string" + }, + "imagePullSecrets": { + "type": "array" + }, + "livenessProbe": { + "properties": {}, + "type": "object" + }, + "management": { + "properties": { + "defaults": { + "properties": { + "metrics": { + "properties": { + "export": { + "properties": { + "enabled": { + "type": "boolean" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "metrics": { + "properties": { + "export": { + "properties": { + "prometheus": { + "properties": { + "enabled": { + "type": "boolean" + }, + "rsocket": { + "properties": { + "enabled": { + "type": "boolean" + }, + "host": { + "type": "string" + }, + "port": { + "type": "integer" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "podSecurityContext": { + "properties": {}, + "type": "object" + }, + "readinessProbe": { + "properties": {}, + "type": "object" + }, + "registry": { + "properties": { + "secret": { + "properties": { + "ref": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "resources": { + "properties": {}, + "type": "object" + }, + "securityContext": { + "properties": {}, + "type": "object" + }, + "startupProbe": { + "properties": {}, + "type": "object" + } + }, + "type": "object" + }, + "server": { + "properties": { + "affinity": { + "properties": {}, + "type": "object" + }, + "config": { + "properties": { + "database": { + "properties": { + "dialect": { + "type": "string" + }, + "driverClassName": { + "type": "string" + }, + "password": { + "type": "string" + }, + "passwordSecret": { + "properties": {}, + "type": "object" + }, + "testOnBorrow": { + "type": "boolean" + }, + "url": { + "type": "string" + }, + "username": { + "type": "string" + }, + "usernameSecret": { + "properties": {}, + "type": "object" + }, + "validationQuery": { + "type": "string" + } + }, + "type": "object" + }, + "management": { + "properties": {}, + "type": "object" + }, + "server": { + "properties": {}, + "type": "object" + }, + "serverUri": { + "type": "string" + }, + "skipperUri": { + "type": "string" + }, + "spring": { + "properties": {}, + "type": "object" + }, + "springCloudConfigEnabled": { + "type": "boolean" + }, + "springCloudKubernetesEnableApi": { + "type": "boolean" + }, + "springCloudKubernetesSecretsEnableApi": { + "type": "boolean" + } + }, + "type": "object" + }, + "containerPort": { + "type": "integer" + }, + "contextPath": { + "type": "string" + }, + "image": { + "properties": { + "digest": { + "type": "string" + }, + "pullPolicy": { + "type": "string" + }, + "pullSecrets": { + "type": "array" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "livenessProbe": { + "properties": { + "failureThreshold": { + "type": "integer" + }, + "httpGet": { + "properties": { + "path": { + "type": "string" + }, + "port": { + "type": "string" + } + }, + "type": "object" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "nodeSelector": { + "properties": {}, + "type": "object" + }, + "podAnnotations": { + "properties": {}, + "type": "object" + }, + "podLabels": { + "properties": {}, + "type": "object" + }, + "podSecurityContext": { + "properties": {}, + "type": "object" + }, + "protocol": { + "type": "string" + }, + "readinessProbe": { + "properties": { + "failureThreshold": { + "type": "integer" + }, + "httpGet": { + "properties": { + "path": { + "type": "string" + }, + "port": { + "type": "string" + } + }, + "type": "object" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "resources": { + "properties": { + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "securityContext": { + "properties": {}, + "type": "object" + }, + "service": { + "properties": { + "port": { + "type": "integer" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "startupProbe": { + "properties": { + "failureThreshold": { + "type": "integer" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "tcpSocket": { + "properties": { + "port": { + "type": "string" + } + }, + "type": "object" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "tolerations": { + "type": "array" + }, + "volumeMounts": { + "type": "array" + }, + "volumes": { + "type": "array" + } + }, + "type": "object" + }, + "serviceAccount": { + "properties": { + "annotations": { + "properties": {}, + "type": "object" + }, + "automount": { + "type": "boolean" + }, + "create": { + "type": "boolean" + }, + "name": { + "type": "string" + } + }, + "type": "object" + }, + "skipper": { + "properties": { + "affinity": { + "properties": {}, + "type": "object" + }, + "config": { + "properties": { + "database": { + "properties": { + "dialect": { + "type": "null" + }, + "driverClassName": { + "type": "null" + }, + "password": { + "type": "null" + }, + "passwordSecret": { + "type": "null" + }, + "testOnBorrow": { + "type": "null" + }, + "url": { + "type": "null" + }, + "username": { + "type": "null" + }, + "usernameSecret": { + "properties": {}, + "type": "object" + }, + "validationQuery": { + "type": "null" + } + }, + "type": "object" + }, + "management": { + "properties": {}, + "type": "object" + }, + "server": { + "properties": {}, + "type": "object" + }, + "spring": { + "properties": {}, + "type": "object" + }, + "springCloudConfigEnabled": { + "type": "boolean" + }, + "springCloudKubernetesEnableApi": { + "type": "boolean" + }, + "springCloudKubernetesSecretsEnableApi": { + "type": "boolean" + } + }, + "type": "object" + }, + "containerPort": { + "type": "integer" + }, + "contextPath": { + "type": "string" + }, + "image": { + "properties": { + "digest": { + "type": "string" + }, + "pullPolicy": { + "type": "string" + }, + "pullSecrets": { + "type": "array" + }, + "repository": { + "type": "string" + }, + "tag": { + "type": "string" + } + }, + "type": "object" + }, + "livenessProbe": { + "properties": { + "failureThreshold": { + "type": "integer" + }, + "httpGet": { + "properties": { + "path": { + "type": "string" + }, + "port": { + "type": "string" + } + }, + "type": "object" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "nodeSelector": { + "properties": {}, + "type": "object" + }, + "podAnnotations": { + "properties": {}, + "type": "object" + }, + "podLabels": { + "properties": {}, + "type": "object" + }, + "podSecurityContext": { + "properties": {}, + "type": "object" + }, + "protocol": { + "type": "string" + }, + "readinessProbe": { + "properties": { + "failureThreshold": { + "type": "integer" + }, + "httpGet": { + "properties": { + "path": { + "type": "string" + }, + "port": { + "type": "string" + } + }, + "type": "object" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "resources": { + "properties": { + "requests": { + "properties": { + "cpu": { + "type": "string" + }, + "memory": { + "type": "string" + } + }, + "type": "object" + } + }, + "type": "object" + }, + "securityContext": { + "properties": {}, + "type": "object" + }, + "service": { + "properties": { + "port": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "startupProbe": { + "properties": { + "failureThreshold": { + "type": "integer" + }, + "initialDelaySeconds": { + "type": "integer" + }, + "periodSeconds": { + "type": "integer" + }, + "tcpSocket": { + "properties": { + "port": { + "type": "string" + } + }, + "type": "object" + }, + "timeoutSeconds": { + "type": "integer" + } + }, + "type": "object" + }, + "tolerations": { + "type": "array" + }, + "volumeMounts": { + "type": "array" + }, + "volumes": { + "type": "array" + } + }, + "type": "object" + } + }, + "type": "object" +} diff --git a/src/helm/scdf/values.yaml b/src/helm/scdf/values.yaml new file mode 100644 index 0000000000..be5aaebe97 --- /dev/null +++ b/src/helm/scdf/values.yaml @@ -0,0 +1,286 @@ +# Default values for scdf. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +# Configuration that applies to Spring Cloud Data Flow as a whole. +configuration: + streamsEnabled: true + tasksEnabled: true + schedulesEnabled: true + composedTaskRunner: + image: + repository: springcloud/spring-cloud-dataflow-composed-task-runner + tag: "2.11.5-SNAPSHOT" + digest: "" + stream: + deployer: + # entries will be added to spring.cloud.deployer.kubernetes in skipper configuration + kubernetes: { } + platform: + # entries will be added to spring.cloud.skipper.server.platform.kubernetes + kubernetes: { } + task: + deployer: + # entries will be added to spring.cloud.deployer.kubernetes in dataflow server configuration + kubernetes: { } + platform: + # entries will be added to spring.cloud.dataflow.task.platform.kubernetes + kubernetes: { } + metrics: + dashboard: + url: 'http://grafana:3000' + analytics: + enabled: true + schedules: + enabled: true + broker: + # + type: rabbit + kafka: + # comma separated list of host:port of brokers + brokers: "" + rabbit: + host: "" + port: 5672 + username: "" + # userNameSecret contains name and key for referencing username from secret + usernameSecret: { } + password: "" + # passwordSecret contains name and key for referencing password from secret + passwordSecret: { } + database: + url: "" + username: "" + # userNameSecret contains name and key for referencing username from secret + usernameSecret: { } + password: "" + # passwordSecret contains name and key for referencing password from secret + passwordSecret: { } + driverClassName: "" + testOnBorrow: true + validationQuery: "" + dialect: "" + +# Global values applied to all deployed applications, tasks and stream applications +global: + # Registry secret + registry: + secret: + ref: "" + imagePullPolicy: IfNotPresent + imagePullSecrets: [ ] + # will be added to spec.template.spec.securityContext + podSecurityContext: { } + # will be added to spec.template.spec.containers.securityContext + securityContext: { } + startupProbe: + tcpSocket: + port: http + failureThreshold: 4 + initialDelaySeconds: 10 + timeoutSeconds: 3 + periodSeconds: 15 + livenessProbe: + httpGet: + path: '/actuator/health/liveness' + port: http + failureThreshold: 4 + initialDelaySeconds: 1 + timeoutSeconds: 3 + periodSeconds: 15 + readinessProbe: + httpGet: + path: '/actuator/health/readiness' + port: http + failureThreshold: 3 + initialDelaySeconds: 1 + timeoutSeconds: 3 + periodSeconds: 15 + resources: { } + # will be applied to management of server and skipper config + management: + metrics: + export: + prometheus: + enabled: false + rsocket: + enabled: false + host: prometheus-rsocket-proxy + port: 7001 + defaults: + metrics: + export: + enabled: false + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Automatically mount a ServiceAccount's API credentials? + automount: true + # Annotations to add to the service account + annotations: { } + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: 'scdf-sa' + +# Values used in Spring Cloud Data Flow Server deployment, configuration and service +server: + image: + repository: 'springcloud/spring-cloud-dataflow-server' + tag: '2.11.5-SNAPSHOT' + digest: "" + pullPolicy: IfNotPresent + pullSecrets: [ ] + contextPath: "" + containerPort: 9393 + protocol: TCP + podAnnotations: { } + podLabels: { } + # will be added to spec.template.spec.securityContext + podSecurityContext: { } + # will be added to spec.template.spec.containers.securityContext + securityContext: { } + + resources: + requests: + cpu: 1500m + memory: 2048Mi + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user after monitoring performance. + # limits: + # cpu: 4000m + # memory: 4096Mi + startupProbe: { } + livenessProbe: + httpGet: + path: '/management/health/liveness' + readinessProbe: + httpGet: + path: '/management/health/readiness' + # If a volume named config will be added and mounted in /workspace/config + volumes: [ ] + volumeMounts: [ ] + nodeSelector: { } + tolerations: [ ] + affinity: { } + # will become part of configmap for scdf-server. + # configure spring.cloud.dataflow.task.platform properties below in configuration section + config: + springCloudConfigEnabled: false + springCloudKubernetesEnableApi: false + springCloudKubernetesSecretsEnableApi: false + management: { } + spring: { } + server: { } + database: + url: "" + username: "" + # userNameSecret contains name and key for referencing username from secret + usernameSecret: { } + password: "" + # passwordSecret contains name and key for referencing password from secret + passwordSecret: { } + driverClassName: "" + testOnBorrow: true + validationQuery: "" + dialect: "" + # usually http://${SCDF_SERVER_SERVICE_HOST}:${SCDF_SERVER_SERVICE_PORT}" + serverUri: "" + # usually "http://${SKIPPER_SERVICE_HOST}:${SKIPPER_SERVICE_PORT}/api" + skipperUri: "" + service: + type: LoadBalancer + port: 9393 + + +# Values in Spring Cloud Skipper deployment, configuration and service +skipper: + image: + repository: 'springcloud/spring-cloud-skipper' + tag: '2.11.5-SNAPSHOT' + digest: "" + pullPolicy: IfNotPresent + pullSecrets: [ ] + contextPath: "" + containerPort: 7577 + protocol: TCP + podAnnotations: { } + podLabels: { } + # will be added to spec.template.spec.securityContext + podSecurityContext: { } + # will be added to spec.template.spec.containers.securityContext + securityContext: { } + + resources: + requests: + cpu: 1500m + memory: 2048Mi + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limit: + # cpu: 4000m + # memory: 4096Mi + startupProbe: + tcpSocket: + port: http + failureThreshold: 4 + initialDelaySeconds: 10 + timeoutSeconds: 3 + periodSeconds: 15 + livenessProbe: + httpGet: + path: '/actuator/health/liveness' + port: http + failureThreshold: 4 + initialDelaySeconds: 1 + timeoutSeconds: 3 + periodSeconds: 15 + readinessProbe: + httpGet: + path: '/actuator/health/readiness' + port: http + failureThreshold: 3 + initialDelaySeconds: 5 + timeoutSeconds: 3 + periodSeconds: 15 + # If you override volumes you should include the following section unless you to not want to use the ConfigMap named scdf-server + # - name: config + # configMap: + # name: scdf-skipper + # items: + # - key: 'application-kubernetes.yaml' + # path: 'application-kubernetes.yaml' + volumes: [ ] + #If you override volumeMounts you should include the following section unless you want to skip config or use a different mapping. + # - name: config + # mountPath: /workspace/config + # readOnly: true + volumeMounts: [ ] + nodeSelector: { } + tolerations: [ ] + affinity: { } + # will become part of configmap for scdf-skipper. + # configure spring.cloud.skipper.server.platform below in configuration section + config: + springCloudConfigEnabled: false + springCloudKubernetesEnableApi: false + springCloudKubernetesSecretsEnableApi: false + management: { } + spring: { } + server: { } + database: + url: + username: + # userNameSecret contains name and key for referencing username from secret + usernameSecret: { } + password: + # passwordSecret contains name and key for referencing password from secret + passwordSecret: + driverClassName: + testOnBorrow: + validationQuery: + dialect: + service: + type: LoadBalancer + port: http diff --git a/src/helm/test-templates.sh b/src/helm/test-templates.sh new file mode 100755 index 0000000000..6faf58dfd9 --- /dev/null +++ b/src/helm/test-templates.sh @@ -0,0 +1,7 @@ +#!/bin/bash +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +pushd "$SCDIR" > /dev/null || exit +helm lint --debug scdf/ --values scdf/test-values.yaml +rm -rf ./output/* +helm template --debug scdf/ --values scdf/test-values.yaml --output-dir ./output +popd > /dev/null || exit