Skip to content

Commit

Permalink
Update cel env to 1.30
Browse files Browse the repository at this point in the history
  • Loading branch information
cici37 committed May 9, 2024
1 parent 3d24b96 commit d6f2778
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,27 @@ func TestValidationExpressions(t *testing.T) {
`quantity(self.val1).isInteger()`,
},
},
{name: "IP and CIDR",
obj: objs("20", "200M"),
schema: schemas(stringType, stringType),
valid: []string{
`isIP("192.168.0.1")`,
`ip.isCanonical("127.0.0.1")`,
`ip("192.168.0.1").family() > 0`,
`ip("0.0.0.0").isUnspecified()`,
`ip("127.0.0.1").isLoopback()`,
`ip("224.0.0.1").isLinkLocalMulticast()`,
`ip("192.168.0.1").isGlobalUnicast()`,
`type(ip("192.168.0.1")) == net.IP`,
`cidr("192.168.0.0/24").containsIP(ip("192.168.0.1"))`,
`cidr("192.168.0.0/24").containsCIDR("192.168.0.0/25")`,
`cidr("2001:db8::/32").containsCIDR(cidr("2001:db8::/33"))`,
`type(cidr("2001:db8::/32").ip()) == net.IP`,
`cidr('192.168.0.0/24') == cidr('192.168.0.0/24').masked()`,
`cidr('192.168.0.0/16').prefixLength() == 16`,
`cidr('::1/128').ip().family() == 6`,
},
},
}

for i := range tests {
Expand Down
2 changes: 1 addition & 1 deletion staging/src/k8s.io/apiserver/pkg/cel/environment/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
// desirable because it means that CEL expressions are portable across a wider range
// of Kubernetes versions.
func DefaultCompatibilityVersion() *version.Version {
return version.MajorMinor(1, 29)
return version.MajorMinor(1, 30)
}

var baseOpts = []VersionedOptions{
Expand Down

0 comments on commit d6f2778

Please sign in to comment.