Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

Add support for HA control plane #337

Merged
merged 5 commits into from
Mar 11, 2020
Merged

Conversation

pmorie
Copy link
Member

@pmorie pmorie commented Mar 10, 2020

Fixes #320

Proposed Changes

  • Adds KnativeServing.spec.highAvailability

Release Note

Initial support for highly available control plane

@googlebot googlebot added the cla: yes Author(s) signed a CLA. label Mar 10, 2020
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

Copy link
Contributor

@jcrossley3 jcrossley3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but this won't actually do anything until you add HighAvailabilityTransform to the Transformers function in extenstions.go

@@ -119,6 +119,15 @@ spec:
name:
description: The name of the ConfigMap or Secret
type: string
highAvailability:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're mixing case convention here, should be high-availability to be consistent

Comment on lines +48 to +47
if instance.Spec.HighAvailability == nil {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could put this outside the closure for a skosh more performance. Transform will ignore a nil Transformer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather do this in a follow-up that changes everywhere that does this, since this PR is blocking the release

if cm.Data == nil {
cm.Data = map[string]string{}
}
cm.Data[enabledComponentsKey] = componentsValue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to log a warning if this value is also present in the instance.Config map... maybe?

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

Copy link
Contributor

@jcrossley3 jcrossley3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Less verbosity

Comment on lines 65 to 62
if err := scheme.Scheme.Convert(cm, u, nil); err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if err := scheme.Scheme.Convert(cm, u, nil); err != nil {
return err
}
return scheme.Scheme.Convert(cm, u, nil)

Comment on lines 81 to 71
if err := scheme.Scheme.Convert(deployment, u, nil); err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if err := scheme.Scheme.Convert(deployment, u, nil); err != nil {
return err
}
return scheme.Scheme.Convert(deployment, u, nil)

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Produced via:
gofmt -s -w $(find -path './vendor' -prune -o -path './third_party' -prune -o -type f -name '*.go' -print)

},
}

for i, _ := range cases {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Format Go code:

Suggested change
for i, _ := range cases {
for i := range cases {

Comment on lines 44 to 46
for _, fn := range platforms {
for i := range platforms {
fn := platforms[i]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really necessary?

@jcrossley3
Copy link
Contributor

jcrossley3 commented Mar 11, 2020

I think you've accidentally discovered a ginormous manifestival bug. Holding until I create a fix...
/hold

@pmorie
Copy link
Member Author

pmorie commented Mar 11, 2020

/hold

@pmorie
Copy link
Member Author

pmorie commented Mar 11, 2020

/hold cancel

if err := unstructured.SetNestedStringMap(u.Object, data, "data"); err != nil {
return err
}
log.Infof("Updated configmap/config-leader-election: %v", u.Object)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just noise. I would delete these logs since manifestival will log the changes from them anyway. But if you insist, make 'em debug?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually won't give you the full content of the object, which i needed, but I can make a PR for manifestival for that.

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-serving-operator-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/knativeserving/common/ha.go Do not exist 81.2%

@houshengbo
Copy link

/lgtm
/approve

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: houshengbo, pmorie

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot merged commit 0255420 into knative:master Mar 11, 2020
@pmorie
Copy link
Member Author

pmorie commented Mar 13, 2020

Part of knative/pkg#1007

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initial API fields for HA control plane
7 participants