You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by "advancedxy (via GitHub)" <gi...@apache.org> on 2023/02/01 13:44:13 UTC

[GitHub] [incubator-uniffle] advancedxy commented on a diff in pull request #528: [ISSUE-469][operator] feat: supports adding labels to rss pods.

advancedxy commented on code in PR #528:
URL: https://github.com/apache/incubator-uniffle/pull/528#discussion_r1093240046


##########
deploy/kubernetes/operator/pkg/utils/rss.go:
##########
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+package utils
+
+import (
+	corev1 "k8s.io/api/core/v1"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/utils/pointer"
+
+	unifflev1alpha1 "github.com/apache/incubator-uniffle/deploy/kubernetes/operator/api/uniffle/v1alpha1"
+)
+
+const (
+	defaultRssName              = "rss"
+	defaultConfigMapName        = "rss-config"
+	defaultCoordinatorSync      = true
+	defaultCoordinatorCount     = 2
+	defaultExcludeNodesFilePath = "/config/exclude_nodes"
+	defaultShuffleServerSync    = false
+	defaultRPCPort              = 19997
+	defaultHTTPPort             = 19996
+	defaultReplicas             = 1
+	defaultXmxSize              = "800M"
+	defaultConfigDir            = "/data/rssadmin/rss/conf"
+	defaultHostNetwork          = true
+	defaultMainImage            = "rss-server:latest"
+)
+
+var (
+	defaultCoordinatorRPCNodePorts  = []int32{30001, 30011}
+	defaultCoordinatorHTTPNodePorts = []int32{30002, 30012}
+)
+
+// BuildRSSWithDefaultValue builds a rss object with required or default values for testing.
+func BuildRSSWithDefaultValue() *unifflev1alpha1.RemoteShuffleService {

Review Comment:
   is it necessary to add ut for this method?



##########
deploy/kubernetes/operator/pkg/controller/sync/shuffleserver/shuffleserver_test.go:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+package shuffleserver
+
+import (
+	"fmt"
+	"testing"
+
+	appsv1 "k8s.io/api/apps/v1"
+
+	unifflev1alpha1 "github.com/apache/incubator-uniffle/deploy/kubernetes/operator/api/uniffle/v1alpha1"
+	"github.com/apache/incubator-uniffle/deploy/kubernetes/operator/pkg/utils"
+)
+
+// IsValidSts checks generated statefulSet, returns whether it is valid and error message.
+type IsValidSts func(*appsv1.StatefulSet) (bool, error)
+
+func buildRssWithLabels() *unifflev1alpha1.RemoteShuffleService {
+	rss := utils.BuildRSSWithDefaultValue()
+	rss.Spec.ShuffleServer.Labels = map[string]string{
+		"key1":                              "value1",
+		"key2":                              "value2",
+		"key3":                              "value3",
+		"uniffle.apache.org/shuffle-server": "change-test",

Review Comment:
   map[string]string {
   "key1": ...
   "key2":...
   ...
   }
   
   has been occurred multiple times.. is it possible to extract this as a var?



##########
deploy/kubernetes/operator/pkg/controller/sync/shuffleserver/shuffleserver_test.go:
##########
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+package shuffleserver
+
+import (
+	"fmt"
+	"testing"
+
+	appsv1 "k8s.io/api/apps/v1"
+
+	unifflev1alpha1 "github.com/apache/incubator-uniffle/deploy/kubernetes/operator/api/uniffle/v1alpha1"

Review Comment:
   To be honest, I'm prefer uniffleAPI, which is simple?
   `v1alpha1` is just too verbose..



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org