Extensions
The extensions file adds three things to the UI, with no plugins to install:
- actions on objects: a link to open, such as a Grafana dashboard for a Deployment, or a command to copy, such as a
sterncommand for its pods; - columns in a kind’s list, read from a field of each object;
- names for the command palette’s
:, so:certopens cert-manager’s Certificates.
KubeGlass never runs a command from the file. It copies the command to the clipboard, and it runs wherever you paste it.
Where the file is
Section titled “Where the file is”| Setting | Default |
|---|---|
extensions_file (KUBEGLASS_EXTENSIONS_FILE) |
~/.kubeglass/extensions.yaml, or /etc/kubeglass/extensions.yaml where there is no home directory |
With the Helm chart, put the file’s contents under extensions: in your values. The chart writes them to a ConfigMap, mounts it at /etc/kubeglass/extensions.yaml and points KUBEGLASS_EXTENSIONS_FILE there:
extensions: actions: - name: Grafana kinds: [Deployment, StatefulSet] url: https://grafana.example.com/d/abc?var-namespace={namespace}&var-app={name}The chart mounts the file with subPath, which Kubernetes doesn’t update in place, so the pod template carries a checksum of the file: helm upgrade with changed extensions rolls the pods.
Settings › Extensions shows where KubeGlass looks for the file, how many actions, columns and aliases it read, and what was wrong with the file. It also has an example to copy.
An example
Section titled “An example”actions: - name: Grafana kinds: [Deployment, StatefulSet] url: https://grafana.example.com/d/abc?var-namespace={namespace}&var-app={name} - name: Tail with stern kinds: [Deployment] command: stern -n {namespace} {name} --context {context}columns: - kind: Certificate.cert-manager.io name: Issuer path: .spec.issuerRef.namealiases: cert: certificates.cert-manager.ioActions
Section titled “Actions”Each action has a name, the kinds it applies to, and either a url or a command, not both.
- A
urlmust start withhttps://orhttp://. KubeGlass opens it in a new tab. - A
commandis copied to the clipboard.
An object’s page shows its actions next to its other buttons: one action as a button, several in an Actions menu. A row’s menu in the list has them too, after the kind’s own actions.
Placeholders are filled in from the object:
| Placeholder | Value |
|---|---|
{name}, {namespace}, {kind}, {uid} |
The object’s name, namespace, kind and UID |
{context} |
The kubeconfig context you’re viewing |
{labels.KEY}, {annotations.KEY} |
The value of one label or annotation, such as {labels.app} |
In a URL each value is URL-encoded. In a command each value becomes one shell word, quoted when it needs to be. A placeholder KubeGlass doesn’t know, or a label the object doesn’t have, stays in the text as it is.
Columns
Section titled “Columns”Each column has a kind, a name for its header, and a path to a field of the object. The path starts with a dot:
| Path | Reads |
|---|---|
.spec.issuerRef.name |
A field |
.spec.containers[0].image |
An item of a list by position |
.status.conditions[type=Ready].status |
The item of a list whose field has that value |
.metadata.labels["app.kubernetes.io/name"] |
A key with dots in it |
Text, numbers and true or false show as they are, a list shows its items separated by commas, and anything else as JSON. The column sorts like the others, and it is hidden when no object in the list has a value there.
Aliases
Section titled “Aliases”aliases maps a name to a kind, written any way the cluster knows it: its plural, plural.group, its kind or a short name. The name can’t contain spaces or colons. Type : and the alias in the command palette to open that kind’s list; a namespace after it works too, as with any kind (:cert kube-system).
In kinds and in a column’s kind, name a kind the way kubectl does: Deployment, deployments, or for a custom resource certificates.cert-manager.io or Certificate.cert-manager.io. Case doesn’t matter. In kinds, "*" means every kind.
Mistakes and changes
Section titled “Mistakes and changes”KubeGlass reads the file strictly: an unknown key or broken YAML makes it ignore the whole file. An entry with a mistake, such as an action with neither url nor command or a path that doesn’t start with a dot, is left out and the rest still work. Settings › Extensions lists each mistake.
KubeGlass looks at the file again when it changes, so there is nothing to restart on your own machine. The UI asks for it every minute. Files over 1 MiB aren’t read.
GET /api/v1/extensions returns the file as KubeGlass has it: path, found, problems, actions, columns and aliases.