roboll / helmfile

Deploy Kubernetes Helm Charts
MIT License
4.04k stars 565 forks source link

Missing command - status? #27

Open xeor opened 6 years ago

xeor commented 6 years ago

I've started using helmfile, and after a couple of days of use, I am missing a way to do helm status on the repo's that the helmfile points to..

mumoshu commented 6 years ago

FYI, this is currently WIP in #70 thanks to @cmeury!

Btw, what is your use-case for this feature? I have never wanted to run helm status through helmfile myself. A short user-story would be welcomed!

mumoshu commented 6 years ago

Forgot to mention you - just adding it for your notice @xeor

mumoshu commented 6 years ago

@cmeury I'm still wondering how this would be implemented in its best form.

AFAICS, just repeating helm status <release> for each relevant release would result in multiplying something like:

$ helm status esteemed-magpie
LAST DEPLOYED: Tue Apr  3 17:30:13 2018
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1/Secret
NAME                   TYPE    DATA  AGE
esteemed-magpie-mysql  Opaque  2     17s

==> v1/PersistentVolumeClaim
NAME                   STATUS  VOLUME                                    CAPACITY  ACCESS MODES  STORAGECLASS  AGE
esteemed-magpie-mysql  Bound   pvc-3ae0dfe4-3719-11e8-811a-080027e8f12b  8Gi       RWO           standard      17s

==> v1/Service
NAME                   TYPE       CLUSTER-IP    EXTERNAL-IP  PORT(S)   AGE
esteemed-magpie-mysql  ClusterIP  10.110.14.39  <none>       3306/TCP  17s

==> v1beta1/Deployment
NAME                   DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
esteemed-magpie-mysql  1        1        1           0          17s

==> v1/Pod(related)
NAME                                    READY  STATUS           RESTARTS  AGE
esteemed-magpie-mysql-6887f4c88c-7zm6f  0/1    PodInitializing  0         17s

NOTES:
MySQL can be accessed via port 3306 on the following DNS name from within your cluster:
esteemed-magpie-mysql.default.svc.cluster.local

To get your root password run:

    MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default esteemed-magpie-mysql -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo)

To connect to your database:

1. Run an Ubuntu pod that you can use as a client:

    kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il

2. Install the mysql client:

    $ apt-get update && apt-get install mysql-client -y

3. Connect using the mysql cli, then provide your password:
    $ mysql -h esteemed-magpie-mysql -p

To connect to your database directly from outside the K8s cluster:
    MYSQL_HOST=127.0.0.1
    MYSQL_PORT=3306

    # Execute the following commands to route the connection:
    export POD_NAME=$(kubectl get pods --namespace default -l "app=esteemed-magpie-mysql" -o jsonpath="{.items[0].metadata.name}")
    kubectl port-forward $POD_NAME 3306:3306

    mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD}

which seems like too verbose(for me).

Probably we should at least omit NOTES: from the output while merging RESOURCES so that it would look more like the status of the whole releases managed by the helmfile.yml?

Also, I guess it should better be consistent with #68

cmeury commented 6 years ago

How about using the JSON output option and print them using our own style?

mumoshu commented 6 years ago

@cmeury Sounds great! I'm now wondering the scope of #70. Would you be willing to submit a separate PR on top of #70 for further enhancement? If so, I'll merge it as-is, if it helps.

@sstarcher You seem to be interested in this feature, too? Any comment on how the output would ideally look like?

sstarcher commented 6 years ago

I'm really only interested in a exit code of all good or something not so good. I general ignore the helmfile output as it's extremely verbose and hard to follow.

mumoshu commented 6 years ago

The plan:

WDYT? @sstarcher @cmeury @xeor

sstarcher commented 6 years ago

sounds like a good idea to me. In the future it would likely be nice to extend the -o to the other outputs.

mumoshu commented 6 years ago

@sstarcher Thx for the confirmation. Yeah. I'm not intended to extend it so much right now, but at least yaml after helm's yaml output would make sense.