Skip to content

Commit

Permalink
If applied, this commit will add an optional canary spec field named …
Browse files Browse the repository at this point in the history
…summary for notification purposes

Signed-off-by: baldey-nz <baldey@gmail.com>
  • Loading branch information
baldey-nz committed Oct 27, 2021
1 parent 01d4780 commit c638edd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions artifacts/flagger/crd.yaml
Expand Up @@ -79,6 +79,9 @@ spec:
- service
- analysis
properties:
summary:
description: Optional msg to add to each notification
type: string
provider:
description: Traffic managent provider
type: string
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/flagger/v1beta1/canary.go
Expand Up @@ -103,6 +103,10 @@ type CanarySpec struct {
// revert canary mutation on deletion of canary resource
// +optional
RevertOnDeletion bool `json:"revertOnDeletion,omitempty"`

// Summary creates new notification message
// +optional
Summary string `json:"summary,omitempty"`
}

// CanaryService defines how ClusterIP services, service mesh or ingress routing objects are generated
Expand Down
10 changes: 10 additions & 0 deletions pkg/controller/events.go
Expand Up @@ -175,6 +175,16 @@ func (c *Controller) alert(canary *flaggerv1.Canary, message string, metadata bo

func alertMetadata(canary *flaggerv1.Canary) []notifier.Field {
var fields []notifier.Field

if canary.Spec.Summary != "" {
fields = append(fields,
notifier.Field{
Name: "Summary",
Value: canary.Spec.Summary,
},
)
}

fields = append(fields,
notifier.Field{
Name: "Target",
Expand Down

0 comments on commit c638edd

Please sign in to comment.