Skip to content

Commit bc12573

Browse files
authored
Merge pull request #59 from nais/rollout_status_annotation
Pass rollout reason annotation to deployment
2 parents 0c5adbd + fcb015d commit bc12573

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

pkg/apis/naiserator/v1alpha1/types.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,13 @@ func (in Application) Hash() (string, error) {
200200
// struct including the relevant fields for
201201
// creating a hash of an Application object
202202
relevantValues := struct {
203-
AppSpec ApplicationSpec
204-
Labels map[string]string
203+
AppSpec ApplicationSpec
204+
Labels map[string]string
205+
ChangeCause string
205206
}{
206207
in.Spec,
207208
in.Labels,
209+
in.Annotations["kubernetes.io/change-cause"],
208210
}
209211

210212
h, err := hash.Hash(relevantValues, nil)

pkg/resourcecreator/deployment.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,22 @@ func Deployment(app *nais.Application, resourceOptions ResourceOptions) (*appsv1
2828
if err != nil {
2929
return nil, err
3030
}
31+
32+
objectMeta := app.CreateObjectMeta()
33+
if val, ok := app.Annotations["kubernetes.io/change-cause"]; ok {
34+
if objectMeta.Annotations == nil {
35+
objectMeta.Annotations = make(map[string]string)
36+
}
37+
38+
objectMeta.Annotations["kubernetes.io/change-cause"] = val
39+
}
40+
3141
return &appsv1.Deployment{
3242
TypeMeta: metav1.TypeMeta{
3343
Kind: "Deployment",
3444
APIVersion: "apps/v1",
3545
},
36-
ObjectMeta: app.CreateObjectMeta(),
46+
ObjectMeta: objectMeta,
3747
Spec: *spec,
3848
}, nil
3949
}

0 commit comments

Comments
 (0)