-
Notifications
You must be signed in to change notification settings - Fork 326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NET-9173: tcp acceptance tests #3988
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
22 changes: 22 additions & 0 deletions
22
acceptance/tests/fixtures/bases/static-server-test-tcp/configmap.yaml
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,22 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: static-server-config | ||
data: | ||
config: | | ||
{ | ||
local_certs | ||
skip_install_trust | ||
auto_https disable_redirects | ||
} | ||
static-server-hostname.virtual.server.consul { | ||
log | ||
respond "hello world" | ||
} | ||
:80 { | ||
log | ||
respond "hello world" | ||
} |
41 changes: 41 additions & 0 deletions
41
acceptance/tests/fixtures/bases/static-server-test-tcp/deployment.yaml
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,41 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: static-server | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: static-server | ||
template: | ||
metadata: | ||
labels: | ||
app: static-server | ||
spec: | ||
containers: | ||
- name: caddy | ||
image: caddy:latest | ||
ports: | ||
- name: https-port | ||
containerPort: 443 | ||
- name: http-port | ||
containerPort: 80 | ||
volumeMounts: | ||
- name: data | ||
mountPath: "/data" | ||
- name: config | ||
mountPath: /etc/caddy/ | ||
readOnly: true | ||
serviceAccountName: static-server | ||
volumes: | ||
- name: data | ||
emptyDir: {} | ||
- name: config | ||
configMap: | ||
name: static-server-config | ||
items: | ||
- key: "config" | ||
path: "Caddyfile" |
10 changes: 10 additions & 0 deletions
10
acceptance/tests/fixtures/bases/static-server-test-tcp/kustomization.yaml
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,10 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
resources: | ||
- deployment.yaml | ||
- configmap.yaml | ||
- service.yaml | ||
- serviceaccount.yaml | ||
- psp-rolebinding.yaml | ||
- privileged-scc-rolebinding.yaml |
14 changes: 14 additions & 0 deletions
14
acceptance/tests/fixtures/bases/static-server-test-tcp/privileged-scc-rolebinding.yaml
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,14 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: static-server-openshift-privileged | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: system:openshift:scc:privileged | ||
subjects: | ||
- kind: ServiceAccount | ||
name: static-server |
14 changes: 14 additions & 0 deletions
14
acceptance/tests/fixtures/bases/static-server-test-tcp/psp-rolebinding.yaml
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,14 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
name: static-server | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: test-psp | ||
subjects: | ||
- kind: ServiceAccount | ||
name: static-server |
21 changes: 21 additions & 0 deletions
21
acceptance/tests/fixtures/bases/static-server-test-tcp/service.yaml
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,21 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: static-server | ||
labels: | ||
app: static-server | ||
spec: | ||
ports: | ||
- name: https-port | ||
port: 443 | ||
targetPort: https-port | ||
protocol: TCP | ||
- name: http-port | ||
port: 80 | ||
targetPort: http-port | ||
protocol: TCP | ||
selector: | ||
app: static-server |
7 changes: 7 additions & 0 deletions
7
acceptance/tests/fixtures/bases/static-server-test-tcp/serviceaccount.yaml
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,7 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: static-server |
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 |
---|---|---|
|
@@ -40,17 +40,19 @@ func TestPeering_Connect(t *testing.T) { | |
t.Skipf("skipping this test because peering is not supported in version %v", cfg.ConsulVersion.String()) | ||
} | ||
|
||
const staticServerPeer = "server" | ||
const staticClientPeer = "client" | ||
const ( | ||
staticServerPeer = "server" | ||
staticClientPeer = "client" | ||
) | ||
|
||
cases := []struct { | ||
name string | ||
ACLsEnabled bool | ||
}{ | ||
{ | ||
"default installation", | ||
false, | ||
}, | ||
// { | ||
// "default installation", | ||
// false, | ||
// }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Left for testing |
||
{ | ||
"secure installation", | ||
true, | ||
|
@@ -337,7 +339,7 @@ func TestPeering_Connect(t *testing.T) { | |
|
||
// Create the external server in the server Kubernetes cluster, outside the mesh in the "external" namespace | ||
logger.Log(t, "creating static-server deployment in server peer outside of mesh") | ||
k8s.DeployKustomize(t, externalServerOpts, cfg.NoCleanupOnFailure, cfg.NoCleanup, cfg.DebugDirectory, "../fixtures/bases/static-server") | ||
k8s.DeployKustomize(t, externalServerOpts, cfg.NoCleanupOnFailure, cfg.NoCleanup, cfg.DebugDirectory, "../fixtures/bases/static-server-test-tcp") | ||
|
||
// Prevent dialing the server directly through the sidecar. | ||
terminatinggateway.CreateMeshConfigEntry(t, staticServerPeerClient, "") | ||
|
@@ -377,6 +379,16 @@ func TestPeering_Connect(t *testing.T) { | |
// Test that we can make a call to the terminating gateway. | ||
logger.Log(t, "trying calls to terminating gateway") | ||
k8s.CheckStaticServerConnectionSuccessful(t, staticClientOpts, staticClientName, externalServerHostnameURL) | ||
|
||
// Update the service default declaring the external service (aka Destination) | ||
logger.Log(t, "updating service defaults to try tcp scenario") | ||
// Register the external service. | ||
externalServerHostnameURL = fmt.Sprintf("https://%s.virtual.%s.consul", externalServerHostnameID, staticServerPeer) | ||
|
||
terminatinggateway.CreateServiceDefaultDestination(t, staticServerPeerClient, "", externalServerHostnameID, "", 443, fmt.Sprintf("%s.%s", externalServerServiceName, externalServerK8sNamespace)) | ||
|
||
logger.Log(t, "trying calls to terminating gateway") | ||
k8s.CheckStaticServerConnectionSuccessful(t, staticClientOpts, staticClientName, "-k", externalServerHostnameURL) | ||
} | ||
}) | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left for testing, will remove