-
Notifications
You must be signed in to change notification settings - Fork 0
/
aws.go
43 lines (34 loc) · 942 Bytes
/
aws.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
corev1 "k8s.io/api/core/v1"
)
type aws struct {
config struct {
enabled bool
region string
secretName string
previousVersion string
roleARN string
}
}
func (aws *aws) mutateContainer(container corev1.Container) corev1.Container {
container = aws.setArgs(container)
return container
}
func (aws *aws) setArgs(c corev1.Container) corev1.Container {
args := []string{"aws"}
args = append(args, fmt.Sprintf("--region=%s", aws.config.region))
if aws.config.secretName != "" {
args = append(args, fmt.Sprintf("--secret-name=%s", aws.config.secretName))
}
if aws.config.roleARN != "" {
args = append(args, fmt.Sprintf("--role-arn=%s", aws.config.roleARN))
}
if aws.config.secretName != "" {
args = append(args, fmt.Sprintf("--previous-version=%s", aws.config.previousVersion))
}
args = append(args, "--")
c.Args = append(args, c.Args...)
return c
}