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

improve CheckAutoScaleAndReplicaCount #40297

Merged
merged 4 commits into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func validateFeatures(values *valuesv1alpha1.Values, spec *v1alpha1.IstioOperato

// CheckAutoScaleAndReplicaCount warns when autoscaleEnabled is true and k8s replicaCount is set.
func CheckAutoScaleAndReplicaCount(values *valuesv1alpha1.Values, spec *v1alpha1.IstioOperatorSpec) (errs util.Errors, warnings []string) {
if values.GetPilot().GetAutoscaleEnabled().GetValue() && spec.GetComponents().GetPilot().GetK8S().GetReplicaCount() != 0 {
if values.GetPilot().GetAutoscaleEnabled().GetValue() && spec.GetComponents().GetPilot().GetK8S().GetReplicaCount() > 1 {
warnings = append(warnings,
"components.pilot.k8s.replicaCount should not be set when values.pilot.autoscaleEnabled is true")
}
Expand Down
18 changes: 18 additions & 0 deletions operator/pkg/apis/istio/v1alpha1/validation/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,24 @@ components.ingressGateways[name=istio-ingressgateway].k8s.replicaCount should no
components.egressGateways[name=istio-egressgateway].k8s.replicaCount should not be set when values.gateways.istio-egressgateway.autoscaleEnabled is true
`),
},
{
name: "pilot.k8s.replicaCount is default value set when autoscaleEnabled is true",
values: `
values:
pilot:
autoscaleEnabled: true
gateways:
istio-ingressgateway:
autoscaleEnabled: true
istio-egressgateway:
autoscaleEnabled: true
components:
pilot:
k8s:
replicaCount: 1
`,
warnings: strings.TrimSpace(``),
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down
8 changes: 8 additions & 0 deletions releasenotes/notes/40297.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: release-notes/v2
kind: bug-fix
area: istioctl
issue:
- https://github.com/istio/istio/issues/40246
releaseNotes:
- |
**Fixed** istioctl install to not show a warning message when `values.pilot.replicaCount` is set equal to its default value.