Skip to content
Closed
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
10 changes: 5 additions & 5 deletions .semaphore/semaphore.yml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions api/pkg/lib/numorstring/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ import (
// - For a port range, set MinPort and MaxPort to the (inclusive) port numbers. Set
// PortName to "".
// - For a single port, set MinPort = MaxPort and PortName = "".
//
// +kubebuilder:validation:Type=integer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this change force the type to be an integer only?

@radixo radixo Jan 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, just set type to Integer, and the XIntOrString relax it to accept string as well. I'm using the same for DSCP

// +kubebuilder:validation:XIntOrString
// +kubebuilder:validation:Pattern=`^.*`
Comment on lines +32 to +34

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

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

The kubebuilder markers appear inconsistent. Type=integer conflicts with Pattern=^.*$ which accepts any string. For a Port type that can represent port ranges or named ports, clarify whether these markers should validate the struct fields (MinPort, MaxPort, PortName) or if different markers are needed.

Suggested change
// +kubebuilder:validation:Type=integer
// +kubebuilder:validation:XIntOrString
// +kubebuilder:validation:Pattern=`^.*`

Copilot uses AI. Check for mistakes.
type Port struct {
MinPort uint16 `json:"minPort,omitempty"`
MaxPort uint16 `json:"maxPort,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions api/pkg/lib/numorstring/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ var (
}
)

// +kubebuilder:validation:Type=integer
// +kubebuilder:validation:XIntOrString
// +kubebuilder:validation:Pattern=`^.*`

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

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

The same marker inconsistency exists here as in Uint8OrString. The combination of Type=integer with Pattern=^.*$ (which matches any string) creates ambiguous validation semantics. Verify these markers correctly represent the type's dual integer/string nature.

Suggested change
// +kubebuilder:validation:Pattern=`^.*`
// +kubebuilder:validation:Pattern=`^(UDP|TCP|ICMP|ICMPv6|SCTP|UDPLite|[0-9]+)$`

Copilot uses AI. Check for mistakes.
type Protocol Uint8OrString

// ProtocolFromInt creates a Protocol struct from an integer value.
Expand Down
4 changes: 4 additions & 0 deletions api/pkg/lib/numorstring/uint8orstring.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ import (
// JSON or YAML marshalling and unmarshalling, it produces or consumes the
// inner type. This allows you to have, for example, a JSON field that can
// accept a name or number.
//
// +kubebuilder:validation:Type=integer
// +kubebuilder:validation:XIntOrString
// +kubebuilder:validation:Pattern=`^.*`
Comment on lines +27 to +29

Copilot AI Jan 6, 2026

Copy link

Choose a reason for hiding this comment

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

The kubebuilder markers seem contradictory. Type=integer suggests only integer values are valid, but Pattern=^.*$ allows any string. Additionally, XIntOrString is typically used for Kubernetes IntOrString types. Please clarify the intended validation behavior and ensure the markers accurately reflect whether this type accepts integers only, strings only, or both.

Suggested change
// +kubebuilder:validation:Type=integer
// +kubebuilder:validation:XIntOrString
// +kubebuilder:validation:Pattern=`^.*`
// +kubebuilder:validation:Type=string
// +kubebuilder:validation:XIntOrString

Copilot uses AI. Check for mistakes.
type Uint8OrString struct {
Type NumOrStringType `json:"type"`
NumVal uint8 `json:"numVal"`
Expand Down
5 changes: 3 additions & 2 deletions felix/bpf/asm/opcode_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions felix/docs/config-params.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ endif
# For building, we use the go-build image for the *host* architecture, even if the target is different
# the one for the host should contain all the necessary cross-compilation tools
# we do not need to use the arch since go-build:v0.15 now is multi-arch manifest
GO_BUILD_IMAGE ?= calico/go-build
GO_BUILD_IMAGE ?= jha48/go-build
CALICO_BUILD = $(GO_BUILD_IMAGE):$(GO_BUILD_VER)


Expand Down
4 changes: 2 additions & 2 deletions libcalico-go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ gen-files: gen-crds
gen-crds:
rm -rf config/crd
# Generate CRDs without descriptions
$(DOCKER_GO_BUILD) sh -c '$(GIT_CONFIG_SSH) controller-gen crd:allowDangerousTypes=true,crdVersions=v1,deprecatedV1beta1CompatibilityPreserveUnknownFields=false,maxDescLen=0 paths=./lib/apis/... output:crd:dir=config/crd/'
$(DOCKER_GO_BUILD) sh -c '$(GIT_CONFIG_SSH) controller-gen crd:allowDangerousTypes=true,crdVersions=v1,deprecatedV1beta1CompatibilityPreserveUnknownFields=false,maxDescLen=0 paths=./lib/apis/crd.projectcalico.org/... output:crd:dir=config/crd/'
# Generate CRDs with descriptions, and place them into a temp directory
$(DOCKER_GO_BUILD) sh -c '$(GIT_CONFIG_SSH) controller-gen crd:allowDangerousTypes=true,crdVersions=v1,deprecatedV1beta1CompatibilityPreserveUnknownFields=false paths=./lib/apis/... output:crd:dir=config/crd/crd-felix'
$(DOCKER_GO_BUILD) sh -c '$(GIT_CONFIG_SSH) controller-gen crd:allowDangerousTypes=true,crdVersions=v1,deprecatedV1beta1CompatibilityPreserveUnknownFields=false paths=./lib/apis/crd.projectcalico.org/... output:crd:dir=config/crd/crd-felix'
# Copy over felix CRD with descriptions
cp config/crd/crd-felix/crd.projectcalico.org_felixconfigurations.yaml config/crd
# Cleanup
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading