Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QDR Auth in smoketest #525

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ spec:
strategy: ephemeral
transports:
qdr:
auth: none
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an equivalent change pending in stf-v-c MR#103

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳++

enabled: true
deploymentSize: 1
web:
Expand Down
2 changes: 1 addition & 1 deletion tests/smoketest/collectd-sensubility.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ worker_count=2
checks={"check-container-health":{"command":"cat /healthcheck.log","handlers":[],"interval":3,"occurrences":3,"refresh":90,"standalone":true}}

[amqp1]
connection=amqp://default-interconnect.<<NAMESPACE>>.svc:5671
connection=amqp://qdr-test:5672
results_channel=sensubility/cloud1-telemetry
client_name=smoketest.redhat.com
results_format=smartgateway
Expand Down
4 changes: 2 additions & 2 deletions tests/smoketest/minimal-collectd.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ LoadPlugin cpu
LoadPlugin amqp1
<Plugin "amqp1">
<Transport "name">
Host "default-interconnect"
Port "5671"
Host "qdr-test"
Port "5672"
Address "collectd"
<Instance "cloud1-telemetry">
Format JSON
Expand Down
66 changes: 66 additions & 0 deletions tests/smoketest/qdr-test.conf.yaml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: qdr-test-config
data:
qdrouterd.conf: |
router {
mode: edge
id: qdr-test.smoketest
workerThreads: 2
saslConfigDir: /etc/sasl2
saslConfigName: qdrouterd
}

sslProfile {
name: sslProfile
caCertFile: /etc/pki/tls/certs/ca.crt
}

listener {
host: 0.0.0.0
port: 5672
authenticatePeer: false
saslMechanisms: ANONYMOUS
}

connector {
host: default-interconnect
port: 5671
role: edge
saslPassword: pass:<<AMQP_PASS>>
saslUsername: guest@default-interconnect
sslProfile: sslProfile
verifyHostname: false
}

address {
prefix: unicast
distribution: closest
}

address {
prefix: exclusive
distribution: closest
}

address {
prefix: broadcast
distribution: multicast
}

address {
distribution: multicast
prefix: collectd
}

address {
distribution: multicast
prefix: anycast/ceilometer
}

log {
module: DEFAULT
enable: info+
includeTimestamp: true
}
52 changes: 52 additions & 0 deletions tests/smoketest/qdr-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: v1
kind: Pod
metadata:
annotations:
openshift.io/scc: restricted-v2
name: qdr-test
labels:
qdr: qdr-test
spec:
containers:
- name: qdr
image: quay.io/tripleowallabycentos9/openstack-qdrouterd:current-tripleo
imagePullPolicy: IfNotPresent
command: ['/usr/sbin/qdrouterd','-c','/etc/qpid-dispatch/qdrouterd.conf']
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
ports:
- containerPort: 5672
name: amqp
protocol: TCP
volumeMounts:
- mountPath: /etc/pki/tls/certs/
name: default-interconnect-selfsigned-cert
- mountPath: /etc/qpid-dispatch/
name: qdr-test-config
resources: {}
volumes:
- name: default-interconnect-selfsigned-cert
secret:
defaultMode: 420
secretName: default-interconnect-selfsigned
- name: qdr-test-config
configMap:
defaultMode: 420
name: qdr-test-config

---

