From 58aa518ba7777e660d58d86a9108c7737bec2c68 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 17 Oct 2020 20:52:13 -0700 Subject: [PATCH] simplify --- controllers/controller_filer_service.go | 30 +++++------------------- controllers/controller_master_service.go | 10 ++------ controllers/controller_volume_service.go | 10 ++------ 3 files changed, 10 insertions(+), 40 deletions(-) diff --git a/controllers/controller_filer_service.go b/controllers/controller_filer_service.go index 9714892..93b03e5 100644 --- a/controllers/controller_filer_service.go +++ b/controllers/controller_filer_service.go @@ -28,28 +28,19 @@ func (r *SeaweedReconciler) createFilerHeadlessService(m *seaweedv1.Seaweed) *co Name: "swfs-filer", Protocol: corev1.Protocol("TCP"), Port: 8888, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 8888, - }, + TargetPort: intstr.FromInt(8888), }, { Name: "swfs-filer-grpc", Protocol: corev1.Protocol("TCP"), Port: 18888, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 18888, - }, + TargetPort: intstr.FromInt(18888), }, { Name: "swfs-s3", Protocol: corev1.Protocol("TCP"), Port: 8333, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 8333, - }, + TargetPort: intstr.FromInt(8333), }, }, Selector: labels, @@ -78,30 +69,21 @@ func (r *SeaweedReconciler) createFilerNodePortService(m *seaweedv1.Seaweed) *co Name: "swfs-filer", Protocol: corev1.Protocol("TCP"), Port: 8888, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 8888, - }, + TargetPort: intstr.FromInt(8888), NodePort: 30888, }, { Name: "swfs-filer-grpc", Protocol: corev1.Protocol("TCP"), Port: 18888, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 18888, - }, + TargetPort: intstr.FromInt(18888), NodePort: 31888, }, { Name: "swfs-s3", Protocol: corev1.Protocol("TCP"), Port: 8333, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 8333, - }, + TargetPort: intstr.FromInt(8333), NodePort: 30833, }, }, diff --git a/controllers/controller_master_service.go b/controllers/controller_master_service.go index 73b9f99..42d24bf 100644 --- a/controllers/controller_master_service.go +++ b/controllers/controller_master_service.go @@ -28,19 +28,13 @@ func (r *SeaweedReconciler) createMasterService(m *seaweedv1.Seaweed) *corev1.Se Name: "swfs-master", Protocol: corev1.Protocol("TCP"), Port: 9333, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 9333, - }, + TargetPort: intstr.FromInt(9333), }, { Name: "swfs-master-grpc", Protocol: corev1.Protocol("TCP"), Port: 19333, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 19333, - }, + TargetPort: intstr.FromInt(19333), }, }, Selector: labels, diff --git a/controllers/controller_volume_service.go b/controllers/controller_volume_service.go index aed2483..f8e9a9f 100644 --- a/controllers/controller_volume_service.go +++ b/controllers/controller_volume_service.go @@ -28,19 +28,13 @@ func (r *SeaweedReconciler) createVolumeServerService(m *seaweedv1.Seaweed) *cor Name: "swfs-volume", Protocol: corev1.Protocol("TCP"), Port: 8444, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 8444, - }, + TargetPort: intstr.FromInt(8444), }, { Name: "swfs-volume-grpc", Protocol: corev1.Protocol("TCP"), Port: 18444, - TargetPort: intstr.IntOrString{ - Type: intstr.Int, - IntVal: 18444, - }, + TargetPort: intstr.FromInt(18444), }, }, Selector: labels,