Skip to content

Commit

Permalink
tests: Add static-client and static-server fixtures for OpenShift
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Glass committed Jul 14, 2023
1 parent ff5c24b commit 9e83262
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 0 deletions.
17 changes: 17 additions & 0 deletions acceptance/tests/fixtures/bases/openshift/network-attachment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: consul-cni
spec:
config: '{
"cniVersion": "0.3.1",
"type": "consul-cni",
"cni_bin_dir": "/var/lib/cni/bin",
"cni_net_dir": "/etc/kubernetes/cni/net.d",
"kubeconfig": "ZZZ-consul-cni-kubeconfig",
"log_level": "info",
"multus": true,
"name": "consul-cni",
"type": "consul-cni"
}'

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,14 @@
# 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:1234"
"k8s.v1.cni.cncf.io/networks": '[{ "name":"consul-cni" }]'
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,18 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0

# When using the CNI on OpenShift, we need to specify the
# network attachment definition for the pods to use. This assumes
# that one named 'consul-cni' was created by the acceptance tests.

apiVersion: apps/v1
kind: Deployment
metadata:
name: static-client
spec:
template:
metadata:
annotations:
"consul.hashicorp.com/connect-inject": "true"
"k8s.v1.cni.cncf.io/networks": '[{ "name":"consul-cni" }]'

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
42 changes: 42 additions & 0 deletions acceptance/tests/fixtures/cases/static-server-openshift/patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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"
"k8s.v1.cni.cncf.io/networks": '[{ "name":"consul-cni" }]'
spec:
containers:
- name: static-server
image: docker.mirror.hashicorp.services/kschoche/http-echo:latest
args:
- -text="hello world"
- -listen=:8080
ports:
- containerPort: 8080
name: http
livenessProbe:
httpGet:
port: 8080
initialDelaySeconds: 1
failureThreshold: 1
periodSeconds: 1
startupProbe:
httpGet:
port: 8080
initialDelaySeconds: 1
failureThreshold: 30
periodSeconds: 1
readinessProbe:
exec:
command: ['sh', '-c', 'test ! -f /tmp/unhealthy']
initialDelaySeconds: 1
failureThreshold: 1
periodSeconds: 1
serviceAccountName: static-server

0 comments on commit 9e83262

Please sign in to comment.