Skip to content

Commit

Permalink
Merge pull request #1897 from panslava/missing-ipv6-subnet
Browse files Browse the repository at this point in the history
Add IsSubnetworkMissingIPv6GCEError to User Errors
  • Loading branch information
k8s-ci-robot authored Jan 23, 2023
2 parents 1dbcea7 + 9a36888 commit 8ed99a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const (
)

var networkTierErrorRegexp = regexp.MustCompile(`The network tier of external IP is STANDARD|PREMIUM, that of Address must be the same.`)
var subnetworkMissingIPv6ErrorRegexp = regexp.MustCompile("Subnetwork does not have an internal IPv6 IP space which is required for IPv6 L4 ILB forwarding rules.")

// NetworkTierError is a struct to define error caused by User misconfiguration of Network Tier.
type NetworkTierError struct {
Expand Down Expand Up @@ -201,6 +202,10 @@ func IsInUsedByError(err error) bool {
return strings.Contains(apiErr.Message, "being used by")
}

func IsSubnetworkMissingIPv6GCEError(err error) bool {
return subnetworkMissingIPv6ErrorRegexp.MatchString(err.Error())
}

// IsNetworkTierMismatchGCEError checks if error is a GCE network tier mismatch for external IP
func IsNetworkTierMismatchGCEError(err error) bool {
return networkTierErrorRegexp.MatchString(err.Error())
Expand Down Expand Up @@ -237,7 +242,8 @@ func IsUserError(err error) bool {
return IsNetworkTierError(err) ||
IsIPConfigurationError(err) ||
IsInvalidLoadBalancerSourceRangesSpecError(err) ||
IsInvalidLoadBalancerSourceRangesAnnotationError(err)
IsInvalidLoadBalancerSourceRangesAnnotationError(err) ||
IsSubnetworkMissingIPv6GCEError(err)
}

// IsNotFoundError returns true if the resource does not exist
Expand Down

0 comments on commit 8ed99a8

Please sign in to comment.