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

can not set ip type whilelist in ingress annotation #1096

Closed
zjj2wry opened this issue Aug 9, 2017 · 0 comments · Fixed by #1095
Closed

can not set ip type whilelist in ingress annotation #1096

zjj2wry opened this issue Aug 9, 2017 · 0 comments · Fixed by #1095

Comments

@zjj2wry
Copy link

zjj2wry commented Aug 9, 2017

if my annotation set ip not cidr will return error.
nginx.conf :

location / {
            set $proxy_upstream_name "3-mongo-80";
            #the annotation does not contain a valid IP address or network: invalid CIDR address: 192.168.8.104
            return 503;
        }

ingress code:
https://github.com/kubernetes/ingress/blob/master/core/pkg/ingress/annotations/ipwhitelist/main.go#L95

// ParseIPNets parses string slice to IPNet.
func ParseIPNets(specs ...string) (IPNet, error) {
	ipnetset := make(IPNet)
	for _, spec := range specs {
		spec = strings.TrimSpace(spec)
		_, ipnet, err := net.ParseCIDR(spec)
		if err != nil {
			return nil, err
		}
		k := ipnet.String() // In case of normalization
		ipnetset[k] = ipnet
	}
	return ipnetset, nil
}
aledbf added a commit that referenced this issue Aug 21, 2017
Fix(#1096) ingress annotation can not set ip in whitelist
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 a pull request may close this issue.

1 participant