Skip to content

Commit b3a728f

Browse files
committed
Move and export InactiveAnnotation
Signed-off-by: Nelo-T. Wallus <[email protected]> Signed-off-by: Nelo-T. Wallus <[email protected]>
1 parent 365ff2f commit b3a728f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pkg/server/filters/filters.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ type (
4444
const (
4545
workspaceAnnotation = "tenancy.kcp.io/workspace"
4646

47-
// inactiveAnnotation is the annotation denoting a logical cluster should be
48-
// deemed unreachable.
49-
inactiveAnnotation = "internal.kcp.io/inactive"
50-
5147
// clusterKey is the context key for the request namespace.
5248
acceptHeaderContextKey acceptHeaderContextKeyType = iota
5349
)

pkg/server/filters/inactivelogicalcluster.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ import (
3030
corev1alpha1informers "github.com/kcp-dev/kcp/sdk/client/informers/externalversions/core/v1alpha1"
3131
)
3232

33+
const (
34+
// InactiveAnnotation is the annotation denoting a logical cluster should be
35+
// deemed unreachable.
36+
InactiveAnnotation = "internal.kcp.io/inactive"
37+
)
38+
3339
// WithBlockInactiveLogicalClusters ensures that any requests to logical
3440
// clusters marked inactive are rejected.
3541
func WithBlockInactiveLogicalClusters(handler http.Handler, kcpClusterClient corev1alpha1informers.LogicalClusterClusterInformer) http.HandlerFunc {
@@ -50,7 +56,7 @@ func WithBlockInactiveLogicalClusters(handler http.Handler, kcpClusterClient cor
5056
if cluster != nil && !cluster.Name.Empty() && !isException {
5157
logicalCluster, err := kcpClusterClient.Cluster(cluster.Name).Lister().Get(corev1alpha1.LogicalClusterName)
5258
if err == nil {
53-
if ann, ok := logicalCluster.ObjectMeta.Annotations[inactiveAnnotation]; ok && ann == "true" {
59+
if ann, ok := logicalCluster.ObjectMeta.Annotations[InactiveAnnotation]; ok && ann == "true" {
5460
responsewriters.ErrorNegotiated(
5561
apierrors.NewForbidden(corev1alpha1.Resource("logicalclusters"), cluster.Name.String(), errors.New("logical cluster is marked inactive")),
5662
errorCodecs, schema.GroupVersion{}, w, req,

0 commit comments

Comments
 (0)