apiVersion: core.oam.dev/v1beta1
kind: TraitDefinition
metadata:
  name: service-kube
  namespace: default
spec:
  appliesToWorkloads:
    - webservice
    - worker
    - backend
  podDisruptive: true
  schematic:
    kube:
      template:
        apiVersion: v1
        kind: Service
        metadata:
          name: my-service
        spec:
          ports:
            - protocol: TCP
              port: 80
              targetPort: 9376
      parameters:
        - name: targetPort
          required: true
          type: number
          fieldPaths:
            - "spec.template.spec.ports[0].targetPort"
          description: "target port num for service provider."
