cloud-bulldozer / performance-dashboards

Performance dashboards from the Perf & Scale team
Apache License 2.0
16 stars 36 forks source link

create token for sa prometheus-k8s if not exists #40

Closed qiliRedHat closed 2 years ago

qiliRedHat commented 2 years ago

Description

create token for sa prometheus-k8s if not exists

Fixes

https://github.com/cloud-bulldozer/performance-dashboards/issues/39

qiliRedHat commented 2 years ago

Limitation: sa not working for kubectl, but the problem with the command create token is that is not available in "old" oc clients and it's not backwards compatible.

 % kubectl version --client=true --short
Flag --short has been deprecated, and will be removed in the future. The --short output will become the default.
Client Version: v1.24.0-beta.0
Kustomize Version: v4.5.4

% kubectl sa
error: unknown command "sa" for "kubectl"

Did you mean this?
    set
    cp
qiliRedHat commented 2 years ago

Test with oc - Passed

 % ./deploy.sh 

    ____  _ __  __        __
   / __ \(_) /_/ /___  __/ /_  ____  ____  ____  ___  _____
  / / / / / __/ __/ / / / __ \/ __ \/ __ \/ __ \/ _ \/ ___/
 / /_/ / / /_/ /_/ /_/ / /_/ / /_/ / /_/ / /_/ /  __/ /
/_____/_/\__/\__/\__, /_.___/\____/ .___/ .___/\___/_/
                /____/           /_/   /_/

Using k8s command: oc
Using namespace: dittybopper
Using default grafana password: admin

Getting environment vars...
Command "get-token" is deprecated, and will be removed in the future version. Use oc create token instead.
Prometheus URL is: https://prometheus-k8s-openshift-monitoring.apps.qili-preserve-az410.qe.azure.devcluster.openshift.com
Prometheus bearer token collected.

Creating namespace...
Looks like the namespace dittybopper already exists, deleting it
namespace "dittybopper" deleted
namespace/dittybopper created

Deploying Grafana...
service/dittybopper created
route.route.openshift.io/dittybopper created
deployment.apps/dittybopper created
configmap/sc-ocp-prom created
configmap/sc-grafana-config created

Waiting for dittybopper deployment to be available...
deployment.apps/dittybopper condition met

You can access the Grafana instance at http://dittybopper-dittybopper.apps.qili-preserve-az410.qe.azure.devcluster.openshift.com

Test with kubectl - Failed as the known limitation in the above comment.

% ./deploy.sh -c kubectl

    ____  _ __  __        __
   / __ \(_) /_/ /___  __/ /_  ____  ____  ____  ___  _____
  / / / / / __/ __/ / / / __ \/ __ \/ __ \/ __ \/ _ \/ ___/
 / /_/ / / /_/ /_/ /_/ / /_/ / /_/ / /_/ / /_/ /  __/ /
/_____/_/\__/\__/\__, /_.___/\____/ .___/ .___/\___/_/
                /____/           /_/   /_/

Using k8s command: kubectl
Using namespace: dittybopper
Using default grafana password: admin

Getting environment vars...
error: unknown command "sa" for "kubectl"

Did you mean this?
    set
    cp
error: unknown command "sa" for "kubectl"

Did you mean this?
    set
    cp
Prometheus URL is: https://prometheus-k8s-openshift-monitoring.apps.qili-preserve-az410.qe.azure.devcluster.openshift.com
ERROR: Prometheus bearer token is not collected.
qiliRedHat commented 2 years ago

@rsevilla87 PTAL