Skip to content

Commit 8dca5b8

Browse files
feat: add httpproxy external patch (#115)
Co-authored-by: Jimmi Dyson <[email protected]>
1 parent 223e827 commit 8dca5b8

File tree

21 files changed

+1217
-16
lines changed

21 files changed

+1217
-16
lines changed

charts/capi-runtime-extensions/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ A Helm chart for capi-runtime-extensions
3737
| handlers.CalicoCNI.defaultPodSubnet | string | `"192.168.0.0/16"` | |
3838
| handlers.CalicoCNI.defaultTigeraOperatorConfigMap.name | string | `"tigera-operator"` | |
3939
| handlers.CalicoCNI.enabled | bool | `true` | |
40+
| handlers.HTTPProxyPatch.enabled | bool | `true` | |
41+
| handlers.HTTPProxyVars.enabled | bool | `true` | |
4042
| handlers.ServiceLoadBalancerGC.enabled | bool | `true` | |
4143
| image.pullPolicy | string | `"IfNotPresent"` | |
4244
| image.repository | string | `"ghcr.io/d2iq-labs/capi-runtime-extensions"` | |

charts/capi-runtime-extensions/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ handlers:
1515
content: ""
1616
ServiceLoadBalancerGC:
1717
enabled: true
18+
HTTPProxyVars:
19+
enabled: true
20+
HTTPProxyPatch:
21+
enabled: true
1822

1923
deployment:
2024
replicas: 1

devbox.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
"hadolint@latest",
2323
"helm-docs@latest",
2424
25-
"kind@latest",
2625
"kubebuilder@latest",
2726
"kubectl@latest",
2827
"kubernetes-controller-tools@latest",
@@ -32,6 +31,7 @@
3231
"shfmt@latest",
3332
"upx@latest",
3433
"yamale@latest",
35-
"yamllint@latest"
34+
"yamllint@latest",
35+
"kind@latest"
3636
]
3737
}

devbox.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@
134134
"version": "0.116.1"
135135
},
136136
"kind@latest": {
137-
"last_modified": "2023-06-30T04:44:22Z",
138-
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#kind",
137+
"last_modified": "2023-06-18T15:53:58Z",
138+
"resolved": "github:NixOS/nixpkgs/91430887645a0953568da2f3e9a3a3bb0a0378ac#kind",
139139
"source": "devbox-search",
140140
"version": "0.20.0"
141141
},

docs/content/http-proxy.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "HTTP proxy"
3+
---
4+
5+
In some network environments it is necessary to use HTTP proxy to successfuly execute HTTP requests.
6+
To configure Kubernetes components (`containerd`, `kubelet`) to use HTTP proxy use the `httpproxypatch`
7+
external patch that will generate appropriate configuration for control plane and worker nodes.
8+
9+
To enable the http proxy enable the `httpproxypatch` external patch on `ClusterClass`.
10+
11+
```yaml
12+
apiVersion: cluster.x-k8s.io/v1beta1
13+
kind: ClusterClass
14+
metadata:
15+
name: <NAME>
16+
spec:
17+
patches:
18+
- name: http-proxy
19+
external:
20+
generateExtension: "httpproxypatch.<external-config-name>"
21+
discoverVariablesExtension: "httpproxyvars.<external-config-name>"
22+
```
23+
24+
On the cluster resource then specify desired HTTP proxy values:
25+
26+
```yaml
27+
apiVersion: cluster.x-k8s.io/v1beta1
28+
kind: Cluster
29+
metadata:
30+
name: <NAME>
31+
spec:
32+
topology:
33+
variables:
34+
name: proxy
35+
values:
36+
http: http://example.com
37+
https: http://example.com
38+
no:
39+
- http://no-proxy-1.example.com
40+
- http://no-proxy-2.example.com
41+
```
42+
43+
Applying this configuration will result in new bootstrap files on the `KubeadmControlPlaneTemplate`
44+
and `KubeadmConfigTemplate`.
45+
46+
This hook is enabled by default, and can be explicitly disabled by omitting the `HTTPProxyVars`
47+
and `HTTPProxyPatch` hook from the `--runtimehooks.enabled-handlers` flag.
48+
49+
If deploying via Helm, then this can be disabled by setting `handlers.HTTProxyVars.enabled=false` and
50+
`handlers.HTTPProxyPatch.enabled=false`.

