Skip to content

Commit aca3ba5

Browse files
author
Cui Shuaijie
committed
fix(platform): add csi-operator sidecar and controller images
1 parent 38a3797 commit aca3ba5

File tree

1 file changed

+133
-0
lines changed
  • pkg/platform/provider/baremetal/phases/csioperator/images

1 file changed

+133
-0
lines changed

pkg/platform/provider/baremetal/phases/csioperator/images/images.go

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,114 @@ import (
2626
"tkestack.io/tke/pkg/util/containerregistry"
2727
)
2828

29+
// CSIVersion indicates the version of CSI external components.
30+
type CSIVersion string
31+
2932
const (
3033
// LatestVersion is latest version of addon.
34+
// TODO: bump up to v1.0.3
3135
LatestVersion = "v1.0.2"
36+
37+
// CSIVersionV0 indicates the 0.3.0 version of CSI.
38+
CSIVersionV0 = "v0.0"
39+
// CSIVersionV1 indicates the 1.x version of CSI.
40+
CSIVersionV1 = "v1.0"
41+
// CSIVersionV1p1 indicates the 1.1+ version of CSI in tencent cloud cvm,
42+
// which does not need to use secret id and key.
43+
CSIVersionV1p1 = "v1.1"
44+
45+
// CSIDriverCephRBD indicates the CephRBD storage type.
46+
CSIDriverCephRBD = "csi-rbd"
47+
// CSIDriverCephFS indicates the CephFS storage type.
48+
CSIDriverCephFS = "csi-cephfs"
49+
// CSIDriverTencentCBS indicates the Tencent Cloud CBS storage type.
50+
CSIDriverTencentCBS = "com.tencent.cloud.csi.cbs"
3251
)
3352

53+
// csiVersion is the set of versions of all CSI components.
54+
type csiVersion struct {
55+
Provisioner string
56+
Attacher string
57+
Resizer string
58+
Snapshotter string
59+
LivenessProbe string
60+
NodeRegistrar string
61+
ClusterRegistrar string
62+
Driver string
63+
}
64+
65+
// csiVersionMap stores all images of CSI need. Refer from
66+
// <https://github.com/tkestack/csi-operator/blob/74188bd0f7462446109ee82f7488d8bd3646f525/pkg/controller/csi/enhancer/enhancer.go#L64>
67+
// Need to keep same with the csi-operator version.
68+
var csiVersionMap = map[string]map[CSIVersion]*csiVersion{
69+
CSIDriverCephRBD: {
70+
CSIVersionV0: {
71+
Provisioner: "csi-provisioner:v0.4.2",
72+
Attacher: "csi-attacher:v0.4.2",
73+
Snapshotter: "csi-snapshotter:v0.4.1",
74+
LivenessProbe: "livenessprobe:v0.4.1",
75+
NodeRegistrar: "driver-registrar:v0.3.0",
76+
Driver: "rbdplugin:v0.3.0",
77+
},
78+
CSIVersionV1: {
79+
Provisioner: "csi-provisioner:v1.0.1",
80+
Attacher: "csi-attacher:v1.1.0",
81+
Snapshotter: "csi-snapshotter:v1.1.0",
82+
LivenessProbe: "livenessprobe:v1.1.0",
83+
NodeRegistrar: "csi-node-driver-registrar:v1.1.0",
84+
Driver: "rbdplugin:v1.0.0",
85+
// TODO: Add resizer.
86+
// Resizer: "v0.1.0",
87+
},
88+
},
89+
CSIDriverCephFS: {
90+
CSIVersionV0: {
91+
Provisioner: "csi-provisioner:v0.4.2",
92+
Attacher: "csi-attacher:v0.4.2",
93+
LivenessProbe: "livenessprobe:v0.4.1",
94+
NodeRegistrar: "driver-registrar:v0.3.0",
95+
Driver: "cephfsplugin:v0.3.0",
96+
},
97+
CSIVersionV1: {
98+
Provisioner: "csi-provisioner:v1.0.1",
99+
Attacher: "csi-attacher:v1.1.0",
100+
LivenessProbe: "livenessprobe:v1.1.0",
101+
NodeRegistrar: "csi-node-driver-registrar:v1.1.0",
102+
Driver: "cephfsplugin:v1.0.0",
103+
// TODO: Add resizer.
104+
// Resizer: "v0.1.0",
105+
},
106+
},
107+
CSIDriverTencentCBS: {
108+
CSIVersionV0: {
109+
Provisioner: "csi-provisioner:v0.4.2",
110+
Attacher: "csi-attacher:v0.4.2",
111+
NodeRegistrar: "driver-registrar:v0.3.0",
112+
Driver: "csi-tencentcloud-cbs:v0.2.1",
113+
},
114+
CSIVersionV1: {
115+
Provisioner: "csi-provisioner:v1.2.0",
116+
Attacher: "csi-attacher:v1.1.0",
117+
Snapshotter: "csi-snapshotter:v1.2.2",
118+
NodeRegistrar: "csi-node-driver-registrar:v1.1.0",
119+
// TODO:NOTE--TKE Stack now use a old version csi-operator image (ID sha256:b77952b83730),
120+
// which only looks like v1.0.2. Version of driver in this image is v1.0.0.
121+
// TODO: FIX--After csi-operator bump up to v1.0.3, use the right version v1.2.0
122+
//Driver: "csi-tencentcloud-cbs:v1.2.0",
123+
Driver: "csi-tencentcloud-cbs:v1.0.0",
124+
Resizer: "csi-resizer:v0.5.0",
125+
},
126+
CSIVersionV1p1: {
127+
Provisioner: "csi-provisioner:v1.2.0",
128+
Attacher: "csi-attacher:v1.1.0",
129+
Snapshotter: "csi-snapshotter:v1.2.2",
130+
NodeRegistrar: "csi-node-driver-registrar:v1.1.0",
131+
Driver: "csi-tencentcloud-cbs:v1.2.0",
132+
Resizer: "csi-resizer:v0.5.0",
133+
},
134+
},
135+
}
136+
34137
type Components struct {
35138
CSIOperator containerregistry.Image
36139
}
@@ -48,6 +151,7 @@ func (c Components) Get(name string) *containerregistry.Image {
48151

49152
var versionMap = map[string]Components{
50153
LatestVersion: {
154+
// TODO: bump up to v1.0.3
51155
CSIOperator: containerregistry.Image{Name: "csi-operator", Tag: "v1.0.2"},
52156
},
53157
}
@@ -63,9 +167,38 @@ func List() []string {
63167
}
64168
}
65169

170+
for _, storages := range csiVersionMap {
171+
for _, csiV := range storages {
172+
items = append(items, getImages(csiV)...)
173+
}
174+
}
175+
66176
return items
67177
}
68178

179+
// getImages return images needed by the csi
180+
func getImages(csi *csiVersion) []string {
181+
images := []string{
182+
csi.Attacher,
183+
csi.Provisioner,
184+
csi.Snapshotter,
185+
csi.Resizer,
186+
csi.LivenessProbe,
187+
csi.NodeRegistrar,
188+
csi.ClusterRegistrar,
189+
csi.Driver,
190+
}
191+
192+
imagesNeed := make([]string, 0)
193+
for _, image := range images {
194+
if image != "" {
195+
imagesNeed = append(imagesNeed, image)
196+
}
197+
}
198+
199+
return imagesNeed
200+
}
201+
69202
func Versions() []string {
70203
keys := make([]string, 0, len(versionMap))
71204
for key := range versionMap {

0 commit comments

Comments
 (0)