@@ -24,10 +24,14 @@ import (
24
24
)
25
25
26
26
const (
27
- defaultHelmRepositoryURL = "https://nutanix.github.io/helm/"
28
- defaultHelmChartVersion = "v2.6.6"
29
- defaultHelmChartName = "nutanix-csi-storage"
30
- defaultHelmReleaseNameTemplate = "nutanix-csi-storage-%s"
27
+ defaultHelmRepositoryURL = "https://nutanix.github.io/helm/"
28
+ defaultStorageHelmChartVersion = "v2.6.6"
29
+ defaultStorageHelmChartName = "nutanix-csi-storage"
30
+ defaultStorageHelmReleaseNameTemplate = "nutanix-csi-storage-%s"
31
+
32
+ defaultSnapshotHelmChartVersion = "v6.3.2"
33
+ defaultSnapshotHelmChartName = "nutanix-csi-snapshot"
34
+ defaultSnapshotHelmReleaseNameTemplate = "nutanix-csi-snapshot-%s"
31
35
)
32
36
33
37
type NutanixCSIConfig struct {
@@ -141,13 +145,13 @@ func (n *NutanixCSI) handleHelmAddonApply(
141
145
},
142
146
Spec : caaphv1.HelmChartProxySpec {
143
147
RepoURL : defaultHelmRepositoryURL ,
144
- ChartName : defaultHelmChartName ,
148
+ ChartName : defaultStorageHelmChartName ,
145
149
ClusterSelector : metav1.LabelSelector {
146
150
MatchLabels : map [string ]string {clusterv1 .ClusterNameLabel : req .Cluster .Name },
147
151
},
148
152
ReleaseNamespace : req .Cluster .Namespace ,
149
- ReleaseName : fmt .Sprintf (defaultHelmReleaseNameTemplate , req .Cluster .Name ),
150
- Version : defaultHelmChartVersion ,
153
+ ReleaseName : fmt .Sprintf (defaultStorageHelmReleaseNameTemplate , req .Cluster .Name ),
154
+ Version : defaultStorageHelmChartVersion ,
151
155
ValuesTemplate : values ,
152
156
},
153
157
}
@@ -163,6 +167,41 @@ func (n *NutanixCSI) handleHelmAddonApply(
163
167
return fmt .Errorf ("failed to apply nutanix-csi installation HelmChartProxy: %w" , err )
164
168
}
165
169
170
+ snapshotChart := & caaphv1.HelmChartProxy {
171
+ TypeMeta : metav1.TypeMeta {
172
+ APIVersion : caaphv1 .GroupVersion .String (),
173
+ Kind : "HelmChartProxy" ,
174
+ },
175
+ ObjectMeta : metav1.ObjectMeta {
176
+ Namespace : req .Cluster .Namespace ,
177
+ Name : "nutanix-csi-snapshot" + req .Cluster .Name ,
178
+ },
179
+ Spec : caaphv1.HelmChartProxySpec {
180
+ RepoURL : defaultHelmRepositoryURL ,
181
+ ChartName : defaultSnapshotHelmChartName ,
182
+ ClusterSelector : metav1.LabelSelector {
183
+ MatchLabels : map [string ]string {clusterv1 .ClusterNameLabel : req .Cluster .Name },
184
+ },
185
+ ReleaseNamespace : req .Cluster .Namespace ,
186
+ ReleaseName : fmt .Sprintf (defaultStorageHelmReleaseNameTemplate , req .Cluster .Name ),
187
+ Version : defaultSnapshotHelmChartVersion ,
188
+ },
189
+ }
190
+
191
+ if err = controllerutil .SetOwnerReference (& req .Cluster , snapshotChart , n .client .Scheme ()); err != nil {
192
+ return fmt .Errorf (
193
+ "failed to set owner reference on nutanix-csi installation HelmChartProxy: %w" ,
194
+ err ,
195
+ )
196
+ }
197
+
198
+ if err = client .ServerSideApply (ctx , n .client , snapshotChart ); err != nil {
199
+ return fmt .Errorf (
200
+ "failed to apply nutanix-csi-snapshot installation HelmChartProxy: %w" ,
201
+ err ,
202
+ )
203
+ }
204
+
166
205
return nil
167
206
}
168
207
0 commit comments