SHARE
TWEET

Untitled

a guest May 24th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/operator-installer/migrate_1.1_to_1.2.sh b/operator-installer/migrate_1.1_to_1.2.sh
  2. index 8859617..11f3df6 100755
  3. --- a/operator-installer/migrate_1.1_to_1.2.sh
  4. +++ b/operator-installer/migrate_1.1_to_1.2.sh
  5. @@ -82,7 +82,8 @@ if [[ $status == *"error"* ]]; then
  6.         echo "$status" && exit 1
  7.  fi
  8.  
  9. -POSTGRESQL_PASSWORD=$(oc get deployment postgres -o=jsonpath={'.spec.template.spec.containers[0].env[?(@.name=="POSTGRESQL_PASSWORD")].value'} -n=$OPENSHIFT_PROJECT)
  10. +# POSTGRESQL_PASSWORD=$(oc get deployment postgres -o=jsonpath={'.spec.template.spec.containers[0].env[?(@.name=="POSTGRESQL_PASSWORD")].value'} -n=$OPENSHIFT_PROJECT)
  11. +POSTGRESQL_PASSWORD=$(oc get deployment keycloak -o=jsonpath={'.spec.template.spec.containers[0].env[?(@.name=="DB_PASSWORD")].value'} -n=$OPENSHIFT_PROJECT)
  12.  SSO_ADMIN_USERNAME=$(oc get deployment keycloak -o=jsonpath={'.spec.template.spec.containers[0].env[?(@.name=="SSO_ADMIN_USERNAME")].value'} -n=$OPENSHIFT_PROJECT)
  13.  SSO_ADMIN_PASSWORD=$(oc get deployment keycloak -o=jsonpath={'.spec.template.spec.containers[0].env[?(@.name=="SSO_ADMIN_PASSWORD")].value'} -n=$OPENSHIFT_PROJECT)
  14.  SECRET=$(oc get oauthclient/openshift-identity-provider-h2fh -o=jsonpath={'.secret'})
  15. @@ -124,13 +125,48 @@ fi
  16.  
  17.  # update to latest defaults. Note that if using quay.io, operator is imply operator-rhel8; if using RHCC, it's server-operator-rhel8
  18.  if [[ ${REGISTRY_PREFIX} == "quay.io/crw" ]]; then OPERATOR_CONTAINER="operator-rhel8"; else OPERATOR_CONTAINER="server-operator-rhel8"; fi
  19. +
  20. +PATCH_JSON=$(cat << EOF
  21. +{
  22. +  "spec": {
  23. +    "database": {
  24. +      "postgresImage": "registry.redhat.io/rhscl/postgresql-96-rhel7:1-40"
  25. +    },
  26. +    "auth": {
  27. +      "identityProviderPostgresPassword": "${REGISTRY_PREFIX}",
  28. +      "identityProviderImage": "registry.redhat.io/redhat-sso-7/sso73-openshift:1.0-11",
  29. +      "identityProviderPostgresPassword":"${POSTGRESQL_PASSWORD}"
  30. +    },
  31. +    "server": {
  32. +      "cheImage":"${REGISTRY_PREFIX}/server-rhel8",
  33. +      "cheImageTag":"1.2"
  34. +    }
  35. +  }
  36. +}
  37. +EOF
  38. +)
  39. +
  40. +echo "[INFO] Patching checluster CR with:"
  41. +echo ${PATCH_JSON}
  42. +echo "[INFO] Current checluster CR:"
  43. +oc get checluster codeready -o json
  44. +echo "[INFO] before patch ============"
  45. +oc patch checluster codeready -p "${PATCH_JSON}" --type merge -n ${OPENSHIFT_PROJECT}
  46. +echo $?
  47. +
  48. +echo "[INFO] Newly patched checluster CR:"
  49. +oc get checluster codeready -o json
  50. +
  51.  oc set image deployment/codeready-operator *=${REGISTRY_PREFIX}/${OPERATOR_CONTAINER}:1.2 -n $OPENSHIFT_PROJECT
  52.  echo "[INFO] Wait 30 seconds to complete rolling update..."; sleep 30s
  53.  
  54. -oc patch checluster/codeready -p '{"spec":{"server":{"cheImage":"'${REGISTRY_PREFIX}'/server-rhel8"}}}' --type merge -n $OPENSHIFT_PROJECT
  55. -oc patch checluster/codeready -p '{"spec":{"server":{"cheImageTag":"1.2"}}}' --type merge -n $OPENSHIFT_PROJECT
  56. -oc patch checluster codeready -p '{"spec": {"auth":{"identityProviderImage":"registry.redhat.io/redhat-sso-7/sso73-openshift:1.0-11"}}}' --type merge -n $OPENSHIFT_PROJECT
  57. -oc patch checluster codeready -p '{"spec": {"auth":{"postgresImage":"registry.redhat.io/rhscl/postgresql-96-rhel7:1-40"}}}' --type merge -n $OPENSHIFT_PROJECT
  58. +echo "[INFO] Update postgre image"
  59. +oc set image deployment/postgres "*=registry.access.redhat.com/rhscl/postgresql-96-rhel7:1-40" -n codeready
  60. +
  61. +# oc patch checluster/codeready -p '{"spec":{"server":{"cheImage":"'${REGISTRY_PREFIX}'/server-rhel8"}}}' --type merge -n $OPENSHIFT_PROJECT
  62. +# oc patch checluster/codeready -p '{"spec":{"server":{"cheImageTag":"1.2"}}}' --type merge -n $OPENSHIFT_PROJECT
  63. +# oc patch checluster codeready -p '{"spec": {"auth":{"postgresImage":"registry.redhat.io/rhscl/postgresql-96-rhel7:1-40"}}}' --type merge -n $OPENSHIFT_PROJECT
  64. +# oc patch checluster codeready -p '{"spec": {"auth":{"keycloakPostgresPassword":"'${POSTGRESQL_PASSWORD}'"}}}' --type merge -n $OPENSHIFT_PROJECT
  65.  
  66.  echo "
  67.  Successfully updated running deployment ${namespace}. Rolling update may take a few minutes to complete.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top