Skip to content

Commit

Permalink
Traefik trusted IPs (#52)
Browse files Browse the repository at this point in the history
* Set trusted ips

* deploy

* I have no plans

* fix

* cleanup
  • Loading branch information
james-otten authored Nov 20, 2024
1 parent 7167a2f commit 9d44cbc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/deploy_k8s_cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,6 @@ jobs:
sudo wg set wg0 listen-port 48123 private-key privatekey peer ${{ secrets.WIREGUARD_PEER_PUBLIC_KEY }} allowed-ips 0.0.0.0/0 endpoint ${{ secrets.WIREGUARD_ENDPOINT }}
sudo ip link set up dev wg0
rm privatekey
- name: Terraform plan
id: plan
if: github.event_name == 'pull_request'
run: terraform plan -no-color -input=false -var-file=${{ vars.ENV_NAME }}.tfvars
continue-on-error: true
working-directory: ./terraform/

- name: Terraform Plan Status
if: steps.plan.outcome == 'failure'
run: exit 1
- name: Terraform Apply
run: |
Expand Down
13 changes: 13 additions & 0 deletions ansible/roles/k8s-cluster-helm/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,16 @@
ansible.builtin.command:
chdir: /root/
cmd: kubectl apply -f datadog_agent.yaml

- name: Copy traefik config
ansible.builtin.template:
src: ./templates/traefik_config.yaml.j2
dest: /root/traefik_config.yaml
owner: root
group: root
mode: '0600'

- name: Apply traefik config manifest
ansible.builtin.command:
chdir: /root/
cmd: kubectl apply -f traefik_config.yaml
10 changes: 10 additions & 0 deletions ansible/roles/k8s-cluster-helm/templates/traefik_config.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
name: traefik
namespace: kube-system
spec:
valuesContent: |-
additionalArguments:
- "--entryPoints.web.proxyProtocol.trustedIPs={{ TRAEFIK_TRUSTED_IPs }}"
- "--entryPoints.web.forwardedHeaders.trustedIPs={{ TRAEFIK_TRUSTED_IPs }}"
3 changes: 2 additions & 1 deletion terraform/mesh_cluster/ansible.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ resource "ansible_host" "meshmgr" {
name = var.mesh_mgr_ips[count.index]
groups = [ansible_group.mgrs.name]
variables = {
K3S_API_ENDPOINT = var.mesh_mgr_ips[0]
K3S_API_ENDPOINT = var.mesh_mgr_ips[0]
TRAEFIK_TRUSTED_IPs = format("%s/32,%s/32,10.42.0.0/16", var.mesh_lb_ip, var.mesh_external_ip)
}
}

Expand Down

0 comments on commit 9d44cbc

Please sign in to comment.