apiVersion: v1
kind: Service
metadata:
name: qdr-test
spec:
ports:
- name: amqp
port: 5672
targetPort: amqp
selector:
qdr: qdr-test
20 changes: 9 additions & 11 deletions tests/smoketest/smoketest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ if [ "${OC_CLIENT_VERSION_Y}" -lt "${OC_CLIENT_VERSION_Y_REQUIRED}" ] || [ "${OC
exit 1
fi

if [ "$(oc get stf default -o=jsonpath='{.spec.transports.qdr.auth}')" != "none" ]; then
echo "*** QDR authentication is currently not supported in smoketests."
echo "To disable it, use: oc patch stf default --patch '{\"spec\":{\"transports\":{\"qdr\":{\"auth\":\"none\"}}}}' --type=merge"
echo "For more info: https://github.com/infrawatch/service-telemetry-operator/pull/492"
exit 1
fi

CLEANUP=${CLEANUP:-true}
SMOKETEST_VERBOSE=${SMOKETEST_VERBOSE:-true}

Expand All @@ -57,18 +50,23 @@ ELASTICSEARCH_AUTH_PASS=$(oc get secret elasticsearch-es-elastic-user -ogo-templ
echo "*** [INFO] Getting Prometheus authentication password"
PROMETHEUS_AUTH_PASS=$(oc get secret default-prometheus-htpasswd -ogo-template='{{ .data.password | base64decode }}')

echo "*** [INFO] Setting namepsace for collectd-sensubility config"
sed "s/<<NAMESPACE>>/${OCP_PROJECT}/g" "${REL}/collectd-sensubility.conf" > /tmp/collectd-sensubility.conf

echo "*** [INFO] Creating configmaps..."
oc delete configmap/stf-smoketest-healthcheck-log configmap/stf-smoketest-collectd-config configmap/stf-smoketest-sensubility-config configmap/stf-smoketest-collectd-entrypoint-script configmap/stf-smoketest-ceilometer-publisher configmap/stf-smoketest-ceilometer-entrypoint-script job/stf-smoketest || true
oc create configmap stf-smoketest-healthcheck-log --from-file "${REL}/healthcheck.log"
oc create configmap stf-smoketest-collectd-config --from-file "${REL}/minimal-collectd.conf.template"
oc create configmap stf-smoketest-sensubility-config --from-file /tmp/collectd-sensubility.conf
oc create configmap stf-smoketest-sensubility-config --from-file "${REL}/collectd-sensubility.conf"
oc create configmap stf-smoketest-collectd-entrypoint-script --from-file "${REL}/smoketest_collectd_entrypoint.sh"
oc create configmap stf-smoketest-ceilometer-publisher --from-file "${REL}/ceilometer_publish.py"
oc create configmap stf-smoketest-ceilometer-entrypoint-script --from-file "${REL}/smoketest_ceilometer_entrypoint.sh"

echo "*** [INFO] Creating Mock OSP Metrics QDR router..."
oc delete pod qdr-test
oc delete service qdr-test
oc delete configmap qdr-test-config
AMQP_PASS=$(oc get secret default-interconnect-users -o json | jq -r .data.guest | base64 -d)
oc create -f <(sed -e "s/<<AMQP_PASS>>/${AMQP_PASS}/;" ./qdr-test.conf.yaml.template)
oc create -f qdr-test.yaml

echo "*** [INFO] Creating smoketest jobs..."
oc delete job -l app=stf-smoketest
for NAME in "${CLOUDNAMES[@]}"; do
Expand Down
6 changes: 3 additions & 3 deletions tests/smoketest/smoketest_ceilometer_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ POD=$(hostname)
echo "*** [INFO] My pod is: ${POD}"

# Run ceilometer_publisher script
python3 /ceilometer_publish.py default-interconnect:5671 'driver=amqp&topic=cloud1-metering' 'driver=amqp&topic=cloud1-event'
python3 /ceilometer_publish.py qdr-test:5672 'driver=amqp&topic=cloud1-metering' 'driver=amqp&topic=cloud1-event'

# Sleeping to produce data
echo "*** [INFO] Sleeping for 20 seconds to produce all metrics and events"
sleep 20
echo "*** [INFO] Sleeping for 30 seconds to produce all metrics and events"
sleep 30

echo "*** [INFO] List of metric names for debugging..."
curl -sk -u "internal:${PROMETHEUS_AUTH_PASS}" -g "${PROMETHEUS}/api/v1/label/__name__/values" 2>&2 | tee /tmp/label_names
Expand Down