-
Notifications
You must be signed in to change notification settings - Fork 396
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1862 from ncdc/0.7/skip-projected-resources
[release-0.7] deletors: skip projected resources
- Loading branch information
Showing
4 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
Copyright 2022 The KCP Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package projection | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
|
||
tenancyv1beta1 "github.com/kcp-dev/kcp/pkg/apis/tenancy/v1beta1" | ||
) | ||
|
||
var projectedAPIs map[schema.GroupVersionResource]struct{} | ||
|
||
func init() { | ||
projectedAPIs = map[schema.GroupVersionResource]struct{}{ | ||
tenancyv1beta1.SchemeGroupVersion.WithResource("workspaces"): {}, | ||
} | ||
} | ||
|
||
// Includes returns true if gvr is for a projected API. An API is projected if it is not stored in etcd and instead | ||
// comes from some other data that is actually stored in etcd. For example, Workspaces (tenancy.kcp.dev/v1beta1) are | ||
// projected; the real data comes from ClusterWorkspaces (tenancy.kcp.dev/v1alpha1). | ||
func Includes(gvr schema.GroupVersionResource) bool { | ||
_, exists := projectedAPIs[gvr] | ||
return exists | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters