Add clusterRef to BindTSIGKey
TSIG keys were included in every cluster's keys.conf namespace-wide. When multiple clusters share a namespace, that leaks keys across clusters. Add spec.clusterRef so a key can target a specific BindCluster; empty keeps the shared (all-clusters-in-namespace) behaviour. - api: BindTSIGKey.spec.clusterRef (optional) - BindCluster keys.conf now includes only keys with matching or empty clusterRef - regenerate CRDs + install.yaml bundle
This commit is contained in:
@@ -128,7 +128,15 @@ func (r *BindClusterReconciler) reconcileKeysSecret(ctx context.Context, c *bind
|
||||
if err := r.List(ctx, &keys, client.InNamespace(c.Namespace)); err != nil {
|
||||
return err
|
||||
}
|
||||
items := append([]bindv1alpha1.BindTSIGKey(nil), keys.Items...)
|
||||
// Include keys scoped to this cluster (spec.clusterRef == name) and shared
|
||||
// keys (empty clusterRef). This keeps keys from leaking across clusters that
|
||||
// share a namespace.
|
||||
var items []bindv1alpha1.BindTSIGKey
|
||||
for _, k := range keys.Items {
|
||||
if k.Spec.ClusterRef == "" || k.Spec.ClusterRef == c.Name {
|
||||
items = append(items, k)
|
||||
}
|
||||
}
|
||||
sort.Slice(items, func(i, j int) bool { return items[i].Name < items[j].Name })
|
||||
|
||||
var b strings.Builder
|
||||
|
||||
Reference in New Issue
Block a user