Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit d24ab31

Browse files
author
Corneil du Plessis
committed
Merge changes from main.
1 parent eb747af commit d24ab31

38 files changed

+188
-142
lines changed

spring-cloud-dataflow-docs/src/main/asciidoc/configuration-carvel.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ These scripts assume you are connected to a Kubernetes cluster and `kubectl` is
5151
| [scdf-type] (oss, pro)
5252
| Creates `scdf-values.yml` in current directory based on `scdf-pro-values.yml` or `scdf-oss-values.yml`
5353

54+
| carvel-import-secret.sh
55+
| <secret-name> <namespace> [secret-namespace] [--import|--placeholder]
56+
| [--plarholder] Creates place holder secret in namespace. [--import] Creates `SecretImport` for secretgen-controller.
57+
5458
| setup-scdf-repo.sh
5559
| [scdf-type] (oss, pro)
5660
| Creates the namespace and installs the relevant Carvel package and credentials. If the optional _scdf-type_ is not provided the environmental variable `SCDF_TYPE` will be used.

src/carvel/config/dataflow-deployment.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ spec:
4949
ports:
5050
- containerPort: 9393
5151
startupProbe:
52-
httpGet:
52+
tcpSocket:
5353
port: 9393
54-
path: #@ dataflow_liveness_path()
5554
failureThreshold: 4
5655
initialDelaySeconds: 10
5756
timeoutSeconds: 3

src/carvel/config/skipper-deployment.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,23 @@ spec:
4141
ports:
4242
- containerPort: 7577
4343
startupProbe:
44-
httpGet:
44+
tcpSocket:
4545
port: 7577
46-
path: /actuator
4746
failureThreshold: 4
4847
initialDelaySeconds: 10
4948
timeoutSeconds: 3
5049
periodSeconds: 15
5150
livenessProbe:
5251
httpGet:
53-
path: /actuator/health
52+
path: /actuator/health/liveness
5453
port: 7577
5554
failureThreshold: 4
5655
initialDelaySeconds: 1
5756
timeoutSeconds: 3
5857
periodSeconds: 15
5958
readinessProbe:
6059
httpGet:
61-
path: /actuator/info
60+
path: /actuator/health/readiness
6261
port: 7577
6362
failureThreshold: 3
6463
initialDelaySeconds: 5

src/carvel/config/skipper.star

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ load("monitoring/monitoring.star", "grafana_enabled")
77
load("monitoring/monitoring.star", "prometheus_rsocket_proxy_enabled")
88
load("common/common.star", "non_empty_string")
99
def env_config():
10-
env = ""
10+
env = []
11+
env.append("LANG=en_US.utf8")
12+
env.append("LC_ALL=en_US.utf8")
13+
env.append("JDK_JAVA_OPTIONS=-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8")
1114
if external_rabbitmq_enabled():
12-
env = external_rabbitmq_env_str()
15+
env.append(external_rabbitmq_env_str())
1316
elif external_kafka_enabled():
14-
env = external_kafka_env_str()
17+
env.append(external_kafka_env_str())
1518
end
16-
return env
19+
return ",".join(env)
1720
end
1821

1922
def skipper_image():
@@ -32,6 +35,7 @@ def skipper_container_env():
3235
envs = []
3336
envs.extend([{"name": "LANG", "value": "en_US.utf8"}])
3437
envs.extend([{"name": "LC_ALL", "value": "en_US.utf8"}])
38+
envs.extend([{"name": "JDK_JAVA_OPTIONS", "value": "-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"}])
3539
envs.extend([{"name": "SPRING_CLOUD_CONFIG_ENABLED", "value": "false"}])
3640
envs.extend([{"name": "SPRING_CLOUD_KUBERNETES_CONFIG_ENABLE_API", "value": "false"}])
3741
envs.extend([{"name": "SPRING_CLOUD_KUBERNETES_SECRETS_ENABLE_API", "value": "false"}])

