Skip to content

Commit

Permalink
add kustomize files
Browse files Browse the repository at this point in the history
- These reflect the different test cases
- sameness.yaml defines the ordered list of failovers
- static-server responds with a unique name so we can track failover order
- static-client includes both DNS and CURL in the image used so we can exec in for testing
  • Loading branch information
wilkermichael committed Jul 27, 2023
1 parent 7bb0a57 commit 4759de7
Show file tree
Hide file tree
Showing 22 changed files with 251 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

apiVersion: consul.hashicorp.com/v1alpha1
kind: ExportedServices
metadata:
name: ap1
spec:
services: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- exportedservices-ap1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- sameness.yaml
12 changes: 12 additions & 0 deletions acceptance/tests/fixtures/bases/sameness-defaults/sameness.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: SamenessGroup
metadata:
name: mine
spec:
members:
- partition: default
- partition: ap1
- peer: cluster-01-a
- peer: cluster-01-b
- peer: cluster-02-a
- peer: cluster-03-a
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- mesh.yaml
7 changes: 7 additions & 0 deletions acceptance/tests/fixtures/bases/sameness-peering/mesh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: Mesh
metadata:
name: mesh
spec:
peering:
peerThroughMeshGateways: true
12 changes: 12 additions & 0 deletions acceptance/tests/fixtures/bases/sameness/intentions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceIntentions
metadata:
name: static-server
spec:
destination:
name: static-server
sources:
- name: static-client
namespace: ns1
samenessGroup: mine
action: allow
7 changes: 7 additions & 0 deletions acceptance/tests/fixtures/bases/sameness/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- intentions.yaml
- payments-service-resolver.yaml
- service-defaults.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceResolver
metadata:
name: static-server
spec:
connectTimeout: 15s
failover:
'*':
samenessGroup: mine
policy:
mode: order-by-locality
regions:
- us-west-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceDefaults
metadata:
name: static-server
spec:
protocol: http
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- ../../../bases/exportedservices-ap1

patchesStrategicMerge:
- patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

apiVersion: consul.hashicorp.com/v1alpha1
kind: ExportedServices
metadata:
name: ap1
spec:
services:
- name: static-server
namespace: ns2
consumers:
- samenessGroup: mine
- name: mesh-gateway
consumers:
- samenessGroup: mine
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- ../../../bases/exportedservices-default

patchesStrategicMerge:
- patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

apiVersion: consul.hashicorp.com/v1alpha1
kind: ExportedServices
metadata:
name: default
spec:
services:
- name: static-server
namespace: ns2
consumers:
- samenessGroup: mine
- name: mesh-gateway
consumers:
- samenessGroup: mine
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- ../../../bases/static-client

patchesStrategicMerge:
- patch.yaml
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: apps/v1
kind: Deployment
metadata:
name: static-client
spec:
template:
metadata:
annotations:
'consul.hashicorp.com/connect-inject': 'true'
consul.hashicorp.com/connect-service-upstreams: "static-server.ns2.default:8080"
spec:
containers:
- name: static-client
image: anubhavmishra/tiny-tools:latest
# Just spin & wait forever, we'll use `kubectl exec` to demo
command: ['/bin/sh', '-c', '--']
args: ['while true; do sleep 30; done;']
# If ACLs are enabled, the serviceAccountName must match the Consul service name.
serviceAccountName: static-client
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- ../../../bases/static-client

patchesStrategicMerge:
- patch.yaml
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: apps/v1
kind: Deployment
metadata:
name: static-client
spec:
template:
metadata:
annotations:
'consul.hashicorp.com/connect-inject': 'true'
consul.hashicorp.com/connect-service-upstreams: "static-server.ns2.ap1:8080"
spec:
containers:
- name: static-client
image: anubhavmishra/tiny-tools:latest
# Just spin & wait forever, we'll use `kubectl exec` to demo
command: ['/bin/sh', '-c', '--']
args: ['while true; do sleep 30; done;']
# If ACLs are enabled, the serviceAccountName must match the Consul service name.
serviceAccountName: static-client
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- ../../../bases/static-server

patchesStrategicMerge:
- patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
name: static-server
spec:
template:
metadata:
annotations:
"consul.hashicorp.com/connect-inject": "true"
spec:
containers:
- name: static-server
image: hashicorp/http-echo:latest
args:
- -text="cluster-01-a"
- -listen=:8080
ports:
- containerPort: 8080
name: http
serviceAccountName: static-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

resources:
- ../../../bases/static-server

patchesStrategicMerge:
- patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

apiVersion: apps/v1
kind: Deployment
metadata:
name: static-server
spec:
template:
metadata:
annotations:
"consul.hashicorp.com/connect-inject": "true"
spec:
containers:
- name: static-server
image: hashicorp/http-echo:latest
args:
- -text="cluster-01-b"
- -listen=:8080
ports:
- containerPort: 8080
name: http
serviceAccountName: static-server

0 comments on commit 4759de7

Please sign in to comment.