-
Notifications
You must be signed in to change notification settings - Fork 474
/
keys.go
35 lines (30 loc) · 1.12 KB
/
keys.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company and Gardener contributors
//
// SPDX-License-Identifier: Apache-2.0
package keys
import (
gardencorev1beta1 "github.com/gardener/gardener/pkg/apis/core/v1beta1"
operatorv1alpha1 "github.com/gardener/gardener/pkg/apis/operator/v1alpha1"
"github.com/gardener/gardener/pkg/client/kubernetes/clientmap"
)
// ForGarden returns a key for retrieving a ClientSet for the given Shoot cluster.
func ForGarden(garden *operatorv1alpha1.Garden) clientmap.ClientSetKey {
return clientmap.GardenClientSetKey{
Name: garden.Name,
}
}
// ForShoot returns a key for retrieving a ClientSet for the given Shoot cluster.
func ForShoot(shoot *gardencorev1beta1.Shoot) clientmap.ClientSetKey {
return clientmap.ShootClientSetKey{
Namespace: shoot.Namespace,
Name: shoot.Name,
}
}
// ForShootWithNamespacedName returns a key for retrieving a ClientSet for the Shoot cluster with the given
// namespace and name.
func ForShootWithNamespacedName(namespace, name string) clientmap.ClientSetKey {
return clientmap.ShootClientSetKey{
Namespace: namespace,
Name: name,
}
}