Skip to content

Commit

Permalink
Add ability to add annotations to JobManager service
Browse files Browse the repository at this point in the history
  • Loading branch information
Sudokamikaze committed Mar 9, 2022
1 parent 312c1ac commit 8e140a0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apis/flinkcluster/v1beta1/flinkcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ type JobManagerSpec struct {
// Currently `VPC, External` are only available for GKE.
AccessScope string `json:"accessScope,omitempty"`

// _(Optional)_ Define JobManager Service annotations for configuration.
Annotations map[string]string `json:"annotations,omitempty"`

// _(Optional)_ Provide external access to JobManager UI/API.
Ingress *JobManagerIngressSpec `json:"ingress,omitempty"`

Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/flinkoperator.k8s.io_flinkclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,10 @@ spec:
properties:
accessScope:
type: string
annotations:
additionalProperties:
type: string
type: object
extraPorts:
items:
properties:
Expand Down
3 changes: 3 additions & 0 deletions controllers/flinkcluster/flinkcluster_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ func newJobManagerService(flinkCluster *v1beta1.FlinkCluster) *corev1.Service {
switch jobManagerSpec.AccessScope {
case v1beta1.AccessScopeCluster:
jobManagerService.Spec.Type = corev1.ServiceTypeClusterIP
jobManagerService.Annotations = jobManagerSpec.Annotations
case v1beta1.AccessScopeVPC:
jobManagerService.Spec.Type = corev1.ServiceTypeLoadBalancer
jobManagerService.Annotations =
Expand All @@ -301,8 +302,10 @@ func newJobManagerService(flinkCluster *v1beta1.FlinkCluster) *corev1.Service {
}
case v1beta1.AccessScopeExternal:
jobManagerService.Spec.Type = corev1.ServiceTypeLoadBalancer
jobManagerService.Annotations = jobManagerSpec.Annotations
case v1beta1.AccessScopeNodePort:
jobManagerService.Spec.Type = corev1.ServiceTypeNodePort
jobManagerService.Annotations = jobManagerSpec.Annotations
case v1beta1.AccessScopeHeadless:
// Headless services do not allocate any sort of VIP or LoadBalancer, and merely
// collect a set of Pod IPs that are assumed to be independently routable:
Expand Down
4 changes: 4 additions & 0 deletions helm-chart/flink-operator/templates/flink-cluster-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,10 @@ spec:
properties:
accessScope:
type: string
annotations:
additionalProperties:
type: string
type: object
extraPorts:
items:
properties:
Expand Down

0 comments on commit 8e140a0

Please sign in to comment.