Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the dependency of csi-translation-lib module on apiserver/cloud-provider/controller-manager #95543

Merged
merged 1 commit into from Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 0 additions & 10 deletions staging/publishing/rules.yaml
Expand Up @@ -1336,16 +1336,6 @@ rules:
branch: master
- repository: apimachinery
branch: master
- repository: apiserver
branch: master
- repository: client-go
branch: master
- repository: cloud-provider
branch: master
- repository: component-base
branch: master
- repository: controller-manager
branch: master
- source:
branch: release-1.16
dir: staging/src/k8s.io/csi-translation-lib
Expand Down
6 changes: 0 additions & 6 deletions staging/src/k8s.io/csi-translation-lib/go.mod
Expand Up @@ -8,17 +8,11 @@ require (
github.com/stretchr/testify v1.4.0
k8s.io/api v0.0.0
k8s.io/apimachinery v0.0.0
k8s.io/cloud-provider v0.0.0
k8s.io/klog/v2 v2.2.0
)

replace (
k8s.io/api => ../api
k8s.io/apimachinery => ../apimachinery
k8s.io/apiserver => ../apiserver
k8s.io/client-go => ../client-go
k8s.io/cloud-provider => ../cloud-provider
k8s.io/component-base => ../component-base
k8s.io/controller-manager => ../controller-manager
k8s.io/csi-translation-lib => ../csi-translation-lib
)
270 changes: 0 additions & 270 deletions staging/src/k8s.io/csi-translation-lib/go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion staging/src/k8s.io/csi-translation-lib/plugins/BUILD
Expand Up @@ -6,6 +6,7 @@ go_library(
"aws_ebs.go",
"azure_disk.go",
"azure_file.go",
"const.go",
"gce_pd.go",
"in_tree_volume.go",
"openstack_cinder.go",
Expand All @@ -19,7 +20,6 @@ go_library(
"//staging/src/k8s.io/api/storage/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/cloud-provider/volume:go_default_library",
"//vendor/k8s.io/klog/v2:go_default_library",
],
)
Expand Down
21 changes: 21 additions & 0 deletions staging/src/k8s.io/csi-translation-lib/plugins/const.go
@@ -0,0 +1,21 @@
/*
Copyright 2020 The Kubernetes 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 plugins

// Matches the delimiter LabelMultiZoneDelimiter used by k8s.io/cloud-provider/volume and is mirrored here to avoid a large dependency
// labelMultiZoneDelimiter separates zones for volumes
const labelMultiZoneDelimiter = "__"
3 changes: 1 addition & 2 deletions staging/src/k8s.io/csi-translation-lib/plugins/gce_pd.go
Expand Up @@ -25,7 +25,6 @@ import (
storage "k8s.io/api/storage/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
cloudvolume "k8s.io/cloud-provider/volume"
)

const (
Expand Down Expand Up @@ -217,7 +216,7 @@ func (g *gcePersistentDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.Persisten
}

zonesLabel := pv.Labels[v1.LabelZoneFailureDomain]
zones := strings.Split(zonesLabel, cloudvolume.LabelMultiZoneDelimiter)
zones := strings.Split(zonesLabel, labelMultiZoneDelimiter)
if len(zones) == 1 && len(zones[0]) != 0 {
// Zonal
volID = fmt.Sprintf(volIDZonalFmt, UnspecifiedValue, zones[0], pv.Spec.GCEPersistentDisk.PDName)
Expand Down
Expand Up @@ -24,7 +24,6 @@ import (
v1 "k8s.io/api/core/v1"
storage "k8s.io/api/storage/v1"
"k8s.io/apimachinery/pkg/util/sets"
cloudvolume "k8s.io/cloud-provider/volume"
)

// InTreePlugin handles translations between CSI and in-tree sources in a PV
Expand Down Expand Up @@ -157,7 +156,7 @@ func translateTopology(pv *v1.PersistentVolume, topologyKey string) error {
}

if label, ok := pv.Labels[v1.LabelZoneFailureDomain]; ok {
zones = strings.Split(label, cloudvolume.LabelMultiZoneDelimiter)
zones = strings.Split(label, labelMultiZoneDelimiter)
if len(zones) > 0 {
return addTopology(pv, topologyKey, zones)
}
Expand Down