-
Notifications
You must be signed in to change notification settings - Fork 13
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
Improve logging in dev scripts #1354
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ GITROOT="$(git rev-parse --show-toplevel)" | |
export GITROOT | ||
# shellcheck source=/dev/null | ||
source "${GITROOT}/dev/env/scripts/lib.sh" | ||
init | ||
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. this is already called beforehand |
||
|
||
apply_res() { | ||
local path="$1" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ GITROOT="$(git rev-parse --show-toplevel)" | |
export GITROOT | ||
# shellcheck source=/dev/null | ||
source "${GITROOT}/dev/env/scripts/lib.sh" | ||
init | ||
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. This is already called beforehand |
||
|
||
registry="quay.io" | ||
username="${QUAY_USER:-}" | ||
|
@@ -71,6 +70,7 @@ function print_auth() { | |
registry_auth="$(print_auth "$(mkauth "${username}" "${password}")")" | ||
|
||
if [[ "$INSTALL_OPERATOR" == "true" || "$RHACS_TARGETED_OPERATOR_UPGRADES" == "true" ]]; then | ||
log "Creating quay-ips image pull secret in namespace ${STACKROX_OPERATOR_NAMESPACE}" | ||
resOperatorImage=$( | ||
cat <<EOF | ||
apiVersion: v1 | ||
|
@@ -84,8 +84,11 @@ type: kubernetes.io/dockerconfigjson | |
EOF | ||
) | ||
echo "$resOperatorImage" | $KUBECTL -n "$STACKROX_OPERATOR_NAMESPACE" apply -f - | ||
else | ||
log "Skipping creating quay-ips image pull secret in namespace ${STACKROX_OPERATOR_NAMESPACE}" | ||
fi | ||
|
||
log "Creating quay-ips image pull secret in namespace ${ACSCS_NAMESPACE}" | ||
res=$( | ||
cat <<EOF | ||
apiVersion: v1 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,6 @@ source "${GITROOT}/dev/env/scripts/lib.sh" | |
# shellcheck source=/dev/null | ||
source "${GITROOT}/dev/env/scripts/docker.sh" | ||
|
||
init | ||
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. already called before by bootstrap.sh |
||
|
||
if [[ "$INSTALL_OLM" == "true" ]]; then | ||
if ! command -v operator-sdk >/dev/null 2>&1; then | ||
die "Error: Unable to install OLM, operator-sdk executable is not found" | ||
|
@@ -20,20 +18,25 @@ if [[ "$INSTALL_OLM" == "true" ]]; then | |
else | ||
log "OLM already installed..." | ||
fi | ||
else | ||
log "Skipping installation of OLM" | ||
fi | ||
|
||
log "Installing operator" | ||
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. Bad indentation |
||
|
||
apply "${MANIFESTS_DIR}"/rhacs-operator/*.yaml # This installs the operator-group. | ||
log "Installing operator" | ||
apply "${MANIFESTS_DIR}"/rhacs-operator/*.yaml # This installs the operator-group. | ||
|
||
if [[ "$OPERATOR_SOURCE" == "quay" ]]; then | ||
apply "${MANIFESTS_DIR}"/rhacs-operator/quay/01-catalogsource.yaml | ||
fi | ||
if [[ "$OPERATOR_SOURCE" == "quay" ]]; then | ||
apply "${MANIFESTS_DIR}"/rhacs-operator/quay/01-catalogsource.yaml | ||
else | ||
log "Skipping installation of RHACS Operator CatalogSource" | ||
fi | ||
|
||
# pragma: allowlist nextline secret | ||
if [[ "$OPERATOR_SOURCE" == "quay" && "$INHERIT_IMAGEPULLSECRETS" == "true" ]]; then | ||
inject_ips "$STACKROX_OPERATOR_NAMESPACE" "stackrox-operator-test-index" "quay-ips" | ||
fi | ||
# pragma: allowlist nextline secret | ||
if [[ "$OPERATOR_SOURCE" == "quay" && "$INHERIT_IMAGEPULLSECRETS" == "true" ]]; then | ||
inject_ips "$STACKROX_OPERATOR_NAMESPACE" "stackrox-operator-test-index" "quay-ips" | ||
else | ||
log "Skipping injection of ImagePullSecrets into ${STACKROX_OPERATOR_NAMESPACE}/stackrox-operator-test-index" | ||
fi | ||
|
||
if [[ "$OPERATOR_SOURCE" == "quay" ]]; then | ||
# Need to wait with the subscription creation until the catalog source has been updated, | ||
|
@@ -70,16 +73,24 @@ if [[ "$OPERATOR_SOURCE" == "quay" ]]; then | |
fi | ||
|
||
# This creates the subscription. | ||
log "Installing RHACS Operator Subscription" | ||
apply "${MANIFESTS_DIR}"/rhacs-operator/quay/*.yaml | ||
|
||
# Apparently we potentially have to wait longer than the default of 60s sometimes... | ||
wait_for_resource_to_appear "$STACKROX_OPERATOR_NAMESPACE" "serviceaccount" "rhacs-operator-controller-manager" 180 | ||
sleep 10 # Wait for ServiceAccount created by OLM to settle, otherwise the patching below might have no effect. | ||
|
||
inject_ips "$STACKROX_OPERATOR_NAMESPACE" "rhacs-operator-controller-manager" "quay-ips" | ||
# Possibly the imagePullSecrets were not picked up yet, which is why we respawn them: | ||
|
||
log "Restarting RHACS Operator pod to pick up imagePullSecrets" | ||
$KUBECTL -n "$STACKROX_OPERATOR_NAMESPACE" delete pod -l app=rhacs-operator | ||
|
||
elif [[ "$OPERATOR_SOURCE" == "marketplace" ]]; then | ||
log "Installing RHACS Operator from Marketplace" | ||
apply "${MANIFESTS_DIR}"/rhacs-operator/marketplace/*.yaml | ||
else | ||
log "Skipping installation of RHACS Operator" | ||
fi | ||
|
||
wait_for_container_to_become_ready "$STACKROX_OPERATOR_NAMESPACE" "app=rhacs-operator" "manager" 900 |
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 is already called by
bootstrap.sh