Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

[Feature] Propagate labels of non-core workloads to pod template #184

Open
@zzxwill

Description

@zzxwill

Is your feature request related to a problem? Please describe.

In order to implement feature #174, not only could labels of ContainerizedWorkloads be propagated to its pods (implemented in #175), but also should work for non-core workloads, like Deployment.

Deployment workload's customized labels like component.oam.dev/name: example-deployment could be automatically generated for its pods.

  • component yaml
apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
  name: example-deployment
spec:
  workload:
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: nginx-deployment
      labels:
        app: nginx
        component.oam.dev/name: example-deployment
    spec:
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
          - name: nginx
            image: nginx:1.17
            ports:
            - containerPort: 80
  • appconfig yaml
apiVersion: core.oam.dev/v1alpha2
kind: ApplicationConfiguration
metadata:
  name: example-deployment-appconfig
spec:
  components:
    - componentName: example-deployment

The pod haven't get the customized label.

✗ k describe pod nginx-deployment-5d85b5fb59-vmkdz
Name:         nginx-deployment-5d85b5fb59-vmkdz
Namespace:    default
Priority:     0
Node:         kind-control-plane/172.18.0.2
Start Time:   Wed, 26 Aug 2020 14:59:02 +0800
Labels:       app=nginx
              pod-template-hash=5d85b5fb59
Annotations:  <none>
Status:       Running
IP:           10.244.0.9
IPs:
  IP:           10.244.0.9
Controlled By:  ReplicaSet/nginx-deployment-5d85b5fb59

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions