-
Notifications
You must be signed in to change notification settings - Fork 0
adds firehose job for vhost #154
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
Open
Sahil-STFC
wants to merge
1
commit into
main
Choose a base branch
from
#151-Add-firehose-to-vhost
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+171
−1
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
components/ua/message-broker/rmq-message-broker-chart/configure-rmq-cookie-permissions.sh
This file contains hidden or 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,19 @@ | ||
| #!/usr/bin/env sh | ||
|
|
||
| set -eu | ||
|
|
||
| SOURCE="/secret/.erlang.cookie" | ||
| TARGET="/var/lib/rabbitmq/.erlang.cookie" | ||
|
|
||
| echo "Copying Erlang cookie..." | ||
|
|
||
| if [ ! -f "$SOURCE" ]; then | ||
| echo "Error: $SOURCE does not exist" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cp "$SOURCE" "$TARGET" | ||
| chown 999:999 "$TARGET" | ||
| chmod 400 "$TARGET" | ||
|
|
||
| echo "Erlang cookie installed successfully." |
26 changes: 26 additions & 0 deletions
26
...ge-broker/rmq-message-broker-chart/templates/configure-rmq-cookie-permissions-config.yaml
This file contains hidden or 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,26 @@ | ||
| apiVersion: v1 | ||
| data: | ||
| configure-rmq-cookie-permissions.sh: |- | ||
| #!/usr/bin/env sh | ||
|
|
||
| set -eu | ||
|
|
||
| SOURCE="/secret/.erlang.cookie" | ||
| TARGET="/var/lib/rabbitmq/.erlang.cookie" | ||
|
|
||
| echo "Copying Erlang cookie..." | ||
|
|
||
| if [ ! -f "$SOURCE" ]; then | ||
| echo "Error: $SOURCE does not exist" | ||
| exit 1 | ||
| fi | ||
|
|
||
| cp "$SOURCE" "$TARGET" | ||
| chown 999:999 "$TARGET" | ||
| chmod 400 "$TARGET" | ||
|
|
||
| echo "Erlang cookie installed successfully." | ||
| kind: ConfigMap | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: configure-rmq-cookie-permissions-config |
17 changes: 17 additions & 0 deletions
17
components/ua/message-broker/rmq-message-broker-chart/templates/uex-init-job-config.yaml
This file contains hidden or 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,17 @@ | ||
| apiVersion: v1 | ||
| data: | ||
| uex-init-job.sh: "#!/bin/bash\nset -e\necho \"Checking RabbitMQ node status for | ||
| node : rabbit@rmq-message-broker-server-0.rmq-message-broker-nodes.apps\"\n\nMAX_RETRIES=\"${MAX_RETRIES:-10}\"\nSLEEP_SECONDS=\"${SLEEP_SECONDS:-10}\"\nRABBITMQ_STATUS=false\n\nfor | ||
| i in $(seq 1 \"$MAX_RETRIES\"); do\n if rabbitmqctl -n rabbit@rmq-message-broker-server-0.rmq-message-broker-nodes.apps | ||
| -l status > /dev/null 2>&1; then\n echo \"RabbitMQ is ready.\"\n RABBITMQ_STATUS=true\n | ||
| \ break\n fi\n\n echo \"[$i/$MAX_RETRIES] RabbitMQ not ready. Retrying in | ||
| ${SLEEP_SECONDS}s...\" \n\n # Don't sleep on the last attempt\n if [ \"$i\" | ||
| -lt \"$MAX_RETRIES\" ]; then\n sleep \"$SLEEP_SECONDS\"\n fi\ndone\n\nif [ | ||
| \"$RABBITMQ_STATUS\" != true ]; then\n echo \"RabbitMQ never became ready after | ||
| $((MAX_RETRIES * SLEEP_SECONDS)) seconds.\" \n exit 1\nfi\n\necho \"Enabling | ||
| message tracing...\"\nrabbitmqctl -n rabbit@rmq-message-broker-server-0.rmq-message-broker-nodes.apps | ||
| -l trace_on -p uex" | ||
| kind: ConfigMap | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: uex-init-job-config | ||
63 changes: 63 additions & 0 deletions
63
components/ua/message-broker/rmq-message-broker-chart/templates/uex-init-job.yaml
This file contains hidden or 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,63 @@ | ||
| apiVersion: batch/v1 | ||
| kind: Job | ||
| metadata: | ||
| name: uex-init-job | ||
| namespace: apps | ||
| spec: | ||
| backoffLimit: 3 | ||
| # ttlSecondsAfterFinished: 600 # seconds | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: uex-init-job | ||
| spec: | ||
| containers: | ||
| - name: uex-init-job | ||
| image: {{ $.Values.image }} | ||
| imagePullPolicy: IfNotPresent | ||
| env: | ||
| - name: MAX_RETRIES | ||
| value: "10" | ||
| - name: SLEEP_SECONDS | ||
| value: "5" | ||
| volumeMounts: | ||
| - name: scripts | ||
| mountPath: {{ $.Values.configMap.uex_init_job_config.scriptMountPath }} | ||
| subPath: {{ $.Values.configMap.uex_init_job_config.scriptKey }} | ||
| - name: rabbitmq-data | ||
| mountPath: /var/lib/rabbitmq | ||
| command: ["bash", {{ $.Values.configMap.uex_init_job_config.scriptMountPath }}] | ||
| restartPolicy: OnFailure | ||
|
|
||
| initContainers: | ||
| - name: setup-erlang-cookie | ||
| image: {{ $.Values.image }} | ||
| command: | ||
| - bash | ||
| - {{ $.Values.configMap.configure_rmq_cookie_permissions_config.scriptMountPath}} | ||
| volumeMounts: | ||
| - name: erlang-cookie | ||
| mountPath: /secret | ||
| - name: configure-cookie-script | ||
| mountPath: {{ $.Values.configMap.configure_rmq_cookie_permissions_config.scriptMountPath}} | ||
| subPath: {{ $.Values.configMap.configure_rmq_cookie_permissions_config.scriptKey}} | ||
| - name: rabbitmq-data | ||
| mountPath: /var/lib/rabbitmq | ||
| volumes: | ||
| - name: scripts | ||
| configMap: | ||
| name: {{ $.Values.configMap.uex_init_job_config.name }} | ||
| items: | ||
| - key: {{ $.Values.configMap.uex_init_job_config.scriptKey }} | ||
| path: {{ $.Values.configMap.uex_init_job_config.scriptKey }} | ||
| - name: configure-cookie-script | ||
| configMap: | ||
| name: {{ $.Values.configMap.configure_rmq_cookie_permissions_config.name }} | ||
| items: | ||
| - key: {{ $.Values.configMap.configure_rmq_cookie_permissions_config.scriptKey}} | ||
| path: {{ $.Values.configMap.configure_rmq_cookie_permissions_config.scriptKey}} | ||
| - name: erlang-cookie | ||
| secret: | ||
| secretName: {{ $.Values.erlang_cookie_secret }} | ||
| - name: rabbitmq-data | ||
| emptyDir: {} |
30 changes: 30 additions & 0 deletions
30
components/ua/message-broker/rmq-message-broker-chart/uex-init-job.sh
This file contains hidden or 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,30 @@ | ||||||||||||||||||||||||||||||||
| #!/bin/bash | ||||||||||||||||||||||||||||||||
| set -e | ||||||||||||||||||||||||||||||||
| echo "Checking RabbitMQ node status for node : rabbit@rmq-message-broker-server-0.rmq-message-broker-nodes.apps" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| MAX_RETRIES="${MAX_RETRIES:-10}" | ||||||||||||||||||||||||||||||||
| SLEEP_SECONDS="${SLEEP_SECONDS:-10}" | ||||||||||||||||||||||||||||||||
| RABBITMQ_STATUS=false | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| for i in $(seq 1 "$MAX_RETRIES"); do | ||||||||||||||||||||||||||||||||
| if rabbitmqctl -n rabbit@rmq-message-broker-server-0.rmq-message-broker-nodes.apps -l status > /dev/null 2>&1; then | ||||||||||||||||||||||||||||||||
| echo "RabbitMQ is ready." | ||||||||||||||||||||||||||||||||
| RABBITMQ_STATUS=true | ||||||||||||||||||||||||||||||||
| break | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| echo "[$i/$MAX_RETRIES] RabbitMQ not ready. Retrying in ${SLEEP_SECONDS}s..." | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| # Don't sleep on the last attempt | ||||||||||||||||||||||||||||||||
| if [ "$i" -lt "$MAX_RETRIES" ]; then | ||||||||||||||||||||||||||||||||
| sleep "$SLEEP_SECONDS" | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably not say it's retying in x if it isn't? Also maybe compare numerical vals directly. Try
Suggested change
|
||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| if [ "$RABBITMQ_STATUS" != true ]; then | ||||||||||||||||||||||||||||||||
| echo "RabbitMQ never became ready after $((MAX_RETRIES * SLEEP_SECONDS)) seconds." | ||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| echo "Enabling message tracing..." | ||||||||||||||||||||||||||||||||
| rabbitmqctl -n rabbit@rmq-message-broker-server-0.rmq-message-broker-nodes.apps -l trace_on -p uex | ||||||||||||||||||||||||||||||||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right, is
node:an element rather than part of the previous line? If you usedos2unixto remove the windows style CRLFs on the source file first,kubectlshould create a multiline configMap correctly like the one above this, it's much easier to check and understand then (but check the script updates below first)!