Skip to content

Commit 3dc0f56

Browse files
authored
feat(kube-ovn): build the chart and image in-tree, retiring the wrapper repo (#3460)
## What this PR does Brings the `kubeovn-chart` wrapper into the tree, so `cozystack/kubeovn-chart` can be archived. Until now `packages/system/kubeovn` pulled a chart tarball from the latest `cozystack/kubeovn-chart` tag at `make update` time, and that repository also built and pushed the `kubeovn` image. The wrapper existed only to cache the upstream chart; with the current caching approach that reason is gone, and the split cost a second repository, a second release step, and a package whose provenance a reader cannot follow without leaving the tree. The package is now shaped like `packages/system/cilium`: - `update` pulls the upstream `kubeovn/kube-ovn` chart directly and applies `patches/mtu.diff`, then syncs the version into the Dockerfile. The MTU patch already carried monorepo-relative paths, so it applies unchanged. - `image` builds `images/kubeovn` (carrying the existing `fix-keepvmip-portgroup` patch) and pins the digest into `values.yaml`, using the shared `image-tags` / `cache-args` helpers. It also carries `cozystack/kubeovn-chart#5`, which never got a tag: `OVN_IPSEC_KEY_DIR` is pinned under `/var/lib`. The kube-ovn default sits in `/etc/origin`, which a Talos node cannot create, so enabling IPsec left the node without ESP security associations. ### The nightly host rewrite had to be fixed first Moving the image build here activates a gap recorded in `docs/agents/image-refs.md`. The nightly host rewrite is a literal `<src-registry>/` substring replace, and kubeovn keeps its host in `global.registry.address` with the bare repository in a sibling key — no trailing slash, no match. While the image came from a separate repository the baked reference carried the public host and the ownership filter skipped it; once CI builds the image here it stamps the build-registry host into that key, and the result is an image mirrored to the public registry while the published tree keeps pointing at the private build registry. The second commit adds an end-of-line-anchored expression that fires only when the source registry is the complete scalar value, so a contiguous reference — which continues past the host — is still handled by the first expression and the two can never both fire on one reference. `keycloak-operator` splits at a different boundary and stays unfixed; that is documented, and dormant while no CI path rebuilds it. Verified: `hack/nightly-mirror_test.bats` passes with the new case and the case fails without the fix; `promote-retag` and `promote-rewrite-tags` suites unaffected; `helm template` and `helm unittest` on the package pass. The pre-existing `helm lint` complaint about a missing `kube-ovn` dependency reproduces on `main` and is left alone. ### Follow-ups this PR does not do - `cozystack/kubeovn-chart` should be archived once this merges, with a pointer here. Its open PR #5 is carried by this change and needs no separate landing. - `cozystack/website` links the Kube-OVN license at `cozystack/kubeovn-chart` in `operations/configuration/licenses.md` and `guides/platform-stack/_index.md` (all versions, including `next`). Archived repositories stay readable so nothing breaks, but the link should move upstream or in-tree. **No follow-up has been opened yet** — flagging rather than ticking the box. ### Screenshots N/A — build and packaging change, no user-facing or UI impact. ### Downstream repositories - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: Walked the trigger map against the diff. The website row matches — not through the app-list or platform-component triggers, but because two of its pages link the repository being archived. Left unticked because no follow-up exists there yet; a human should decide whether the license link moves to `kubeovn/kube-ovn` or to this package. No other row matches: the change touches no `packages/apps/` or `packages/extra/` package, no `values.schema.json`, no `ApplicationDefinition`, no platform variant, and no node prerequisite. ### Release note ```release-note feat(kube-ovn): the Kube-OVN chart and image are now built in this repository instead of cozystack/kubeovn-chart. OVN_IPSEC_KEY_DIR now defaults to /var/lib/ovs_ipsec_keys, so enabling IPsec on Talos nodes no longer leaves them without ESP security associations. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Updated Kube-OVN image build to use upstream chart metadata and keep registry/version alignment during `update`. - Added conditional MTU support for the OVN CNI DS via chart values. - Introduced `OVN_IPSEC_KEY_DIR` to standardize the OVN IPsec keys directory. - **Bug Fixes** - Preserved VM networking port-group assignments during live migration when an alive virt-launcher sibling pod exists. - Improved nightly mirror host rewriting for split and standalone registry host formats. - **Tests** - Added coverage for the end-of-line “whole scalar value” host rewrite case. - **Documentation** - Refreshed “Known gaps” guidance for nightly mirror host rewriting behavior and limitations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents cc44f6c + 6cb5793 commit 3dc0f56

8 files changed

Lines changed: 247 additions & 11 deletions

File tree

‎docs/agents/image-refs.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,13 @@ If a package stamps a reference somewhere the two globs do not cover, add that f
6565

6666
These are real, currently unfixed, and predate the shared enumeration. They are recorded here so nobody rediscovers them as surprises.
6767

68-
**The nightly host rewrite cannot reach a split host.** It is a literal `<src-registry>/` substring replace, so it only rewrites a reference whose host sits contiguously in front of the repository. Two live layouts defeat it: `keycloak-operator` splits the host into a sibling `registry:` key, and `kubeovn` puts it in `global.registry.address` with no trailing slash. Collection understands both shapes — the host is rejoined, so a split-key ref carrying the source-registry host is still selected and mirrored. Today neither package's ref does: keycloak-operator is never rebuilt by any CI path (#3416), and kubeovn's image is built and pushed to the public registry by cozystack/kubeovn-chart, so both baked refs keep the committed public-registry host and the ownership filter skips them — stale, but resolvable. The gap turns live the moment either package flows through a CI build that stamps the build-registry host into those keys: the image would be mirrored, yet the host rewrite would miss it, and the published tree would keep pointing at the private build registry. Fixing it properly means structure-aware rewriting rather than a substring pass. This is a defect in the host dimension; the version dimension the promote rewrite handles is unaffected, because the version always lives in a `tag` key regardless of where the host is.
68+
**The nightly host rewrite cannot reach a host split across two keys.** The primary pass is a literal `<src-registry>/` substring replace, so it only rewrites a reference whose host sits contiguously in front of the repository. Two layouts defeat it, and only one is now handled.
69+
70+
`kubeovn` puts the whole host in `global.registry.address` with the bare repository in a sibling key, so there is no trailing slash to match. This one **is** rewritten now, by a second, end-of-line-anchored expression that fires only when the source registry is the complete scalar value — a contiguous `<src>/<repo>@<digest>` ref continues past the host, so the two expressions can never both fire on one reference. It had to be fixed when kubeovn's image build moved into this repository: until then the image was built and pushed to the public registry by cozystack/kubeovn-chart, the baked ref kept the committed public-registry host, and the ownership filter skipped it. The moment a CI build stamps the build-registry host into that key, the image is mirrored but the host is not rewritten, and the published tree points at the private build registry. Covered by `hack/nightly-mirror_test.bats`.
71+
72+
`keycloak-operator` remains unfixed. It splits at a different boundary — `registry: iad.ocir.io` beside `repository: idyksih5sir9/cozystack/<name>` — so neither key holds the source registry as a whole and no anchored replace can reach it; rewriting it needs a structure-aware pass that knows how the destination host splits. The gap stays dormant because no CI path rebuilds the package (#3416), and turns live the moment one does.
73+
74+
Collection understands both shapes — the host is rejoined, so a split-key ref carrying the source-registry host is still selected and mirrored. This is a defect in the host dimension; the version dimension the promote rewrite handles is unaffected, because the version always lives in a `tag` key regardless of where the host is.
6975

7076
**A reference inside a gzip is invisible.** `capi-providers-cpprovider` stamps its kamaji reference into `files/control-plane-components.yaml` and into the `files/components.gz` built from it, and the chart ships the `.gz`. Nothing enumerates either: declaring only the readable copy would rewrite what nothing consumes and diverge it from what does. Note the promote postcondition cannot catch this class at all — `grep -rIl` skips binary files — so it fails silently rather than loudly. No tag rewrite is owed (kamaji is component-versioned) and the image is still mirrored and retagged via its `.tag` file, so the residual is that a nightly's kamaji ConfigMap keeps the build-registry host. The fix is decompress, rewrite, recompress with `gzip -n` for reproducibility.
7177

‎hack/nightly-mirror.sh‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,26 @@ else
141141
# never pushed to DST_REGISTRY; scanning a file that is not rewritten leaves
142142
# the published tree pointing at the private CI registry. A `find -name
143143
# values.yaml` at any depth would do the former to vendored chart defaults.
144+
# The second expression reaches one shape the first cannot: a host that is the
145+
# *entire* scalar value, with the repository in a sibling key — kubeovn's
146+
# `global.registry.address`, now that its image is built here rather than in
147+
# cozystack/kubeovn-chart. There is no trailing slash for `<src>/` to match, so
148+
# the host survived the rewrite while the image itself was mirrored, publishing
149+
# a tree that points at the private CI registry. Anchoring on end-of-line means
150+
# it only fires when SRC_REGISTRY is the complete value: a contiguous
151+
# `<src>/<repo>@<digest>` ref continues past the host and is left to the first
152+
# expression, so the two cannot both fire on one reference.
153+
#
154+
# It deliberately does NOT fix keycloak-operator, whose host splits at a
155+
# different boundary (`registry: iad.ocir.io` + `repository:
156+
# idyksih5sir9/cozystack/<name>`): neither key holds SRC_REGISTRY as a whole,
157+
# so rewriting it needs the structure-aware pass docs/agents/image-refs.md
158+
# describes. That gap stays dormant while no CI path rebuilds the package.
144159
image_ref_files "$TREE" | while IFS= read -r f; do
145-
sed -i "s|${SRC_ESC}/|${DST_REGISTRY}/|g" "$f"
160+
sed -i \
161+
-e "s|${SRC_ESC}/|${DST_REGISTRY}/|g" \
162+
-e "s|\(:[[:space:]]*[\"']\?\)${SRC_ESC}\([\"']\?\)[[:space:]]*$|\1${DST_REGISTRY}\2|" \
163+
"$f"
146164
done
147165
fi
148166

‎hack/nightly-mirror_test.bats‎

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,11 +230,11 @@ _make_tree() {
230230
#
231231
# Scope, so the name does not overclaim: this pins WHICH FILES the rewrite
232232
# visits, not that every ref inside them is successfully rewritten. The sed
233-
# itself only runs outside --dry-run (it needs skopeo) and is a literal
234-
# "<src>/" substring replace, so it still cannot rewrite a host split into a
235-
# sibling `registry:` key (keycloak-operator) or one without a trailing slash
236-
# (kubeovn's global.registry.address). That is a known gap recorded in
237-
# docs/agents/image-refs.md, not something this test covers.
233+
# itself only runs outside --dry-run (it needs skopeo), so it still cannot
234+
# rewrite a host split into a sibling `registry:` key (keycloak-operator).
235+
# That is a known gap recorded in docs/agents/image-refs.md, not something
236+
# this test covers; the whole-value shape (kubeovn) is covered by the
237+
# dedicated test below.
238238
tmp=$(mktemp -d)
239239
trap 'rm -rf "$tmp"' EXIT
240240
_make_tree "$tmp/tree"
@@ -246,3 +246,44 @@ _make_tree() {
246246
echo "$files" | grep -q '/system/tagfile/images/thing.tag$'
247247
echo "$files" | grep -q '/system/multus/templates/multus-daemonset-thick.yml$'
248248
}
249+
250+
@test "the host rewrite reaches a host that is the whole scalar value" {
251+
# kubeovn keeps its host in global.registry.address with the repository in a
252+
# sibling key, so there is no trailing slash for the literal "<src>/" replace
253+
# to match. The image was mirrored, the host was not rewritten, and the
254+
# published tree kept pointing at the private CI registry. Dormant while the
255+
# image was built in cozystack/kubeovn-chart; live once it is built here.
256+
#
257+
# Needs a skopeo stub because the sed only runs outside --dry-run. Scope: this
258+
# covers the whole-value shape only. keycloak-operator splits the host at a
259+
# different boundary (`registry: iad.ocir.io`), where no single key holds
260+
# SRC_REGISTRY, and is still unfixed — see docs/agents/image-refs.md.
261+
tmp=$(mktemp -d)
262+
trap 'rm -rf "$tmp"' EXIT
263+
_make_tree "$tmp/tree"
264+
265+
# The stub must answer `inspect` with the source digest: the script verifies
266+
# every dest tag resolves to it and aborts before the rewrite otherwise.
267+
mkdir -p "$tmp/bin"
268+
{
269+
echo '#!/bin/sh'
270+
echo 'case "$1" in'
271+
printf ' inspect) echo "sha256:%s" ;;\n' "$D"
272+
echo ' *) exit 0 ;;'
273+
echo 'esac'
274+
} > "$tmp/bin/skopeo"
275+
chmod +x "$tmp/bin/skopeo"
276+
277+
PATH="$tmp/bin:$PATH" hack/nightly-mirror.sh 0.0.0-nightly.test "$tmp/tree"
278+
279+
# the whole-value host is rewritten, and the repository beside it is untouched
280+
grep -q '^ address: ghcr.io/cozystack/cozystack$' "$tmp/tree/system/globalreg/values.yaml"
281+
grep -q '^ repository: globalreg$' "$tmp/tree/system/globalreg/values.yaml"
282+
! grep -q 'iad.ocir.io' "$tmp/tree/system/globalreg/values.yaml"
283+
284+
# a contiguous ref is still rewritten exactly once, not double-prefixed
285+
grep -q '^image: ghcr.io/cozystack/cozystack/foo:main@sha256:' "$tmp/tree/system/foo/values.yaml"
286+
287+
# third-party hosts are left alone
288+
grep -q 'docker.io/clastix/kubectl' "$tmp/tree/system/third/values.yaml"
289+
}

‎packages/system/kubeovn/Makefile‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
KUBEOVN_TAG=$(shell awk '$$1 == "appVersion:" {print $$2}' charts/kube-ovn/Chart.yaml)
2+
13
export NAME=kubeovn
24
export NAMESPACE=cozy-$(NAME)
35

@@ -8,7 +10,27 @@ test:
810
helm unittest .
911

1012
update:
11-
rm -rf charts values.yaml Chart.yaml
12-
tag=$$(git ls-remote --tags --sort="v:refname" https://github.com/cozystack/kubeovn-chart | awk -F'[/^]' 'END{print $$3}') && \
13-
curl -sSL https://github.com/cozystack/kubeovn-chart/archive/refs/tags/$${tag}.tar.gz | \
14-
tar xzvf - --strip 2 kubeovn-chart-$${tag#*v}/chart
13+
rm -rf charts
14+
tag=$$(git ls-remote --tags --sort="v:refname" https://github.com/kubeovn/kube-ovn | awk -F'[/^]' '{print $$3}' | grep '^v1\.15\.' | tail -n1) && \
15+
curl -sSL https://github.com/kubeovn/kube-ovn/archive/refs/tags/$${tag}.tar.gz | \
16+
tar -xzf - --strip 1 kube-ovn-$${tag#*v}/charts/kube-ovn
17+
# Teach the CNI DaemonSet to honour an explicit MTU: upstream derives it from
18+
# the node interface, which is wrong when the underlay is encapsulated.
19+
patch --no-backup-if-mismatch -p4 < patches/mtu.diff
20+
version=$$(awk '$$1 == "appVersion:" {print $$2}' charts/kube-ovn/Chart.yaml) && \
21+
$(SED_INPLACE) -e "s/ARG VERSION=.*/ARG VERSION=$${version}/" images/kubeovn/Dockerfile && \
22+
$(SED_INPLACE) -e "s/ARG TAG=.*/ARG TAG=v$${version}/" images/kubeovn/Dockerfile
23+
24+
image:
25+
docker buildx build images/kubeovn \
26+
$(call image-tags,kubeovn,v$(KUBEOVN_TAG)) \
27+
$(call cache-args,kubeovn) \
28+
--metadata-file images/kubeovn.json \
29+
$(BUILDX_ARGS)
30+
ADDRESS="$(REGISTRY)" \
31+
yq -i '.global.registry.address = strenv(ADDRESS)' values.yaml
32+
REPOSITORY="kubeovn" \
33+
yq -i '.global.images.kubeovn.repository = strenv(REPOSITORY)' values.yaml
34+
TAG="$(IMAGE_TAG)@$$(yq e '."containerimage.digest"' images/kubeovn.json -o json -r)" \
35+
yq -i '.global.images.kubeovn.tag = strenv(TAG)' values.yaml
36+
rm -f images/kubeovn.json
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# syntax = docker/dockerfile:experimental
2+
ARG VERSION="1.15.10"
3+
ARG BASE_TAG=v$VERSION
4+
5+
FROM golang:1.26-bookworm as builder
6+
7+
ARG TAG="v1.15.10"
8+
RUN git clone --branch ${TAG} --depth 1 https://github.com/kubeovn/kube-ovn /source
9+
10+
WORKDIR /source
11+
12+
COPY patches /patches
13+
RUN git apply /patches/*.diff
14+
RUN make build-go
15+
16+
WORKDIR /source/dist/images
17+
18+
# imported from https://github.com/kubeovn/kube-ovn/blob/master/dist/images/Dockerfile
19+
FROM kubeovn/kube-ovn-base:$BASE_TAG AS setcap
20+
21+
COPY --from=builder /source/dist/images/*.sh /kube-ovn/
22+
COPY --from=builder /source/dist/images/kubectl-ko /kube-ovn/kubectl-ko
23+
COPY --from=builder /source/dist/images/01-kube-ovn.conflist /kube-ovn/01-kube-ovn.conflist
24+
25+
COPY --from=builder /source/dist/images/kube-ovn /kube-ovn/kube-ovn
26+
COPY --from=builder /source/dist/images/kube-ovn-cmd /kube-ovn/kube-ovn-cmd
27+
COPY --from=builder /source/dist/images/kube-ovn-daemon /kube-ovn/kube-ovn-daemon
28+
COPY --from=builder /source/dist/images/kube-ovn-controller /kube-ovn/kube-ovn-controller
29+
RUN ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-monitor && \
30+
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-speaker && \
31+
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-webhook && \
32+
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-leader-checker && \
33+
ln -s /kube-ovn/kube-ovn-cmd /kube-ovn/kube-ovn-ic-controller && \
34+
ln -s /kube-ovn/kube-ovn-controller /kube-ovn/kube-ovn-pinger && \
35+
setcap CAP_NET_BIND_SERVICE+eip /kube-ovn/kube-ovn-cmd && \
36+
setcap CAP_NET_RAW,CAP_NET_BIND_SERVICE+eip /kube-ovn/kube-ovn-controller && \
37+
setcap CAP_NET_ADMIN,CAP_NET_RAW,CAP_NET_BIND_SERVICE,CAP_SYS_ADMIN+eip /kube-ovn/kube-ovn-daemon
38+
39+
FROM kubeovn/kube-ovn-base:$BASE_TAG
40+
41+
COPY --chmod=0644 --from=builder /source/dist/images/logrotate/* /etc/logrotate.d/
42+
COPY --from=builder /source/dist/images/grace_stop_ovn_controller /usr/share/ovn/scripts/grace_stop_ovn_controller
43+
44+
COPY --from=setcap /kube-ovn /kube-ovn
45+
RUN /kube-ovn/iptables-wrapper-installer.sh --no-sanity-check
46+
47+
WORKDIR /kube-ovn
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
diff --git a/pkg/controller/pod.go b/pkg/controller/pod.go
2+
--- a/pkg/controller/pod.go
3+
+++ b/pkg/controller/pod.go
4+
@@ -1061,6 +1061,7 @@
5+
}
6+
}
7+
}
8+
+ var hasAliveVMSibling bool
9+
isVMPod, vmName := isVMPod(pod)
10+
if isVMPod && c.config.EnableKeepVMIP {
11+
ports, err := c.OVNNbClient.ListNormalLogicalSwitchPorts(true, map[string]string{"pod": podKey})
12+
@@ -1081,6 +1082,18 @@
13+
if !isOwnerRefToDel {
14+
klog.Infof("try keep ip for vm pod %s", podKey)
15+
keepIPCR = true
16+
+ // The VM LSP is shared across every virt-launcher pod of the VM
17+
+ // (ExternalIDs["pod"] is keyed by VM name). Port-group memberships,
18+
+ // however, belong to whichever virt-launcher pod is currently
19+
+ // running the VM. If another live sibling exists (e.g. a
20+
+ // live-migration destination while the completed source is being
21+
+ // GC'd), its memberships must not be wiped out.
22+
+ siblings, listErr := c.podsLister.Pods(pod.Namespace).List(labels.Everything())
23+
+ if listErr != nil {
24+
+ klog.Errorf("failed to list pods in namespace %s: %v", pod.Namespace, listErr)
25+
+ return listErr
26+
+ }
27+
+ hasAliveVMSibling = hasAliveSiblingVMPod(siblings, vmName, pod.Name)
28+
}
29+
}
30+
if keepIPCR {
31+
@@ -1106,12 +1119,18 @@
32+
return err
33+
}
34+
if keepIPCR {
35+
- // always remove lsp from port groups
36+
- for _, port := range ports {
37+
- klog.Infof("remove lsp %s from all port groups", port.Name)
38+
- if err = c.OVNNbClient.RemovePortFromPortGroups(port.Name); err != nil {
39+
- klog.Errorf("failed to remove lsp %s from all port groups: %v", port.Name, err)
40+
- return err
41+
+ // always remove lsp from port groups, unless another live virt-launcher
42+
+ // pod owns the memberships (e.g. live-migration destination while the
43+
+ // completed source is being GC'd).
44+
+ if hasAliveVMSibling {
45+
+ klog.Infof("skip removing lsp from port groups: another alive virt-launcher pod exists for vm %s/%s", pod.Namespace, vmName)
46+
+ } else {
47+
+ for _, port := range ports {
48+
+ klog.Infof("remove lsp %s from all port groups", port.Name)
49+
+ if err = c.OVNNbClient.RemovePortFromPortGroups(port.Name); err != nil {
50+
+ klog.Errorf("failed to remove lsp %s from all port groups: %v", port.Name, err)
51+
+ return err
52+
+ }
53+
}
54+
}
55+
} else {
56+
@@ -2358,6 +2377,27 @@
57+
return false, ""
58+
}
59+
60+
+// hasAliveSiblingVMPod reports whether pods contains any alive virt-launcher
61+
+// pod owned by the VMI vmName, excluding the pod with name excludePodName.
62+
+// It is used to decide whether a VM LSP's port-group memberships are still
63+
+// owned by another running sibling (e.g. a live-migration destination) when a
64+
+// completed/GC'd source pod is being processed.
65+
+func hasAliveSiblingVMPod(pods []*v1.Pod, vmName, excludePodName string) bool {
66+
+ for _, p := range pods {
67+
+ if p == nil || p.Name == excludePodName {
68+
+ continue
69+
+ }
70+
+ isVM, name := isVMPod(p)
71+
+ if !isVM || name != vmName {
72+
+ continue
73+
+ }
74+
+ if isPodAlive(p) {
75+
+ return true
76+
+ }
77+
+ }
78+
+ return false
79+
+}
80+
+
81+
func isOwnsByTheVM(vmi metav1.Object) (bool, string) {
82+
for _, owner := range vmi.GetOwnerReferences() {
83+
if owner.Kind == util.KindVirtualMachine &&
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff --git a/packages/system/kubeovn/charts/kube-ovn/templates/ovncni-ds.yaml b/packages/system/kubeovn/charts/kube-ovn/templates/ovncni-ds.yaml
2+
--- a/packages/system/kubeovn/charts/kube-ovn/templates/ovncni-ds.yaml
3+
+++ b/packages/system/kubeovn/charts/kube-ovn/templates/ovncni-ds.yaml
4+
@@ -122,6 +122,9 @@
5+
- --set-vxlan-tx-off={{- .Values.func.SET_VXLAN_TX_OFF }}
6+
- --non-primary-cni-mode={{- .Values.cni_conf.NON_PRIMARY_CNI }}
7+
+ {{- with .Values.mtu }}
8+
+ - --mtu={{ . }}
9+
+ {{- end }}
10+
securityContext:
11+
runAsUser: 0
12+
privileged: false

‎packages/system/kubeovn/values.yaml‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,14 @@ kube-ovn:
1414
cni_conf:
1515
CNI_CONFIG_PRIORITY: "10"
1616
MOUNT_LOCAL_BIN_DIR: false
17+
# These three directories are hostPaths on every node. The kube-ovn defaults
18+
# place them under /etc/origin, which a Talos node cannot create: its root
19+
# filesystem is read-only, so the container fails at create time with
20+
# "mkdir /etc/origin: read-only file system". Keep them under the writable
21+
# /var/lib. OVN_IPSEC_KEY_DIR only takes effect with func.ENABLE_OVN_IPSEC
22+
# on, where its absence leaves the node without ESP security associations.
1723
OPENVSWITCH_DIR: "/var/lib/openvswitch"
24+
OVN_IPSEC_KEY_DIR: "/var/lib/ovs_ipsec_keys"
1825
OVN_DIR: "/var/lib/ovn"
1926
DISABLE_MODULES_MANAGEMENT: true
2027
ovn-central:

0 commit comments

Comments
 (0)