Skip to content

Commit

Permalink
Merge pull request #124779 from cici37/updateEnv
Browse files Browse the repository at this point in the history
Update CEL default compatibility environment version  to 1.30
  • Loading branch information
k8s-ci-robot committed May 23, 2024
2 parents b42bb8f + 6980cda commit 8339711
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 @@ -2039,6 +2039,27 @@ func TestValidationExpressions(t *testing.T) {
},
expectedCost: 7,
},
{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 = append(baseOptsWithoutStrictCost, StrictCostOpt)
Expand Down

0 comments on commit 8339711

Please sign in to comment.