Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pkg/app/pipedv1/plugin/kubernetes/deployment/annotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ func annotateConfigHash(manifests []provider.Manifest) error {
}

for _, m := range manifests {
if m.IsDeployment() {
if m.IsDeployment() || m.IsStatefulSet() || m.IsDaemonSet() {
if err := annotateConfigHashToWorkload(m, configMaps, secrets); err != nil {
return err
}

// TODO: Add support for other workload types, such as StatefulSet, DaemonSet, etc.
}
}

Expand Down
152 changes: 152 additions & 0 deletions pkg/app/pipedv1/plugin/kubernetes/deployment/annotate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,158 @@ metadata:
type: Opaque
data:
one: "MQ=="
`,
},
{
name: "StatefulSet config",
manifests: `
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: canary-by-statefulset-change
labels:
app: canary-by-statefulset-change
spec:
serviceName: "nginx"
replicas: 2
selector:
matchLabels:
app: canary-by-statefulset-change
template:
metadata:
labels:
app: canary-by-statefulset-change
spec:
containers:
- name: nginx
image: nginx:1.14.2
volumeMounts:
- name: config
mountPath: /etc/nginx-config
readOnly: true
volumes:
- name: config
configMap:
name: canary-by-statefulset-change
---
apiVersion: v1
kind: ConfigMap
metadata:
name: canary-by-statefulset-change
data:
two: "2"
`,
expected: `
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: canary-by-statefulset-change
labels:
app: canary-by-statefulset-change
spec:
serviceName: "nginx"
replicas: 2
selector:
matchLabels:
app: canary-by-statefulset-change
template:
metadata:
labels:
app: canary-by-statefulset-change
annotations:
pipecd.dev/config-hash: 77ck6gt828
spec:
containers:
- name: nginx
image: nginx:1.14.2
volumeMounts:
- name: config
mountPath: /etc/nginx-config
readOnly: true
volumes:
- name: config
configMap:
name: canary-by-statefulset-change
---
apiVersion: v1
kind: ConfigMap
metadata:
name: canary-by-statefulset-change
data:
two: "2"
`,
},
{
name: "DaemonSet config",
manifests: `
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: canary-by-daemonset-change
labels:
app: canary-by-daemonset-change
spec:
selector:
matchLabels:
app: canary-by-daemonset-change
template:
metadata:
labels:
app: canary-by-daemonset-change
spec:
containers:
- name: fluentd-elasticsearch
image: fluentd:v1.8
volumeMounts:
- name: config
mountPath: /var/log
volumes:
- name: config
configMap:
name: canary-by-daemonset-change
---
apiVersion: v1
kind: ConfigMap
metadata:
name: canary-by-daemonset-change
data:
two: "2"
`,
expected: `
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: canary-by-daemonset-change
labels:
app: canary-by-daemonset-change
spec:
selector:
matchLabels:
app: canary-by-daemonset-change
template:
metadata:
labels:
app: canary-by-daemonset-change
annotations:
pipecd.dev/config-hash: bm69558hh6
spec:
containers:
- name: fluentd-elasticsearch
image: fluentd:v1.8
volumeMounts:
- name: config
mountPath: /var/log
volumes:
- name: config
configMap:
name: canary-by-daemonset-change
---
apiVersion: v1
kind: ConfigMap
metadata:
name: canary-by-daemonset-change
data:
two: "2"
`,
},
}
Expand Down
Loading