Skip to content

Commit

Permalink
bump version to v0.3.0-rc.1
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwit committed Dec 25, 2021
1 parent 6e75bab commit aa8740e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ generatorOptions:
images:
- name: chanwit/tf-controller
newName: ghcr.io/chanwit/tf-controller
newTag: v0.2.0
newTag: v0.3.0-rc.1
39 changes: 39 additions & 0 deletions controllers/terraform_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,3 +950,42 @@ func (r *TerraformReconciler) indexBy(kind string) func(o client.Object) []strin
return nil
}
}

func (r *TerraformReconciler) event(ctx context.Context, terraform infrav1.Terraform, revision, severity, msg string, metadata map[string]string) {
log := logr.FromContext(ctx)

annotations := map[string]string{
infrav1.GroupVersion.Group + "/revision": revision,
}

eventType := "Normal"
if severity == events.EventSeverityError {
eventType = "Warning"
}

r.EventRecorder.AnnotatedEventf(&terraform, annotations, eventType, severity, msg)

if r.ExternalEventRecorder != nil {
objRef, err := reference.GetReference(r.Scheme, &terraform)
if err != nil {
log.Error(err, "unable to send event")
return
}
if metadata == nil {
metadata = map[string]string{}
}
if revision != "" {
metadata["revision"] = revision
}

reason := severity
if c := apimeta.FindStatusCondition(terraform.Status.Conditions, meta.ReadyCondition); c != nil {
reason = c.Reason
}

if err := r.ExternalEventRecorder.Eventf(*objRef, metadata, severity, reason, msg); err != nil {
log.Error(err, "unable to send event")
return
}
}
}

0 comments on commit aa8740e

Please # to comment.