Skip to content

Commit b701e7e

Browse files
committed
Add OpenShift example and Document health upstream
1 parent efe3342 commit b701e7e

File tree

7 files changed

+197
-6
lines changed

7 files changed

+197
-6
lines changed

CHANGELOG.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## v1.0.1 - 2024-06-27
8+
## [Unrelesed]
9+
10+
### Added
911

12+
* Add maxclients in example
13+
* Document Health upstream
14+
* Add OpenShift deployment examples
15+
16+
## v1.0.1 - 2024-06-27
1017

1118
### Added
1219

@@ -30,11 +37,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3037

3138
## Previous versions from layer4-proxy
3239

33-
[0.1.7]: https://code.kiers.eu/jjkiers/layer4-proxy/compare/v0.1.1...v0.1.7
34-
35-
40+
0.1.7: [diff](https://code.kiers.eu/jjkiers/layer4-proxy/compare/v0.1.1...v0.1.7)
3641

37-
Types of changes:
42+
## Types of changes:
3843

3944
* `Added` for new features.
4045
* `Changed` for changes in existing functionality.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,21 +75,25 @@ servers:
7575
listen:
7676
- "127.0.0.1:8081"
7777
default: remote
78+
maxclients: 3
7879
via:
7980
*viaanchor
8081
health-server:
8182
listen: [ "127.0.0.1:8081" ]
8283
default: health
84+
maxclients: 2
8385
via:
8486
*viaanchor
8587

8688
upstream:
8789
remote: "tcp://www.remote.example.com:8082" # proxy to remote address
8890
```
8991
90-
There are two upstreams built in:
92+
There are several upstreams built in:
9193
* Ban, which terminates the connection immediately
9294
* Echo, which reflects back with the input
95+
* Health, a simple HTTP/1.1 health check
96+
* Proxy, the proxy upstream
9397
9498
For detailed configuration, check [this example](./config.yaml.example).
9599

openshift/01-imagestream.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: image.openshift.io/v1
2+
kind: ImageStream
3+
metadata:
4+
labels:
5+
app: upstream-connector
6+
app.kubernetes.io/component: upstream-connector
7+
app.kubernetes.io/instance: upstream-connector
8+
name: upstream-connector
9+
spec:
10+
lookupPolicy:
11+
local: false
12+
tags:
13+
- from:
14+
kind: DockerImage
15+
name: me2digital/tls-proxy-tunnel:2.0
16+
generation: null
17+
importPolicy:
18+
importMode: Legacy
19+
name: "2.0"

openshift/01-tpt-k8-config.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: tpt-config
5+
data:
6+
config.yaml: |
7+
version: 1
8+
log: info
9+
10+
via: &viaanchor
11+
target: target.fqdn.com:443
12+
headers:
13+
Proxy-Authorization: Basic ${ENCODED_PW}
14+
Host: target.fqdn.com:443
15+
16+
servers:
17+
first_server:
18+
listen:
19+
- "0.0.0.0:8080"
20+
tls: true # Enable TLS features like SNI filtering
21+
sni:
22+
target.fqdn.com: proxy-via
23+
SNI1.domain.com: proxy-via
24+
SNI2.domain.com: proxy-via
25+
default: echo
26+
maxclients: 5
27+
via:
28+
*viaanchor
29+
30+
health-server:
31+
listen: [ "0.0.0.0:8081" ]
32+
default: health
33+
maxclients: 2
34+
via:
35+
*viaanchor
36+
37+
upstream:
38+
proxy-via: "tcp://proxy.internal.fqdn:3128"

openshift/02-service-k8.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
app: up-connector
7+
name: up-connector
8+
spec:
9+
ports:
10+
- name: up-connector
11+
port: 8080
12+
protocol: TCP
13+
targetPort: 8080
14+
selector:
15+
app: up-connector
16+
type: ClusterIP
17+
status:
18+
loadBalancer: {}

openshift/03-deployment-k8.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
annotations:
5+
image.openshift.io/triggers: '[{"from":{"kind":"ImageStreamTag","name":"upstream-connector:1.0"},"fieldPath":"spec.template.spec.containers[?(@.name==\"upstream-connector\")].image"}]'
6+
openshift.io/generated-by: OpenShiftNewApp
7+
creationTimestamp: null
8+
labels:
9+
app: up-connector
10+
app.kubernetes.io/component: up-connector
11+
app.kubernetes.io/instance: up-connector
12+
name: up-connector
13+
spec:
14+
replicas: 1
15+
selector:
16+
matchLabels:
17+
deployment: up-connector
18+
strategy: {}
19+
template:
20+
metadata:
21+
annotations:
22+
openshift.io/generated-by: OpenShiftNewApp
23+
creationTimestamp: null
24+
labels:
25+
deployment: up-connector
26+
spec:
27+
containers:
28+
- image: 'me2digital/tls-proxy-tunnel:2.0'
29+
name: up-connector
30+
imagePullPolicy: IfNotPresent
31+
env:
32+
- name: ENCODED_PW
33+
value: base64-encode-username_and_pw
34+
- name: RUST_LOG
35+
value: info
36+
ports:
37+
- name: up-connector
38+
containerPort: 8080
39+
protocol: TCP
40+
readinessProbe:
41+
httpGet:
42+
path: /healthz
43+
port: 8081
44+
scheme: HTTP
45+
initialDelaySeconds: 1
46+
timeoutSeconds: 1
47+
periodSeconds: 10
48+
successThreshold: 1
49+
failureThreshold: 3
50+
livenessProbe:
51+
httpGet:
52+
path: /healthz
53+
port: 8081
54+
scheme: HTTP
55+
initialDelaySeconds: 1
56+
timeoutSeconds: 1
57+
periodSeconds: 10
58+
successThreshold: 1
59+
failureThreshold: 3
60+
startupProbe:
61+
httpGet:
62+
path: /healthz
63+
port: 8081
64+
scheme: HTTP
65+
initialDelaySeconds: 1
66+
timeoutSeconds: 1
67+
periodSeconds: 10
68+
successThreshold: 1
69+
failureThreshold: 3
70+
resources:
71+
limits:
72+
cpu: 500m
73+
memory: 500Mi
74+
requests:
75+
cpu: 100m
76+
memory: 100Mi
77+
volumeMounts:
78+
- name: tpt-config
79+
mountPath: /etc/tpt/config.yaml
80+
subPath: config.yaml
81+
dnsPolicy: ClusterFirst
82+
restartPolicy: Always
83+
schedulerName: default-scheduler
84+
securityContext: {}
85+
terminationGracePeriodSeconds: 30
86+
volumes:
87+
- name: tpt-config
88+
configMap:
89+
name: tpt-config
90+
defaultMode: 420
91+
status: {}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: route.openshift.io/v1
2+
kind: Route
3+
metadata:
4+
name: k8s-dev-con
5+
spec:
6+
host: k8s-dev.INTERNAL.DOMAIN
7+
port:
8+
targetPort: up-connector
9+
tls:
10+
termination: passthrough
11+
insecureEdgeTerminationPolicy: None
12+
to:
13+
kind: Service
14+
name: up-k8-connector
15+
weight: 100
16+
status: {}

0 commit comments

Comments
 (0)