Skip to content

Commit 3d04984

Browse files
committed
Add multicluster.ErrClusterNotFound for providers
On-behalf-of: SAP <[email protected]> Signed-off-by: Marvin Beckers <[email protected]>
1 parent 7e76384 commit 3d04984

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

pkg/multicluster/errors.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package multicluster
18+
19+
import (
20+
"errors"
21+
)
22+
23+
var (
24+
// ErrClusterNotFound can be returned by provider implementations if the cluster requested
25+
// doesn't exist and cannot be constructed.
26+
ErrClusterNotFound = errClusterNotFound()
27+
)
28+
29+
func errClusterNotFound() error { return errors.New("cluster not found") }

pkg/multicluster/multicluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type Provider interface {
5454
// Get returns a cluster for the given identifying cluster name. Get
5555
// returns an existing cluster if it has been created before.
5656
// If no cluster is known to the provider under the given cluster name,
57-
// an error should be returned.
57+
// ErrClusterNotFound should be returned.
5858
Get(ctx context.Context, clusterName string) (cluster.Cluster, error)
5959

6060
// IndexField indexes the given object by the given field on all engaged

0 commit comments

Comments
 (0)