carvel-dev / kapp

kapp is a simple deployment tool focused on the concept of "Kubernetes application" — a set of resources with the same label

Home Page:https://carvel.dev/kapp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add example for ownershipLabelRules

scothis opened this issue · comments

I couldn't find an example of how ownershipsLabelRules are expected to work.

I was trying to show logs from a Pod managed by a Knative Service, despite adding the log annotations to the resulting Pod and using --logs with my deploy command, nothing was showing up...

By reading the source, this seems to solve my issue, but I don't know if I might be "holding it wrong."

ownershipLabelRules:
- path: [spec, template, metadata, labels]
  resourceMatchers:
  - apiVersionKindMatcher: {apiVersion: serving.knative.dev/v1, kind: Service}

Besides adding this to the website docs, it might be worth adding to the knative examples as well.

Thanks @scothis for bringing it up. We will revisit the docs and add the example so that user has reference while using ownershipLabelRules

If I may, I would like to extend this request with an example for how to use ownershipLabelRules so that one can see logs for Deployments that result from a PackageInstall.

edit: I realise that the relationship between a pkgi and its resources is not based on ownership but managed by kapp. So ownershipLabelRules may not help. Either way it would be cool if the logs for pkgi-"owned" components could be shown.

@scothis , There is a format in the same page you linked above, was it not helpful or not easily obvious in the documentation?

We could look at adding this as an example in our examples folder as you have suggested.

@renuy I didn't see that config sample. I probably used the table of contents on the page to skip the overview section and go directly to the ownershipLabelRules section.