Skip to content

Global Component Pod Labels #1437

@BirdHighway

Description

@BirdHighway

Desired Functionality
When debugging or monitoring flows it is helpful to be able to quickly identify the specific kubernetes pod one is looking for. With local components the command kubectl get pods --show-labels will give enough information to narrow down which pod is which in most cases. The flow ID and step ID are both included in the pod name as well as separate labels on the pod for flowId and stepId.

Screenshot from 2022-06-26 21-04-21

With global components it is necessary to know the component ID.

Screenshot from 2022-06-26 21-11-45

It would be helpful to be able to easily identify global components by the name of the component as well, using a label such as compName.

Screenshot from 2022-06-26 21-14-42

When there are only one or two global components it is easy enough to keep them straight, but if there are 20, for example, it is difficult to keep them straight by component ID alone. This change would make it easier to navigate the deployed pods via the command line for those who prefer to use kubectl.

Solution Proposal

The file services/component-orchestrator/src/drivers/kubernetes/KubernetesDriver.js has a function _generateDeploymentDefinition()
(link) that specifies the labels the pods will have. Adding a label based on the component name could be done as the below snippet shows, where toSnakeCase() is a hypothetical function that would replace non alphanumeric characters with underscores.

if (component.isGlobal) {
    labels = {
        componentId: component.id,
        compName: toSnakeCase(component.name),
    };

link

Pros / Cons / Thoughts

  • The label compName is not used elsewhere in the project, so it is unlikely that the label will match any existing selectors
  • This may be a niche use case - if others would not find this useful then it may not be worth the trouble
  • Labels must conform to the requirements specified by Kubernetes

The most difficult aspect of this may be the character requirements - how would the word für be handled, for example? (ü is an invalid character for a Kubernetes label value)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions