-
Notifications
You must be signed in to change notification settings - Fork 339
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) signing token in multizone (#1007)
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com> # Conflicts: # pkg/sds/auth/universal/auth_test.go # pkg/tokens/builtin/issuer/issuer.go # test/framework/universal_cluster.go
- Loading branch information
Nikolay Nikolaev
committed
Oct 1, 2020
1 parent
b8aa994
commit 4e88438
Showing
19 changed files
with
266 additions
and
71 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,98 @@ | ||
package e2e | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
|
||
"github.com/gruntwork-io/terratest/modules/k8s" | ||
"github.com/gruntwork-io/terratest/modules/retry" | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
"github.com/pkg/errors" | ||
|
||
"github.com/kumahq/kuma/pkg/config/core" | ||
. "github.com/kumahq/kuma/test/framework" | ||
) | ||
|
||
var _ = Describe("Test Kubernetes/Universal deployment when Global is on K8S", func() { | ||
|
||
var globalCluster, remoteCluster Cluster | ||
|
||
BeforeEach(func() { | ||
k8sClusters, err := NewK8sClusters( | ||
[]string{Kuma1}, | ||
Verbose) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
universalClusters, err := NewUniversalClusters( | ||
[]string{Kuma3}, | ||
Verbose) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
// Global | ||
globalCluster = k8sClusters.GetCluster(Kuma1) | ||
err = NewClusterSetup(). | ||
Install(Kuma(core.Global)). | ||
Setup(globalCluster) | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = globalCluster.VerifyKuma() | ||
Expect(err).ToNot(HaveOccurred()) | ||
globalCP := globalCluster.GetKuma() | ||
|
||
echoServerToken, err := globalCP.GenerateDpToken("echo-server_kuma-test_svc_8080") | ||
Expect(err).ToNot(HaveOccurred()) | ||
demoClientToken, err := globalCP.GenerateDpToken("demo-client") | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
// Remote | ||
remoteCluster = universalClusters.GetCluster(Kuma3) | ||
err = NewClusterSetup(). | ||
Install(Kuma(core.Remote, WithGlobalAddress(globalCP.GetKDSServerAddress()))). | ||
Install(EchoServerUniversal(echoServerToken)). | ||
Install(DemoClientUniversal(demoClientToken)). | ||
Setup(remoteCluster) | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = remoteCluster.VerifyKuma() | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
// connect Remote with Global | ||
err = k8s.KubectlApplyFromStringE(globalCluster.GetTesting(), globalCluster.GetKubectlOptions(), | ||
fmt.Sprintf(ZoneTemplateK8s, | ||
Kuma3, | ||
remoteCluster.GetKuma().GetIngressAddress())) | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
|
||
AfterEach(func() { | ||
err := globalCluster.DeleteKuma() | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = globalCluster.DismissCluster() | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
err = remoteCluster.DeleteKuma() | ||
Expect(err).ToNot(HaveOccurred()) | ||
err = remoteCluster.DismissCluster() | ||
Expect(err).ToNot(HaveOccurred()) | ||
}) | ||
|
||
It("communication in between apps in remote zone works", func() { | ||
stdout, _, err := remoteCluster.ExecWithRetries("", "", "demo-client", | ||
"curl", "-v", "-m", "3", "localhost:4001") | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(stdout).To(ContainSubstring("HTTP/1.1 200 OK")) | ||
|
||
retry.DoWithRetry(remoteCluster.GetTesting(), "curl remote service", | ||
DefaultRetries, DefaultTimeout, | ||
func() (string, error) { | ||
stdout, _, err = remoteCluster.ExecWithRetries("", "", "demo-client", | ||
"curl", "-v", "-m", "3", "localhost:4001") | ||
if err != nil { | ||
return "should retry", err | ||
} | ||
if strings.Contains(stdout, "HTTP/1.1 200 OK") { | ||
return "Accessing service successful", nil | ||
} | ||
return "should retry", errors.Errorf("should retry") | ||
}) | ||
}) | ||
}) |
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
Oops, something went wrong.