Skip to content

Commit

Permalink
Add dual stack support
Browse files Browse the repository at this point in the history
  • Loading branch information
aojea committed Aug 19, 2019
1 parent bc6ea0d commit 1cd41b3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
6 changes: 6 additions & 0 deletions pkg/apis/config/v1alpha3/default.go

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

2 changes: 2 additions & 0 deletions pkg/apis/config/v1alpha3/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ const (
IPv4Family ClusterIPFamily = "ipv4"
// IPv6Family sets ClusterIPFamily to ipv6
IPv6Family ClusterIPFamily = "ipv6"
// DualStackFamily sets ClusterIPFamily to ipv4-ipv6
DualStackFamily ClusterIPFamily = "ipv4-ipv6"
)

// PatchJSON6902 represents an inline kustomize json 6902 patch
Expand Down
6 changes: 6 additions & 0 deletions pkg/internal/apis/config/default.go

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

2 changes: 2 additions & 0 deletions pkg/internal/apis/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ const (
IPv4Family ClusterIPFamily = "ipv4"
// IPv6Family sets ClusterIPFamily to ipv6
IPv6Family ClusterIPFamily = "ipv6"
// DualStackFamily sets ClusterIPFamily to ipv4-ipv6
DualStackFamily ClusterIPFamily = "ipv4-ipv6"
)

// PatchJSON6902 represents an inline kustomize json 6902 patch
Expand Down
16 changes: 12 additions & 4 deletions pkg/internal/apis/config/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package config

import (
"net"
"strings"

"github.com/pkg/errors"

Expand All @@ -39,12 +40,19 @@ func (c *Cluster) Validate() error {
}

// podSubnet should be a valid CIDR
if _, _, err := net.ParseCIDR(c.Networking.PodSubnet); err != nil {
errs = append(errs, errors.Wrapf(err, "invalid podSubnet"))
cidrs := strings.Split(c.Networking.PodSubnet, ",")
for _, cidr := range cidrs {
if _, _, err := net.ParseCIDR(cidr); err != nil {
errs = append(errs, errors.Wrapf(err, "invalid podSubnet"))
}
}

// serviceSubnet should be a valid CIDR
if _, _, err := net.ParseCIDR(c.Networking.ServiceSubnet); err != nil {
errs = append(errs, errors.Wrapf(err, "invalid serviceSubnet"))
cidrs = strings.Split(c.Networking.ServiceSubnet, ",")
for _, cidr := range cidrs {
if _, _, err := net.ParseCIDR(cidr); err != nil {
errs = append(errs, errors.Wrapf(err, "invalid serviceSubnet"))
}
}

// validate nodes
Expand Down

0 comments on commit 1cd41b3

Please sign in to comment.