Skip to content

Commit

Permalink
Fix all the "make vet" errors in Controller V2 branch. (#177)
Browse files Browse the repository at this point in the history
* Validation step to check Nodes and ASG launch configs

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Validating launch definition after a rolling upgrade

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Resolve error log message and return statement

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Adding Functional Test (#113)

* Adding BDD, workflow and badge

* Changing CI workflow job name

* Adding make manifests

* Clarifying cron time zone comment

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* release 0.13 (#115)

* release 0.13

* Update CHANGELOG.md

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* bump version (#116)

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Repo selection for CI and BDD workflows & CI step for releases (#117)

* CI-BDD not on forks & Step for releases (#2)

* Testing CI-BDD not on forks & Step for releases

* Adding step for image with tag git-tag

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Terminate unjoined nodes

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Resolving PR comments

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Set version and update CHANGELOG for version 0.14. (#121)

Co-authored-by: Shri Javadekar <[email protected]>
Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Bump version to 0.15-dev.

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Fix typo in README.md. (#125)

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Ignore the terminated instance during upgrade

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Added WARNING prefix in the logging

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Apply suggestions from code review

Co-authored-by: Kevin Downey <[email protected]>
Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Capitalize sprintf to Sprintf

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Upgrade to Go 1.15 (#128)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Fix few typos and simplify error returns, remove redundant types (#131)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Readiness gates implementation for eager mode (#130)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Adding Functional Test (#113)

* Adding BDD, workflow and badge

* Changing CI workflow job name

* Adding make manifests

* Clarifying cron time zone comment

Signed-off-by: sbadiger <[email protected]>

* Validation step to check Nodes and ASG launch configs (#112)

* Validation step to check Nodes and ASG launch configs

* Validating launch definition after a rolling upgrade

* Resolve error log message and return statement

Co-authored-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* release 0.13 (#115)

* release 0.13

* Update CHANGELOG.md

Signed-off-by: sbadiger <[email protected]>

* bump version (#116)

Signed-off-by: sbadiger <[email protected]>

* Repo selection for CI and BDD workflows & CI step for releases (#117)

* CI-BDD not on forks & Step for releases (#2)

* Testing CI-BDD not on forks & Step for releases

* Adding step for image with tag git-tag

Signed-off-by: sbadiger <[email protected]>

* Terminate unjoined nodes (#120)

* Validation step to check Nodes and ASG launch configs

* Validating launch definition after a rolling upgrade

* Resolve error log message and return statement

* Terminate unjoined nodes

* Resolving PR comments

Co-authored-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Set version and update CHANGELOG for version 0.14. (#121)

Co-authored-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Bump version to 0.15-dev.

Signed-off-by: sbadiger <[email protected]>

* Fix bug when switching to launch templates (#136)

* Update rollingupgrade_controller.go

* Update rollingupgrade_controller.go

Signed-off-by: Eytan Avisror <[email protected]>

* spacing fixes

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Extract script runner to a separate type; fix work with env. variables (#132)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Set version and update CHANGELOG for version v0.15 (#137)

Signed-off-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Bump version to v0.16-dev.

Signed-off-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Propagate parent env variables to allow to talk with API Server (#144)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Bump Golang CI action to fix failed CI run (#146)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Simplify (#145)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Add Expiration to cache and do not refresh ASG if cache is not expired (#143)

Signed-off-by: Oleg Atamanenko <[email protected]>

Co-authored-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Fix documentation for uniform across AZ Update strategy and fix typos (#147)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Move cluster state from package level to a cluster state impl (#148)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Simplify work with intstr type. (#149)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* If instance is in standby mode already, just return (#138)

Signed-off-by: Oleg Atamanenko <[email protected]>

Co-authored-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Handle terminated instances gracefully. (#150)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Template version comparison fix (#155)

* get template version

Signed-off-by: Eytan Avisror <[email protected]>

* fix tests

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* release 0.16 (#157)

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* bump version to 0.17-dev (#158)

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Don't uncordon node on failure to run postDrain script when IgnoreDrainFailures set (#151)

* Don't uncordon node on failure to run postDrain script when IgnoreDrainFailures set

Signed-off-by: Adam Malcontenti-Wilson <[email protected]>

* Test node uncordon when postDrain / postDrainWait script fails

Signed-off-by: Adam Malcontenti-Wilson <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Abort on strategy failure instead of continuing (#152)

* Abort on strategy failure instead of continuing

Signed-off-by: Adam Malcontenti-Wilson <[email protected]>

* Remove unformatted error message placeholder

Signed-off-by: Adam Malcontenti-Wilson <[email protected]>

* Explictly specify strategy for tests

Signed-off-by: Adam Malcontenti-Wilson <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* use NamespacedName (#160)

Signed-off-by: Eytan Avisror <[email protected]>

Co-authored-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Set version and update CHANGELOG for version v0.17 (#161)

Signed-off-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Bump version to v0.18-dev (#162)

Signed-off-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Move constants to types so that they can be reused (#167)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Remove separate module for pkg/log (#168)

Signed-off-by: Oleg Atamanenko <[email protected]>

Co-authored-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Bump dependencies. (#169)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* use standard fmt.Errorf to format error message; unify error format (#171)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Fix namespaced name order (#170)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Add instance id to the logs (#173)

Signed-off-by: Oleg Atamanenko <[email protected]>

Co-authored-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Bump golang and busybox (#172)

Signed-off-by: Oleg Atamanenko <[email protected]>

Co-authored-by: Shri Javadekar <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Expose template list and other execution errors to logs (#166)

* Log and return wrapped launchtemplate error

Signed-off-by: Adam Malcontenti-Wilson <[email protected]>

* Expose execution error in logs

Signed-off-by: Adam Malcontenti-Wilson <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* output can contain other messages from API Server, so be more relaxed (#174)

Signed-off-by: Oleg Atamanenko <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Delete README.md

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* delete all

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* scaffolding

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* add API

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* initial code

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* add more scaffolding

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* Add kubernetes API calls

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* aws API calls

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* AWS API calls & Drift detection

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* validate() function

Signed-off-by: shreyas-badiger <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* modified validate()

Signed-off-by: sbadiger <[email protected]>

* modified validate()

Signed-off-by: sbadiger <[email protected]>

* initial rotation logic

Signed-off-by: Eytan Avisror <[email protected]>
Signed-off-by: sbadiger <[email protected]>

* basic script_runner without any modifications

Signed-off-by: sbadiger <[email protected]>

* Fix all the vet related errors

Signed-off-by: sbadiger <[email protected]>

Co-authored-by: Alfredo Garo <[email protected]>
Co-authored-by: Eytan Avisror <[email protected]>
Co-authored-by: Shri Javadekar <[email protected]>
Co-authored-by: Shri Javadekar <[email protected]>
Co-authored-by: Shri Javadekar <[email protected]>
Co-authored-by: Craig Robson <[email protected]>
Co-authored-by: Kevin Downey <[email protected]>
Co-authored-by: Oleg Atamanenko <[email protected]>
Co-authored-by: Shreyas Badiger <[email protected]>
Co-authored-by: Adam Malcontenti-Wilson <[email protected]>
Co-authored-by: Adam Malcontenti-Wilson <[email protected]>
Co-authored-by: Eytan Avisror <[email protected]>
  • Loading branch information
13 people authored Jan 28, 2021
1 parent 59e9b0d commit 7cb15b0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
8 changes: 6 additions & 2 deletions api/v1alpha1/rollingupgrade_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ limitations under the License.
package v1alpha1

import (
"common"

"fmt"
"strconv"
"strings"

"github.com/keikoproj/upgrade-manager/controllers/common"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
Expand Down Expand Up @@ -220,13 +221,16 @@ func (r *RollingUpgrade) IsForceRefresh() bool {
return r.Spec.ForceRefresh
}

func (r *RollingUpgrade) StrategyMode() UpdateStrategyMode {
return r.Spec.Strategy.Mode
}
func (r *RollingUpgrade) Validate() (bool, error) {
strategy := r.Spec.Strategy

// validating the Type value
if strategy.Type == "" {
r.Spec.Strategy.Type = RandomUpdateStrategy
} else if !common.ContainsEqualFold(AllowedStrategyType, strategy.Type) {
} else if !common.ContainsEqualFold(AllowedStrategyType, string(strategy.Type)) {
err := fmt.Errorf("%s: Invalid value for startegy Type - %d", r.Name, strategy.MaxUnavailable.IntVal)
return false, err
}
Expand Down
19 changes: 10 additions & 9 deletions controllers/providers/aws/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@ func GetScalingAZs(instances []*autoscaling.Instance) []string {
return AZs
}

func SelectInstancesByAZ(instances []*autoscaling.Group) *autoscaling.Instance {
for _, instance := range group.Instances {
selectedID := aws.StringValue(instance.InstanceId)
if strings.EqualFold(instanceID, selectedID) {
return instance
}
}
return &autoscaling.Instance{}
}
// func SelectInstancesByAZ(instances []*autoscaling.Group) *autoscaling.Instance {
// for _, instance := range group.Instances {
// selectedID := aws.StringValue(instance.InstanceId)
// if strings.EqualFold(instanceID, selectedID) {
// return instance
// }
// }
// return &autoscaling.Instance{}
// }


// func ListScalingInstanceIDs(group *autoscaling.Group) []string {
// instanceIDs := make([]string, 0)
Expand Down
12 changes: 11 additions & 1 deletion controllers/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,21 @@ func (r *RollingUpgradeReconciler) ReplaceNodeBatch(rollingUpgrade *v1alpha1.Rol
switch mode {
case v1alpha1.UpdateStrategyModeEager:
for _, target := range batch {
_ = target
// Add in-progress tag

// Standby

// Wait for desired nodes

// predrain script

// Issue drain/scripts concurrently - set lastDrainTime

// post drain script

// Wait for desired nodes

// Issue drain/scripts concurrently - set lastDrainTime

// Is drained?
Expand All @@ -91,6 +100,7 @@ func (r *RollingUpgradeReconciler) ReplaceNodeBatch(rollingUpgrade *v1alpha1.Rol
}
case v1alpha1.UpdateStrategyModeLazy:
for _, target := range batch {
_ = target
// Add in-progress tag

// Issue drain/scripts concurrently - set lastDrainTime
Expand All @@ -100,7 +110,7 @@ func (r *RollingUpgradeReconciler) ReplaceNodeBatch(rollingUpgrade *v1alpha1.Rol
// Terminate - set lastTerminateTime
}
}

return true, nil
}

func (r *RollingUpgradeReconciler) SelectTargets(rollingUpgrade *v1alpha1.RollingUpgrade, scalingGroup *autoscaling.Group) []*autoscaling.Instance {
Expand Down

0 comments on commit 7cb15b0

Please sign in to comment.