Skip to content

Display crosslinks from CR additional printercolumns to secrets #2278

@gberche-orange

Description

@gberche-orange

Secrets are heavily used in k8s resources including CR. Being able to quicly navigate from a resource (including CRs) to a secret is important.

As an headlamp user, in order to easily inspect secrets referenced in k8s CRs, I need hyperlinks to the secret page to be added in

  • the page c/<ns</crds/<crd-name> in the objects table when the secret is referenced as an additional printer column ("test-remote-k8s-secret" in screenshot below)
    image
  • the page c/<ns</customresources/<crd-name>/<cr-name> in the objects table when the secret is referenced as an additional printer column ("test-remote-k8s-secret" in screenshot below)
    image

Identifying that an additional printed column field describes a secret can not be systematic (see backlground below)

A first approach is to apply a simple heuristic: if the printer column name contains the "secret" keyword, then display an hyperlink to the secret page in the same namespace.

A 2nd more robust solution could be to provide ability to configure patterns that should trigger then an additional printer column should be displayed asa secret.

General Background on secret references

Outside of fields highlighted as additional printer colums, references to secrets are common in K8s CR resources. However, headlamp does not yet display the CR outside of the plain yaml or the web form in #2087 This section could potentially be useful in the future to extend crosslinks to fields beyond those highlighted in additional printer columns

Some examples of such references from CR to secrets

Examples:

status:
  binding:
    name: prod-account-service-reference
  conditions:
  - type: Ready
    status: 'True'
    reason: 'Projected'
    message: ''
    lastTransitionTime: '2021-01-20T17:00:00Z'

There are no consistently applied naming conventions that enable identifying that a field within a k8s resource correspond to a secret. Some CR choose to make explicit the actual link within the status. Some CRs rather use the spec to describe the expected secret source, or a secret that should be generated as an outcome of the CR.

The api naming conventions can provide heuristics for common cases of detecting Objects fields as secrets such as the following examples

secretRef:
    name: foo
    # namespace would generally not be needed and is discouraged,
    # as explained above.
    namespace: foo-namespace

Co authored with @Guilamb

Metadata

Metadata

Assignees

No one assigned

    Labels

    CRDCustom Resource DefinitionsfrontendIssues related to the frontendkind/featureCategorizes issue or PR as related to a new feature.priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

    Type

    No type

    Projects

    Status

    Queued

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions