generated from terraform-ibm-modules/terraform-ibm-module-template
-
Notifications
You must be signed in to change notification settings - Fork 15
feat: toggle ocp console patch #588
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
ee33ea0
feat: configure ocp console patch
imprateeksh e71e282
fix: passed kubeconfig info as env
imprateeksh 40fbcd7
Merge branch 'main' into disable-ocp-console
imprateeksh 1be3595
refactor: reverted basic example change
imprateeksh 3a231eb
fix: updated script and addressed review changes
imprateeksh a7bd552
fix: addressed review changes
imprateeksh 6dcb5b1
fix: modified fscloud example
imprateeksh 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
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
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
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
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
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
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
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,77 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
|
|
||
| PATCH_APPLY="oc patch consoles.operator.openshift.io cluster --patch '{\"spec\":{\"managementState\":\"Managed\"}}' --type=merge" | ||
| PATCH_REMOVE="oc patch consoles.operator.openshift.io cluster --patch '{\"spec\":{\"managementState\":\"Removed\"}}' --type=merge" | ||
| MAX_ATTEMPTS=10 | ||
| RETRY_WAIT=5 | ||
|
|
||
| function check_oc_cli() { | ||
| if ! command -v oc &> /dev/null; then | ||
| echo "Error: OpenShift CLI (oc) is not installed. Exiting." | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| function apply_oc_patch() { | ||
|
|
||
| local attempt=0 | ||
| while [ $attempt -lt $MAX_ATTEMPTS ]; do | ||
| echo "Attempt $((attempt+1)) of $MAX_ATTEMPTS: Applying OpenShift Console patch..." | ||
|
|
||
| if eval "$PATCH_APPLY"; then | ||
| echo "Patch applied successfully." | ||
| return 0 | ||
| else | ||
| echo "Failed to apply patch. Retrying in ${RETRY_WAIT}s..." | ||
| sleep $RETRY_WAIT | ||
| ((attempt++)) | ||
| RETRY_WAIT=$((RETRY_WAIT * 2)) | ||
| fi | ||
| done | ||
|
|
||
| echo "Maximum retry attempts reached. Could not apply patch." | ||
| exit 1 | ||
| } | ||
|
|
||
| function remove_oc_patch() { | ||
|
|
||
| local attempt=0 | ||
| while [ $attempt -lt $MAX_ATTEMPTS ]; do | ||
| echo "Attempt $((attempt+1)) of $MAX_ATTEMPTS: Removing OpenShift Console patch..." | ||
|
|
||
| if eval "$PATCH_REMOVE"; then | ||
| echo "Patch removed successfully." | ||
| return 0 | ||
| else | ||
| echo "Failed to remove patch. Retrying in ${RETRY_WAIT}s..." | ||
| sleep $RETRY_WAIT | ||
| ((attempt++)) | ||
| RETRY_WAIT=$((RETRY_WAIT * 2)) | ||
| fi | ||
| done | ||
|
|
||
| echo "Maximum retry attempts reached. Could not remove patch." | ||
| exit 1 | ||
| } | ||
|
|
||
| echo "=========================================" | ||
|
|
||
| if [[ -z "${ENABLE_OCP_CONSOLE}" ]]; then | ||
| echo "ENABLE_OCP_CONSOLE must be set" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| check_oc_cli | ||
|
|
||
| if [ "${ENABLE_OCP_CONSOLE}" == "true" ]; then | ||
imprateeksh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "Enabling the OpenShift Console" | ||
| apply_oc_patch | ||
| else | ||
| echo "Disabling the OpenShift Console" | ||
| remove_oc_patch | ||
| fi | ||
|
|
||
| echo "=========================================" | ||
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.
Uh oh!
There was an error while loading. Please reload this page.