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

[issue #1115] check if <updateIntervalSec> in Gateway is a positive i… #1144

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Chi-Kai
Copy link
Contributor

@Chi-Kai Chi-Kai commented Feb 28, 2025

…nteger.

What this PR does / why we need it:
fix #1115
Will this PR make the community happier?

Which issue this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close that issue when PR gets merged): fixes #

How is this PR tested

  • unit test
  • e2e test
  • other (please specify)
    图片

Special notes for your reviewer:

Release note:

Comment on lines 51 to 57
if edgedevice.Spec.GatewaySettings.LwM2MSetting == nil {
return nil, fmt.Errorf("LwM2MSetting not found in EdgeDevice spec.GatewaySettings")
}
if edgedevice.Spec.GatewaySettings.LwM2MSetting.UpdateIntervalSec <= 0 {
return nil, fmt.Errorf("LwM2MSetting UpdateIntervalSec must be greater than 0, current value: %d", edgedevice.Spec.GatewaySettings.LwM2MSetting.UpdateIntervalSec)
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

can we use kubebuilder to validate the value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

图片
It has been modified.

@tomqin93 tomqin93 requested a review from Copilot March 4, 2025 04:48

Choose a reason for hiding this comment

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

PR Overview

This PR ensures that the updateIntervalSec field is validated as a positive integer in Gateway configurations.

  • Added a kubebuilder validation marker for a minimum value of 1 in the Go type definition.
  • Updated the CRD YAML configuration to enforce a minimum value of 1 for updateIntervalSec.

Reviewed Changes

File Description
pkg/k8s/api/v1alpha1/edgedevice_types.go Added kubebuilder validation for updateIntervalSec to require a minimum of 1.
pkg/k8s/crd/config/edgedevice/bases/shifu.edgenesis.io_edgedevices.yaml Updated the CRD spec to include a minimum of 1 for updateIntervalSec for added consistency.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Shifu should check if <updateIntervalSec> in Gateway is a positive integer.
4 participants