conlink 2.5.1 → 2.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ on:
7
7
  workflow_dispatch: {}
8
8
 
9
9
  jobs:
10
- compose-tests:
10
+ tests:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - name: Checkout
@@ -22,3 +22,11 @@ jobs:
22
22
  - name: "dctest test/test*.yaml"
23
23
  timeout-minutes: 5
24
24
  run: time node_modules/.bin/dctest --verbose-commands conlink-test $(ls -v test/test*.yaml)
25
+
26
+ - name: Check --show-config and net2dot
27
+ run: |
28
+ cfg=$(./conlink --show-config --compose-file examples/test1-compose.yaml)
29
+ summary=$(echo "${cfg}" | jq -r '.|"\(.bridges|keys|sort|join(".")) \(.services|keys|sort|join("."))"')
30
+ [ "${summary}" = "s1.s2.s3 h1.h2.h3.r0" ]
31
+ dot=$(echo "${cfg}" | ./net2dot)
32
+ [ $(echo "${dot}" | grep "r0.*eth" | wc -l) -ge 10 ]
package/mdc CHANGED
@@ -30,7 +30,7 @@ RESOLVED_MODES="$(${RESOLVE_DEPS} --path "${MODES_DIR}" --format=paths ${MODE_SP
30
30
 
31
31
  COMPOSE_FILE=./.compose-empty.yaml
32
32
  cat /dev/null > ${ENV_FILE}-mdc-tmp
33
- echo -e "version: '2.4'\nservices: {}" > ./.compose-empty.yaml
33
+ echo -e "services: {}" > ./.compose-empty.yaml
34
34
 
35
35
  vecho "Removing ${MDC_FILES_DIR}"
36
36
  case "$(basename ${MDC_FILES_DIR})" in
package/net2dot.cljs CHANGED
@@ -57,11 +57,12 @@
57
57
  (let [graph (digraph {:splines true :compound true})
58
58
  host (subgraph graph "cluster_host" "host system" HOST-PROPS)
59
59
  conlink (subgraph host "cluster_conlink" "conlink/network" CONLINK-PROPS)
60
+ links (->> network-config :services vals (map :links) (apply concat))
60
61
  bridges (reduce
61
62
  #(->> (subgraph conlink (str "cluster_bridge_" %2)
62
63
  %2 BRIDGE-PROPS)
63
64
  (assoc %1 %2))
64
- {} (map :bridge (keep :bridge (:links network-config))))
65
+ {} (keys (:bridges network-config)))
65
66
  services (reduce
66
67
  #(->> (subgraph host (str "cluster_service_" (dot-id %2))
67
68
  (str "service '" (name %2) "'") SVC-PROPS)
@@ -73,7 +74,7 @@
73
74
  (assoc %1 %2))
74
75
  {} (keys (:containers network-config)))]
75
76
 
76
- (doseq [link (:links network-config)]
77
+ (doseq [link links]
77
78
  (let [{:keys [service container dev outer-dev bridge base]} link
78
79
  cname (or service container)
79
80
  cnode (get (if service services containers) (keyword cname))
@@ -85,7 +86,7 @@
85
86
  "-" (name dev)))
86
87
  out-id (str "out-" outer-dev)
87
88
  out-parent (condp = (keyword base)
88
- :conlink (get bridges (:bridge bridge))
89
+ :conlink (get bridges (keyword (:bridge bridge)))
89
90
  :host host)
90
91
  {:keys [type vlanid]} link
91
92
  [elabel iprops] (if (= "host" base)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conlink",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "conlink - Declarative Low-Level Networking for Containers",
5
5
  "repository": "https://github.com/LonoCloud/conlink",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -112,7 +112,7 @@ General Options:
112
112
  - Add default values to a link:
113
113
  - type: veth
114
114
  - dev: eth0
115
- - mac: random MAC starting with first octet of 'c2'
115
+ - mac: random MAC starting with first octet of 'c2' (not added to ipvlan)
116
116
  - mtu: --default-mtu (for non *vlan type)
117
117
  - base: :conlink for veth type, :host for *vlan types, :local otherwise"
118
118
  [{:as link :keys [type bridge ip route forward netem ethtool]} bridges opts]
@@ -120,7 +120,8 @@ General Options:
120
120
  {:keys [default-mtu keep-veth-offload]} opts
121
121
  type (keyword (or type "veth"))
122
122
  dev (get link :dev "eth0")
123
- mac (get link :mac (random-mac))
123
+ mac (when-not (= :ipvlan type)
124
+ (get link :mac (random-mac)))
124
125
  base-default (cond (= :veth type) :conlink
125
126
  (VLAN-TYPES type) :host
126
127
  :else :local)
@@ -138,10 +139,11 @@ General Options:
138
139
  {:type type
139
140
  :dev dev
140
141
  :base base
141
- :mac mac
142
142
  :ethtool ethtool}
143
143
  (when bridge
144
144
  {:bridge bridge})
145
+ (when mac
146
+ {:mac mac})
145
147
  (when (not (VLAN-TYPES type))
146
148
  {:mtu (get link :mtu default-mtu)})
147
149
  (when route
@@ -904,7 +906,7 @@ General Options:
904
906
  docker-eth0-addresses (when docker-eth0? (intf-ipv4-addresses "eth0"))
905
907
  _ (swap! ctx merge {:kmod-ovs? kmod-ovs?
906
908
  :kmod-mirred? kmod-mirred?
907
- :docker-eth0? docker-eth0?
909
+ :docker-eth0? (or docker-eth0? show-config)
908
910
  :docker-eth0-address (first docker-eth0-addresses)})
909
911
  network-config (P/-> (load-configs compose-file network-file)
910
912
  (interpolate-walk env)
@@ -977,7 +979,9 @@ General Options:
977
979
  (P/let
978
980
  [event-filter {"event" ["start" "die"]}
979
981
  ;; Listen for docker and/or podman events
980
- _ (docker-listen client event-filter handle-event)
982
+ ;; NOTE: sometimes (podman on macos) this blocks
983
+ ;; until the first event. Wrap it to skip await.
984
+ _ [(docker-listen client event-filter handle-event)]
981
985
  containers ^obj (list-containers client)]
982
986
  ;; Generate fake events for existing containers
983
987
  (P/all (for [container containers