-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add KinD deployment env for developement
Signed-off-by: Mohamed Mahmoud <mmahmoud@redhat.com>
- Loading branch information
1 parent
9507ebf
commit e4cddad
Showing
4 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: netobserv-privileged | ||
--- | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: netobserv-ebpf-agent | ||
namespace: netobserv-privileged | ||
labels: | ||
k8s-app: netobserv-ebpf-agent | ||
spec: | ||
selector: | ||
matchLabels: | ||
k8s-app: netobserv-ebpf-agent | ||
template: | ||
metadata: | ||
labels: | ||
k8s-app: netobserv-ebpf-agent | ||
spec: | ||
hostNetwork: true | ||
dnsPolicy: ClusterFirstWithHostNet | ||
containers: | ||
- name: netobserv-ebpf-agent | ||
image: localhost/ebpf-agent:test | ||
securityContext: | ||
privileged: true | ||
runAsUser: 0 | ||
env: | ||
- name: SAMPLING | ||
value: "1" | ||
- name: CACHE_ACTIVE_TIMEOUT | ||
value: 200ms | ||
- name: LOG_LEVEL | ||
value: debug | ||
- name: FLOWS_TARGET_HOST | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: status.hostIP | ||
- name: FLOWS_TARGET_PORT | ||
value: "9999" | ||
- name: ENABLE_RTT | ||
value: "true" | ||
- name: ENABLE_PKT_DROPS | ||
value: "true" | ||
- name: ENABLE_DNS_TRACKING | ||
value: "true" | ||
volumeMounts: | ||
- name: bpf-kernel-debug | ||
mountPath: /sys/kernel/debug | ||
mountPropagation: Bidirectional | ||
volumes: | ||
- name: bpf-kernel-debug | ||
hostPath: | ||
path: /sys/kernel/debug | ||
type: Directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env bash | ||
set -eux | ||
|
||
DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
|
||
KIND_IMAGE="kindest/node:v1.27.3" | ||
|
||
# deploy_kind installs the kind cluster | ||
deploy_kind() { | ||
cat <<EOF | kind create cluster --image ${KIND_IMAGE} --config=- --kubeconfig=${DIR}/kubeconfig | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
networking: | ||
podSubnet: $NET_CIDR_IPV4,$NET_CIDR_IPV6 | ||
serviceSubnet: $SVC_CIDR_IPV4,$SVC_CIDR_IPV6 | ||
ipFamily: $IP_FAMILY | ||
nodes: | ||
- role: control-plane | ||
kubeadmConfigPatches: | ||
- | | ||
kind: ClusterConfiguration | ||
apiServer: | ||
extraArgs: | ||
v: "5" | ||
controllerManager: | ||
extraArgs: | ||
v: "5" | ||
scheduler: | ||
extraArgs: | ||
v: "5" | ||
- role: worker | ||
- role: worker | ||
EOF | ||
} | ||
|
||
# install_netobserv-agent will install the daemonset | ||
# into each kind docker container | ||
install_netobserv-agent() { | ||
docker build . -t localhost/ebpf-agent:test | ||
kind load docker-image localhost/ebpf-agent:test | ||
kubectl apply -f ${DIR}/agent.yml | ||
} | ||
|
||
# print_success prints a little success message at the end of the script | ||
print_success() { | ||
set +x | ||
echo "Your kind cluster was created successfully" | ||
echo "Run the following to load the kubeconfig:" | ||
echo "export KUBECONFIG=${DIR}/kubeconfig" | ||
set -x | ||
} | ||
|
||
KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME:-kind}" | ||
IP_FAMILY=${IP_FAMILY:-dual} | ||
NET_CIDR_IPV4=${NET_CIDR_IPV4:-10.244.0.0/16} | ||
SVC_CIDR_IPV4=${SVC_CIDR_IPV4:-10.96.0.0/16} | ||
NET_CIDR_IPV6=${NET_CIDR_IPV6:-fd00:10:244::/48} | ||
SVC_CIDR_IPV6=${SVC_CIDR_IPV6:-fd00:10:96::/112} | ||
|
||
# At the minimum, deploy the kind cluster | ||
deploy_kind | ||
export KUBECONFIG=${DIR}/kubeconfig | ||
oc label node kind-worker node-role.kubernetes.io/worker= | ||
oc label node kind-worker2 node-role.kubernetes.io/worker= | ||
|
||
install_netobserv-agent | ||
|
||
# Print success at the end of this script | ||
print_success |