#!/bin/bash
#
# Copyright (c) 2023 Oracle and/or its affiliates. All rights reserved.
# Licensed under the GNU General Public License Version 3 as shown at https://www.gnu.org/licenses/gpl-3.0.txt.

KUBECFG=$1
export KUBECONFIG=${KUBECFG}

# Re: calico unable to uinstall cleanly
# https://github.com/tigera/operator/issues/2031
# RFC: Graceful termination of the operator https://github.com/tigera/operator/pull/2662

kubectl patch -n calico-system installations.operator.tigera.io/default  --type json \
  --patch='[{"op":"remove","path":"/metadata/finalizers"}]'

kubectl delete installation default
