{"owner":"flannel-io","repo":"flannel","hasSkills":true,"hasMcp":false,"mcpConfig":null,"found":["CLAUDE.md"],"skills":{"CLAUDE.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nFlannel is a network fabric for Kubernetes that provides layer 3 IPv4 networking between nodes in a cluster. The main binary is `flanneld`, which runs on each host and allocates subnet leases from a larger preconfigured address space.\n\n## Development Commands\n\n### Building\n\nBuild for amd64 (in Docker container):\n```bash\nmake dist/flanneld-amd64\n```\n\nBuild for specific architecture:\n```bash\nARCH=arm64 make dist/flanneld-arm64\nARCH=s390x make dist/flanneld-s390x\n```\n\nBuild multi-arch image:\n```bash\nmake buildx-create-builder  # One-time setup\nmake build-multi-arch\n```\n\nBuild natively (requires CGO for amd64):\n```bash\nCGO_ENABLED=1 make dist/flanneld\n```\n\n### Testing\n\nRun all tests (includes license check, gofmt, unit tests, e2e tests):\n```bash\nmake test\n```\n\nRun unit tests only:\n```bash\nmake unit-test\n```\n\nRun e2e tests:\n```bash\nmake e2e-test\n```\n\nRun tests for specific packages:\n```bash\nTEST_PACKAGES=\"pkg/ip pkg/subnet\" make unit-test\n```\n\nCheck formatting:\n```bash\nmake gofmt\n```\n\nVerify go modules:\n```bash\nmake verify-modules\n```\n\nUpdate dependencies:\n```bash\nmake deps  # runs go mod tidy && go mod vendor\n```\n\n### Local Development\n\nInstall binary locally (for quick iteration):\n```bash\nmake install\n```\n\n## Architecture\n\n### Core Components\n\n**main.go**: Entry point that:\n- Parses command-line flags (etcd endpoints, kube config, interface selection, etc.)\n- Initializes the subnet manager (etcd or kube)\n- Starts the backend network\n- Manages traffic rules (iptables/nftables)\n\n**Backend System** (`pkg/backend/`):\nBackends are registered via init() and implement the network encapsulation layer:\n- `vxlan`: VXLAN encapsulation (recommended, default port 8472)\n- `host-gw`: Direct IP routes via layer 2\n- `wireguard`: WireGuard encrypted tunnels\n- `ipsec`: IPsec encrypted tunnels with strongSwan\n- `udp`: Simple UDP encapsulation (debug only)\n- `ipip`: IP-in-IP encapsulation\n- `tencentvpc`: Tencent Cloud VPC integration\n- `alloc`: Experimental allocation-only backend\n- `extension`: External backend plugin support\n\nBackends are imported with blank identifier in main.go to trigger registration:\n```go\n_ \"github.com/flannel-io/flannel/pkg/backend/vxlan\"\n```\n\n**Subnet Managers** (`pkg/subnet/`):\nTwo implementations for storing/retrieving network configuration:\n- `etcd`: Uses etcd v3 as datastore (standalone deployments)\n- `kube`: Uses Kubernetes API as datastore (kube subnet manager mode, no separate etcd needed)\n\n**Traffic Management** (`pkg/trafficmngr/`):\nManages forwarding rules and masquerading using either iptables or nftables.\n\n### Package Structure\n\n- `pkg/ip`: IP address utilities and subnet operations\n- `pkg/ipmatch`: IP address matching and selection (interface selection logic)\n- `pkg/lease`: Subnet lease management\n- `pkg/routing`: Route table management\n- `pkg/ns`: Network namespace utilities\n- `pkg/version`: Version information\n\n### Build Architecture\n\n**CGO_ENABLED**: Set to 1 for amd64 (enables UDP backend), 0 for other architectures.\n\n**Cross-compilation**: Uses Docker with golang:1.25 image and qemu-user-static for cross-arch builds.\n\n**Version embedding**: Git tag/commit is embedded via ldflags:\n```\n-ldflags '-X github.com/flannel-io/flannel/pkg/version.Version=$(TAG)'\n```\n\n### Testing Strategy\n\n**Unit tests**: Run in Docker with NET_ADMIN and SYS_ADMIN capabilities to test network operations and namespace creation.\n\n**E2E tests**: Two suites. The kind-based suite (`make kind-e2e-test`) is a native Ginkgo v2 + Gomega suite in `e2e/` (build tag `e2e`) that drives a kind cluster via the `sigs.k8s.io/kind` library and Kubernetes via client-go. The etcd/docker functional suite (`make e2e-test`) still uses the bash_unit framework (`dist/functional-test.sh`, `dist/functional-test-k8s.sh`).\n\n**Functional tests**: Located in `dist/functional-test.sh` and `dist/functional-test-k8s.sh`.\n\n## Key Configuration\n\n**Go version**: 1.25 (see Makefile GO_VERSION)\n\n**Supported architectures**: amd64, arm, arm64, s390x, ppc64le, riscv64\n\n**Container registry**: quay.io/coreos/flannel (override with REGISTRY env var)\n\n**Default test packages**: \n```\npkg/ip pkg/subnet pkg/subnet/etcd pkg/subnet/kube pkg/trafficmngr pkg/backend\n```\n\n## Release Process\n\nSee `Documentation/building.md` for full details. Key steps:\n\n1. Create and push a git tag\n2. Run `make release` to build all architectures\n3. Run `make release-manifest` to generate kube-flannel.yml\n4. Run `make release-helm` to package Helm chart\n5. Upload artifacts from `dist/` to GitHub release\n\n## Debugging\n\n**Interface selection**: Flannel selects interfaces via `-iface`, `-iface-regex`, or `-iface-can-reach` flags. Logic in `pkg/ipmatch`.\n\n**Backend issues**: Check backend-specific documentation in `Documentation/backends.md`.\n\n**Subnet conflicts**: Network configuration stored in etcd or Kubernetes configmap/node annotations (depending on subnet manager).\n"},"files":{"CLAUDE.md":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nFlannel is a network fabric for Kubernetes that provides layer 3 IPv4 networking between nodes in a cluster. The main binary is `flanneld`, which runs on each host and allocates subnet leases from a larger preconfigured address space.\n\n## Development Commands\n\n### Building\n\nBuild for amd64 (in Docker container):\n```bash\nmake dist/flanneld-amd64\n```\n\nBuild for specific architecture:\n```bash\nARCH=arm64 make dist/flanneld-arm64\nARCH=s390x make dist/flanneld-s390x\n```\n\nBuild multi-arch image:\n```bash\nmake buildx-create-builder  # One-time setup\nmake build-multi-arch\n```\n\nBuild natively (requires CGO for amd64):\n```bash\nCGO_ENABLED=1 make dist/flanneld\n```\n\n### Testing\n\nRun all tests (includes license check, gofmt, unit tests, e2e tests):\n```bash\nmake test\n```\n\nRun unit tests only:\n```bash\nmake unit-test\n```\n\nRun e2e tests:\n```bash\nmake e2e-test\n```\n\nRun tests for specific packages:\n```bash\nTEST_PACKAGES=\"pkg/ip pkg/subnet\" make unit-test\n```\n\nCheck formatting:\n```bash\nmake gofmt\n```\n\nVerify go modules:\n```bash\nmake verify-modules\n```\n\nUpdate dependencies:\n```bash\nmake deps  # runs go mod tidy && go mod vendor\n```\n\n### Local Development\n\nInstall binary locally (for quick iteration):\n```bash\nmake install\n```\n\n## Architecture\n\n### Core Components\n\n**main.go**: Entry point that:\n- Parses command-line flags (etcd endpoints, kube config, interface selection, etc.)\n- Initializes the subnet manager (etcd or kube)\n- Starts the backend network\n- Manages traffic rules (iptables/nftables)\n\n**Backend System** (`pkg/backend/`):\nBackends are registered via init() and implement the network encapsulation layer:\n- `vxlan`: VXLAN encapsulation (recommended, default port 8472)\n- `host-gw`: Direct IP routes via layer 2\n- `wireguard`: WireGuard encrypted tunnels\n- `ipsec`: IPsec encrypted tunnels with strongSwan\n- `udp`: Simple UDP encapsulation (debug only)\n- `ipip`: IP-in-IP encapsulation\n- `tencentvpc`: Tencent Cloud VPC integration\n- `alloc`: Experimental allocation-only backend\n- `extension`: External backend plugin support\n\nBackends are imported with blank identifier in main.go to trigger registration:\n```go\n_ \"github.com/flannel-io/flannel/pkg/backend/vxlan\"\n```\n\n**Subnet Managers** (`pkg/subnet/`):\nTwo implementations for storing/retrieving network configuration:\n- `etcd`: Uses etcd v3 as datastore (standalone deployments)\n- `kube`: Uses Kubernetes API as datastore (kube subnet manager mode, no separate etcd needed)\n\n**Traffic Management** (`pkg/trafficmngr/`):\nManages forwarding rules and masquerading using either iptables or nftables.\n\n### Package Structure\n\n- `pkg/ip`: IP address utilities and subnet operations\n- `pkg/ipmatch`: IP address matching and selection (interface selection logic)\n- `pkg/lease`: Subnet lease management\n- `pkg/routing`: Route table management\n- `pkg/ns`: Network namespace utilities\n- `pkg/version`: Version information\n\n### Build Architecture\n\n**CGO_ENABLED**: Set to 1 for amd64 (enables UDP backend), 0 for other architectures.\n\n**Cross-compilation**: Uses Docker with golang:1.25 image and qemu-user-static for cross-arch builds.\n\n**Version embedding**: Git tag/commit is embedded via ldflags:\n```\n-ldflags '-X github.com/flannel-io/flannel/pkg/version.Version=$(TAG)'\n```\n\n### Testing Strategy\n\n**Unit tests**: Run in Docker with NET_ADMIN and SYS_ADMIN capabilities to test network operations and namespace creation.\n\n**E2E tests**: Two suites. The kind-based suite (`make kind-e2e-test`) is a native Ginkgo v2 + Gomega suite in `e2e/` (build tag `e2e`) that drives a kind cluster via the `sigs.k8s.io/kind` library and Kubernetes via client-go. The etcd/docker functional suite (`make e2e-test`) still uses the bash_unit framework (`dist/functional-test.sh`, `dist/functional-test-k8s.sh`).\n\n**Functional tests**: Located in `dist/functional-test.sh` and `dist/functional-test-k8s.sh`.\n\n## Key Configuration\n\n**Go version**: 1.25 (see Makefile GO_VERSION)\n\n**Supported architectures**: amd64, arm, arm64, s390x, ppc64le, riscv64\n\n**Container registry**: quay.io/coreos/flannel (override with REGISTRY env var)\n\n**Default test packages**: \n```\npkg/ip pkg/subnet pkg/subnet/etcd pkg/subnet/kube pkg/trafficmngr pkg/backend\n```\n\n## Release Process\n\nSee `Documentation/building.md` for full details. Key steps:\n\n1. Create and push a git tag\n2. Run `make release` to build all architectures\n3. Run `make release-manifest` to generate kube-flannel.yml\n4. Run `make release-helm` to package Helm chart\n5. Upload artifacts from `dist/` to GitHub release\n\n## Debugging\n\n**Interface selection**: Flannel selects interfaces via `-iface`, `-iface-regex`, or `-iface-can-reach` flags. Logic in `pkg/ipmatch`.\n\n**Backend issues**: Check backend-specific documentation in `Documentation/backends.md`.\n\n**Subnet conflicts**: Network configuration stored in etcd or Kubernetes configmap/node annotations (depending on subnet manager).\n"},"items":[{"name":"CLAUDE.md","path":"CLAUDE.md","title":"CLAUDE.md","content":"# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## Project Overview\n\nFlannel is a network fabric for Kubernetes that provides layer 3 IPv4 networking between nodes in a cluster. The main binary is `flanneld`, which runs on each host and allocates subnet leases from a larger preconfigured address space.\n\n## Development Commands\n\n### Building\n\nBuild for amd64 (in Docker container):\n```bash\nmake dist/flanneld-amd64\n```\n\nBuild for specific architecture:\n```bash\nARCH=arm64 make dist/flanneld-arm64\nARCH=s390x make dist/flanneld-s390x\n```\n\nBuild multi-arch image:\n```bash\nmake buildx-create-builder  # One-time setup\nmake build-multi-arch\n```\n\nBuild natively (requires CGO for amd64):\n```bash\nCGO_ENABLED=1 make dist/flanneld\n```\n\n### Testing\n\nRun all tests (includes license check, gofmt, unit tests, e2e tests):\n```bash\nmake test\n```\n\nRun unit tests only:\n```bash\nmake unit-test\n```\n\nRun e2e tests:\n```bash\nmake e2e-test\n```\n\nRun tests for specific packages:\n```bash\nTEST_PACKAGES=\"pkg/ip pkg/subnet\" make unit-test\n```\n\nCheck formatting:\n```bash\nmake gofmt\n```\n\nVerify go modules:\n```bash\nmake verify-modules\n```\n\nUpdate dependencies:\n```bash\nmake deps  # runs go mod tidy && go mod vendor\n```\n\n### Local Development\n\nInstall binary locally (for quick iteration):\n```bash\nmake install\n```\n\n## Architecture\n\n### Core Components\n\n**main.go**: Entry point that:\n- Parses command-line flags (etcd endpoints, kube config, interface selection, etc.)\n- Initializes the subnet manager (etcd or kube)\n- Starts the backend network\n- Manages traffic rules (iptables/nftables)\n\n**Backend System** (`pkg/backend/`):\nBackends are registered via init() and implement the network encapsulation layer:\n- `vxlan`: VXLAN encapsulation (recommended, default port 8472)\n- `host-gw`: Direct IP routes via layer 2\n- `wireguard`: WireGuard encrypted tunnels\n- `ipsec`: IPsec encrypted tunnels with strongSwan\n- `udp`: Simple UDP encapsulation (debug only)\n- `ipip`: IP-in-IP encapsulation\n- `tencentvpc`: Tencent Cloud VPC integration\n- `alloc`: Experimental allocation-only backend\n- `extension`: External backend plugin support\n\nBackends are imported with blank identifier in main.go to trigger registration:\n```go\n_ \"github.com/flannel-io/flannel/pkg/backend/vxlan\"\n```\n\n**Subnet Managers** (`pkg/subnet/`):\nTwo implementations for storing/retrieving network configuration:\n- `etcd`: Uses etcd v3 as datastore (standalone deployments)\n- `kube`: Uses Kubernetes API as datastore (kube subnet manager mode, no separate etcd needed)\n\n**Traffic Management** (`pkg/trafficmngr/`):\nManages forwarding rules and masquerading using either iptables or nftables.\n\n### Package Structure\n\n- `pkg/ip`: IP address utilities and subnet operations\n- `pkg/ipmatch`: IP address matching and selection (interface selection logic)\n- `pkg/lease`: Subnet lease management\n- `pkg/routing`: Route table management\n- `pkg/ns`: Network namespace utilities\n- `pkg/version`: Version information\n\n### Build Architecture\n\n**CGO_ENABLED**: Set to 1 for amd64 (enables UDP backend), 0 for other architectures.\n\n**Cross-compilation**: Uses Docker with golang:1.25 image and qemu-user-static for cross-arch builds.\n\n**Version embedding**: Git tag/commit is embedded via ldflags:\n```\n-ldflags '-X github.com/flannel-io/flannel/pkg/version.Version=$(TAG)'\n```\n\n### Testing Strategy\n\n**Unit tests**: Run in Docker with NET_ADMIN and SYS_ADMIN capabilities to test network operations and namespace creation.\n\n**E2E tests**: Two suites. The kind-based suite (`make kind-e2e-test`) is a native Ginkgo v2 + Gomega suite in `e2e/` (build tag `e2e`) that drives a kind cluster via the `sigs.k8s.io/kind` library and Kubernetes via client-go. The etcd/docker functional suite (`make e2e-test`) still uses the bash_unit framework (`dist/functional-test.sh`, `dist/functional-test-k8s.sh`).\n\n**Functional tests**: Located in `dist/functional-test.sh` and `dist/functional-test-k8s.sh`.\n\n## Key Configuration\n\n**Go version**: 1.25 (see Makefile GO_VERSION)\n\n**Supported architectures**: amd64, arm, arm64, s390x, ppc64le, riscv64\n\n**Container registry**: quay.io/coreos/flannel (override with REGISTRY env var)\n\n**Default test packages**: \n```\npkg/ip pkg/subnet pkg/subnet/etcd pkg/subnet/kube pkg/trafficmngr pkg/backend\n```\n\n## Release Process\n\nSee `Documentation/building.md` for full details. Key steps:\n\n1. Create and push a git tag\n2. Run `make release` to build all architectures\n3. Run `make release-manifest` to generate kube-flannel.yml\n4. Run `make release-helm` to package Helm chart\n5. Upload artifacts from `dist/` to GitHub release\n\n## Debugging\n\n**Interface selection**: Flannel selects interfaces via `-iface`, `-iface-regex`, or `-iface-can-reach` flags. Logic in `pkg/ipmatch`.\n\n**Backend issues**: Check backend-specific documentation in `Documentation/backends.md`.\n\n**Subnet conflicts**: Network configuration stored in etcd or Kubernetes configmap/node annotations (depending on subnet manager).\n","category":"root","tokens":1256}]}