Skip to content

Commit

Permalink
fix webhook panic (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
MegaByte875 committed Sep 30, 2023
1 parent 7898790 commit 55f4dc9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,13 @@ resources:
kind: NebulaRestore
path: github.com/vesoft-inc/nebula-operator/apis/apps/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: nebula-graph.io
group: autoscaling
kind: NebulaAutoscaler
path: github.com/vesoft-inc/nebula-operator/apis/autoscaling/v1alpha1
version: v1alpha1
version: "3"
2 changes: 1 addition & 1 deletion cmd/autoscaler/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (o *Options) AddFlags(flags *pflag.FlagSet) {
flags.DurationVar(&o.HPAOpts.HorizontalPodAutoscalerUpscaleForbiddenWindow.Duration, "autoscaler-upscale-delay", defaultAutoscalerUpscaleForbiddenWindow.Duration, "The period since last upscale, before another upscale can be performed in nebula autoscaler.")
flags.DurationVar(&o.HPAOpts.HorizontalPodAutoscalerDownscaleStabilizationWindow.Duration, "autoscaler-downscale-stabilization", defaultAutoscalerDownscaleStabilizationWindow.Duration, "The period for which nebula autoscaler will look backwards and not scale down below any recommendation it made during that period.")
flags.DurationVar(&o.HPAOpts.HorizontalPodAutoscalerDownscaleForbiddenWindow.Duration, "autoscaler-downscale-delay", defaultAutoscalerDownscaleForbiddenWindow.Duration, "The period since last downscale, before another downscale can be performed in nebula autoscaler.")
flags.Float64Var(&o.HPAOpts.HorizontalPodAutoscalerTolerance, "autscaler-tolerance", 0.1, "The minimum change (from 1.0) in the desired-to-actual metrics ratio for the nebula autoscaler to consider scaling.")
flags.Float64Var(&o.HPAOpts.HorizontalPodAutoscalerTolerance, "autoscaler-tolerance", 0.1, "The minimum change (from 1.0) in the desired-to-actual metrics ratio for the nebula autoscaler to consider scaling.")
flags.DurationVar(&o.HPAOpts.HorizontalPodAutoscalerCPUInitializationPeriod.Duration, "autoscaler-cpu-initialization-period", defaultAutoscalerCPUInitializationPeriod.Duration, "The period after pod start when CPU samples might be skipped.")
flags.DurationVar(&o.HPAOpts.HorizontalPodAutoscalerInitialReadinessDelay.Duration, "autoscaler-initial-readiness-delay", defaultAutoscalerInitialReadinessDelay.Duration, "The period after pod start during which readiness changes will be treated as initial readiness.")

Expand Down
3 changes: 2 additions & 1 deletion pkg/webhook/nebulacluster/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ func validateNebulaClusterUpdateStoragedDataVolume(nc, oldNC *v1alpha1.NebulaClu
if len(nc.Spec.Storaged.DataVolumeClaims) != len(oldNC.Spec.Storaged.DataVolumeClaims) {
allErrs = append(allErrs, field.Forbidden(
field.NewPath("spec", "storaged", "dataVolumeClaims"),
"storaged dataVolumeClaims len is immutable",
"storaged dataVolumeClaims is immutable",
))
return allErrs
}
for i, pvc := range nc.Spec.Storaged.DataVolumeClaims {
if pvc.Resources.Requests.Storage().Cmp(*oldNC.Spec.Storaged.DataVolumeClaims[i].Resources.Requests.Storage()) == -1 {
Expand Down

0 comments on commit 55f4dc9

Please sign in to comment.