docs/content/service-loadbalancer-gc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ and thus triggering the cloud provider interface to clean up the external resour
1010
load-balancer services have been fully deleted, indicating that the cloud provider interface has cleaned up the external
1111
resources.
1212

13-
This hook is enabled by default, and can be explicitly disabled by omitting the `LoadBalancerGC` hook from the
13+
This hook is enabled by default, and can be explicitly disabled by omitting the `ServiceLoadBalancerGC` hook from the
1414
`--runtimehooks.enabled-handlers` flag.
1515

1616
If deploying via Helm, then this can be disabled by setting `handlers.ServiceLoadBalancerGC.enabled=false`.
1717

1818
By default, all clusters will be cleaned up when deleting, but this can be opted out from by setting the annotation
19-
`capiext.labs.d2iq.io//loadbalancer-gc=false`.
19+
`capiext.labs.d2iq.io/loadbalancer-gc=false`.

go.mod

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ go 1.20
77

88
require (
99
github.com/go-logr/logr v1.2.4
10+
github.com/onsi/gomega v1.27.8
1011
github.com/spf13/pflag v1.0.5
1112
github.com/stretchr/testify v1.8.4
1213
golang.org/x/sync v0.3.0
14+
gomodules.xyz/jsonpatch/v2 v2.3.0
1315
k8s.io/api v0.28.1
16+
k8s.io/apiextensions-apiserver v0.28.1
1417
k8s.io/apimachinery v0.28.1
1518
k8s.io/client-go v0.28.1
1619
k8s.io/component-base v0.28.1
@@ -25,7 +28,10 @@ require (
2528
github.com/blang/semver v3.5.1+incompatible // indirect
2629
github.com/blang/semver/v4 v4.0.0 // indirect
2730
github.com/cespare/xxhash/v2 v2.2.0 // indirect
31+
github.com/coredns/caddy v1.1.0 // indirect
32+
github.com/coredns/corefile-migration v1.0.20 // indirect
2833
github.com/davecgh/go-spew v1.1.1 // indirect
34+
github.com/docker/distribution v2.8.2+incompatible // indirect
2935
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
3036
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
3137
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
@@ -50,27 +56,26 @@ require (
5056
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5157
github.com/modern-go/reflect2 v1.0.2 // indirect
5258
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
53-
github.com/onsi/gomega v1.27.8 // indirect
59+
github.com/opencontainers/go-digest v1.0.0 // indirect
5460
github.com/pkg/errors v0.9.1 // indirect
5561
github.com/pmezard/go-difflib v1.0.0 // indirect
5662
github.com/prometheus/client_golang v1.16.0 // indirect
5763
github.com/prometheus/client_model v0.4.0 // indirect
5864
github.com/prometheus/common v0.44.0 // indirect
5965
github.com/prometheus/procfs v0.10.1 // indirect
6066
github.com/spf13/cobra v1.7.0 // indirect
67+
github.com/valyala/fastjson v1.6.4 // indirect
6168
golang.org/x/net v0.13.0 // indirect
6269
golang.org/x/oauth2 v0.10.0 // indirect
6370
golang.org/x/sys v0.10.0 // indirect
6471
golang.org/x/term v0.10.0 // indirect
6572
golang.org/x/text v0.11.0 // indirect
6673
golang.org/x/time v0.3.0 // indirect
67-
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
6874
google.golang.org/appengine v1.6.7 // indirect
6975
google.golang.org/protobuf v1.31.0 // indirect
7076
gopkg.in/inf.v0 v0.9.1 // indirect
7177
gopkg.in/yaml.v2 v2.4.0 // indirect
7278
gopkg.in/yaml.v3 v3.0.1 // indirect
73-
k8s.io/apiextensions-apiserver v0.27.2 // indirect
7479
k8s.io/cluster-bootstrap v0.27.2 // indirect
7580
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
7681
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect

0 commit comments

Comments
 (0)