Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clickable links to Docker images #97

Open
applejag opened this issue Apr 9, 2024 · 0 comments
Open

Add clickable links to Docker images #97

applejag opened this issue Apr 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@applejag
Copy link
Collaborator

applejag commented Apr 9, 2024

A bit of a goofy idea, and would only be as a "wouldn't it be cool if" kind of feature.

Expected Behavior

When doing kubectl describe, it would be nice if the Docker image name was a link to the registry.

This can be done via the OSC 8 escape sequence.

For example, the "Image" part of:

$ kubectl describe pods
...
Containers:
  trustmanager:
    Container ID:    containerd://b0151dd97058ba40968eec66d024795c762fba9365c106518f97d1b1c6183684
    Image:           quay.io/jetstack/trust-manager:v0.8.0
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this here

There's no way to really guess how to construct the links, so there's going to need some heuristic-based hardcoding (and potentially configurable later via ~/.kube/color.yaml file).

To begin with, it should know how to convert the following images to the following URLs:

Image URL
quay.io/jetstack/trust-manager:v0.8.0 https://quay.io/repository/jetstack/trust-manager?tab=tags&tag=v0.8.0
quay.io/jetstack/trust-manager@sha256:e45773dbc05105a19e0750fdb2524ba056ae1568f37b7ed99d42ad64264734fc https://quay.io/repository/jetstack/trust-manager/manifest/sha256:e45773dbc05105a19e0750fdb2524ba056ae1568f37b7ed99d42ad64264734fc
docker.io/grafana/grafana:10.4.0 https://hub.docker.com/r/grafana/grafana
docker.io/grafana/grafana@sha256:f9811e4e687ffecf1a43adb9b64096c50bc0d7a782f8608530f478b6542de7d5 https://hub.docker.com/r/grafana/grafana
grafana/grafana:10.4.0 https://hub.docker.com/r/grafana/grafana
grafana/grafana@sha256:f9811e4e687ffecf1a43adb9b64096c50bc0d7a782f8608530f478b6542de7d5 https://hub.docker.com/r/grafana/grafana
nginx:alpine https://hub.docker.com/_/nginx
nginx@sha256:31bad00311cb5eeb8a6648beadcf67277a175da89989f14727420a80e2e76742 https://hub.docker.com/_/nginx
ghcr.io/riskident/jelease:v0.6.2 https://github.com/riskident/jelease/pkgs/container/jelease
ghcr.io/riskident/jelease@sha256:927d3b2af3f4528053ac541498482f1e39a6912aa8f8c289a2cc1e4db53503fd https://github.com/riskident/jelease/pkgs/container/jelease
gcr.io/etcd-development/etcd:v3.5.12 https://gcr.io/etcd-development/etcd:v3.5.12
gcr.io/etcd-development/etcd@sha256:cebe24b890641de3e7ff8a640c4597bdda321090c29f4dedcedaa8cadbbe08e1 https://gcr.io/etcd-development/etcd@sha256:cebe24b890641de3e7ff8a640c4597bdda321090c29f4dedcedaa8cadbbe08e1
docker.elastic.co/elasticsearch/elasticsearch:7.12.1 https://www.docker.elastic.co/r/elasticsearch/elasticsearch:7.12.1
docker.elastic.co/elasticsearch/elasticsearch@sha256:561bf27aa989803bfbac48ebd48e32daadb4215cf7940c599a62c13f225427fa https://www.docker.elastic.co/r/elasticsearch/elasticsearch

Some links can't go directly to the exact tag or digest as you need more information to build the link than what you have available (such as Docker Hub links that need both image tag and digest to construct the URL). There can be future improvements to kubecolor that make this more exact.

Should also handle no tag as :latest

Current Behavior

Just displayed as (colored) text.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: linux
  • kubectl version: v1.29.3
  • kubecolor version: 0.2.2

More info about OSC 8, and list of terminal support: https://github.com/Alhadis/OSC8-Adoption/

@applejag applejag added the enhancement New feature or request label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant