otterize / network-mapper

Map Kubernetes traffic: in-cluster, to the Internet, and to AWS IAM and export as text, intents, or an image
Apache License 2.0
612 stars 23 forks source link

Custom annotation for service name #128

Closed DanTulovsky closed 1 year ago

DanTulovsky commented 1 year ago

According to: https://docs.otterize.com/reference/configuration/network-mapper#pod-annotations setting the intents.otterize.com/service-name annotation on a pod will set the name of the service.

Please consider allowing this annotation to be set by the users. We already have such an annotation on our pods and it would be best not to duplicate it.

(As an aside, maybe a label would be better? Perhaps default to the app.kubernetest.io/name label? As virtually everything should have that set already.)

Thank you

orishoshan commented 1 year ago

Hey @DanTulovsky!

We're thinking of adding a helm-chart configuration value named global.serviceNameOverrideAnnotationName. It would go in the global section because it applies to multiple subcharts: to the intents-operator, network-mapper and credentials-operator. If you don't specify it, you'll get the default value intents.otterize.com/service-name.

Regarding use of labels: we preferred use of an annotation because it is not size-limited, unlike labels. Since we want to keep it backwards-compatible, we prefer not to use app.kubernetes.io/name at the moment, as it would alter default behavior for existing users.

usarid commented 1 year ago

LGTM - let’s do it. global.serviceNameOverrideAnnotationName

omris94 commented 1 year ago

Hey @DanTulovsky, I've just merged and released everything. You can set the annotation now using global.serviceNameOverrideAnnotationName. You can find more information here.