-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-enable unit tests and linting in gha
- Loading branch information
1 parent
7060490
commit 9ae92b4
Showing
13 changed files
with
51 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ const ( | |
ReplicaSetReconcilerModeDefault = ReplicaSetReconcilerMode("default") | ||
ReplicaSetReconcilerModeRolloutRestart = ReplicaSetReconcilerMode("rollout-restart") | ||
ReplicaSetReconcilerModeX0Y = ReplicaSetReconcilerMode("x0y") | ||
|
||
ReplicaSetControllerKindStatefulSet = "StatefulSet" | ||
) | ||
|
||
type ReplicaSetController struct { | ||
|
@@ -69,6 +71,8 @@ type ReplicaSetScalerReconciler struct { | |
|
||
// For more details, check Reconcile and its Result here: | ||
// - https://pkg.go.dev/sigs.k8s.io/[email protected]/pkg/reconcile | ||
// | ||
//nolint:gocyclo | ||
func (r *ReplicaSetScalerReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
log := log.FromContext(ctx) | ||
log.V(1).Info("Received reconcile request") | ||
|
@@ -203,7 +207,7 @@ func (r *ReplicaSetScalerReconciler) Reconcile(ctx context.Context, req ctrl.Req | |
|
||
replicaSetController := ReplicaSetController{} | ||
switch scaler.Spec.ReplicaSetControllerRef.Kind { | ||
case "StatefulSet": | ||
case ReplicaSetControllerKindStatefulSet: | ||
replicaSetController.Kind = scaler.Spec.ReplicaSetControllerRef.Kind | ||
default: | ||
err := fmt.Errorf("Unsupported ReplicaSetControllerRef.Kind") | ||
|
@@ -227,7 +231,7 @@ func (r *ReplicaSetScalerReconciler) Reconcile(ctx context.Context, req ctrl.Req | |
} | ||
|
||
switch replicaSetController.Kind { | ||
case "StatefulSet": | ||
case ReplicaSetControllerKindStatefulSet: | ||
statefulSetController, err := findByRef[*appsv1.StatefulSet]( | ||
ctx, | ||
r.Scheme, | ||
|
@@ -407,7 +411,7 @@ func (r *ReplicaSetScalerReconciler) Reconcile(ctx context.Context, req ctrl.Req | |
|
||
func (r *ReplicaSetScalerReconciler) GetRSControllerDesiredReplicas(replicaSetController ReplicaSetController) int32 { | ||
switch replicaSetController.Kind { | ||
case "StatefulSet": | ||
case ReplicaSetControllerKindStatefulSet: | ||
return *replicaSetController.StatefulSet.Spec.Replicas | ||
default: | ||
panic("unreachable") | ||
|
@@ -416,7 +420,7 @@ func (r *ReplicaSetScalerReconciler) GetRSControllerDesiredReplicas(replicaSetCo | |
|
||
func (r *ReplicaSetScalerReconciler) GetRSControllerActualReplicas(replicaSetController ReplicaSetController) int32 { | ||
switch replicaSetController.Kind { | ||
case "StatefulSet": | ||
case ReplicaSetControllerKindStatefulSet: | ||
return replicaSetController.StatefulSet.Status.Replicas | ||
default: | ||
panic("unreachable") | ||
|
@@ -426,7 +430,7 @@ func (r *ReplicaSetScalerReconciler) GetRSControllerActualReplicas(replicaSetCon | |
func (r *ReplicaSetScalerReconciler) ScaleTo(ctx context.Context, replicaSetController ReplicaSetController, replicas int32, restart bool) error { | ||
var obj client.Object | ||
switch replicaSetController.Kind { | ||
case "StatefulSet": | ||
case ReplicaSetControllerKindStatefulSet: | ||
replicaSetController.StatefulSet.Spec.Replicas = ptr.To(replicas) | ||
containerFound := false | ||
for containerIndex, container := range replicaSetController.StatefulSet.Spec.Template.Spec.Containers { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters