himanshug commented on a change in pull request #10686:
URL: https://github.com/apache/druid/pull/10686#discussion_r549418236



##########
File path: docs/development/extensions-core/kubernetes.md
##########
@@ -57,3 +55,34 @@ Additionally, this extension has following configuration.
 |`druid.discovery.k8s.renewDeadline`|`Duration`|Lease renewal period used by 
Leader.|PT17S|No|
 |`druid.discovery.k8s.retryPeriod`|`Duration`|Retry wait used by Leader 
Election algorithm on failed operations.|PT5S|No|
 
+### Gotchas
+
+- Label/Annotation path in each pod spec MUST EXIST, which is easily satisfied 
if there is at least one label/annotation in the pod spec already. This 
limitation may be removed in future.
+- Druid Pods need permissions to be able to add labels to self-pod, List and 
Watch other Pods, create ConfigMap for leader election. Assuming, "default" 
service account is used by Druid pods, you might need to add following or 
something similar Kubernetes Role and Role Binding.

Review comment:
       everyone needs pod list/update .
   `create/update ConfigMap` is needed only by coordinators/overlords which 
participate in leader election ... but `read ConfigMap` is needed by all so as 
to know who the leader is. That said, I haven't tested such granularity and 
would just give same permission to all pods.

##########
File path: integration-tests/script/setup_druid_on_k8s.sh
##########
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+# 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.
+
+set -e
+
+export KUBECTL="sudo /usr/local/bin/kubectl"
+
+# setup client keystore
+cd integration-tests
+./docker/tls/generate-client-certs-and-keystores.sh
+rm -rf docker/client_tls
+cp -r client_tls docker/client_tls
+cd ..
+
+# Build Docker images for pods
+mvn -B -ff -q dependency:go-offline \
+      install \
+      -Pdist,bundle-contrib-exts \
+      -Pskip-static-checks,skip-tests \
+      -Dmaven.javadoc.skip=true
+
+docker build -t druid/cluster:v1 -f 
distribution/docker/DockerfileBuildTarAdvanced .
+
+# This tmp dir is used for MiddleManager pod and Historical Pod to cache 
segments.
+mkdir tmp
+chmod 777 tmp
+
+$KUBECTL apply -f integration-tests/k8s/role-and-binding.yaml
+sed -i "s|REPLACE_VOLUMES|`pwd`|g" integration-tests/k8s/tiny-cluster.yaml
+$KUBECTL apply -f integration-tests/k8s/tiny-cluster.yaml
+
+# Wait 4 * 15 seconds to launch pods.
+#count=0
+#JSONPATH='{range .items[*]}{@.metadata.name}:{range 
@.status.conditions[*]}{@.type}={@.status};{end}{end}'; until sudo 
/usr/local/bin/kubectl -n default get pods -lapp=travis-example -o 
jsonpath="$JSONPATH" 2>&1 | grep -q "Ready=True"; do sleep 4;if [ $count -eq 15 
];then break 2 ;else let "count++";fi;echo $i;echo "waiting for travis-example 
deployment to be available"; sudo /usr/local/bin/kubectl get pods -n default; 
done
+sleep 120
+
+## Debug And FastFail
+
+sudo /usr/local/bin/kubectl get pod

Review comment:
       changed

##########
File path: integration-tests/script/setup_k8s_cluster.sh
##########
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+# 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.
+
+set -e
+
+# Set Necessary ENV
+export CHANGE_MINIKUBE_NONE_USER=true
+export MINIKUBE_WANTUPDATENOTIFICATION=false
+export MINIKUBE_WANTREPORTERRORPROMPT=false
+export MINIKUBE_HOME=$HOME
+export KUBECONFIG=$HOME/.kube/config
+export KUBECTL="sudo /usr/local/bin/kubectl"

Review comment:
       changed




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to