Skip to content

Commit

Permalink
Set default tunnel type to Geneve
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiraut authored and antoninbas committed Jul 2, 2020
1 parent afa39fb commit 8e07f0d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
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

0 comments on commit 8e07f0d

Please sign in to comment.