Skip to content

Commit eaac5c5

Browse files
committed
Add ability to proxy local services into the cluster
1 parent 055e734 commit eaac5c5

File tree

7 files changed

+164
-76
lines changed

7 files changed

+164
-76
lines changed

README.MD

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,15 @@ This repository aims to provide a ready-to-go [Tilt](https://docs.tilt.dev/) set
6969
## Prerequisites
7070
* [Tilt](https://docs.tilt.dev/install.html)
7171
* Kubernetes ([Docker Desktop](https://docs.docker.com/desktop/kubernetes/) or [Minikube](https://minikube.sigs.k8s.io/docs/) are recommended for those new to kubernetes) [Tilt cluster setup](https://docs.tilt.dev/choosing_clusters)
72-
* For Windows users a bash program. By default git bash is used with an assumed installation directory of C:/Program Files/Git
7372
* [helm](https://helm.sh/docs/intro/install/) must be installed to generate the k8s from the helm charts in the gitops repo
73+
* For Windows users:
74+
* A bash program. By default git bash is used with an assumed installation directory of C:/Program Files/Git
7475

7576
## Startup Services
7677
In the root directory of the repository run `tilt up`. This will start all the faf services in the correct order. The status of each service can be viewed in the tilt UI by visiting <http://localhost:10350>. This is the control server for tilt where you can restart services or disable them for substitution by services you would like to run from source code as you actively develop them.
7778

7879
## Development
79-
To develop against the FAF infrastructure you should disable the service in tilt that you are actively developing. Once disabled you can start up your developed version. Some tweaks may need to be made to the default configuration parameters in the source code. The proper values can be found in the configMaps in each of the services kubernetes deploy yaml files.
80+
To develop against the FAF infrastructure you can insert the service in tilt that you are actively developing by adding it to the local_services list in your tilt_config.json file or as --local_services when you run tilt up. This will proxy the connections in the cluster to that service to your locally running instance. Some tweaks may need to be made to the default configuration parameters in the source code. The proper values can be found in the configMaps in each of the services kubernetes deploy yaml files. You may need to specify your host-ip in the config or arguments in order to get the proxied connections to work
8081

8182
## Test Data
8283
The default test data that is loaded can be found in [faf-db](https://github.com/FAForever/db/blob/develop/test-data.sql).

Tiltfile

Lines changed: 125 additions & 70 deletions
Large diffs are not rendered by default.

cluster/traefik/values-local.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ traefik:
1515
updateStrategy:
1616
type: Recreate
1717

18-
hostNetwork: true
18+
hostNetwork: false
1919

2020
ports:
2121
metrics:
@@ -38,7 +38,7 @@ traefik:
3838

3939
# HostNetwork
4040
service:
41-
enabled: false
41+
enabled: true
4242

4343
logs:
4444
general:
@@ -50,3 +50,7 @@ traefik:
5050
level: INFO
5151
access:
5252
enabled: true
53+
54+
providers:
55+
kubernetesCRD:
56+
allowExternalNameServices: true

tilt/helm/host-proxy/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apiVersion: v2
2+
name: host-proxy
3+
version: 1.0.0
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- if .Values.hostIP }}
2+
apiVersion: v1
3+
kind: Endpoints
4+
metadata:
5+
name: {{.Values.name}}
6+
subsets:
7+
- addresses:
8+
- ip: {{.Values.hostIP}}
9+
ports:
10+
- port: {{.Values.port}}
11+
{{- end }}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{.Values.name}}
5+
spec:
6+
{{- if .Values.hostIP }}
7+
clusterIP: None
8+
ports:
9+
- protocol: "TCP"
10+
port: {{.Values.port}}
11+
targetPort: {{.Values.port}}
12+
{{ else }}
13+
type: ExternalName
14+
externalName: {{.Values.hostname}}
15+
{{- end }}

tilt/scripts/helm-with-cache.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/bin/bash
22

3-
cache_dir=$1
3+
chart_cache_dir=$1
44
shift
55

66
chart=$1
7-
chart_cache_dir="$cache_dir/$chart"
87

98
mkdir -p "$chart_cache_dir"
109

0 commit comments

Comments
 (0)