From 004c285633c7eb14adafa390586f5072b0ca1abb Mon Sep 17 00:00:00 2001 From: Pedro Ruivo Date: Mon, 22 Jan 2024 13:50:01 +0000 Subject: [PATCH] Fix some error with environment configmap (#694) * Added KUBECONFIG otherwise it uses the default * Delete the configmap before creating a new one Signed-off-by: Pedro Ruivo --- provision/rosa-cross-dc/Taskfile.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/provision/rosa-cross-dc/Taskfile.yaml b/provision/rosa-cross-dc/Taskfile.yaml index 72f21f7a..225a8f32 100644 --- a/provision/rosa-cross-dc/Taskfile.yaml +++ b/provision/rosa-cross-dc/Taskfile.yaml @@ -899,9 +899,11 @@ tasks: - ROSA_CLUSTER_NAME cmds: - echo "Creating configmap with environment data." - - KUBECONFIG="{{.ISPN_DIR}}/.task/kubecfg/{{.ROSA_CLUSTER_NAME}}" oc -n {{.KC_NAMESPACE_PREFIX}}keycloak create configmap env-config --from-file={{.ENV_DATA_JSON_PATH}} || (kubectl -n {{.KC_NAMESPACE_PREFIX}}keycloak create configmap env-config --from-file={{.ENV_DATA_JSON_PATH}}) + - KUBECONFIG="{{.ISPN_DIR}}/.task/kubecfg/{{.ROSA_CLUSTER_NAME}}" kubectl -n {{.KC_NAMESPACE_PREFIX}}keycloak delete configmap env-config --ignore-not-found + - KUBECONFIG="{{.ISPN_DIR}}/.task/kubecfg/{{.ROSA_CLUSTER_NAME}}" kubectl -n {{.KC_NAMESPACE_PREFIX}}keycloak create configmap env-config --from-file={{.ENV_DATA_JSON_PATH}} preconditions: - test -f "{{.ENV_DATA_JSON_PATH}}" + - test -f "{{.ISPN_DIR}}/.task/kubecfg/{{.ROSA_CLUSTER_NAME}}" delete-env-configmap: internal: true @@ -910,4 +912,6 @@ tasks: - ROSA_CLUSTER_NAME cmds: - echo "Deleting configmap with environment data." - - bash -c "kubectl -n {{.KC_NAMESPACE_PREFIX}}keycloak delete configmap env-config || exit 0" + - KUBECONFIG="{{.ISPN_DIR}}/.task/kubecfg/{{.ROSA_CLUSTER_NAME}}" kubectl -n {{.KC_NAMESPACE_PREFIX}}keycloak delete configmap env-config --ignore-not-found + preconditions: + - test -f "{{.ISPN_DIR}}/.task/kubecfg/{{.ROSA_CLUSTER_NAME}}"