Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f0e851c0bc | |||
| 55e80b467c |
@@ -16,6 +16,12 @@ const (
|
|||||||
// BindTSIGKeySpec defines a TSIG key. If no existing key material is imported,
|
// BindTSIGKeySpec defines a TSIG key. If no existing key material is imported,
|
||||||
// the operator generates a random key and stores it in a Secret.
|
// the operator generates a random key and stores it in a Secret.
|
||||||
type BindTSIGKeySpec struct {
|
type BindTSIGKeySpec struct {
|
||||||
|
// ClusterRef names the BindCluster this key is included in. When empty the
|
||||||
|
// key is shared with every cluster in the namespace (useful when multiple
|
||||||
|
// clusters share one namespace).
|
||||||
|
// +optional
|
||||||
|
ClusterRef string `json:"clusterRef,omitempty"`
|
||||||
|
|
||||||
// Algorithm is the HMAC algorithm. Defaults to hmac-sha256.
|
// Algorithm is the HMAC algorithm. Defaults to hmac-sha256.
|
||||||
// +kubebuilder:default="hmac-sha256"
|
// +kubebuilder:default="hmac-sha256"
|
||||||
// +optional
|
// +optional
|
||||||
|
|||||||
@@ -66,6 +66,12 @@ spec:
|
|||||||
- hmac-sha1
|
- hmac-sha1
|
||||||
- hmac-md5
|
- hmac-md5
|
||||||
type: string
|
type: string
|
||||||
|
clusterRef:
|
||||||
|
description: |-
|
||||||
|
ClusterRef names the BindCluster this key is included in. When empty the
|
||||||
|
key is shared with every cluster in the namespace (useful when multiple
|
||||||
|
clusters share one namespace).
|
||||||
|
type: string
|
||||||
importExisting:
|
importExisting:
|
||||||
description: |-
|
description: |-
|
||||||
ImportExisting, when true, means the referenced Secret already contains a
|
ImportExisting, when true, means the referenced Secret already contains a
|
||||||
|
|||||||
@@ -2043,6 +2043,12 @@ spec:
|
|||||||
- hmac-sha1
|
- hmac-sha1
|
||||||
- hmac-md5
|
- hmac-md5
|
||||||
type: string
|
type: string
|
||||||
|
clusterRef:
|
||||||
|
description: |-
|
||||||
|
ClusterRef names the BindCluster this key is included in. When empty the
|
||||||
|
key is shared with every cluster in the namespace (useful when multiple
|
||||||
|
clusters share one namespace).
|
||||||
|
type: string
|
||||||
importExisting:
|
importExisting:
|
||||||
description: |-
|
description: |-
|
||||||
ImportExisting, when true, means the referenced Secret already contains a
|
ImportExisting, when true, means the referenced Secret already contains a
|
||||||
|
|||||||
@@ -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 {
|
if err := r.List(ctx, &keys, client.InNamespace(c.Namespace)); err != nil {
|
||||||
return err
|
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 })
|
sort.Slice(items, func(i, j int) bool { return items[i].Name < items[j].Name })
|
||||||
|
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
|
|||||||
Reference in New Issue
Block a user