Skip to content
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

Set default tunnel type to Geneve #894

Closed
wants to merge 3 commits into from
Closed
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: 1 addition & 1 deletion cmd/antrea-agent/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
defaultHostGateway = "antrea-gw0"
defaultHostProcPathPrefix = "/host"
defaultServiceCIDR = "10.96.0.0/12"
defaultTunnelType = ovsconfig.VXLANTunnel
defaultTunnelType = ovsconfig.GeneveTunnel
defaultMTUGeneve = 1450
defaultMTUVXLAN = 1450
defaultMTUGRE = 1462
Expand Down
34 changes: 25 additions & 9 deletions hack/generate-manifest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ function echoerr {

_usage="Usage: $0 [--mode (dev|release)] [--kind] [--ipsec] [--keep] [--help|-h]
Generate a YAML manifest for Antrea using Kustomize and print it to stdout.
--mode (dev|release) Choose the configuration variant that you need (default is 'dev')
--encap-mode Traffic encapsulation mode. (default is 'encap')
--kind Generate a manifest appropriate for running Antrea in a Kind cluster
--cloud Generate a manifest appropriate for running Antrea in Public Cloud
--ipsec Generate a manifest with IPSec encryption of tunnel traffic enabled
--proxy Generate a manifest with Antrea proxy enabled
--np Generate a manifest with Namespaced Antrea NetworkPolicy CRDs and ClusterNetworkPolicy related CRDs enabled
--keep Debug flag which will preserve the generated kustomization.yml
--help, -h Print this message and exit
--mode (dev|release) Choose the configuration variant that you need (default is 'dev')
--encap-mode Traffic encapsulation mode. (default is 'encap')
--kind Generate a manifest appropriate for running Antrea in a Kind cluster
--cloud Generate a manifest appropriate for running Antrea in Public Cloud
--ipsec Generate a manifest with IPSec encryption of tunnel traffic enabled
--proxy Generate a manifest with Antrea proxy enabled
--np Generate a manifest with Namespaced Antrea NetworkPolicy CRDs and ClusterNetworkPolicy related CRDs enabled
--keep Debug flag which will preserve the generated kustomization.yml
--tun (geneve|vxlan|gre|stt) Choose encap tunnel type from geneve, gre, stt and vxlan (default is geneve)
--help, -h Print this message and exit

In 'release' mode, environment variables IMG_NAME and IMG_TAG must be set.

Expand All @@ -55,6 +56,7 @@ NP=false
KEEP=false
ENCAP_MODE=""
CLOUD=""
TUN_TYPE="geneve"

while [[ $# -gt 0 ]]
do
Expand Down Expand Up @@ -93,6 +95,10 @@ case $key in
KEEP=true
shift
;;
--tun)
TUN_TYPE="$2"
shift 2
;;
-h|--help)
print_usage
exit 0
Expand All @@ -110,6 +116,12 @@ if [ "$MODE" != "dev" ] && [ "$MODE" != "release" ]; then
exit 1
fi

if [ "$TUN_TYPE" != "geneve" ] && [ "$TUN_TYPE" != "vxlan" ] && [ "$TUN_TYPE" != "gre" ] && [ "$TUN_TYPE" != "stt" ]; then
echoerr "--tun must be one of 'geneve', 'gre', 'stt' or 'vxlan'"
print_help
exit 1
fi

if [ "$MODE" == "release" ] && [ -z "$IMG_NAME" ]; then
echoerr "In 'release' mode, environment variable IMG_NAME must be set"
print_help
Expand Down Expand Up @@ -170,6 +182,10 @@ if [[ $ENCAP_MODE != "" ]]; then
sed -i.bak -E "s/^[[:space:]]*#[[:space:]]*trafficEncapMode[[:space:]]*:[[:space:]]*[a-z]+[[:space:]]*$/trafficEncapMode: $ENCAP_MODE/" antrea-agent.conf
fi

if [[ $TUN_TYPE != "geneve" ]]; then
sed -i.bak -E "s/^[[:space:]]*#[[:space:]]*tunnelType[[:space:]]*:[[:space:]]*[a-z]+[[:space:]]*$/tunnelType: $TUN_TYPE/" antrea-agent.conf
fi

# unfortunately 'kustomize edit add configmap' does not support specifying 'merge' as the behavior,
# which is why we use a template kustomization file.
sed -e "s/<AGENT_CONF_FILE>/antrea-agent.conf/; s/<CONTROLLER_CONF_FILE>/antrea-controller.conf/" ../../patches/kustomization.configMap.tpl.yml > kustomization.yml
Expand Down
2 changes: 1 addition & 1 deletion hack/netpol/test-kind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ kind load docker-image antrea/netpol:latest
# pre-load the test container image on all the Nodes
docker pull antrea/netpol-test
kind load docker-image antrea/netpol-test
$ROOT_DIR/hack/generate-manifest.sh --kind | kubectl apply -f -
$ROOT_DIR/hack/generate-manifest.sh --kind --tun "vxlan" | kubectl apply -f -

echo "===> Creating netpol ClusterRoleBinding, ServiceAccount and Job <==="

Expand Down