Last active
September 27, 2021 23:36
-
-
Save warroyo/4ebdb49d046284c4f0ccc76d71323556 to your computer and use it in GitHub Desktop.
switch antrea tunnel type
This file contains hidden or 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
| #@ load("@ytt:overlay", "overlay") | |
| #@ load("@ytt:data", "data") | |
| #@ load("@ytt:yaml", "yaml") | |
| #@overlay/match by=overlay.subset({"kind":"Secret","metadata":{"annotations":{"tkg.tanzu.vmware.com/addon-type": "cni/antrea"}}}) | |
| --- | |
| apiVersion: v1 | |
| kind: Secret | |
| #@ if data.values.ANTREA_VXLAN: | |
| stringData: | |
| #@overlay/match missing_ok=True | |
| overlays.yaml: | | |
| #@ load("@ytt:overlay", "overlay") | |
| #@ load("@ytt:data", "data") | |
| #@ load("@ytt:yaml", "yaml") | |
| #@ load("@ytt:regexp", "regexp") | |
| #@ def has_name_and_namespace(doc, name, namespace): | |
| #@ if not ("metadata" in doc and \ | |
| #@ "name" in doc["metadata"] and \ | |
| #@ "namespace" in doc["metadata"]): | |
| #@ return False | |
| #@ end | |
| #@ return regexp.match(name, doc["metadata"]["name"]) and \ | |
| #@ regexp.match(namespace, doc["metadata"]["namespace"]) | |
| #@ end | |
| #@ def shared_conf(): | |
| #@overlay/match missing_ok=True | |
| tunnelType: vxlan | |
| #@ end | |
| #@ def add_shared_conf(old, _): | |
| #@ return yaml.encode(overlay.apply(yaml.decode(old),shared_conf())) | |
| #@ end | |
| #@overlay/match by=lambda _, left, right: has_name_and_namespace(left, "antrea-config-.*", "kube-system") and left["kind"] == "ConfigMap" | |
| --- | |
| apiVersion: v1 | |
| kind: ConfigMap | |
| data: | |
| #@overlay/replace via=add_shared_conf | |
| antrea-agent.conf: | |
| #@ end |
This file contains hidden or 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
| #@data/values | |
| #@overlay/match-child-defaults missing_ok=True | |
| --- | |
| ANTREA_VXLAN: |
This file contains hidden or 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
| ANTREA_VXLAN: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment