-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix the error that backendconfig doesn't work when no env specified (#…
…770) * Fix the error that backendconfig doesn't work when no env specified * fix ci * fix ci
- Loading branch information
1 parent
56e5bad
commit d7b77a5
Showing
33 changed files
with
575 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: compute.functionmesh.io/v1alpha1 | ||
kind: BackendConfig | ||
metadata: | ||
name: global-backend-config | ||
spec: | ||
autoUpdate: true | ||
pod: | ||
liveness: | ||
initialDelaySeconds: 10 | ||
periodSeconds: 30 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
.../integration-oauth2/cases/global-and-namespaced-config-without-auto-update/manifests.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
apiVersion: compute.functionmesh.io/v1alpha1 | ||
kind: Source | ||
metadata: | ||
name: test-datagen-source | ||
spec: | ||
className: org.apache.pulsar.io.datagenerator.DataGeneratorSource | ||
clusterName: test-pulsar | ||
forwardSourceMessageProperty: true | ||
image: docker.io/streamnative/pulsar-io-data-generator:3.2.2.1 | ||
java: | ||
extraDependenciesDir: /pulsar/lib | ||
jar: connectors/pulsar-io-data-generator-3.2.2.1.nar | ||
minReplicas: 1 | ||
name: test-datagen-source | ||
namespace: default | ||
output: | ||
producerConf: {} | ||
topic: public/default/test-datagen-source | ||
typeClassName: org.apache.pulsar.io.datagenerator.Person | ||
processingGuarantee: atleast_once | ||
pulsar: | ||
authConfig: | ||
oauth2Config: | ||
audience: urn:sn:pulsar:sndev:test | ||
issuerUrl: https://auth.sncloud-stg.dev/ | ||
keySecretName: sn-platform-oauth2-private-key | ||
keySecretKey: auth.json | ||
pulsarConfig: test-source | ||
replicas: 1 | ||
resources: | ||
limits: | ||
cpu: "0.2" | ||
memory: 1.1G | ||
requests: | ||
cpu: "0.1" | ||
memory: 1G | ||
sourceConfig: | ||
sleepBetweenMessages: "5000" | ||
tenant: public | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test-source | ||
data: | ||
webServiceURL: http://sn-platform-pulsar-broker.default.svc.cluster.local:8080 | ||
brokerServiceURL: pulsar://sn-platform-pulsar-broker.default.svc.cluster.local:6650 |
14 changes: 14 additions & 0 deletions
14
...ntegration-oauth2/cases/global-and-namespaced-config-without-auto-update/mesh-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: compute.functionmesh.io/v1alpha1 | ||
kind: BackendConfig | ||
metadata: | ||
name: backend-config | ||
namespace: default | ||
spec: | ||
env: | ||
namespaced1: namespacedvalue1 | ||
shared1: fromnamespace | ||
podenv: backendconfigvalue | ||
pod: | ||
liveness: | ||
initialDelaySeconds: 30 | ||
periodSeconds: 10 |
167 changes: 167 additions & 0 deletions
167
...tests/integration-oauth2/cases/global-and-namespaced-config-without-auto-update/verify.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
set -e | ||
|
||
E2E_DIR=$(dirname "$0") | ||
BASE_DIR=$(cd "${E2E_DIR}"/../../../../..;pwd) | ||
PULSAR_NAMESPACE=${PULSAR_NAMESPACE:-"default"} | ||
PULSAR_RELEASE_NAME=${PULSAR_RELEASE_NAME:-"sn-platform"} | ||
E2E_KUBECONFIG=${E2E_KUBECONFIG:-"/tmp/e2e-k8s.config"} | ||
|
||
source "${BASE_DIR}"/.ci/helm.sh | ||
|
||
if [ ! "$KUBECONFIG" ]; then | ||
export KUBECONFIG=${E2E_KUBECONFIG} | ||
fi | ||
|
||
manifests_file="${BASE_DIR}"/.ci/tests/integration-oauth2/cases/global-and-namespaced-config-without-auto-update/manifests.yaml | ||
mesh_config_file="${BASE_DIR}"/.ci/tests/integration-oauth2/cases/global-and-namespaced-config-without-auto-update/mesh-config.yaml | ||
global_mesh_config_file="${BASE_DIR}"/.ci/clusters/global_backend_config.yaml | ||
|
||
kubectl apply -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl apply -f "${manifests_file}" > /dev/null 2>&1 | ||
|
||
verify_fm_result=$(ci::verify_function_mesh test-datagen-source 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_fm_result" | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" global1 global1=globalvalue1 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" namespaced1 namespaced1=namespacedvalue1 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
# if global and namespaced config has same key, the value from namespace should be used | ||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" shared1 shared1=fromnamespace 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
# verify liveness config | ||
verify_liveness_result=$(ci::verify_liveness_probe test-datagen-source-source-0 '{"failureThreshold":3,"httpGet":{"path":"/","port":9094,"scheme":"HTTP"},"initialDelaySeconds":30,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}' 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_liveness_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
# update the namespaced config, it should not trigger the reconcile since the autoUpdate is false | ||
kubectl patch BackendConfig backend-config --type='json' -p='[{"op": "replace", "path": "/spec/env/shared1", "value": "newvalue"}]' > /dev/null 2>&1 | ||
sleep 30 | ||
|
||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" shared1 shared1=fromnamespace 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
# delete the namespaced config, the source should not be reconciled since the autoUpdate is false | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
sleep 30 | ||
|
||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" namespaced1 namespaced1=namespacedvalue1 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" shared1 shared1=fromnamespace 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_liveness_result=$(ci::verify_liveness_probe test-datagen-source-source-0 '{"failureThreshold":3,"httpGet":{"path":"/","port":9094,"scheme":"HTTP"},"initialDelaySeconds":30,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":10}' 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_liveness_result" | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
# delete the global config, the source should be reconciled since the autoUpdate is true in the global config | ||
kubectl delete -f "${global_mesh_config_file}" -n $FUNCTION_MESH_NAMESPACE > /dev/null 2>&1 || true | ||
sleep 30 | ||
|
||
verify_fm_result=$(ci::verify_function_mesh test-datagen-source 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_fm_result" | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" global1 "" 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" namespaced1 "" 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_env_result=$(ci::verify_env "test-datagen-source-source-0" shared1 "" 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_env_result" | ||
kubectl delete -f "${mesh_config_file}" > /dev/null 2>&1 | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
# it should use liveness config from namespaced config | ||
verify_liveness_result=$(ci::verify_liveness_probe test-datagen-source-source-0 "" 2>&1) | ||
if [ $? -eq 0 ]; then | ||
echo "e2e-test: ok" | yq eval - | ||
else | ||
echo "$verify_liveness_result" | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true |
50 changes: 50 additions & 0 deletions
50
.ci/tests/integration-oauth2/cases/global-and-namespaced-config/manifests.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
apiVersion: compute.functionmesh.io/v1alpha1 | ||
kind: Sink | ||
metadata: | ||
name: test-datagen-sink | ||
spec: | ||
autoAck: true | ||
className: org.apache.pulsar.io.datagenerator.DataGeneratorPrintSink | ||
clusterName: test-pulsar | ||
image: docker.io/streamnative/pulsar-io-data-generator:3.2.2.1 | ||
input: | ||
sourceSpecs: | ||
public/default/datagen: | ||
receiverQueueSize: 1000 | ||
topics: | ||
- public/default/datagen | ||
typeClassName: org.apache.pulsar.io.datagenerator.Person | ||
java: | ||
extraDependenciesDir: /pulsar/lib | ||
jar: connectors/pulsar-io-data-generator-3.2.2.1.nar | ||
minReplicas: 1 | ||
namespace: default | ||
processingGuarantee: atleast_once | ||
sinkConfig: {} | ||
pulsar: | ||
authConfig: | ||
oauth2Config: | ||
audience: urn:sn:pulsar:sndev:test | ||
issuerUrl: https://auth.sncloud-stg.dev/ | ||
keySecretName: sn-platform-oauth2-private-key | ||
keySecretKey: auth.json | ||
pulsarConfig: test-sink | ||
replicas: 1 | ||
resources: | ||
limits: | ||
cpu: "0.2" | ||
memory: 1.1G | ||
requests: | ||
cpu: "0.1" | ||
memory: 1G | ||
subscriptionName: mysub | ||
subscriptionPosition: latest | ||
tenant: public | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test-sink | ||
data: | ||
webServiceURL: http://sn-platform-pulsar-broker.default.svc.cluster.local:8080 | ||
brokerServiceURL: pulsar://sn-platform-pulsar-broker.default.svc.cluster.local:6650 |
11 changes: 11 additions & 0 deletions
11
.ci/tests/integration-oauth2/cases/global-and-namespaced-config/mesh-config-kube-system.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: compute.functionmesh.io/v1alpha1 | ||
kind: BackendConfig | ||
metadata: | ||
name: backend-config | ||
namespace: kube-system | ||
spec: | ||
autoUpdate: true | ||
pod: | ||
liveness: | ||
initialDelaySeconds: 50 | ||
periodSeconds: 60 |
11 changes: 11 additions & 0 deletions
11
.ci/tests/integration-oauth2/cases/global-and-namespaced-config/mesh-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: compute.functionmesh.io/v1alpha1 | ||
kind: BackendConfig | ||
metadata: | ||
name: backend-config | ||
namespace: default | ||
spec: | ||
autoUpdate: true | ||
pod: | ||
liveness: | ||
initialDelaySeconds: 30 | ||
periodSeconds: 10 |
Oops, something went wrong.