|
4 | 4 | package unit |
5 | 5 |
|
6 | 6 | import ( |
| 7 | + "fmt" |
7 | 8 | "testing" |
8 | 9 |
|
9 | 10 | "github.com/gruntwork-io/terratest/modules/helm" |
@@ -265,9 +266,44 @@ func TestDeploymentSecurityContext(t *testing.T) { |
265 | 266 | assert.Equal(t, d, deployment) |
266 | 267 | } |
267 | 268 |
|
| 269 | +func TestDeploymentCustomCAcertificates(t *testing.T) { |
| 270 | + options := &helm.Options{ |
| 271 | + Version: helmChartVersion, |
| 272 | + SetValues: map[string]string{ |
| 273 | + "customCAcertificates": "SGVsbG8gV29ybGQ=", |
| 274 | + }, |
| 275 | + } |
| 276 | + deployment := renderDeploymentManifest(t, options) |
| 277 | + d := defaultDeployment() |
| 278 | + |
| 279 | + d.Spec.Template.Spec.Volumes = []corev1.Volume{ |
| 280 | + { |
| 281 | + Name: "ca-certificates", |
| 282 | + VolumeSource: corev1.VolumeSource{ |
| 283 | + ConfigMap: &corev1.ConfigMapVolumeSource{ |
| 284 | + LocalObjectReference: corev1.LocalObjectReference{ |
| 285 | + Name: fmt.Sprintf("%s-ca-certificates", helmReleaseName), |
| 286 | + }, |
| 287 | + }, |
| 288 | + }, |
| 289 | + }, |
| 290 | + } |
| 291 | + manager := d.Spec.Template.Spec.DeepCopy().Containers[0] |
| 292 | + manager.VolumeMounts = []corev1.VolumeMount{ |
| 293 | + { |
| 294 | + Name: "ca-certificates", |
| 295 | + ReadOnly: true, |
| 296 | + MountPath: "/etc/ssl/certs/custom-ca-certificates.crt", |
| 297 | + SubPath: "ca-certificates", |
| 298 | + }, |
| 299 | + } |
| 300 | + d.Spec.Template.Spec.Containers[0] = manager |
| 301 | + |
| 302 | + assert.Equal(t, d, deployment) |
| 303 | +} |
| 304 | + |
268 | 305 | // TODO: |
269 | 306 | // - customCAcertificates |
270 | | -// - securityContext |
271 | 307 | // - kubeRbacProxy.* |
272 | 308 | // - operator.* |
273 | 309 | // - controllers.* |
0 commit comments