Skip to content

Commit 722be66

Browse files
authored
Merge pull request kubernetes#95543 from wawa0210/fix-95530
Remove the dependency of csi-translation-lib module on apiserver/cloud-provider/controller-manager
2 parents 7b11de2 + 3d6d692 commit 722be66

File tree

7 files changed

+24
-291
lines changed

7 files changed

+24
-291
lines changed

staging/publishing/rules.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,16 +1094,6 @@ rules:
10941094
branch: master
10951095
- repository: apimachinery
10961096
branch: master
1097-
- repository: apiserver
1098-
branch: master
1099-
- repository: client-go
1100-
branch: master
1101-
- repository: cloud-provider
1102-
branch: master
1103-
- repository: component-base
1104-
branch: master
1105-
- repository: controller-manager
1106-
branch: master
11071097
- source:
11081098
branch: release-1.17
11091099
dir: staging/src/k8s.io/csi-translation-lib

staging/src/k8s.io/csi-translation-lib/go.mod

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,11 @@ require (
88
github.com/stretchr/testify v1.4.0
99
k8s.io/api v0.0.0
1010
k8s.io/apimachinery v0.0.0
11-
k8s.io/cloud-provider v0.0.0
1211
k8s.io/klog/v2 v2.2.0
1312
)
1413

1514
replace (
1615
k8s.io/api => ../api
1716
k8s.io/apimachinery => ../apimachinery
18-
k8s.io/apiserver => ../apiserver
19-
k8s.io/client-go => ../client-go
20-
k8s.io/cloud-provider => ../cloud-provider
21-
k8s.io/component-base => ../component-base
22-
k8s.io/controller-manager => ../controller-manager
2317
k8s.io/csi-translation-lib => ../csi-translation-lib
2418
)

staging/src/k8s.io/csi-translation-lib/go.sum

Lines changed: 0 additions & 270 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

staging/src/k8s.io/csi-translation-lib/plugins/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ go_library(
66
"aws_ebs.go",
77
"azure_disk.go",
88
"azure_file.go",
9+
"const.go",
910
"gce_pd.go",
1011
"in_tree_volume.go",
1112
"openstack_cinder.go",
@@ -19,7 +20,6 @@ go_library(
1920
"//staging/src/k8s.io/api/storage/v1:go_default_library",
2021
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
2122
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
22-
"//staging/src/k8s.io/cloud-provider/volume:go_default_library",
2323
"//vendor/k8s.io/klog/v2:go_default_library",
2424
],
2525
)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
Copyright 2020 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 plugins
18+
19+
// Matches the delimiter LabelMultiZoneDelimiter used by k8s.io/cloud-provider/volume and is mirrored here to avoid a large dependency
20+
// labelMultiZoneDelimiter separates zones for volumes
21+
const labelMultiZoneDelimiter = "__"

staging/src/k8s.io/csi-translation-lib/plugins/gce_pd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
storage "k8s.io/api/storage/v1"
2626
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2727
"k8s.io/apimachinery/pkg/util/sets"
28-
cloudvolume "k8s.io/cloud-provider/volume"
2928
)
3029

3130
const (
@@ -217,7 +216,7 @@ func (g *gcePersistentDiskCSITranslator) TranslateInTreePVToCSI(pv *v1.Persisten
217216
}
218217

219218
zonesLabel := pv.Labels[v1.LabelZoneFailureDomain]
220-
zones := strings.Split(zonesLabel, cloudvolume.LabelMultiZoneDelimiter)
219+
zones := strings.Split(zonesLabel, labelMultiZoneDelimiter)
221220
if len(zones) == 1 && len(zones[0]) != 0 {
222221
// Zonal
223222
volID = fmt.Sprintf(volIDZonalFmt, UnspecifiedValue, zones[0], pv.Spec.GCEPersistentDisk.PDName)

staging/src/k8s.io/csi-translation-lib/plugins/in_tree_volume.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import (
2424
v1 "k8s.io/api/core/v1"
2525
storage "k8s.io/api/storage/v1"
2626
"k8s.io/apimachinery/pkg/util/sets"
27-
cloudvolume "k8s.io/cloud-provider/volume"
2827
)
2928

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

159158
if label, ok := pv.Labels[v1.LabelZoneFailureDomain]; ok {
160-
zones = strings.Split(label, cloudvolume.LabelMultiZoneDelimiter)
159+
zones = strings.Split(label, labelMultiZoneDelimiter)
161160
if len(zones) > 0 {
162161
return addTopology(pv, topologyKey, zones)
163162
}

0 commit comments

Comments
 (0)