This would add another Go package aimed at emulating the manual install/uninstall logic that's currently done in the hack/install.sh
andhack/uninstall.sh
scripts. When interacting with the deploy-metering
binary, you have the choice of using the command flags available, or their respective environment variable. In the case where both the flag, and the environment variable are specified, the flag value takes precedence.
$ make bin/deploy-metering
- Deploy package: kube-reporting/metering-operator#921
- Deploy CLI: kube-reporting/metering-operator#934
With the addition of the deploy-metering cli, we can assign a default (typically an empty value) value most of the configuration options. This means that the only required flag/environment variable that needs to be set (and this is also validated within the deploy package) is the namespace in which the metering stack is managed. Before deploying metering set the following:
$ export METERING_NAMESPACE="metering"
or
$ ./bin/deploy-metering install --namespace metering
It's important to note that when the MeteringConfig
custom resource is unspecified, the package
uses the manifests/deploy/$DEPLOY_PLATFORM/metering-ansible-operator/default.yaml
as the default MeteringConfig
resource, which will fail validation in the metering-ansible-operator due to a missing storage section.
doesn't include any storage options, so the install process will succeed, but fail during the metering-ansible-operator storage validation tasks.
$METERING_NAMESPACE
/--namespace
: the namespace to deploy metering resources on.$METERING_CR_FILE
/--metering-cr
: the relative (or absolute) path to a customizedMeteringConfig
custom resource.$DEPLOY_MANIFESTS_DIR
/--deploy-manifests-dir
: the relative (or absolute) path to themanifests/deploy/
directory. Set this when working outside of the operator-metering cloned repository, or when thebin/deploy-metering
binary has been moved to the user's/usr/local/bin
directory.$DEPLOY_PLATFORM
/--deploy-platform
: the platform in which metering is deploy on. The supported values include "upstream", "openshift", and "ocp-testing".
$SKIP_METERING_OPERATOR_DEPLOYMENT
/--skip-metering-operator-deployment
: create only the$METERING_NAMESPACE
namespace, the metering CRDs, and theMeteringConfig
CR.$METERING_OPERATOR_IMAGE_REPO
/--repo
: override the image repository used in the metering-ansible-operator container images.$METERING_OPERATOR_IMAGE_TAG
/--tag
: override the image tag used in the metering-ansible-operator container images.
Note: You need to set both the image repository and tag to override any of the container images.
$METERING_DELETE_NAMESPACE
/--delete-namespace
: defaults to false$METERING_DELETE_CRDS
/--delete-crd
: defaults to false$METERING_DELETE_CRB
/--delete-crb
: defaults to false$METERING_DELETE_PVCS
/--delete-pvc
: defaults to true$METERING_DELETE_ALL
/--delete-all
: defaults to false. This sets all the internal states that rely on the value of the ENV vars listed above, to true.
$ export METERING_NAMESPACE="metering"
$ ./bin/deploy-metering install --namespace test
INFO[09-17-2019 14:54:42] Setting the log level to info app=deploy
INFO[09-17-2019 14:54:42] Metering Deploy Namespace: test app=deploy
...
Note: You can either use the flags, or the environment variables when running any of the following examples. Also, specify a customized MeteringConfig
custom resource before running any of these examples.
$ export METERING_NAMESPACE="metering"
$ ./bin/deploy-metering install
$ export METERING_NAMESPACE="metering"
$ export DEPLOY_PLATFORM="upstream"
$ ./bin/deploy-metering install
$ export METERING_NAMESPACE="metering"
$ export SKIP_METERING_OPERATOR_DEPLOYMENT="true"
$ ./bin/deploy-metering install
$ export METERING_NAMESPACE="metering"
$ export METERING_OPERATOR_IMAGE_REPO="quay.io/tflannag/origin-metering-ansible-operator"
$ export METERING_OPERATOR_IMAGE_TAG="latest"
$ ./bin/deploy-metering install
$ pwd
/home/tflannag/go/src/github.com/operator-framework/operator-metering
$ cd ../
$ pwd
/home/tflannag/go/src/github.com/operator-framework
$ export METERING_NAMESPACE="metering"
$ export DEPLOY_MANIFESTS_DIR="operator-metering/manifests/deploy"
$ ./operator-metering/bin/deploy-metering install
Note: set the $METERING_CR_FILE
before running any of these examples.
$ export METERING_NAMESPACE="metering"
$ ./bin/deploy-metering uninstall
$ export METERING_NAMESPACE="metering"
$ export DEPLOY_PLATFORM="upstream"
$ ./bin/deploy-metering uninstall
$ export METERING_NAMESPACE="metering"
$ export METERING_DELETE_CRB="true"
$ ./bin/deploy-metering uninstall
Note: only the $METERING_NAMESPACE
and the metering CRDs should be skipped.
Also, the reporting-operator creates the cluster-monitoring-view cluster role, but due to owner ref, that's not cleaned up.
$ export METERING_NAMESPACE="metering"
$ export METERING_DELETE_CRB="true"
$ ./bin/deploy-metering uninstall
$ export METERING_NAMESPACE="metering"
$ export METERING_DELETE_ALL="true"
$ ./bin/deploy-metering uninstall
Note: The entire metering stack should be deleted (except for the cluster-monitoring-view mentioned above).
- Before the PRs listed above were merged, we needed to add the
MeteringConfig
resource to the metering clientset. It would be nice to test out differentMeteringConfig
resource configurations while installing, and verifying that all the specified fields match the yaml output in the case where some structures were misformatted during development. - Also need to verify that the storage options are still working.
@timflannagan1, I found an issue such that the
deploy-metering
will fail if off-site storage cred is not given, i.e. the correctscrete
is not created