-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(kuma-cp) do not override other dataplane with dp lifecycle
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
- Loading branch information
1 parent
4b96e9d
commit 3e08712
Showing
10 changed files
with
248 additions
and
20 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
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,16 @@ | ||
package auth_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/kumahq/kuma/pkg/test" | ||
"github.com/kumahq/kuma/test/framework" | ||
) | ||
|
||
func TestE2EDpAuth(t *testing.T) { | ||
if framework.IsK8sClustersStarted() { | ||
test.RunSpecs(t, "E2E Auth DP Suite") | ||
} else { | ||
t.SkipNow() | ||
} | ||
} |
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,85 @@ | ||
package auth | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
"github.com/kumahq/kuma/pkg/config/core" | ||
. "github.com/kumahq/kuma/test/framework" | ||
) | ||
|
||
func DpAuthUniversal() { | ||
var cluster Cluster | ||
var deployOptsFuncs []KumaDeploymentOption | ||
|
||
E2EBeforeSuite(func() { | ||
cluster = NewUniversalCluster(NewTestingT(), Kuma3, Silent) | ||
deployOptsFuncs = KumaUniversalDeployOpts | ||
|
||
err := NewClusterSetup(). | ||
Install(Kuma(core.Standalone, deployOptsFuncs...)). | ||
Setup(cluster) | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = cluster.VerifyKuma() | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
|
||
E2EAfterSuite(func() { | ||
Expect(cluster.DeleteKuma(deployOptsFuncs...)).To(Succeed()) | ||
Expect(cluster.DismissCluster()).To(Succeed()) | ||
}) | ||
|
||
It("should not be able to override someone else Dataplane", func() { | ||
// given other dataplane | ||
dp := ` | ||
type: Dataplane | ||
mesh: default | ||
name: dp-01 | ||
networking: | ||
address: 192.168.0.1 | ||
inbound: | ||
- port: 8080 | ||
tags: | ||
kuma.io/service: not-test-server | ||
` | ||
Expect(YamlUniversal(dp)(cluster)).To(Succeed()) | ||
|
||
// when trying to spin up dataplane with same name but token bound to a different service | ||
dpToken, err := cluster.GetKuma().GenerateDpToken("default", "test-server") | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = TestServerUniversal("dp-01", "default", dpToken, WithServiceName("test-server"))(cluster) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
// then | ||
Eventually(func() (string, error) { | ||
return cluster.GetKuma().GetKumaCPLogs() | ||
}, "30s", "1s").Should(ContainSubstring("you are trying to override existing dataplane to which you don't have an access")) | ||
}) | ||
|
||
It("should be able to override old Dataplane of same service", func() { | ||
// given | ||
dp := ` | ||
type: Dataplane | ||
mesh: default | ||
name: dp-02 | ||
networking: | ||
address: 192.168.0.2 | ||
inbound: | ||
- port: 8080 | ||
tags: | ||
kuma.io/service: test-server | ||
` | ||
Expect(YamlUniversal(dp)(cluster)).To(Succeed()) | ||
|
||
// when | ||
dpToken, err := cluster.GetKuma().GenerateDpToken("default", "test-server") | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = TestServerUniversal("dp-02", "default", dpToken, WithServiceName("test-server"))(cluster) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
// then | ||
Eventually(func() (string, error) { | ||
return cluster.GetKumactlOptions().RunKumactlAndGetOutput("get", "dataplanes", "-oyaml") | ||
}, "30s", "1s").ShouldNot(ContainSubstring("192.168.0.2")) | ||
}) | ||
} |
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,9 @@ | ||
package auth_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
|
||
"github.com/kumahq/kuma/test/e2e/auth/dp" | ||
) | ||
|
||
var _ = Describe("Test Universal", auth.DpAuthUniversal) |
Oops, something went wrong.