Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite rollout controller code #102

Merged
merged 1 commit into from
Dec 16, 2022

Conversation

zmberg
Copy link
Member

@zmberg zmberg commented Nov 11, 2022

Ⅰ. Describe what this PR does

Rewrite rollout controller code

@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch 2 times, most recently from 5aab2b4 to 0641a29 Compare November 15, 2022 12:38
ObservedWorkloadGeneration: workload.Generation,
PodTemplateHash: workload.PodTemplateHash,
CanaryRevision: workload.CanaryRevision,
StableRevision: workload.StableRevision,
Copy link

Choose a reason for hiding this comment

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

gofmt: File is not gofmt-ed with -s


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch from 0641a29 to 9ab695d Compare November 17, 2022 07:13
"context"
"fmt"
"reflect"
"sigs.k8s.io/controller-runtime/pkg/client"
Copy link

Choose a reason for hiding this comment

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

goimports: File is not goimports-ed


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch 2 times, most recently from 7d7ad16 to 859c5f5 Compare November 22, 2022 11:45
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
utilpointer "k8s.io/utils/pointer"
)

var (
scheme *runtime.Scheme
scheme *runtime.Scheme
nginxIngressAnnotationDefaultPrefix = "nginx.ingress.kubernetes.io"
Copy link

Choose a reason for hiding this comment

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

U1000: var nginxIngressAnnotationDefaultPrefix is unused


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@@ -17,59 +17,130 @@ limitations under the License.
package rollout

import (
"fmt"
Copy link

Choose a reason for hiding this comment

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

goimports: File is not goimports-ed


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

import (
"context"
"fmt"
"github.com/openkruise/rollouts/pkg/util/configuration"
Copy link

Choose a reason for hiding this comment

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

goimports: File is not goimports-ed


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2022

Codecov Report

Merging #102 (cd25c84) into master (c0b1fea) will increase coverage by 9.05%.
The diff coverage is 41.88%.

@@            Coverage Diff             @@
##           master     #102      +/-   ##
==========================================
+ Coverage   36.36%   45.41%   +9.05%     
==========================================
  Files          40       37       -3     
  Lines        3556     3543      -13     
==========================================
+ Hits         1293     1609     +316     
+ Misses       2059     1652     -407     
- Partials      204      282      +78     
Flag Coverage Δ
unittests 45.41% <41.88%> (+9.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/controller/rollout/rollout_controller.go 10.29% <0.00%> (-2.21%) ⬇️
pkg/controller/rollout/rollout_event_handler.go 48.57% <0.00%> (ø)
pkg/trafficrouting/network/gateway/gateway.go 53.27% <0.00%> (ø)
pkg/util/condition.go 0.00% <0.00%> (ø)
pkg/util/controller_finder.go 0.00% <0.00%> (ø)
pkg/util/lua_configuration.go 37.50% <ø> (ø)
pkg/util/rollout_utils.go 3.50% <0.00%> (+0.33%) ⬆️
pkg/controller/rollout/rollout_status.go 20.00% <20.00%> (ø)
pkg/trafficrouting/network/ingress/ingress.go 61.80% <25.00%> (ø)
pkg/controller/rollout/rollout_canary.go 43.46% <43.46%> (ø)
... and 9 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch 3 times, most recently from 9be3169 to bb454df Compare November 23, 2022 10:48
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
utilpointer "k8s.io/utils/pointer"
)

var (
scheme *runtime.Scheme
scheme *runtime.Scheme
Copy link

Choose a reason for hiding this comment

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

gofmt: File is not gofmt-ed with -s


ℹ️ Learn about @sonatype-lift commands

You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.

Command Usage
@sonatype-lift ignore Leave out the above finding from this PR
@sonatype-lift ignoreall Leave out all the existing findings from this PR
@sonatype-lift exclude <file|issue|path|tool> Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file

Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.


Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]

@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch 3 times, most recently from 7cfa022 to 7889c9f Compare November 24, 2022 02:57
@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch from 7889c9f to 8900fe1 Compare December 6, 2022 06:08
steps := len(c.Rollout.Spec.Strategy.Canary.Steps)
cond := util.GetRolloutCondition(*c.NewStatus, v1alpha1.RolloutConditionProgressing)
// need manual confirmation
if currentStep.Pause.Duration == nil {
Copy link
Member

Choose a reason for hiding this comment

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

If currentSetp == "100%", should we still need this manual confirmation?

Copy link
Member Author

Choose a reason for hiding this comment

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

The situation is a bit complicated, because there are two fields, weight and replicas, if one of them is 100% and the other is not, it is difficult to judge.

@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch from 8900fe1 to 7868fd6 Compare December 7, 2022 05:39
@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch from 7868fd6 to 1b655b9 Compare December 9, 2022 09:36
@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch 4 times, most recently from 25d861a to a5fba0b Compare December 14, 2022 12:38
@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch from a5fba0b to db67699 Compare December 14, 2022 13:05
@furykerry
Copy link
Member

/lgtm

Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
@zmberg zmberg force-pushed the rewrite-for-rollout-controller branch from db67699 to fbf442e Compare December 15, 2022 02:53
@kruise-bot kruise-bot removed the lgtm label Dec 15, 2022
@furykerry
Copy link
Member

/lgtm

@furykerry
Copy link
Member

/lgtm

@furykerry
Copy link
Member

/approve

@kruise-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: furykerry

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

@kruise-bot kruise-bot merged commit 973e39b into openkruise:master Dec 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants