Skip to content

Commit

Permalink
update helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
cyclinder committed Aug 30, 2022
1 parent 52b5c56 commit c3aa560
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 57 deletions.
118 changes: 82 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,95 @@

## Why



## How to start

### Examples

Multus Net-Atta-Def CRD examples:

- Macvlan-standalone

```shell
{
"cniVersion": "0.3.0",
"name": "macvlan-veth",
"plugins": [
{
"type": "macvlan",
"master": "enp4s0f1np1",
"mode": "bridge",
"ipam": {
"default_ipv4_ippool": [
"default-v4-ippool"
],
"type": "spiderpool",
"log_level": "DEBUG",
"log_file_path": "/var/log/spidernet/spiderpool.log",
"log_file_max_size": 100,
"log_file_max_age": 30,
"log_file_max_count": 10
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-standalone
namespace: kube-system
spec:
config: |-
{
"cniVersion": "0.3.0",
"name": "macvlan-standalone",
"plugins": [
{
"type": "macvlan",
"master": "ens192", # macvlan master insterface
"mode": "bridge",
"ipam": {
"type": "spiderpool",
"log_level": "DEBUG",
"log_file_path": "/var/log/spidernet/spiderpool.log",
"log_file_max_size": 100,
"log_file_max_age": 30,
"log_file_max_count": 10
}
},{
"type": "veth",
"routes": [{"dst": "10.244.0.0/18"},{"dst": "10.244.64.0/18"}], # calico/service subnet
"rp_filter": {
"enable": true,
"value": 2
},
"skip_call": false
}
},{
"type": "veth",
"routes": [
{
"dst": "10.240.0.0/12"
},{
"dst": "172.96.0.0/18"
]
}

```

- Macvlan-overlay

Calico + Macvlan:

```shell
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: macvlan-overlay
namespace: kube-system
spec:
config: |-
{
"cniVersion": "0.3.0",
"name": "macvlan-overlay",
"plugins": [
{
"type": "macvlan",
"master": "ens192",
"mode": "bridge",
"ipam": {
"type": "spiderpool",
"log_level": "DEBUG",
"log_file_path": "/var/log/spidernet/spiderpool.log",
"log_file_max_size": 100,
"log_file_max_age": 30,
"log_file_max_count": 10
}
],
"rp_filter": {
"enable": true,
"value": 2
},
"skip_call": false
}
]
}
},{
"type": "router",
"routes": [{"dst": "10.244.0.0/18"},{"dst": "10.244.64.0/18"}], # service/calico subnet
"rp_filter": {
"enable": true,
"value": 2
},
"delDefaultRoute4": true,
"delDefaultRoute6": true,
"defaultOverlayInterface": eth0,
"skip_call": false
}
]
}

```

## Notice
File renamed without changes.
6 changes: 3 additions & 3 deletions charts/plugins/Chart.yaml → charts/meta-plugins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
name: plugins
name: meta-plugins
description: Veth works with macvlan cni to solve some communication problems when macvlan is used as CNI.

# Library charts provide useful utilities or functions for the chart developer. They're included as
Expand All @@ -10,13 +10,13 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v0.1.1
version: v0.1.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "v0.1.1"
appVersion: "v0.1.2"

maintainers:
- name: Spider-Guys
Expand Down
8 changes: 4 additions & 4 deletions charts/plugins/README.md → charts/meta-plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ Plugins works with macvlan cni to solve some communication problems when macvlan
## Quick Install

```shell
helm repo add cni-plugins https://spidernet-io.github.io/cni-plugins
helm install cni-plugins/veth -n kube-system .
helm repo add cni-meta-plugins https://spidernet-io.github.io/cni-plugins
helm install meta-meta-plugins cni-meta-plugins/meta-meta-plugins -n kube-system
```

By default, the image's tag is consistent with the Chart version, if you want to specify the image's tag, you can follow the command below:

```shell
helm install cni-plugins/veth -n kube-system . \
--set image.tag=v0.1.1
helm install cni-meta-plugins/veth -n kube-system . \
--set image.tag=v0.1.2
```

-----------------------------
Expand Down
1 change: 1 addition & 0 deletions charts/meta-plugins/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ .Release.Name}} has been successfully installed, you can check if the plugin named "veth and router" exists in the /opt/cni/bin path of each node.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "plugins.name" -}}
{{- define "meta-plugins.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "plugins.fullname" -}}
{{- define "meta-plugins.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "plugins.chart" -}}
{{- define "meta-plugins.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "plugins.labels" -}}
helm.sh/chart: {{ include "plugins.chart" . }}
{{ include "plugins.selectorLabels" . }}
{{- define "meta-plugins.labels" -}}
helm.sh/chart: {{ include "meta-plugins.chart" . }}
{{ include "meta-plugins.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "plugins.selectorLabels" -}}
app.kubernetes.io/name: {{ include "plugins.name" . }}
{{- define "meta-plugins.selectorLabels" -}}
app.kubernetes.io/name: {{ include "meta-plugins.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "plugins.serviceAccountName" -}}
{{- define "meta-plugins.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "plugins.fullname" .) .Values.serviceAccount.name }}
{{- default (include "meta-plugins.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
name: kube-{{ .Chart.Name }}-ds
namespace: kube-system
labels:
{{- include "plugins.labels" . | nindent 4 }}
{{- include "meta-plugins.labels" . | nindent 4 }}
{{- if .Values.annotations }}
anotations:
{{ toYaml .Values.instances.arp.ipAddressPools | indent 2 }}
Expand All @@ -21,7 +21,7 @@ spec:
template:
metadata:
labels:
{{- include "plugins.labels" . | nindent 8 }}
{{- include "meta-plugins.labels" . | nindent 8 }}
app: plugins
spec:
hostNetwork: true
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion charts/plugins/templates/NOTES.txt

This file was deleted.

2 changes: 1 addition & 1 deletion plugins/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type PluginConf struct {
// RpFilter
DelDefaultRoute4 *bool `json:"delDefaultRoute4,omitempty"`
DelDefaultRoute6 *bool `json:"delDefaultRoute6,omitempty"`
DefaultOverlayInterface string `json:"default_overlay_interface,omitempty"`
DefaultOverlayInterface string `json:"defaultOverlayInterface,omitempty"`
// RpFilter
RPFilter *ty.RPFilter `json:"rp_filter,omitempty"`
Skipped bool `json:"skip_call,omitempty"`
Expand Down

0 comments on commit c3aa560

Please sign in to comment.