mirror of
https://github.com/outbackdingo/kamaji.git
synced 2026-01-27 10:19:29 +00:00
feat: add hostNetwork support for the Konnectivity Agent (#883)
This commit extends CRD API: Added hostNetwork field to KonnectivityAgentSpec struct. It's false by default so it's backwards compatible. Signed-off-by: Dario Tranchitella <dario@tranchitella.eu>
This commit is contained in:
committed by
GitHub
parent
c04d8ddc85
commit
f52fe45c46
@@ -257,6 +257,12 @@ type KonnectivityAgentSpec struct {
|
||||
//+kubebuilder:default={{key: "CriticalAddonsOnly", operator: "Exists"}}
|
||||
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
|
||||
ExtraArgs ExtraArgs `json:"extraArgs,omitempty"`
|
||||
// HostNetwork enables the konnectivity agent to use the Host network namespace.
|
||||
// By enabling this mode, the Agent doesn't need to wait for the CNI initialisation,
|
||||
// enabling a sort of out-of-band access to nodes for troubleshooting scenarios,
|
||||
// or when the agent needs direct access to the host network.
|
||||
//+kubebuilder:default=false
|
||||
HostNetwork bool `json:"hostNetwork,omitempty"`
|
||||
// Mode allows specifying the Agent deployment mode: Deployment, or DaemonSet (default).
|
||||
//+kubebuilder:default="DaemonSet"
|
||||
//+kubebuilder:validation:Enum=DaemonSet;Deployment
|
||||
|
||||
@@ -108,6 +108,14 @@ spec:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
hostNetwork:
|
||||
default: false
|
||||
description: |-
|
||||
HostNetwork enables the konnectivity agent to use the Host network namespace.
|
||||
By enabling this mode, the Agent doesn't need to wait for the CNI initialisation,
|
||||
enabling a sort of out-of-band access to nodes for troubleshooting scenarios,
|
||||
or when the agent needs direct access to the host network.
|
||||
type: boolean
|
||||
image:
|
||||
default: registry.k8s.io/kas-network-proxy/proxy-agent
|
||||
description: AgentImage defines the container image for Konnectivity's agent.
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
apiVersion: kamaji.clastix.io/v1alpha1
|
||||
kind: TenantControlPlane
|
||||
metadata:
|
||||
name: example-hostnetwork-tcp
|
||||
namespace: tenant-system
|
||||
spec:
|
||||
controlPlane:
|
||||
deployment:
|
||||
replicas: 2
|
||||
service:
|
||||
serviceType: LoadBalancer
|
||||
kubernetes:
|
||||
version: v1.29.0
|
||||
kubelet:
|
||||
cgroupfs: systemd
|
||||
preferredAddressTypes: ["InternalIP", "ExternalIP"]
|
||||
networkProfile:
|
||||
address: "10.0.0.100"
|
||||
port: 6443
|
||||
serviceCidr: "10.96.0.0/16"
|
||||
podCidr: "10.244.0.0/16"
|
||||
addons:
|
||||
coreDNS: {}
|
||||
konnectivity:
|
||||
server:
|
||||
port: 8132
|
||||
agent:
|
||||
hostNetwork: true
|
||||
tolerations:
|
||||
- key: "CriticalAddonsOnly"
|
||||
operator: "Exists"
|
||||
- key: "node.kubernetes.io/not-ready"
|
||||
operator: "Exists"
|
||||
effect: "NoExecute"
|
||||
tolerationSeconds: 300
|
||||
kubeProxy: {}
|
||||
@@ -39626,6 +39626,18 @@ parameters and cause konnectivity components to misbehave in
|
||||
unxpected ways. Only modify if you know what you are doing.<br/>
|
||||
</td>
|
||||
<td>false</td>
|
||||
</tr><tr>
|
||||
<td><b>hostNetwork</b></td>
|
||||
<td>boolean</td>
|
||||
<td>
|
||||
HostNetwork enables the konnectivity agent to use the Host network namespace.
|
||||
By enabling this mode, the Agent doesn't need to wait for the CNI initialisation,
|
||||
enabling a sort of out-of-band access to nodes for troubleshooting scenarios,
|
||||
or when the agent needs direct access to the host network.<br/>
|
||||
<br/>
|
||||
<i>Default</i>: false<br/>
|
||||
</td>
|
||||
<td>false</td>
|
||||
</tr><tr>
|
||||
<td><b>image</b></td>
|
||||
<td>string</td>
|
||||
|
||||
@@ -190,6 +190,7 @@ func (r *Agent) mutate(ctx context.Context, tenantControlPlane *kamajiv1alpha1.T
|
||||
podTemplateSpec.SetLabels(utilities.MergeMaps(podTemplateSpec.GetLabels(), specSelector.MatchLabels))
|
||||
podTemplateSpec.Spec.PriorityClassName = "system-cluster-critical"
|
||||
podTemplateSpec.Spec.Tolerations = tenantControlPlane.Spec.Addons.Konnectivity.KonnectivityAgentSpec.Tolerations
|
||||
podTemplateSpec.Spec.HostNetwork = tenantControlPlane.Spec.Addons.Konnectivity.KonnectivityAgentSpec.HostNetwork
|
||||
podTemplateSpec.Spec.NodeSelector = map[string]string{
|
||||
"kubernetes.io/os": "linux",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user