<p dir="auto">A few points of improvement of the Redis example on <a href="https://github.com/kubernetes/kubernetes/tree/master/examples/redis">https://github.com/kubernetes/kubernetes/tree/master/examples/redis</a>:</p>
<ul dir="auto">
<li>
<p dir="auto">Configuration files should include only fields that deviate from the <a href="http://download.redis.io/redis-stable/redis.conf" rel="nofollow">default</a> in order to clarify. For example for <code class="notranslate">redis-master.conf</code> it could probably be (excluding comments) using <a href="http://redis.io/commands/config-get" rel="nofollow">CONFIG GET</a> to check, or just use a single <code class="notranslate">redis.conf</code> like:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="save 900 1
save 300 10
save 60 10000
dir /redis-master-data
slaveof ${master-ip} ${master-port}  # only for slave, not when bootstrapping."><pre class="notranslate"><code class="notranslate">save 900 1
save 300 10
save 60 10000
dir /redis-master-data
slaveof ${master-ip} ${master-port}  # only for slave, not when bootstrapping.
</code></pre></div>
</li>
<li>
<p dir="auto">Describe how to use in clients (should be to use the <code class="notranslate">redis-sentinel</code> host name but should be documented)</p>
</li>
<li>
<p dir="auto">Describe how to upgrade to newer versions of Redis, preferably using the <code class="notranslate">Deployment</code> Job.</p>
</li>
<li>
<p dir="auto">Could simplify <a href="https://github.com/kubernetes/kubernetes/blob/master/examples/redis/image/run.sh"><code class="notranslate">run.sh</code></a>:</p>
<ul dir="auto">
<li>Use <code class="notranslate">cat some.config.template | envsubst &gt; some.config</code> for both cases: <code class="notranslate">launchsentinel()</code> and <code class="notranslate">launchslave()</code></li>
<li>Use Kubernetes <code class="notranslate">args: ["redis-server", "/redis-master/redis.conf"]</code> to start the master.</li>
<li>Use Kubernetes <code class="notranslate">args</code> to ask the <code class="notranslate">redis-master</code> Pod to start with master IP set to <code class="notranslate">$(hostname -i)</code>.</li>
<li>Possibly even remove completely <code class="notranslate">run.sh</code></li>
</ul>
</li>
<li>
<p dir="auto">Remove to describe <code class="notranslate">redis-proxy.yaml</code></p>
</li>
</ul>
<p dir="auto">Extra question: Instead of <code class="notranslate">while true</code>, why not just let Kubernetes handle that? It seems useful to see pods restarting vs seeing them running. Of course one should include some probes (could be in the example as well), so that it'd get restarted anyway.</p>
<p dir="auto">Right now, when users create federation resources (for ex: services, namespaces), we create them in federation control plane and all underlying kubernetes clusters. We need to enable users to be able to specify a subset of kubernetes clusters in which that resource should be created.<br>
For ex: while registering a cluster, user needs to create a secret with kubeconfig for that cluster. This secret is required only in the federation control plane and not in the underlying kubernetes cluster. We need a way for users to specify that this secret should not be created in any of the underlying kubernetes clusters.</p>
<p dir="auto">Proposal: Support annotation with key <code class="notranslate">federation.beta.kubernetes.io/cluster-selector</code>. Value will be a struct ClusterSelector which be exactly same as <a href="https://github.com/kubernetes/kubernetes/blob/ed763b8034eebb84dd3682ab0230276b1bb23845/pkg/api/v1/types.go#L1406">NodeSelector</a>.<br>
All federation controllers will be looking for this annotation to decide in which kubernetes clusters should that resource be created.<br>
Note: If the create request was sent to federation apiserver, then the resource will always be created in federation control plane. This cluster selector is to decide in which kubernetes clusters should the resource be created in.</p>
<p dir="auto">Work items:</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Define ClusterSelector in the API.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Update existing federation controllers to honor the annotation (Just services controller for now)</li>
</ul>