Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add label to identify individual services #2622

Closed
kolbe opened this issue Jun 4, 2020 · 3 comments · Fixed by #2654
Closed

Add label to identify individual services #2622

kolbe opened this issue Jun 4, 2020 · 3 comments · Fixed by #2654
Assignees
Labels
Milestone

Comments

@kolbe
Copy link
Contributor

kolbe commented Jun 4, 2020

Feature Request

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

Service labels facilitate identifying certain types of services but don't quite facilitate identifying an individual service. For example, the prometheus and grafana services have the same labels:

Name:              tidb-prometheus
Namespace:         tinewswriter-tidb
Labels:            app.kubernetes.io/component=monitor
                   app.kubernetes.io/instance=tidb
                   app.kubernetes.io/managed-by=tidb-operator
                   app.kubernetes.io/name=tidb-cluster

Name:              tidb-grafana
Namespace:         tinewswriter-tidb
Labels:            app.kubernetes.io/component=monitor
                   app.kubernetes.io/instance=tidb
                   app.kubernetes.io/managed-by=tidb-operator
                   app.kubernetes.io/name=tidb-cluster
$ kubectl get svc basic-tidb-peer -o json | jq .metadata.labels
{
  "app.kubernetes.io/component": "tidb",
  "app.kubernetes.io/instance": "basic",
  "app.kubernetes.io/managed-by": "tidb-operator",
  "app.kubernetes.io/name": "tidb-cluster"
}
$ kubectl get svc basic-tidb -o json | jq .metadata.labels
{
  "app.kubernetes.io/component": "tidb",
  "app.kubernetes.io/instance": "basic",
  "app.kubernetes.io/managed-by": "tidb-operator",
  "app.kubernetes.io/name": "tidb-cluster"
}

But it just isn't useful to see the basic-tidb service alongside the basic-tidb-peer service, since one of them presents connection end points to end-users and the other is meant to be used internally.

$ kubectl get svc -A -l app.kubernetes.io/component=tidb
NAMESPACE   NAME              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)              AGE
default     basic-tidb        ClusterIP   10.108.16.250   <none>        4000/TCP,10080/TCP   17m
default     basic-tidb-peer   ClusterIP   None            <none>        10080/TCP            17m

Describe the feature you'd like:

Add a label that allows the end user to identify each actual, end-user-accessible service individually.

Describe alternatives you've considered:

Teachability, Documentation, Adoption, Migration Strategy:

@DanielZhangQD DanielZhangQD added this to the v1.1.1 milestone Jun 4, 2020
@zjj2wry zjj2wry self-assigned this Jun 7, 2020
@zjj2wry
Copy link
Contributor

zjj2wry commented Jun 7, 2020

I think it makes sense for the service to have a unique label, for example, promethus operator has ServiceMonitor crd to find the corresponding service through the label.

@cofyc cofyc added the status/WIP Issue/PR is being worked on label Jun 8, 2020
@mikechengwei
Copy link
Contributor

I think i can do it in this pr #2176

@mikechengwei
Copy link
Contributor

I found this feature have finished in #2654 , i will fix my code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants