-
Notifications
You must be signed in to change notification settings - Fork 225
Fix Kafka Channel dispatcher ownerRef #1536
Fix Kafka Channel dispatcher ownerRef #1536
Conversation
This approach makes sense to me 👍 /lgtm |
@@ -89,3 +91,13 @@ func TopicName(separator, namespace, name string) string { | |||
topic := []string{knativeKafkaTopicPrefix, namespace, name} | |||
return strings.Join(topic, separator) | |||
} | |||
|
|||
func FindContainer(d *appsv1.Deployment, containerName string) *corev1.Container { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a function like this in the codebase. Any pointers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrm...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same. I ended-up implemented it. https://github.com/knative/eventing/blob/master/pkg/reconciler/pingsource/pingsource.go#L198
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold
Ok, looks like I need to write some unit tests for this function I created...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/unhold
Done with unit tests.
Next time I need this, I will refactor it into a function in knative/pkg
d, err := r.KubeClientSet.AppsV1().Deployments(dispatcherNamespace).Update(expected) | ||
if err == nil { | ||
controller.GetEventRecorder(ctx).Event(kc, corev1.EventTypeNormal, dispatcherDeploymentUpdated, "Dispatcher deployment updated") | ||
kc.Status.PropagateDispatcherStatus(&d.Status) | ||
return d, nil | ||
} else { | ||
kc.Status.MarkServiceFailed("DispatcherDeploymentUpdateFailed", "Failed to update the dispatcher deployment: %v", err) | ||
} | ||
return d, newDeploymentWarn(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed a new commit and made it easier to understand now.
Looks more similar to old code: https://github.com/knative/eventing-contrib/blob/master/kafka/channel/pkg/reconciler/controller/kafkachannel.go#L307
/lgtm This sets us up for different kinds of deployments as the dispatcher as well in the future with a bit more work. |
|
The following is the coverage report on the affected files.
|
@matzew @lionelvillard |
} | ||
|
||
if *d.Spec.Replicas == 0 { | ||
logging.FromContext(ctx).Infof("Dispatcher deployment has 0 replicas. Scaling up deployment to 1 replicas") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: replicas -> replica, both instances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aliok, matzew, slinkydeveloper The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #1188
Proposed Changes
Release Note
Docs