Skip to content

Commit

Permalink
yaml: add support for generating static Kubernetes manifest
Browse files Browse the repository at this point in the history
This patch provides a way to generate the static Kubernetes manifest
which can be used to install Calico VPP without using operator.
  • Loading branch information
onong committed Jun 13, 2024
1 parent 8b7af52 commit be02aef
Show file tree
Hide file tree
Showing 4 changed files with 180 additions and 0 deletions.
46 changes: 46 additions & 0 deletions docs/manifest_based_install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Install Calico VPP using static Kubernetes manifest

The recommended way to install Calico VPP is using operator. However, it is possible
to bypass the operator and install Calico VPP using the Kubernetes manifests directly.
To be able to do so, one would need the static Calico VPP manifest.

Here's how to generate the static Kubernetes manifest:

* Go to the `vpp-dataplane/yaml/static` dir:

```bash
cd vpp-dataplane/yaml/static
```

* Download the appropriate Calico Kubernetes manifest file:

```bash
wget https://raw.githubusercontent.com/projectcalico/calico/release-v3.28/manifests/calico.yaml
```

* Copy the appropriate generated Calico VPP manifest and rename it to `calico-vpp-daemonset.yaml`.
For example, to install in EKS:

```bash
cp vpp-dataplane/yaml/generated/calico-vpp-eks.yaml ./calico-vpp-daemonset.yaml
```

* If installing in EKS, add the following to the `calico-node` env definitions
in the `calico-vpp-daemonset.yaml` file:

```
- name: FELIX_AWSSRCDSTCHECK
value: "Disable"
```

* Run kustomize

```bash
kubectl kustomize . > calico-vpp-eks.yaml
```

Now, you can install Calico VPP using the above manifest:

```bash
kubectl create -f calico-vpp-eks.yaml
```
46 changes: 46 additions & 0 deletions yaml/static/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Install Calico VPP using static Kubernetes manifest

The recommended way to install Calico VPP is using operator. However, it is possible
to bypass the operator and install Calico VPP using the Kubernetes manifests directly.
To be able to do so, one would need the static Calico VPP manifest.

Here's how to generate the static Kubernetes manifest:

* Go to the `vpp-dataplane/yaml/static` dir:

```bash
cd vpp-dataplane/yaml/static
```

* Download the appropriate Calico Kubernetes manifest file:

```bash
wget https://raw.githubusercontent.com/projectcalico/calico/release-v3.28/manifests/calico.yaml
```

* Copy the appropriate generated Calico VPP manifest and rename it to `calico-vpp-daemonset.yaml`.
For example, to install in EKS:

```bash
cp vpp-dataplane/yaml/generated/calico-vpp-eks.yaml ./calico-vpp-daemonset.yaml
```

* If installing in EKS, add the following to the `calico-node` env definitions
in the `calico-vpp-daemonset.yaml` file:

```
- name: FELIX_AWSSRCDSTCHECK
value: "Disable"
```

* Run kustomize

```bash
kubectl kustomize . > calico-vpp-eks.yaml
```

Now, you can install Calico VPP using the above manifest:

```bash
kubectl create -f calico-vpp-eks.yaml
```
83 changes: 83 additions & 0 deletions yaml/static/calico-patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# calico-config configmap changes
kind: ConfigMap
apiVersion: v1
metadata:
name: calico-config
namespace: kube-system
data:
calico_backend: "none"
cni_network_config: |-
{
"name": "k8s-pod-network",
"cniVersion": "0.3.1",
"plugins": [
{
"type": "calico",
"log_level": "debug",
"datastore_type": "kubernetes",
"nodename": "__KUBERNETES_NODE_NAME__",
"mtu": __CNI_MTU__,
"ipam": {
"type": "calico-ipam"
},
"policy": {
"type": "k8s"
},
"kubernetes": {
"kubeconfig": "__KUBECONFIG_FILEPATH__"
},
"dataplane_options": {
"type": "grpc",
"socket": "unix:///var/run/calico/cni-server.sock"
}
},
{
"type": "portmap",
"snat": true,
"capabilities": {"portMappings": true}
}
]
}
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: calico-node
namespace: kube-system
labels:
k8s-app: calico-node
spec:
template:
spec:
containers:
- name: calico-node
env:
- name: FELIX_USEINTERNALDATAPLANEDRIVER
value: "false"
- name: FELIX_DATAPLANEDRIVER
value: /usr/local/bin/felix-plugins/felix-api-proxy
- name: FELIX_XDPENABLED
value: "false"
# Cluster type to identify the deployment type
- name: CLUSTER_TYPE
value: "k8s,bgp,vpp"
# Remove bird from liveness and readiness probes
livenessProbe:
exec:
command:
- /bin/calico-node
- -felix-live
readinessProbe:
exec:
command:
- /bin/calico-node
- -felix-ready
volumeMounts:
- mountPath: /usr/local/bin/felix-plugins
name: felix-plugins
readOnly: true
volumes:
- name: felix-plugins
hostPath:
path: /var/lib/calico/felix-plugins
5 changes: 5 additions & 0 deletions yaml/static/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resources:
- calico.yaml
- calico-vpp-daemonset.yaml
patchesStrategicMerge:
- calico-patch.yaml

0 comments on commit be02aef

Please sign in to comment.