fix the nameServerListStr empty bugs; regenerate some yaml files
diff --git a/deploy/crds/rocketmq.apache.org_brokers.yaml b/deploy/crds/rocketmq.apache.org_brokers.yaml
index fae4a43..6e80d29 100644
--- a/deploy/crds/rocketmq.apache.org_brokers.yaml
+++ b/deploy/crds/rocketmq.apache.org_brokers.yaml
@@ -49,9 +49,6 @@
spec:
description: BrokerSpec defines the desired state of Broker
properties:
- ServiceAccountName:
- description: ServiceAccountName
- type: string
affinity:
description: Affinity the pod's scheduling constraints
properties:
@@ -1356,6 +1353,9 @@
type: string
type: object
type: object
+ serviceAccountName:
+ description: ServiceAccountName
+ type: string
size:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "operator-sdk generate k8s" to regenerate code after
@@ -1425,6 +1425,23 @@
type: string
metadata:
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
+ properties:
+ annotations:
+ additionalProperties:
+ type: string
+ type: object
+ finalizers:
+ items:
+ type: string
+ type: array
+ labels:
+ additionalProperties:
+ type: string
+ type: object
+ name:
+ type: string
+ namespace:
+ type: string
type: object
spec:
description: 'Spec defines the desired characteristics of a
@@ -2081,6 +2098,23 @@
description: May contain labels and annotations that
will be copied into the PVC when creating it. No other
fields are allowed and will be rejected during validation.
+ properties:
+ annotations:
+ additionalProperties:
+ type: string
+ type: object
+ finalizers:
+ items:
+ type: string
+ type: array
+ labels:
+ additionalProperties:
+ type: string
+ type: object
+ name:
+ type: string
+ namespace:
+ type: string
type: object
spec:
description: The specification for the PersistentVolumeClaim.
diff --git a/deploy/crds/rocketmq.apache.org_consoles.yaml b/deploy/crds/rocketmq.apache.org_consoles.yaml
index c730ef6..fab41e0 100644
--- a/deploy/crds/rocketmq.apache.org_consoles.yaml
+++ b/deploy/crds/rocketmq.apache.org_consoles.yaml
@@ -63,6 +63,23 @@
type: string
metadata:
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
+ properties:
+ annotations:
+ additionalProperties:
+ type: string
+ type: object
+ finalizers:
+ items:
+ type: string
+ type: array
+ labels:
+ additionalProperties:
+ type: string
+ type: object
+ name:
+ type: string
+ namespace:
+ type: string
type: object
spec:
description: Specification of the desired behavior of the Deployment.
@@ -205,6 +222,23 @@
metadata:
description: 'Standard object''s metadata. More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
+ properties:
+ annotations:
+ additionalProperties:
+ type: string
+ type: object
+ finalizers:
+ items:
+ type: string
+ type: array
+ labels:
+ additionalProperties:
+ type: string
+ type: object
+ name:
+ type: string
+ namespace:
+ type: string
type: object
spec:
description: 'Specification of the desired behavior of
@@ -6484,6 +6518,23 @@
the PVC when creating it. No other
fields are allowed and will be rejected
during validation.
+ properties:
+ annotations:
+ additionalProperties:
+ type: string
+ type: object
+ finalizers:
+ items:
+ type: string
+ type: array
+ labels:
+ additionalProperties:
+ type: string
+ type: object
+ name:
+ type: string
+ namespace:
+ type: string
type: object
spec:
description: The specification for the
diff --git a/deploy/crds/rocketmq.apache.org_nameservices.yaml b/deploy/crds/rocketmq.apache.org_nameservices.yaml
index 04f21e5..315d85e 100644
--- a/deploy/crds/rocketmq.apache.org_nameservices.yaml
+++ b/deploy/crds/rocketmq.apache.org_nameservices.yaml
@@ -46,9 +46,6 @@
spec:
description: NameServiceSpec defines the desired state of NameService
properties:
- ServiceAccountName:
- description: ServiceAccountName
- type: string
affinity:
description: Affinity the pod's scheduling constraints
properties:
@@ -1239,6 +1236,9 @@
type: string
type: object
type: object
+ serviceAccountName:
+ description: ServiceAccountName
+ type: string
size:
description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
Important: Run "operator-sdk generate k8s" to regenerate code after
@@ -1310,6 +1310,23 @@
type: string
metadata:
description: 'Standard object''s metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata'
+ properties:
+ annotations:
+ additionalProperties:
+ type: string
+ type: object
+ finalizers:
+ items:
+ type: string
+ type: array
+ labels:
+ additionalProperties:
+ type: string
+ type: object
+ name:
+ type: string
+ namespace:
+ type: string
type: object
spec:
description: 'Spec defines the desired characteristics of a
diff --git a/deploy/role.yaml b/deploy/role.yaml
index f75b84e..b9c63ce 100644
--- a/deploy/role.yaml
+++ b/deploy/role.yaml
@@ -1,17 +1,4 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
diff --git a/pkg/controller/nameservice/nameservice_controller.go b/pkg/controller/nameservice/nameservice_controller.go
index 5e6375f..ece34de 100644
--- a/pkg/controller/nameservice/nameservice_controller.go
+++ b/pkg/controller/nameservice/nameservice_controller.go
@@ -183,6 +183,11 @@
sort.Strings(hostIps)
sort.Strings(instance.Status.NameServers)
+ nameServerListStr := ""
+ for _, value := range hostIps {
+ nameServerListStr = nameServerListStr + value + ":9876;"
+ }
+
// Update status.NameServers if needed
if !reflect.DeepEqual(hostIps, instance.Status.NameServers) {
oldNameServerListStr := ""
@@ -190,10 +195,6 @@
oldNameServerListStr = oldNameServerListStr + value + ":9876;"
}
- nameServerListStr := ""
- for _, value := range hostIps {
- nameServerListStr = nameServerListStr + value + ":9876;"
- }
share.NameServersStr = nameServerListStr[:len(nameServerListStr)-1]
reqLogger.Info("share.NameServersStr:" + share.NameServersStr)
@@ -243,8 +244,13 @@
runningNameServerNum := getRunningNameServersNum(podList.Items)
if runningNameServerNum == instance.Spec.Size {
share.IsNameServersStrInitialized = true
+ share.NameServersStr = nameServerListStr // reassign if operator restarts
}
+ reqLogger.Info("Share variables", "GroupNum", share.GroupNum,
+ "NameServersStr", share.NameServersStr, "IsNameServersStrUpdated", share.IsNameServersStrUpdated,
+ "IsNameServersStrInitialized", share.IsNameServersStrInitialized, "BrokerClusterName", share.BrokerClusterName)
+
if requeue {
return reconcile.Result{Requeue: true, RequeueAfter: time.Duration(cons.RequeueIntervalInSecond) * time.Second}, nil
}