Skip to content

Commit

Permalink
Add component labels to service labels (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas authored Mar 21, 2022
1 parent 2749ad0 commit 1789cbd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions controllers/flinkcluster/flinkcluster_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ func newJobManagerService(flinkCluster *v1beta1.FlinkCluster) *corev1.Service {
Port: *jobManagerSpec.Ports.UI,
TargetPort: intstr.FromString("ui")}
var jobManagerServiceName = getJobManagerServiceName(clusterName)
var podLabels = getComponentLabels(flinkCluster, "jobmanager")
podLabels = mergeLabels(podLabels, jobManagerSpec.PodLabels)
var serviceLabels = mergeLabels(jobManagerSpec.ServiceLabels, getRevisionHashLabels(&flinkCluster.Status.Revision))
selectorLabels := getComponentLabels(flinkCluster, "jobmanager")
serviceLabels := mergeLabels(selectorLabels, getRevisionHashLabels(&flinkCluster.Status.Revision))
serviceLabels = mergeLabels(serviceLabels, jobManagerSpec.ServiceLabels)
var serviceAnnotations = jobManagerSpec.ServiceAnnotations

var jobManagerService = &corev1.Service{
Expand All @@ -285,7 +285,7 @@ func newJobManagerService(flinkCluster *v1beta1.FlinkCluster) *corev1.Service {
Annotations: serviceAnnotations,
},
Spec: corev1.ServiceSpec{
Selector: podLabels,
Selector: selectorLabels,
Ports: []corev1.ServicePort{rpcPort, blobPort, queryPort, uiPort},
},
}
Expand Down
3 changes: 3 additions & 0 deletions controllers/flinkcluster/flinkcluster_converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,9 @@ func TestGetDesiredClusterState(t *testing.T) {
Namespace: "default",
Labels: map[string]string{
RevisionNameLabel: "flinkjobcluster-sample-85dc8f749",
"app": "flink",
"cluster": "flinkjobcluster-sample",
"component": "jobmanager",
},
Annotations: map[string]string{
"networking.gke.io/load-balancer-type": "Internal",
Expand Down

0 comments on commit 1789cbd

Please sign in to comment.