src/carvel/config/values/values.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ scdf:
2020
cpu: ""
2121
memory: ""
2222
requests:
23-
cpu: 500m
24-
memory: 1024Mi
23+
cpu: 1500m
24+
memory: 1536Mi
2525
metrics:
2626
dashboard:
2727
url: ""
@@ -64,8 +64,8 @@ scdf:
6464
cpu: ""
6565
memory: ""
6666
requests:
67-
cpu: 500m
68-
memory: 1024Mi
67+
cpu: 1500m
68+
memory: 1536Mi
6969
database:
7070
url: ""
7171
username: ""

src/carvel/test/servers.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ describe('servers', () => {
252252
const container = deploymentContainer(deployment, SKIPPER_NAME);
253253
const envs = containerEnvValues(container);
254254
expect(envs).toBeTruthy();
255-
expect(envs).toHaveLength(6);
255+
expect(envs).toHaveLength(7);
256256
expect(envs).toEqual(
257257
expect.arrayContaining([
258258
expect.objectContaining({
@@ -573,11 +573,11 @@ describe('servers', () => {
573573
const dataflowContainer = deploymentContainer(dataflowDeployment, SCDF_SERVER_NAME);
574574
const skipperContainer = deploymentContainer(skipperDeployment, SKIPPER_NAME);
575575

576-
expect(dataflowContainer?.resources?.requests?.cpu).toBe('500m');
577-
expect(dataflowContainer?.resources?.requests?.memory).toBe('1024Mi');
576+
expect(dataflowContainer?.resources?.requests?.cpu).toBe('1500m');
577+
expect(dataflowContainer?.resources?.requests?.memory).toBe('1536Mi');
578578

579-
expect(skipperContainer?.resources?.requests?.cpu).toBe('500m');
580-
expect(skipperContainer?.resources?.requests?.memory).toBe('1024Mi');
579+
expect(skipperContainer?.resources?.requests?.cpu).toBe('1500m');
580+
expect(skipperContainer?.resources?.requests?.memory).toBe('1536Mi');
581581
});
582582

583583
it('should change resources', async () => {

src/deploy/carvel/add-local-registry-secret.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,17 @@ SECRET_NAME=$1
2121
REGISTRY_NAME=$2
2222
REGISTRY_USER=$3
2323
REGISTRY_PWD=$4
24+
SECRET_NS=$NS
2425
if [ "$5" != "" ]; then
25-
NS=$5
26+
SECRET_NS=$5
2627
fi
27-
check_env NS
28-
kubectl create secret docker-registry "$SECRET_NAME" \
29-
--docker-server="$REGISTRY_NAME" \
30-
--docker-username="$REGISTRY_USER" \
31-
--docker-password="$REGISTRY_PWD" \
32-
--namespace "$NS"
28+
check_env SECRET_NAME
29+
check_env SECRET_NS
3330

31+
#kubectl create secret docker-registry "$SECRET_NAME" \
32+
# --docker-server="$REGISTRY_NAME" \
33+
# --docker-username="$REGISTRY_USER" \
34+
# --docker-password="$REGISTRY_PWD" \
35+
# --namespace "$NS"
3436

37+
"$SCDIR/carvel-import-secret.sh" "$SECRET_NAME" "$SECRET_NS"

src/deploy/carvel/carvel-add-registry-secret.sh

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,35 @@ function check_env() {
1313
}
1414

1515
function create_secret() {
16-
echo "Create docker-registry secret $1 for $2 username=$3"
17-
kubectl create secret docker-registry "$1" \
18-
--docker-server="$2" \
19-
--docker-username="$3" \
20-
--docker-password="$4" \
21-
--namespace "$5"
22-
kubectl create secret docker-registry "$1" \
23-
--docker-server="$2" \
24-
--docker-username="$3" \
25-
--docker-password="$4" \
26-
--namespace "$NS"
27-
# "$SCDIR/carvel-import-secret.sh" "$1" "$NS" "$5"
28-
echo "Annotating $1 for image-pull-secret"
29-
kubectl annotate secret "$1" --namespace "$5" secretgen.carvel.dev/image-pull-secret=""
30-
kubectl annotate secret "$1" --namespace "$NS" secretgen.carvel.dev/image-pull-secret=""
16+
SCRT_NAME=$1
17+
REG_NAME=$2
18+
REG_USER=$3
19+
REG_PWD=$4
20+
SCRT_NS=$5
21+
echo "Create docker-registry secret $SCRT_NAME for $REG_NAME username=$REG_USER"
22+
kubectl create secret docker-registry "$SCRT_NAME" \
23+
--docker-server="$REG_NAME" \
24+
--docker-username="$REG_USER" \
25+
--docker-password="$REG_PWD" \
26+
--namespace "$SCRT_NS"
27+
# kubectl create secret docker-registry "$SCRT_NAME" \
28+
# --docker-server="$REG_NAME" \
29+
# --docker-username="$REG_USER" \
30+
# --docker-password="$4" \
31+
# --namespace "$NS"
32+
echo "Annotating $SCRT_NAME for image-pull-secret"
33+
# kubectl annotate secret "$SCRT_NAME" --namespace "$SCRT_NS" secretgen.carvel.dev/image-pull-secret=""
34+
# kubectl annotate secret "$1" --namespace "$NS" secretgen.carvel.dev/image-pull-secret=""
35+
echo "Exporting $SCRT_NAME from $SCRT_NS"
36+
kubectl apply -f - <<EOF
37+
apiVersion: secretgen.carvel.dev/v1alpha1
38+
kind: SecretExport
39+
metadata:
40+
name: ${SCRT_NAME}
41+
namespace: ${SCRT_NS}
42+
spec:
43+
toNamespace: '*'
44+
EOF
3145

3246
}
3347
if [ "$4" = "" ]; then
@@ -41,6 +55,8 @@ REGISTRY_PWD=$4
4155
if [ "$5" != "" ]; then
4256
NS=$5
4357
fi
58+
check_env SECRET_NAME
59+
check_env REGISTRY_NAME
60+
check_env REGISTRY_USER
4461
check_env NS
4562
create_secret "$SECRET_NAME" "$REGISTRY_NAME" "$REGISTRY_USER" "$REGISTRY_PWD" "secrets-ns"
46-

src/deploy/carvel/carvel-import-secret.sh

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@ if [ "$2" = "" ]; then
33
echo "Argument required: <secret-name> <target-namespace>"
44
exit 1
55
fi
6+
IMPORT_TYPE=placeholder
67
SECRET_NAME=$1
78
NAMESPACE=$2
8-
if [ "$3" != "" ]; then
9+
if [ "$3" != "" ] && [ "$3" != "--import" ] && [ "$3" != "--placeholder" ]; then
910
FROM_NAMESPACE=$3
11+
shift
1012
else
1113
FROM_NAMESPACE=secret-ns
1214
fi
15+
if [ "$3" == "--import" ]; then
16+
IMPORT_TYPE=import
17+
elif [ "$3" == "--placeholder" ]; then
18+
IMPORT_TYPE=placeholder
19+
fi
1320
if [ "$SECRET_NAME" = "" ]; then
1421
echo "SECRET_NAME required"
1522
exit 2
@@ -18,9 +25,8 @@ if [ "$NAMESPACE" = "" ]; then
1825
echo "NAMESPACE required"
1926
exit 2
2027
fi
21-
22-
FILE="$(mktemp).yml"
23-
cat >$FILE <<EOF
28+
if [ "$IMPORT_TYPE" == "import" ]; then
29+
kubectl apply -f - <<EOF
2430
apiVersion: secretgen.carvel.dev/v1alpha1
2531
kind: SecretImport
2632
metadata:
@@ -29,12 +35,23 @@ metadata:
2935
spec:
3036
fromNamespace: $FROM_NAMESPACE
3137
EOF
32-
echo "Create SecretImport $SECRET_NAME from $FROM_NAMESPACE to $NAMESPACE"
33-
if [ "$DEBUG" = "true" ]; then
34-
cat $FILE
38+
echo "Created SecretImport $SECRET_NAME from $FROM_NAMESPACE to $NAMESPACE"
39+
else
40+
kubectl apply -f - <<EOF
41+
apiVersion: v1
42+
kind: Secret
43+
metadata:
44+
name: $SECRET_NAME
45+
namespace: $NAMESPACE
46+
annotations:
47+
secretgen.carvel.dev/image-pull-secret: ""
48+
type: kubernetes.io/dockerconfigjson
49+
data:
50+
.dockerconfigjson: e30K
51+
EOF
52+
echo "Created Placeholder Secret $SECRET_NAME in $NAMESPACE"
3553
fi
36-
kubectl apply -f $FILE
37-
rm -f $FILE
54+
3855
if [ "$DEBUG" = "true" ]; then
3956
kubectl describe secret $SECRET_NAME --namespace $NAMESPACE
4057
fi

src/deploy/carvel/carvel-prepare-namespaces.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if ((PRESENT > 0)); then
3939
fi
4040
kubectl create serviceaccount "$SA" --namespace $NS
4141

42-
$SCDIR/carvel-add-registry-secret.sh scdf-metadata-default docker.io "$DOCKER_HUB_USERNAME" "$DOCKER_HUB_PASSWORD"
42+
$SCDIR/carvel-add-registry-secret.sh scdfmetadata docker.io "$DOCKER_HUB_USERNAME" "$DOCKER_HUB_PASSWORD"
4343
$SCDIR/carvel-add-registry-secret.sh reg-creds-dockerhub docker.io "$DOCKER_HUB_USERNAME" "$DOCKER_HUB_PASSWORD"
4444

4545

src/deploy/carvel/deploy-local-broker.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,15 @@ export BROKER
4747
yq ".scdf.binder.type=\"$BINDER_NAME\"" -i ./scdf-values.yml
4848

4949
if [ "$BROKER" = "rabbitmq" ]; then
50-
yq ".scdf.binder.rabbit.host=\"rabbitmq.rabbitmq\"" -i ./scdf-values.yml
50+
# RABBITMQ_HOST=$(kubectl get --namespace rabbitmq services rabbitmq | grep -F rabbitmq | awk '{ print $3 }')
51+
RABBITMQ_HOST="rabbitmq.rabbitmq"
52+
yq ".scdf.binder.rabbit.host=\"$RABBITMQ_HOST\"" -i ./scdf-values.yml
5153
yq ".scdf.binder.rabbit.port=5672" -i ./scdf-values.yml
5254
else
55+
# KAFKA_HOST=$(kubectl get --namespace kafka services kafka | grep -F kafka | awk '{ print $3 }')
56+
KAFKA_HOST="kafka.kafka"
5357
yq ".scdf.binder.type=\"kafka\"" -i ./scdf-values.yml
54-
yq ".scdf.binder.kafka.broker.host=\"kafka-broker.kafka\"" -i ./scdf-values.yml
58+
yq ".scdf.binder.kafka.broker.host=\"$KAFKA_HOST\"" -i ./scdf-values.yml
5559
yq ".scdf.binder.kafka.zk.host=\"kafka-zk.kafka\"" -i ./scdf-values.yml
5660
fi
5761
end_time=$(date +%s)

src/deploy/carvel/deploy-local-database.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ set -e
3737
kubectl rollout status deployment --namespace "$DATABASE" $DATABASE
3838
set +e
3939

40+
JDBC_URL="jdbc:$DATABASE://$DATABASE.$DATABASE/dataflow"
41+
"$SCDIR/configure-database.sh" dataflow $DATABASE "$JDBC_URL" $DATABASE database-username database-password
42+
"$SCDIR/configure-database.sh" skipper $DATABASE "$JDBC_URL" $DATABASE database-username database-password
43+
export DATABASE
44+
echo "Deployed $DATABASE. Host:$DATABASE.$DATABASE"
4045
FILE="$(mktemp).yml"
4146
cat >$FILE <<EOF
4247
apiVersion: secretgen.carvel.dev/v1alpha1
@@ -52,13 +57,7 @@ if [ "$DEBUG" = "true" ]; then
5257
cat $FILE
5358
fi
5459
kubectl apply -f $FILE
55-
56-
JDBC_URL="jdbc:$DATABASE://$DATABASE.$DATABASE/dataflow"
57-
$SCDIR/configure-database.sh dataflow $DATABASE "$JDBC_URL" $DATABASE database-username database-password
58-
$SCDIR/configure-database.sh skipper $DATABASE "$JDBC_URL" $DATABASE database-username database-password
59-
"$SCDIR/carvel-import-secret.sh" "$DATABASE" "$NS" "$DATABASE"
60-
export DATABASE
61-
echo "Deployed $DATABASE. Host:$DATABASE.$DATABASE"
60+
"$SCDIR/carvel-import-secret.sh" "$DATABASE" "$NS" "$DATABASE" --import
6261
end_time=$(date +%s)
6362
elapsed=$((end_time - start_time))
6463
echo -e "Deployed $DATABASE in ${bold}$elapsed${end} seconds"

src/deploy/carvel/deploy-scdf.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ if [ "$SKIPPER_VERSION" != "" ]; then
6161
yq ".scdf.skipper.image.tag=\"$SKIPPER_VERSION\"" -i ./scdf-values.yml
6262
echo "Overriding Skipper version=$SKIPPER_VERSION"
6363
fi
64+
65+
"$SCDIR/carvel-import-secret.sh" "scdfmetadata" "$NS"
66+
"$SCDIR/carvel-import-secret.sh" "reg-creds-dockerhub" "$NS"
67+
68+
if [ "$SCDF_TYPE" = "pro" ]; then
69+
"$SCDIR/carvel-import-secret.sh" "reg-creds-dev-registry" "$NS"
70+
fi
6471
set +e
6572
$SCDIR/carvel-deploy-package.sh $APP_NAME $PACKAGE_NAME $PACKAGE_VERSION "./scdf-values.yml" "$NS"
6673
end_time=$(date +%s)

src/deploy/carvel/prepare-cluster.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
bold="\033[1m"
33
dim="\033[2m"
44
end="\033[0m"
5-
CERT_MANAGER_VERSION=v1.11.2
6-
SECRETGEN_CONTROLLER_VERSION=v0.14.3
7-
KAPP_CONTROLLER_VERSION=v0.45.1
5+
CERT_MANAGER_VERSION=v1.14.2
6+
SECRETGEN_CONTROLLER_VERSION=v0.17.0
7+
KAPP_CONTROLLER_VERSION=v0.50.0
88
start_time=$(date +%s)
99
echo "Deploying cert-manager $CERT_MANAGER_VERSION"
1010
kapp deploy --yes --wait --wait-check-interval 10s --app cert-manager \

src/deploy/carvel/prepare-local-namespace.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $SCDIR/add-roles.sh "system:aggregate-to-edit" "system:aggregate-to-admin" "syst
3636

3737
kubectl create serviceaccount "$SA" --namespace $NS
3838

39-
$SCDIR/add-local-registry-secret.sh scdf-metadata-default docker.io "$DOCKER_HUB_USERNAME" "$DOCKER_HUB_PASSWORD"
39+
$SCDIR/add-local-registry-secret.sh scdfmetadata docker.io "$DOCKER_HUB_USERNAME" "$DOCKER_HUB_PASSWORD"
4040
$SCDIR/add-local-registry-secret.sh reg-creds-dockerhub docker.io "$DOCKER_HUB_USERNAME" "$DOCKER_HUB_PASSWORD"
4141

4242

src/deploy/carvel/scdf-oss-values.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,6 @@ scdf:
1111
value: "true"
1212
- name: SPRING_CLOUD_DATAFLOW_FEATURES_SCHEDULES_ENABLED
1313
value: "true"
14-
skipper:
15-
config:
16-
spring:
17-
cloud:
18-
skipper:
19-
server:
20-
platform:
21-
kubernetes:
22-
accounts:
23-
default:
24-
environmentVariables: 'LANG=en_US.utf8,LC_ALL=en_US.utf8,JDK_JAVA_OPTIONS=-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8'
2514
registry:
2615
secret:
2716
ref: "reg-creds-dockerhub"

0 commit comments

Comments
 (0)