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

Flannel package enhancements misconfigured version setting + tests #47460

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Changes from 12 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
68 changes: 61 additions & 7 deletions flannel.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package:
name: flannel
version: "0.26.5"
epoch: 3
epoch: 4
description: flannel is a network fabric for containers, designed for Kubernetes
copyright:
- license: Apache-2.0
Expand Down Expand Up @@ -34,8 +34,8 @@ pipeline:
if [ "$(go env GOARCH)" = "amd64" ]; then
CGO_ENABLED=1
fi
CGO_ENABLED=$(CGO_ENABLED) go build -o "${{targets.destdir}}"/usr/bin/flanneld \
-ldflags '-extldflags "-static" -X github.com/flannel-io/flannel/pkg/version.version=${{package.version}}'
CGO_ENABLED=$CGO_ENABLED go build -o "${{targets.destdir}}"/usr/bin/flanneld \
-ldflags "-extldflags \"-static\" -X github.com/flannel-io/flannel/pkg/version.Version=${{package.version}}"

update:
enabled: true
Expand All @@ -44,8 +44,62 @@ update:
strip-prefix: v

test:
environment:
contents:
packages:
- ${{package.name}}
- etcd
pipeline:
# AUTOGENERATED
- runs: |
flanneld --version
flanneld --help
- name: "Test flanneld daemon output"
uses: test/daemon-check-output
with:
setup: |
#!/bin/sh -ex
# Start etcd in background with proper networking configuration
mkdir -p /tmp/etcd-data
etcd --data-dir=/tmp/etcd-data \
--listen-client-urls=http://127.0.0.1:2379 \
--advertise-client-urls=http://127.0.0.1:2379 > /tmp/etcd.log 2>&1 &
ETCD_PID=$!

# Ensure etcd is ready before proceeding
for i in 1 2 3 4 5; do
if etcdctl --endpoints=http://127.0.0.1:2379 endpoint status --write-out=table; then
break
fi
sleep 1
done

# Store flannel network config in etcd
printf "{\"Network\": \"10.244.0.0/16\", \"Backend\": {\"Type\": \"host-gw\"}}" > /tmp/flannel-config.json
etcdctl --endpoints=http://127.0.0.1:2379 put /coreos.com/network/config "$(cat /tmp/flannel-config.json)"

# Save PID for cleanup
echo "export ETCD_PID=$ETCD_PID" > /tmp/etcd_pid.sh
# Disable iptables to avoid permission issues in unprivileged test environments and focus testing on core networking capabilities
start: flanneld --etcd-endpoints=http://127.0.0.1:2379 --iface=eth0 --iptables-forward-rules=false
timeout: 10
expected_output: |
Created subnet manager
error_strings: |
"msg":"error connecting to etcd"
"level":"error" .* "could not create subnet manager"
"panic"
"fatal"
"Failed"
"Error: could not access etcd"
"error: could not allocate lease"
post: |
#!/bin/sh -ex
# Load etcd PID from setup phase
. /tmp/etcd_pid.sh

# Verify flannel created the proper subnet configuration
if [ ! -f /run/flannel/subnet.env ]; then
echo "Subnet file not found"
exit 1
fi
grep -q "FLANNEL_SUBNET=" /run/flannel/subnet.env

# Cleanup etcd process
kill $ETCD_PID || true
Loading