Skip to main content
logoTetrate Service BridgeVersion: 1.10.x

Labels and Annotations Propagation

Labels and annotations serve as a way to organize and categorize TSB resources. You can now apply these to TSB resources starting from the organization level down to the configuration level. This allows you to easily identify and group resources based on their labels and annotations.

Features

  1. Inclusion in Hierarchical Resources: Labels and annotations are available for resources that generate configurations from Organizations, Tenants, Workspaces, Config Groups (Gateway Groups, Traffic Group, Security Group and Istio Internal Group) and TSB Bridged mode configurations under config groups (e.g. Gateway, SecuritySettings, TrafficSettings and others).

    Following is a sample of labels and annotations applied to a Workspace:

    apiVersion: tsb.tetrate.io/v2
    kind: Workspace
    metadata:
    name: bookinfo
    annotations:
    tsb.tetrate.io/organization: tetrate
    tsb.tetrate.io/tenant: tetrate
    workspace-annotation: bookinfo-ws
    labels:
    workspace-label: bookinfo-ws
    spec:
    displayName: Bookinfo
    namespaceSelector:
    names:
    - "*/bookinfo"
  2. Propagation Mode: The system uses a top-to-bottom propagation mode for labels and annotations. This means:

    • Labels and annotations defined at a higher level (e.g., Organization) will be propagated to lower levels (e.g., Tenant, Workspaces, etc.)
    • However, any child resource can override a label or annotation defined by its parent.
    • To understand TSB Hierarchical Resource, please refer to TSB Resource Model.
  3. Labels and Annotations in Configurations: An annotation that's set at the Workspace level will appear in any configurations associated with that workspace, such as Virtual Service, Gateway, Destination Rule, and so on. However:

    • If a specific configuration (like a Virtual Service) re-defines the same annotation, it will take precedence over the one defined in its parent resource (in this case, the Workspace).

Usage Guidelines

  1. Consistency: Aim to be consistent with label and annotation keys. This makes it easier to manage and locate resources later.
  2. Overriding with Caution: While child resources can override parent labels and annotations, doing so should be approached with caution to avoid confusion and misconfigurations.
  3. Documentation: Document the purpose of specific labels and annotations, especially if they have implications on deployment, scaling, or any other operational aspects.

Best Practices

  1. Clear Naming Conventions: Establish clear naming conventions for labels and annotations to ensure they are meaningful and understandable across the team.
  2. Regular Audits: Periodically review and audit the labels and annotations to ensure they're current and relevant. Remove or update any that are outdated.
  3. Change Management: When overriding labels or annotations, especially in a production environment, consider having a change management process in place. This helps in tracking changes and understanding their implications.

In summary, the addition of labels and annotations to TSB resources offers greater flexibility in resource management. This, combined with the top-down propagation model and the ability to override, ensures that resources can be tailored to specific needs while maintaining a level of consistency and uniformity. Proper usage and management of these labels and annotations will enhance the overall TSB experience.