From df886ae3821726c17d63c08157d13ab332f4552a Mon Sep 17 00:00:00 2001 From: kqzh <35095889+kqzh@users.noreply.github.com> Date: Mon, 18 Sep 2023 14:35:51 +0800 Subject: [PATCH 1/4] feat: add spec port --- apis/apps/v1alpha1/nebulacluster_graphd.go | 19 ++++---- apis/apps/v1alpha1/nebulacluster_metad.go | 19 ++++---- apis/apps/v1alpha1/nebulacluster_storaged.go | 24 +++++----- apis/apps/v1alpha1/nebulacluster_types.go | 44 +++++++++++++++++++ .../apps.nebula-graph.io_nebulaclusters.yaml | 44 +++++++++++++++++++ pkg/controller/component/exporter.go | 10 ++--- 6 files changed, 118 insertions(+), 42 deletions(-) diff --git a/apis/apps/v1alpha1/nebulacluster_graphd.go b/apis/apps/v1alpha1/nebulacluster_graphd.go index 7eb11311..fb279336 100644 --- a/apis/apps/v1alpha1/nebulacluster_graphd.go +++ b/apis/apps/v1alpha1/nebulacluster_graphd.go @@ -28,14 +28,11 @@ import ( ) const ( - GraphdComponentType = ComponentType("graphd") - GraphdPortNameThrift = "thrift" - defaultGraphdPortThrift = 9669 - GraphdPortNameHTTP = "http" - defaultGraphdPortHTTP = 19669 - GraphdPortNameHTTP2 = "http2" - defaultGraphdPortHTTP2 = 19670 - defaultGraphdImage = "vesoft/nebula-graphd" + GraphdComponentType = ComponentType("graphd") + GraphdPortNameThrift = "thrift" + GraphdPortNameHTTP = "http" + GraphdPortNameHTTP2 = "http2" + defaultGraphdImage = "vesoft/nebula-graphd" ) var _ NebulaClusterComponent = &graphdComponent{} @@ -141,15 +138,15 @@ func (c *graphdComponent) GenerateContainerPorts() []corev1.ContainerPort { return []corev1.ContainerPort{ { Name: GraphdPortNameThrift, - ContainerPort: defaultGraphdPortThrift, + ContainerPort: c.nc.Spec.Graphd.Port, }, { Name: GraphdPortNameHTTP, - ContainerPort: defaultGraphdPortHTTP, + ContainerPort: c.nc.Spec.Graphd.HTTPPort, }, { Name: GraphdPortNameHTTP2, - ContainerPort: defaultGraphdPortHTTP2, + ContainerPort: c.nc.Spec.Graphd.HTTP2Port, }, } } diff --git a/apis/apps/v1alpha1/nebulacluster_metad.go b/apis/apps/v1alpha1/nebulacluster_metad.go index 9a0adea1..1e277a50 100644 --- a/apis/apps/v1alpha1/nebulacluster_metad.go +++ b/apis/apps/v1alpha1/nebulacluster_metad.go @@ -28,14 +28,11 @@ import ( ) const ( - MetadComponentType = ComponentType("metad") - MetadPortNameThrift = "thrift" - defaultMetadPortThrift = 9559 - MetadPortNameHTTP = "http" - defaultMetadPortHTTP = 19559 - MetadPortNameHTTP2 = "http2" - defaultMetadPortHTTP2 = 19560 - defaultMetadImage = "vesoft/nebula-metad" + MetadComponentType = ComponentType("metad") + MetadPortNameThrift = "thrift" + MetadPortNameHTTP = "http" + MetadPortNameHTTP2 = "http2" + defaultMetadImage = "vesoft/nebula-metad" ) var _ NebulaClusterComponent = &metadComponent{} @@ -158,15 +155,15 @@ func (c *metadComponent) GenerateContainerPorts() []corev1.ContainerPort { return []corev1.ContainerPort{ { Name: MetadPortNameThrift, - ContainerPort: defaultMetadPortThrift, + ContainerPort: c.nc.Spec.Metad.Port, }, { Name: MetadPortNameHTTP, - ContainerPort: defaultMetadPortHTTP, + ContainerPort: c.nc.Spec.Metad.HTTPPort, }, { Name: MetadPortNameHTTP2, - ContainerPort: defaultMetadPortHTTP2, + ContainerPort: c.nc.Spec.Metad.HTTP2Port, }, } } diff --git a/apis/apps/v1alpha1/nebulacluster_storaged.go b/apis/apps/v1alpha1/nebulacluster_storaged.go index 23f1b2ef..7cffaa98 100644 --- a/apis/apps/v1alpha1/nebulacluster_storaged.go +++ b/apis/apps/v1alpha1/nebulacluster_storaged.go @@ -28,16 +28,12 @@ import ( ) const ( - StoragedComponentType = ComponentType("storaged") - StoragedPortNameThrift = "thrift" - defaultStoragedPortThrift = 9779 - StoragedPortNameHTTP = "http" - defaultStoragedPortHTTP = 19779 - StoragedPortNameHTTP2 = "http2" - defaultStoragedPortHTTP2 = 19780 - StoragedPortNameAdmin = "admin" - defaultStoragedPortAdmin = 9778 - defaultStoragedImage = "vesoft/nebula-storaged" + StoragedComponentType = ComponentType("storaged") + StoragedPortNameThrift = "thrift" + StoragedPortNameHTTP = "http" + StoragedPortNameHTTP2 = "http2" + StoragedPortNameAdmin = "admin" + defaultStoragedImage = "vesoft/nebula-storaged" ) var _ NebulaClusterComponent = &storagedComponent{} @@ -159,19 +155,19 @@ func (c *storagedComponent) GenerateContainerPorts() []corev1.ContainerPort { return []corev1.ContainerPort{ { Name: StoragedPortNameThrift, - ContainerPort: defaultStoragedPortThrift, + ContainerPort: c.nc.Spec.Storaged.Port, }, { Name: StoragedPortNameHTTP, - ContainerPort: defaultStoragedPortHTTP, + ContainerPort: c.nc.Spec.Storaged.HTTPPort, }, { Name: StoragedPortNameHTTP2, - ContainerPort: defaultStoragedPortHTTP2, + ContainerPort: c.nc.Spec.Storaged.HTTP2Port, }, { Name: StoragedPortNameAdmin, - ContainerPort: defaultStoragedPortAdmin, + ContainerPort: c.nc.Spec.Storaged.AdminPort, }, } } diff --git a/apis/apps/v1alpha1/nebulacluster_types.go b/apis/apps/v1alpha1/nebulacluster_types.go index aec7d23e..bf16e2df 100644 --- a/apis/apps/v1alpha1/nebulacluster_types.go +++ b/apis/apps/v1alpha1/nebulacluster_types.go @@ -237,6 +237,10 @@ type ExporterSpec struct { // IgnoreRegex means the regex to ignore metrics // +optional IgnoreRegex string `json:"ignoreRegex,omitempty"` + + // +optional + // +kubebuilder:default=9100 + HTTPPort int32 `json:"httpPort,omitempty"` } type ConsoleSpec struct { @@ -358,6 +362,18 @@ type GraphdSpec struct { // K8S persistent volume claim for Graphd log volume. // +optional LogVolumeClaim *StorageClaim `json:"logVolumeClaim,omitempty"` + + // +optional + // +kubebuilder:default=9669 + Port int32 `json:"port,omitempty"` + + // +optional + // +kubebuilder:default=19669 + HTTPPort int32 `json:"httpPort,omitempty"` + + // +optional + // +kubebuilder:default=19670 + HTTP2Port int32 `json:"http2Port,omitempty"` } // MetadSpec defines the desired state of Metad @@ -384,6 +400,18 @@ type MetadSpec struct { // LicenseManagerURL defines a nebula license manager url LicenseManagerURL *string `json:"licenseManagerURL,omitempty"` + + // +optional + // +kubebuilder:default=9559 + Port int32 `json:"port,omitempty"` + + // +optional + // +kubebuilder:default=19559 + HTTPPort int32 `json:"httpPort,omitempty"` + + // +optional + // +kubebuilder:default=19560 + HTTP2Port int32 `json:"http2Port,omitempty"` } // StoragedSpec defines the desired state of Storaged @@ -417,6 +445,22 @@ type StoragedSpec struct { // Note: This feature is in alpha state. // +optional ConcurrentTransfer *bool `json:"concurrentTransfer,omitempty"` + + // +optional + // +kubebuilder:default=9779 + Port int32 `json:"port,omitempty"` + + // +optional + // +kubebuilder:default=19779 + HTTPPort int32 `json:"httpPort,omitempty"` + + // +optional + // +kubebuilder:default=19780 + HTTP2Port int32 `json:"http2Port,omitempty"` + + // +optional + // +kubebuilder:default=9778 + AdminPort int32 `json:"adminPort,omitempty"` } // ComponentSpec is a common set of k8s resource configs for nebula components. diff --git a/config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml b/config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml index dd0e64f8..ae9b59ec 100644 --- a/config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml +++ b/config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml @@ -920,6 +920,10 @@ spec: - name type: object type: array + httpPort: + default: 9100 + format: int32 + type: integer ignoreRegex: type: string image: @@ -3590,6 +3594,14 @@ spec: - name type: object type: array + http2Port: + default: 19670 + format: int32 + type: integer + httpPort: + default: 19669 + format: int32 + type: integer image: type: string initContainers: @@ -4319,6 +4331,10 @@ spec: additionalProperties: type: string type: object + port: + default: 9669 + format: int32 + type: integer readinessProbe: properties: exec: @@ -6368,6 +6384,14 @@ spec: - name type: object type: array + http2Port: + default: 19560 + format: int32 + type: integer + httpPort: + default: 19559 + format: int32 + type: integer image: type: string initContainers: @@ -7106,6 +7130,10 @@ spec: additionalProperties: type: string type: object + port: + default: 9559 + format: int32 + type: integer readinessProbe: properties: exec: @@ -8706,6 +8734,10 @@ spec: type: object storaged: properties: + adminPort: + default: 9778 + format: int32 + type: integer affinity: properties: nodeAffinity: @@ -9187,6 +9219,14 @@ spec: - name type: object type: array + http2Port: + default: 19780 + format: int32 + type: integer + httpPort: + default: 19779 + format: int32 + type: integer image: type: string initContainers: @@ -9916,6 +9956,10 @@ spec: additionalProperties: type: string type: object + port: + default: 9779 + format: int32 + type: integer readinessProbe: properties: exec: diff --git a/pkg/controller/component/exporter.go b/pkg/controller/component/exporter.go index 0c56defb..21d85c34 100644 --- a/pkg/controller/component/exporter.go +++ b/pkg/controller/component/exporter.go @@ -32,8 +32,6 @@ import ( "github.com/vesoft-inc/nebula-operator/pkg/util/maputil" ) -const defaultMetricsPort = 9100 - type nebulaExporter struct { clientSet kube.ClientSet } @@ -97,8 +95,8 @@ func (e *nebulaExporter) generateService(nc *v1alpha1.NebulaCluster) *corev1.Ser { Name: "metrics", Protocol: corev1.ProtocolTCP, - Port: defaultMetricsPort, - TargetPort: intstr.FromInt(defaultMetricsPort), + Port: nc.Spec.Exporter.HTTPPort, + TargetPort: intstr.FromInt(int(nc.Spec.Exporter.HTTPPort)), }, }, }, @@ -137,7 +135,7 @@ func (e *nebulaExporter) generateDeployment(nc *v1alpha1.NebulaCluster) *appsv1. { Name: "metrics", Protocol: corev1.ProtocolTCP, - ContainerPort: defaultMetricsPort, + ContainerPort: nc.Spec.Exporter.HTTPPort, }, }, VolumeMounts: nc.ExporterComponent().ComponentSpec().VolumeMounts(), @@ -149,7 +147,7 @@ func (e *nebulaExporter) generateDeployment(nc *v1alpha1.NebulaCluster) *appsv1. container.LivenessProbe = &corev1.Probe{ ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ - Port: intstr.FromInt(defaultMetricsPort), + Port: intstr.FromInt(int(nc.Spec.Exporter.HTTPPort)), Path: "/health", Scheme: corev1.URISchemeHTTP, }, From d9b8feff61ac07f3a9da1e752451464b5ebf8784 Mon Sep 17 00:00:00 2001 From: kqzh <35095889+kqzh@users.noreply.github.com> Date: Mon, 18 Sep 2023 17:21:07 +0800 Subject: [PATCH 2/4] feat: adjust cmd --- apis/apps/v1alpha1/nebulacluster_common.go | 9 +++++ apis/apps/v1alpha1/nebulacluster_component.go | 5 +++ apis/apps/v1alpha1/nebulacluster_graphd.go | 33 ++++++++++----- apis/apps/v1alpha1/nebulacluster_metad.go | 33 ++++++++++----- apis/apps/v1alpha1/nebulacluster_storaged.go | 40 ++++++++++++------- apis/apps/v1alpha1/nebulacluster_types.go | 16 -------- .../apps.nebula-graph.io_nebulaclusters.yaml | 16 -------- 7 files changed, 88 insertions(+), 64 deletions(-) diff --git a/apis/apps/v1alpha1/nebulacluster_common.go b/apis/apps/v1alpha1/nebulacluster_common.go index 886f8c95..a65eb4aa 100644 --- a/apis/apps/v1alpha1/nebulacluster_common.go +++ b/apis/apps/v1alpha1/nebulacluster_common.go @@ -471,6 +471,15 @@ func generateContainers(c NebulaClusterComponent, cm *corev1.ConfigMap) []corev1 flags += " --assigned_zone=$NODE_ZONE" } + c.GenerateContainerPorts() + + if !c.IsDefaultThriftPort() { + flags += " --port=" + strconv.Itoa(int(c.GetHTTPPort())) + } + if !c.IsDefaultHTTPPort() { + flags += " --ws_http_port=" + strconv.Itoa(int(c.GetHTTPPort())) + } + cmd := []string{"/bin/sh", "-ecx"} if c.ComponentType() == GraphdComponentType && nc.IsIntraZoneReadingEnabled() { cmd = append(cmd, fmt.Sprintf("source /node/zone; echo $NODE_ZONE; exec /usr/local/nebula/bin/nebula-%s", componentType)+ diff --git a/apis/apps/v1alpha1/nebulacluster_component.go b/apis/apps/v1alpha1/nebulacluster_component.go index edc295bb..bb1d23c3 100644 --- a/apis/apps/v1alpha1/nebulacluster_component.go +++ b/apis/apps/v1alpha1/nebulacluster_component.go @@ -206,6 +206,11 @@ type NebulaClusterComponent interface { IsReady() bool GetUpdateRevision() string UpdateComponentStatus(status *ComponentStatus) + + IsDefaultThriftPort() bool + GetThriftPort() int32 + IsDefaultHTTPPort() bool + GetHTTPPort() int32 } // +k8s:deepcopy-gen=false diff --git a/apis/apps/v1alpha1/nebulacluster_graphd.go b/apis/apps/v1alpha1/nebulacluster_graphd.go index fb279336..7a3ea898 100644 --- a/apis/apps/v1alpha1/nebulacluster_graphd.go +++ b/apis/apps/v1alpha1/nebulacluster_graphd.go @@ -28,11 +28,14 @@ import ( ) const ( - GraphdComponentType = ComponentType("graphd") - GraphdPortNameThrift = "thrift" - GraphdPortNameHTTP = "http" - GraphdPortNameHTTP2 = "http2" - defaultGraphdImage = "vesoft/nebula-graphd" + GraphdComponentType = ComponentType("graphd") + GraphdPortNameThrift = "thrift" + defaultGraphdPortThrift = 9669 + GraphdPortNameHTTP = "http" + defaultGraphdPortHTTP = 19669 + GraphdPortNameHTTP2 = "http2" + defaultGraphdPortHTTP2 = 19670 + defaultGraphdImage = "vesoft/nebula-graphd" ) var _ NebulaClusterComponent = &graphdComponent{} @@ -144,10 +147,6 @@ func (c *graphdComponent) GenerateContainerPorts() []corev1.ContainerPort { Name: GraphdPortNameHTTP, ContainerPort: c.nc.Spec.Graphd.HTTPPort, }, - { - Name: GraphdPortNameHTTP2, - ContainerPort: c.nc.Spec.Graphd.HTTP2Port, - }, } } @@ -305,3 +304,19 @@ func (c *graphdComponent) GenerateConfigMap() *corev1.ConfigMap { func (c *graphdComponent) UpdateComponentStatus(status *ComponentStatus) { c.nc.Status.Graphd = *status } + +func (c *graphdComponent) IsDefaultThriftPort() bool { + return c.nc.Spec.Graphd.Port == defaultGraphdPortThrift +} + +func (c *graphdComponent) GetThriftPort() int32 { + return c.nc.Spec.Graphd.Port +} + +func (c *graphdComponent) IsDefaultHTTPPort() bool { + return c.nc.Spec.Graphd.HTTPPort == defaultGraphdPortHTTP +} + +func (c *graphdComponent) GetHTTPPort() int32 { + return c.nc.Spec.Graphd.HTTPPort +} diff --git a/apis/apps/v1alpha1/nebulacluster_metad.go b/apis/apps/v1alpha1/nebulacluster_metad.go index 1e277a50..54af4b18 100644 --- a/apis/apps/v1alpha1/nebulacluster_metad.go +++ b/apis/apps/v1alpha1/nebulacluster_metad.go @@ -28,11 +28,14 @@ import ( ) const ( - MetadComponentType = ComponentType("metad") - MetadPortNameThrift = "thrift" - MetadPortNameHTTP = "http" - MetadPortNameHTTP2 = "http2" - defaultMetadImage = "vesoft/nebula-metad" + MetadComponentType = ComponentType("metad") + MetadPortNameThrift = "thrift" + defaultMetadPortThrift = 9559 + MetadPortNameHTTP = "http" + defaultMetadPortHTTP = 19559 + MetadPortNameHTTP2 = "http2" + defaultMetadPortHTTP2 = 19560 + defaultMetadImage = "vesoft/nebula-metad" ) var _ NebulaClusterComponent = &metadComponent{} @@ -161,10 +164,6 @@ func (c *metadComponent) GenerateContainerPorts() []corev1.ContainerPort { Name: MetadPortNameHTTP, ContainerPort: c.nc.Spec.Metad.HTTPPort, }, - { - Name: MetadPortNameHTTP2, - ContainerPort: c.nc.Spec.Metad.HTTP2Port, - }, } } @@ -383,3 +382,19 @@ func (c *metadComponent) GenerateConfigMap() *corev1.ConfigMap { func (c *metadComponent) UpdateComponentStatus(status *ComponentStatus) { c.nc.Status.Metad = *status } + +func (c *metadComponent) IsDefaultThriftPort() bool { + return c.nc.Spec.Metad.Port == defaultMetadPortThrift +} + +func (c *metadComponent) GetThriftPort() int32 { + return c.nc.Spec.Metad.Port +} + +func (c *metadComponent) IsDefaultHTTPPort() bool { + return c.nc.Spec.Metad.HTTPPort == defaultMetadPortHTTP +} + +func (c *metadComponent) GetHTTPPort() int32 { + return c.nc.Spec.Metad.HTTPPort +} diff --git a/apis/apps/v1alpha1/nebulacluster_storaged.go b/apis/apps/v1alpha1/nebulacluster_storaged.go index 7cffaa98..86ef828c 100644 --- a/apis/apps/v1alpha1/nebulacluster_storaged.go +++ b/apis/apps/v1alpha1/nebulacluster_storaged.go @@ -28,12 +28,16 @@ import ( ) const ( - StoragedComponentType = ComponentType("storaged") - StoragedPortNameThrift = "thrift" - StoragedPortNameHTTP = "http" - StoragedPortNameHTTP2 = "http2" - StoragedPortNameAdmin = "admin" - defaultStoragedImage = "vesoft/nebula-storaged" + StoragedComponentType = ComponentType("storaged") + StoragedPortNameThrift = "thrift" + defaultStoragedPortThrift = 9779 + StoragedPortNameHTTP = "http" + defaultStoragedPortHTTP = 19779 + StoragedPortNameHTTP2 = "http2" + defaultStoragedPortHTTP2 = 19780 + StoragedPortNameAdmin = "admin" + defaultStoragedPortAdmin = 9778 + defaultStoragedImage = "vesoft/nebula-storaged" ) var _ NebulaClusterComponent = &storagedComponent{} @@ -161,14 +165,6 @@ func (c *storagedComponent) GenerateContainerPorts() []corev1.ContainerPort { Name: StoragedPortNameHTTP, ContainerPort: c.nc.Spec.Storaged.HTTPPort, }, - { - Name: StoragedPortNameHTTP2, - ContainerPort: c.nc.Spec.Storaged.HTTP2Port, - }, - { - Name: StoragedPortNameAdmin, - ContainerPort: c.nc.Spec.Storaged.AdminPort, - }, } } @@ -384,3 +380,19 @@ func storageDataVolumeClaims(storageClaims []StorageClaim, componentType string) } return pvcs, nil } + +func (c *storagedComponent) IsDefaultThriftPort() bool { + return c.nc.Spec.Storaged.Port == defaultStoragedPortThrift +} + +func (c *storagedComponent) GetThriftPort() int32 { + return c.nc.Spec.Storaged.Port +} + +func (c *storagedComponent) IsDefaultHTTPPort() bool { + return c.nc.Spec.Storaged.HTTPPort == defaultStoragedPortHTTP +} + +func (c *storagedComponent) GetHTTPPort() int32 { + return c.nc.Spec.Storaged.HTTPPort +} diff --git a/apis/apps/v1alpha1/nebulacluster_types.go b/apis/apps/v1alpha1/nebulacluster_types.go index bf16e2df..1f427e03 100644 --- a/apis/apps/v1alpha1/nebulacluster_types.go +++ b/apis/apps/v1alpha1/nebulacluster_types.go @@ -370,10 +370,6 @@ type GraphdSpec struct { // +optional // +kubebuilder:default=19669 HTTPPort int32 `json:"httpPort,omitempty"` - - // +optional - // +kubebuilder:default=19670 - HTTP2Port int32 `json:"http2Port,omitempty"` } // MetadSpec defines the desired state of Metad @@ -408,10 +404,6 @@ type MetadSpec struct { // +optional // +kubebuilder:default=19559 HTTPPort int32 `json:"httpPort,omitempty"` - - // +optional - // +kubebuilder:default=19560 - HTTP2Port int32 `json:"http2Port,omitempty"` } // StoragedSpec defines the desired state of Storaged @@ -453,14 +445,6 @@ type StoragedSpec struct { // +optional // +kubebuilder:default=19779 HTTPPort int32 `json:"httpPort,omitempty"` - - // +optional - // +kubebuilder:default=19780 - HTTP2Port int32 `json:"http2Port,omitempty"` - - // +optional - // +kubebuilder:default=9778 - AdminPort int32 `json:"adminPort,omitempty"` } // ComponentSpec is a common set of k8s resource configs for nebula components. diff --git a/config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml b/config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml index ae9b59ec..54d567ce 100644 --- a/config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml +++ b/config/crd/bases/apps.nebula-graph.io_nebulaclusters.yaml @@ -3594,10 +3594,6 @@ spec: - name type: object type: array - http2Port: - default: 19670 - format: int32 - type: integer httpPort: default: 19669 format: int32 @@ -6384,10 +6380,6 @@ spec: - name type: object type: array - http2Port: - default: 19560 - format: int32 - type: integer httpPort: default: 19559 format: int32 @@ -8734,10 +8726,6 @@ spec: type: object storaged: properties: - adminPort: - default: 9778 - format: int32 - type: integer affinity: properties: nodeAffinity: @@ -9219,10 +9207,6 @@ spec: - name type: object type: array - http2Port: - default: 19780 - format: int32 - type: integer httpPort: default: 19779 format: int32 From 9508215b636b92b13a695a412a3faf65de1e1526 Mon Sep 17 00:00:00 2001 From: kqzh <35095889+kqzh@users.noreply.github.com> Date: Mon, 18 Sep 2023 17:21:50 +0800 Subject: [PATCH 3/4] fix: typo --- apis/apps/v1alpha1/nebulacluster_common.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/apis/apps/v1alpha1/nebulacluster_common.go b/apis/apps/v1alpha1/nebulacluster_common.go index a65eb4aa..bded936e 100644 --- a/apis/apps/v1alpha1/nebulacluster_common.go +++ b/apis/apps/v1alpha1/nebulacluster_common.go @@ -470,9 +470,6 @@ func generateContainers(c NebulaClusterComponent, cm *corev1.ConfigMap) []corev1 if c.ComponentType() == GraphdComponentType && nc.IsIntraZoneReadingEnabled() { flags += " --assigned_zone=$NODE_ZONE" } - - c.GenerateContainerPorts() - if !c.IsDefaultThriftPort() { flags += " --port=" + strconv.Itoa(int(c.GetHTTPPort())) } From 3a5b8d2b82e4842619fef1e0c67314d5434c0044 Mon Sep 17 00:00:00 2001 From: kqzh <35095889+kqzh@users.noreply.github.com> Date: Mon, 18 Sep 2023 17:59:31 +0800 Subject: [PATCH 4/4] fix: port --- apis/apps/v1alpha1/nebulacluster_common.go | 2 +- apis/apps/v1alpha1/nebulacluster_graphd.go | 2 -- apis/apps/v1alpha1/nebulacluster_metad.go | 2 -- apis/apps/v1alpha1/nebulacluster_storaged.go | 6 ++++-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apis/apps/v1alpha1/nebulacluster_common.go b/apis/apps/v1alpha1/nebulacluster_common.go index bded936e..624a6087 100644 --- a/apis/apps/v1alpha1/nebulacluster_common.go +++ b/apis/apps/v1alpha1/nebulacluster_common.go @@ -471,7 +471,7 @@ func generateContainers(c NebulaClusterComponent, cm *corev1.ConfigMap) []corev1 flags += " --assigned_zone=$NODE_ZONE" } if !c.IsDefaultThriftPort() { - flags += " --port=" + strconv.Itoa(int(c.GetHTTPPort())) + flags += " --port=" + strconv.Itoa(int(c.GetThriftPort())) } if !c.IsDefaultHTTPPort() { flags += " --ws_http_port=" + strconv.Itoa(int(c.GetHTTPPort())) diff --git a/apis/apps/v1alpha1/nebulacluster_graphd.go b/apis/apps/v1alpha1/nebulacluster_graphd.go index 7a3ea898..b42c9401 100644 --- a/apis/apps/v1alpha1/nebulacluster_graphd.go +++ b/apis/apps/v1alpha1/nebulacluster_graphd.go @@ -33,8 +33,6 @@ const ( defaultGraphdPortThrift = 9669 GraphdPortNameHTTP = "http" defaultGraphdPortHTTP = 19669 - GraphdPortNameHTTP2 = "http2" - defaultGraphdPortHTTP2 = 19670 defaultGraphdImage = "vesoft/nebula-graphd" ) diff --git a/apis/apps/v1alpha1/nebulacluster_metad.go b/apis/apps/v1alpha1/nebulacluster_metad.go index 54af4b18..bf8172f9 100644 --- a/apis/apps/v1alpha1/nebulacluster_metad.go +++ b/apis/apps/v1alpha1/nebulacluster_metad.go @@ -33,8 +33,6 @@ const ( defaultMetadPortThrift = 9559 MetadPortNameHTTP = "http" defaultMetadPortHTTP = 19559 - MetadPortNameHTTP2 = "http2" - defaultMetadPortHTTP2 = 19560 defaultMetadImage = "vesoft/nebula-metad" ) diff --git a/apis/apps/v1alpha1/nebulacluster_storaged.go b/apis/apps/v1alpha1/nebulacluster_storaged.go index 86ef828c..df1d175e 100644 --- a/apis/apps/v1alpha1/nebulacluster_storaged.go +++ b/apis/apps/v1alpha1/nebulacluster_storaged.go @@ -33,8 +33,6 @@ const ( defaultStoragedPortThrift = 9779 StoragedPortNameHTTP = "http" defaultStoragedPortHTTP = 19779 - StoragedPortNameHTTP2 = "http2" - defaultStoragedPortHTTP2 = 19780 StoragedPortNameAdmin = "admin" defaultStoragedPortAdmin = 9778 defaultStoragedImage = "vesoft/nebula-storaged" @@ -165,6 +163,10 @@ func (c *storagedComponent) GenerateContainerPorts() []corev1.ContainerPort { Name: StoragedPortNameHTTP, ContainerPort: c.nc.Spec.Storaged.HTTPPort, }, + { + Name: StoragedPortNameAdmin, + ContainerPort: c.nc.Spec.Storaged.Port - 1, + }, } }