-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add base changes for cluster endpoint access
- Loading branch information
Showing
10 changed files
with
328 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package v1alpha5 | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/ginkgo/extensions/table" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
type EndpointAccessCases struct { | ||
vpc *ClusterVPC | ||
endpoints *ClusterEndpoints | ||
Public *bool | ||
Private *bool | ||
} | ||
|
||
var _ = Describe("VPC Configuration", func() { | ||
DescribeTable("Can determine if VPC config in config file has cluster endpoints", | ||
func(e EndpointAccessCases) { | ||
cc := &ClusterConfig{} | ||
Expect(cc.HasClusterEndpointAccess()).Should(BeTrue()) | ||
cc.VPC = e.vpc | ||
Expect(cc.HasClusterEndpointAccess()).Should(BeTrue()) | ||
if cc.VPC != nil { | ||
cc.VPC.ClusterEndpoints = e.endpoints | ||
} | ||
if e.Public != nil && cc.VPC.ClusterEndpoints != nil { | ||
cc.VPC.ClusterEndpoints.PublicAccess = e.Public | ||
} | ||
if e.Private != nil && cc.VPC.ClusterEndpoints != nil { | ||
cc.VPC.ClusterEndpoints.PrivateAccess = e.Private | ||
} | ||
if e.Public != nil && e.Private != nil { | ||
if *e.Public == true || *e.Private == true { | ||
Expect(cc.HasClusterEndpointAccess()).Should(BeTrue()) | ||
} | ||
if *e.Public == true && *e.Private == false { | ||
Expect(cc.HasClusterEndpointAccess()).Should(BeTrue()) | ||
} | ||
if *e.Public == false && *e.Private == true { | ||
Expect(cc.HasClusterEndpointAccess()).Should(BeTrue()) | ||
} | ||
if *e.Public == false && *e.Private == false { | ||
Expect(cc.HasClusterEndpointAccess()).Should(BeFalse()) | ||
} | ||
} | ||
}, | ||
Entry("No VPC", EndpointAccessCases{ | ||
vpc: nil, | ||
endpoints: nil, | ||
Public: nil, | ||
Private: nil, | ||
}), | ||
Entry("Has Empty VPC", EndpointAccessCases{ | ||
vpc: &ClusterVPC{}, | ||
endpoints: nil, | ||
Public: nil, | ||
Private: nil, | ||
}), | ||
Entry("Public=True, Private=true", EndpointAccessCases{ | ||
vpc: &ClusterVPC{}, | ||
endpoints: &ClusterEndpoints{}, | ||
Public: &True, | ||
Private: &True, | ||
}), | ||
Entry("Public=true, Private=false", EndpointAccessCases{ | ||
vpc: &ClusterVPC{}, | ||
endpoints: &ClusterEndpoints{}, | ||
Public: &True, | ||
Private: &False, | ||
}), | ||
Entry("Public=false, Private=true", EndpointAccessCases{ | ||
vpc: &ClusterVPC{}, | ||
endpoints: &ClusterEndpoints{}, | ||
Public: nil, | ||
Private: nil, | ||
}), | ||
Entry("Public=false, Private=false", EndpointAccessCases{ | ||
vpc: &ClusterVPC{}, | ||
endpoints: &ClusterEndpoints{}, | ||
Public: &False, | ||
Private: &False, | ||
}), | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package vpc | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/weaveworks/eksctl/pkg/testutils" | ||
) | ||
|
||
func TestSuite(t *testing.T) { | ||
testutils.RegisterAndRun(t) | ||
} |
Oops, something went wrong.