Skip to content

feat: add httpproxy external patch #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions charts/capi-runtime-extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ A Helm chart for capi-runtime-extensions
| handlers.CalicoCNI.defaultPodSubnet | string | `"192.168.0.0/16"` | |
| handlers.CalicoCNI.defaultTigeraOperatorConfigMap.name | string | `"tigera-operator"` | |
| handlers.CalicoCNI.enabled | bool | `true` | |
| handlers.HTTPProxyPatch.enabled | bool | `true` | |
| handlers.HTTPProxyVars.enabled | bool | `true` | |
| handlers.ServiceLoadBalancerGC.enabled | bool | `true` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/d2iq-labs/capi-runtime-extensions"` | |
Expand Down
4 changes: 4 additions & 0 deletions charts/capi-runtime-extensions/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ handlers:
content: ""
ServiceLoadBalancerGC:
enabled: true
HTTPProxyVars:
enabled: true
HTTPProxyPatch:
enabled: true

deployment:
replicas: 1
Expand Down
4 changes: 2 additions & 2 deletions devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"hadolint@latest",
"helm-docs@latest",
"[email protected]",
"kind@latest",
"kubebuilder@latest",
"kubectl@latest",
"kubernetes-controller-tools@latest",
Expand All @@ -32,6 +31,7 @@
"shfmt@latest",
"upx@latest",
"yamale@latest",
"yamllint@latest"
"yamllint@latest",
"kind@latest"
]
}
4 changes: 2 additions & 2 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@
"version": "0.116.1"
},
"kind@latest": {
"last_modified": "2023-06-30T04:44:22Z",
"resolved": "github:NixOS/nixpkgs/3c614fbc76fc152f3e1bc4b2263da6d90adf80fb#kind",
"last_modified": "2023-06-18T15:53:58Z",
"resolved": "github:NixOS/nixpkgs/91430887645a0953568da2f3e9a3a3bb0a0378ac#kind",
"source": "devbox-search",
"version": "0.20.0"
},
Expand Down
50 changes: 50 additions & 0 deletions docs/content/http-proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: "HTTP proxy"
---

In some network environments it is necessary to use HTTP proxy to successfuly execute HTTP requests.
To configure Kubernetes components (`containerd`, `kubelet`) to use HTTP proxy use the `httpproxypatch`
external patch that will generate appropriate configuration for control plane and worker nodes.

To enable the http proxy enable the `httpproxypatch` external patch on `ClusterClass`.

```yaml
apiVersion: cluster.x-k8s.io/v1beta1
kind: ClusterClass
metadata:
name: <NAME>
spec:
patches:
- name: http-proxy
external:
generateExtension: "httpproxypatch.<external-config-name>"
discoverVariablesExtension: "httpproxyvars.<external-config-name>"
```

On the cluster resource then specify desired HTTP proxy values:

```yaml
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: <NAME>
spec:
topology:
variables:
name: proxy
values:
http: http://example.com
https: http://example.com
no:
- http://no-proxy-1.example.com
- http://no-proxy-2.example.com
```

Applying this configuration will result in new bootstrap files on the `KubeadmControlPlaneTemplate`
and `KubeadmConfigTemplate`.

This hook is enabled by default, and can be explicitly disabled by omitting the `HTTPProxyVars`
and `HTTPProxyPatch` hook from the `--runtimehooks.enabled-handlers` flag.

If deploying via Helm, then this can be disabled by setting `handlers.HTTProxyVars.enabled=false` and
`handlers.HTTPProxyPatch.enabled=false`.
4 changes: 2 additions & 2 deletions docs/content/service-loadbalancer-gc.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ and thus triggering the cloud provider interface to clean up the external resour
load-balancer services have been fully deleted, indicating that the cloud provider interface has cleaned up the external
resources.

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

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

By default, all clusters will be cleaned up when deleting, but this can be opted out from by setting the annotation
`capiext.labs.d2iq.io//loadbalancer-gc=false`.
`capiext.labs.d2iq.io/loadbalancer-gc=false`.
11 changes: 8 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ go 1.20

require (
github.com/go-logr/logr v1.2.4
github.com/onsi/gomega v1.27.8
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
golang.org/x/sync v0.3.0
gomodules.xyz/jsonpatch/v2 v2.3.0
k8s.io/api v0.28.1
k8s.io/apiextensions-apiserver v0.28.1
k8s.io/apimachinery v0.28.1
k8s.io/client-go v0.28.1
k8s.io/component-base v0.28.1
Expand All @@ -25,7 +28,10 @@ require (
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/coredns/caddy v1.1.0 // indirect
github.com/coredns/corefile-migration v1.0.20 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
Expand All @@ -50,27 +56,26 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/gomega v1.27.8 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/valyala/fastjson v1.6.4 // indirect
golang.org/x/net v0.13.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.10.0 // indirect
golang.org/x/term v0.10.0 // indirect
golang.org/x/text v0.11.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.2 // indirect
k8s.io/cluster-bootstrap v0.27.2 // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
Expand Down
Loading