mirror of https://github.com/kubernetes/kops.git
parent
3dac0f7fb5
commit
686e4efa3b
|
@ -69,6 +69,9 @@ type CreateClusterOptions struct {
|
|||
|
||||
// Enable/Disable Bastion Host complete setup
|
||||
Bastion bool
|
||||
|
||||
// Egress configuration - FOR TESTING ONLY
|
||||
Egress string
|
||||
}
|
||||
|
||||
func (o *CreateClusterOptions) InitDefaults() {
|
||||
|
@ -249,8 +252,9 @@ func RunCreateCluster(f *util.Factory, out io.Writer, c *CreateClusterOptions) e
|
|||
subnetName := zoneName
|
||||
if existingSubnets[subnetName] == nil {
|
||||
cluster.Spec.Subnets = append(cluster.Spec.Subnets, api.ClusterSubnetSpec{
|
||||
Name: subnetName,
|
||||
Zone: subnetName,
|
||||
Name: subnetName,
|
||||
Zone: subnetName,
|
||||
Egress: c.Egress,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,6 @@ package main
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
//"fmt"
|
||||
"github.com/golang/glog"
|
||||
"io/ioutil"
|
||||
"k8s.io/kops/cmd/kops/util"
|
||||
|
@ -52,11 +51,11 @@ func TestCreateClusterPrivate(t *testing.T) {
|
|||
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/private", "v1alpha2")
|
||||
}
|
||||
|
||||
// TestCreateClusterPrivate runs kops create cluster private.example.com --zones us-test-1a --master-zones us-test-1a
|
||||
//func TestCreateClusterWithNGWSpecified(t *testing.T) {
|
||||
// runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ngwspecified", "v1alpha1")
|
||||
// runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ngwspecified", "v1alpha2")
|
||||
//}
|
||||
// TestCreateClusterWithNGWSpecified runs kops create cluster private.example.com --zones us-test-1a --master-zones us-test-1a
|
||||
func TestCreateClusterWithNGWSpecified(t *testing.T) {
|
||||
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ngwspecified", "v1alpha1")
|
||||
runCreateClusterIntegrationTest(t, "../../tests/integration/create_cluster/ngwspecified", "v1alpha2")
|
||||
}
|
||||
|
||||
func runCreateClusterIntegrationTest(t *testing.T, srcDir string, version string) {
|
||||
var stdout bytes.Buffer
|
||||
|
|
|
@ -158,7 +158,6 @@ func RunUpdateCluster(f *util.Factory, clusterName string, out io.Writer, c *Upd
|
|||
}
|
||||
|
||||
err = applyCmd.Run()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ aws configure # Input your credentials here
|
|||
aws iam list-users
|
||||
```
|
||||
|
||||
PyPi is the officially supported `aws cli` download avenue, and kops suggests using it. [More information](https://pypi.python.org/pypi/awscli) on the package.
|
||||
|
||||
#### Other Platforms
|
||||
|
||||
Official documentation [here](http://docs.aws.amazon.com/cli/latest/userguide/installing.html)
|
||||
|
|
|
@ -310,4 +310,6 @@ type ClusterZoneSpec struct {
|
|||
|
||||
// ProviderID is the cloud provider id for the objects associated with the zone (the subnet on AWS)
|
||||
ProviderID string `json:"id,omitempty"`
|
||||
|
||||
Egress string `json:"egress,omitempty"`
|
||||
}
|
||||
|
|
|
@ -64,15 +64,17 @@ func Convert_v1alpha1_ClusterSpec_To_kops_ClusterSpec(in *ClusterSpec, out *kops
|
|||
ProviderID: z.ProviderID,
|
||||
Zone: z.Name,
|
||||
Type: kops.SubnetTypePrivate,
|
||||
Egress: z.Egress,
|
||||
})
|
||||
}
|
||||
|
||||
if z.CIDR != "" {
|
||||
out.Subnets = append(out.Subnets, kops.ClusterSubnetSpec{
|
||||
Name: "utility-" + z.Name,
|
||||
CIDR: z.CIDR,
|
||||
Zone: z.Name,
|
||||
Type: kops.SubnetTypeUtility,
|
||||
Name: "utility-" + z.Name,
|
||||
CIDR: z.CIDR,
|
||||
Zone: z.Name,
|
||||
Type: kops.SubnetTypeUtility,
|
||||
Egress: z.Egress,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
|
@ -82,6 +84,7 @@ func Convert_v1alpha1_ClusterSpec_To_kops_ClusterSpec(in *ClusterSpec, out *kops
|
|||
ProviderID: z.ProviderID,
|
||||
Zone: z.Name,
|
||||
Type: kops.SubnetTypePublic,
|
||||
Egress: z.Egress,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -148,6 +151,7 @@ func Convert_kops_ClusterSpec_To_v1alpha1_ClusterSpec(in *kops.ClusterSpec, out
|
|||
return fmt.Errorf("cannot convert to v1alpha1: duplicate zone: %v", zone)
|
||||
}
|
||||
zone.PrivateCIDR = s.CIDR
|
||||
zone.Egress = s.Egress
|
||||
zone.ProviderID = s.ProviderID
|
||||
|
||||
case kops.SubnetTypeUtility:
|
||||
|
@ -172,6 +176,7 @@ func Convert_kops_ClusterSpec_To_v1alpha1_ClusterSpec(in *kops.ClusterSpec, out
|
|||
return fmt.Errorf("cannot convert to v1alpha1: duplicate zone: %v", zone)
|
||||
}
|
||||
zone.CIDR = s.CIDR
|
||||
zone.Egress = s.Egress
|
||||
zone.ProviderID = s.ProviderID
|
||||
}
|
||||
}
|
||||
|
|
|
@ -962,7 +962,6 @@ func autoConvert_v1alpha1_KubeAPIServerConfig_To_kops_KubeAPIServerConfig(in *Ku
|
|||
out.OIDCIssuerURL = in.OIDCIssuerURL
|
||||
out.OIDCClientID = in.OIDCClientID
|
||||
out.OIDCCAFile = in.OIDCCAFile
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -228,6 +228,7 @@ type ClusterSubnetSpec struct {
|
|||
// ProviderID is the cloud provider id for the objects associated with the zone (the subnet on AWS)
|
||||
ProviderID string `json:"id,omitempty"`
|
||||
|
||||
Egress string `json:"egress,omitempty"`
|
||||
Type SubnetType `json:"type,omitempty"`
|
||||
Egress string `json:"egress,omitempty"`
|
||||
|
||||
Type SubnetType `json:"type,omitempty"`
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ func (c *Cluster) Validate(strict bool) error {
|
|||
// Egress specification support
|
||||
{
|
||||
for _, s := range c.Spec.Subnets {
|
||||
if s.Egress != "" && !(strings.Contains("nat-", s.Egress)) {
|
||||
if s.Egress != "" && !strings.HasPrefix(s.Egress, "nat-") {
|
||||
return fmt.Errorf("egress must be of type NAT Gateway")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ func (b *NetworkModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
return err
|
||||
}
|
||||
|
||||
var ngw = &awstasks.NatGateway{}
|
||||
var ngw *awstasks.NatGateway
|
||||
if b.Cluster.Spec.Subnets[i].Egress != "" {
|
||||
if strings.Contains(b.Cluster.Spec.Subnets[i].Egress, "nat-") {
|
||||
|
||||
|
@ -204,7 +204,7 @@ func (b *NetworkModelBuilder) Build(c *fi.ModelBuilderContext) error {
|
|||
Name: s(zone + "." + b.ClusterName()),
|
||||
Subnet: utilitySubnet,
|
||||
ElasticIP: eip,
|
||||
AssociatedRouteTable: b.LinkToPrivateRouteTableInZone(zone), // Unsure about this?
|
||||
AssociatedRouteTable: b.LinkToPrivateRouteTableInZone(zone),
|
||||
}
|
||||
c.AddTask(ngw)
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ spec:
|
|||
nodes: private
|
||||
zones:
|
||||
- cidr: 172.20.0.0/22
|
||||
egress: nat-09123456
|
||||
name: us-test-1a
|
||||
privateCIDR: 172.20.32.0/19
|
||||
|
||||
|
|
|
@ -27,9 +27,8 @@ spec:
|
|||
nonMasqueradeCIDR: 100.64.0.0/10
|
||||
subnets:
|
||||
- cidr: 172.20.32.0/19
|
||||
egress: nat-09123456
|
||||
name: us-test-1a
|
||||
ngwEip: eipalloc-e12345
|
||||
ngwId: nat-09123456
|
||||
type: Private
|
||||
zone: us-test-1a
|
||||
- cidr: 172.20.0.0/22
|
||||
|
|
|
@ -4,5 +4,4 @@ Cloud: aws
|
|||
Topology: private
|
||||
Networking: kopeio-vxlan
|
||||
Bastion: true
|
||||
NgwEips: eipalloc-e12345
|
||||
NgwIds: nat-09123456
|
||||
Egress: nat-09123456
|
Loading…
Reference in New Issue