Skip to content

Commit

Permalink
Resolve knative service diff to prevent dup revision (kubeflow#1484)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzisun authored Mar 20, 2021
1 parent d5f62f1 commit fc82f52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ func (r *KsvcReconciler) Reconcile() (*knservingv1.ServiceStatus, error) {
}

// Reconcile differences and update
// knative mutator defaults the enableServiceLinks to false which would generate a diff despite no changes on desired knative service
// https://github.com/knative/serving/blob/main/pkg/apis/serving/v1/revision_defaults.go#L134
if desired.Spec.ConfigurationSpec.Template.Spec.EnableServiceLinks == nil &&
existing.Spec.ConfigurationSpec.Template.Spec.EnableServiceLinks != nil &&
*existing.Spec.ConfigurationSpec.Template.Spec.EnableServiceLinks == false {
desired.Spec.ConfigurationSpec.Template.Spec.EnableServiceLinks = proto.Bool(false)
}
diff, err := kmp.SafeDiff(desired.Spec.ConfigurationSpec, existing.Spec.ConfigurationSpec)
if err != nil {
return &existing.Status, errors.Wrapf(err, "failed to diff knative service configuration spec")
Expand Down

0 comments on commit fc82f52

Please sign in to comment.