-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix log path when using custom java log yaml config * fix ci * Update * fix ci
- Loading branch information
1 parent
3bf6d79
commit b7d924a
Showing
4 changed files
with
191 additions
and
3 deletions.
There are no files selected for viewing
130 changes: 130 additions & 0 deletions
130
.ci/tests/integration-oauth2/cases/java-log-config-yaml/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,130 @@ | ||
apiVersion: compute.functionmesh.io/v1alpha1 | ||
kind: Function | ||
metadata: | ||
name: java-log-config-yaml | ||
namespace: default | ||
spec: | ||
image: streamnative/pulsar-functions-java-sample:3.2.2.1 | ||
className: org.apache.pulsar.functions.api.examples.ExclamationFunction | ||
forwardSourceMessageProperty: true | ||
maxPendingAsyncRequests: 1000 | ||
replicas: 1 | ||
maxReplicas: 5 | ||
logTopic: persistent://public/default/logging-function-logs | ||
input: | ||
topics: | ||
- persistent://public/default/input-java-log-config-yaml-topic | ||
typeClassName: java.lang.String | ||
output: | ||
topic: persistent://public/default/output-java-log-config-yaml-topic | ||
typeClassName: java.lang.String | ||
resources: | ||
requests: | ||
cpu: 50m | ||
memory: 1G | ||
limits: | ||
cpu: "0.2" | ||
memory: 1.1G | ||
# each secret will be loaded ad an env variable from the `path` secret with the `key` in that secret in the name of `name` | ||
secretsMap: | ||
"name": | ||
path: "test-secret" | ||
key: "username" | ||
"pwd": | ||
path: "test-secret" | ||
key: "password" | ||
pulsar: | ||
pulsarConfig: "test-pulsar" | ||
tlsConfig: | ||
enabled: false | ||
allowInsecure: false | ||
hostnameVerification: true | ||
certSecretName: sn-platform-tls-broker | ||
certSecretKey: "" | ||
authConfig: | ||
oauth2Config: | ||
audience: urn:sn:pulsar:sndev:test | ||
issuerUrl: https://auth.sncloud-stg.dev/ | ||
keySecretName: sn-platform-oauth2-private-key | ||
keySecretKey: auth.json | ||
java: | ||
log: | ||
javaLog4JConfigFileType: yaml | ||
logConfig: | ||
name: "java-log-config-cm" | ||
key: "log.yaml" | ||
jar: /pulsar/examples/api-examples.jar | ||
# to be delete & use admission hook | ||
clusterName: test | ||
autoAck: true | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: test-pulsar | ||
data: | ||
webServiceURL: http://sn-platform-pulsar-broker.default.svc.cluster.local:8080 | ||
brokerServiceURL: pulsar://sn-platform-pulsar-broker.default.svc.cluster.local:6650 | ||
--- | ||
apiVersion: v1 | ||
data: | ||
username: YWRtaW4= | ||
password: MWYyZDFlMmU2N2Rm | ||
kind: Secret | ||
metadata: | ||
name: test-secret | ||
type: Opaque | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: java-log-config-cm | ||
data: | ||
log.yaml: | | ||
Configuration: | ||
name: pulsar-functions-kubernetes-instance | ||
monitorInterval: 30 | ||
Properties: | ||
Property: | ||
- name: pulsar.log.level | ||
value: DEBUG | ||
- name: bk.log.level | ||
value: DEBUG | ||
Appenders: | ||
Console: | ||
name: Console | ||
target: SYSTEM_OUT | ||
PatternLayout: | ||
Pattern: "%d{ISO8601_OFFSET_DATE_TIME_HHMM} [%t] %-5level %logger{36} - %msg%n" | ||
RollingRandomAccessFile: | ||
name: RollingRandomAccessFile | ||
fileName: "${sys:pulsar.function.log.dir}/${sys:pulsar.function.log.file}.log" | ||
filePattern: "${sys:pulsar.function.log.dir}/${sys:pulsar.function.log.file}.%d{yyyy-MM-dd}-%i.log.gz" | ||
PatternLayout: | ||
Pattern: "%d{yyyy-MMM-dd HH:mm:ss a} [%t] %-5level %logger{36} - %msg%n" | ||
Policies: | ||
SizeBasedTriggeringPolicy: | ||
size: "10MB" | ||
DefaultRolloverStrategy: | ||
max: 5 | ||
Loggers: | ||
Root: | ||
level: "${sys:pulsar.log.level}" | ||
AppenderRef: | ||
- ref: Console | ||
level: "${sys:pulsar.log.level}" | ||
- ref: RollingRandomAccessFile | ||
Logger: | ||
name: org.apache.pulsar.functions.runtime.shaded.org.apache.bookkeeper | ||
level: "${sys:bk.log.level}" | ||
additivity: false | ||
AppenderRef: | ||
- ref: Console | ||
- ref: RollingRandomAccessFile |
59 changes: 59 additions & 0 deletions
59
.ci/tests/integration-oauth2/cases/java-log-config-yaml/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,59 @@ | ||
#!/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/java-log-config-yaml/manifests.yaml | ||
|
||
kubectl apply -f "${manifests_file}" > /dev/null 2>&1 | ||
|
||
verify_fm_result=$(ci::verify_function_mesh java-log-config-yaml 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_fm_result" | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_java_result=$(NAMESPACE=${PULSAR_NAMESPACE} CLUSTER=${PULSAR_RELEASE_NAME} ci::verify_exclamation_function_with_auth "persistent://public/default/input-java-log-config-yaml-topic" "persistent://public/default/output-java-log-config-yaml-topic" "test-message" "test-message!" 10 2>&1) | ||
if [ $? -ne 0 ]; then | ||
echo "$verify_java_result" | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true | ||
exit 1 | ||
fi | ||
|
||
verify_log_config_result=$(kubectl logs -l compute.functionmesh.io/name=java-log-config-yaml --tail=-1 | grep "Got result: object:" 2>&1) | ||
if [ $? -eq 0 ]; then | ||
echo "e2e-test: ok" | yq eval - | ||
else | ||
echo "$verify_log_config_result" | ||
fi | ||
kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true |
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