mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-30 04:06:34 +09:00
feat(cozyplane): vendor the eBPF CNI chart
packages/system/cozyplane vendors chart/cozyplane from lllamnyp/cozyplane (ref-pinned; make update re-vendors and re-applies the Cozystack-side Chart.yaml version stanza). The CNI slot installs before everything else, so its dependency floor is the kube API alone: the chart ships only the LOCAL group's CRDs (local.sdn.cozystack.io, underlay IPAM) — the tenant kinds are served by the aggregated apiserver, packaged separately. On Talos the agent and resolver bootstrap against KubePrism (localhost:7445), because with no kube-proxy the kubernetes.default ClusterIP is unserved until cozyplane-kpr runs, and kpr needs the agent. The helm-unittest suite pins exactly that platform contract: the KubePrism endpoint, the 00- conflist precedence over a co-installed CNI, and the LOCAL-group-only CRDs. Assisted-by: LLM Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
This commit is contained in:
1 parent
d88322197f
commit
28d54a2591
13 files changed
+1102
No files matched your search
@@ -0,0 +1,8 @@
|
||||
.DS_Store
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
.git
|
||||
.gitignore
|
||||
tests/
|
||||
@@ -0,0 +1,17 @@
|
||||
apiVersion: v2
|
||||
name: cozyplane
|
||||
description: Multi-tenant eBPF CNI for Cozystack — flat default network plus VPC tenancy
|
||||
type: application
|
||||
# Placeholder; the real version is stamped by the build/release pipeline.
|
||||
version: 0.3.29
|
||||
appVersion: "0.1.0"
|
||||
kubeVersion: ">=1.30.0-0"
|
||||
keywords:
|
||||
- cni
|
||||
- networking
|
||||
- ebpf
|
||||
- cozystack
|
||||
- vpc
|
||||
home: https://github.com/lllamnyp/cozyplane
|
||||
sources:
|
||||
- https://github.com/lllamnyp/cozyplane
|
||||
@@ -0,0 +1,27 @@
|
||||
export NAME=cozyplane
|
||||
export NAMESPACE=cozy-$(NAME)
|
||||
|
||||
include ../../../hack/common-envs.mk
|
||||
include ../../../hack/package.mk
|
||||
|
||||
# cozyplane builds and publishes its own container image from
|
||||
# github.com/lllamnyp/cozyplane; this package only vendors the Helm chart (kept
|
||||
# in that repo's chart/cozyplane) and references the published image in
|
||||
# values.yaml. There is no image build target here.
|
||||
|
||||
test:
|
||||
helm lint .
|
||||
helm unittest .
|
||||
|
||||
# The vendoring ref in lllamnyp/cozyplane (a release tag once upstream cuts
|
||||
# them; keep the three cozyplane packages on the same ref). Makefile and
|
||||
# tests/ are Cozystack-side and survive the vendor, and so does the version
|
||||
# stanza below: Cozystack owns the chart version, upstream keeps 0.0.0.
|
||||
COZYPLANE_REF=65bade1c310c739edcf230af0a274086b1ac72f9
|
||||
CHART_VERSION=0.3.29
|
||||
|
||||
update:
|
||||
find . -mindepth 1 -maxdepth 1 ! -name Makefile ! -name tests -exec rm -rf {} +
|
||||
curl -sSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \
|
||||
tar -xzf - --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane
|
||||
sed -i -e '/# Unused as a release coordinate/,/^version: 0.0.0/c\# Placeholder; the real version is stamped by the build/release pipeline.\nversion: $(CHART_VERSION)' Chart.yaml
|
||||
@@ -0,0 +1,74 @@
|
||||
# cozyplane Helm chart
|
||||
|
||||
Packages cozyplane — a multi-tenant eBPF CNI (flat default network + VPC
|
||||
tenancy + VPC peering) — as the node agent DaemonSet, the controller
|
||||
Deployment, the `local.sdn.cozystack.io` CRDs (underlay IPAM), RBAC, and the
|
||||
VPCBinding `export` admission policy. The tenant API is not here: the
|
||||
`sdn.cozystack.io` group is served only by the separate
|
||||
[cozyplane-apiserver](../cozyplane-apiserver) chart.
|
||||
|
||||
cozyplane is the **primary CNI**. Install it on a cluster with no other CNI
|
||||
(or in place of one being removed), and keep a Service implementation — stock
|
||||
kube-proxy or Cilium in kube-proxy-replacement mode — alongside it. See
|
||||
[../../docs/user-guide.md](../../docs/user-guide.md) for the full deployment and
|
||||
usage walkthrough and [../../docs/control-plane.md](../../docs/control-plane.md)
|
||||
for the tenancy model.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Kubernetes >= 1.30 (the `export` ValidatingAdmissionPolicy; set
|
||||
`exportPolicy.enabled=false` for older clusters).
|
||||
- A Linux kernel with BTF (`/sys/kernel/btf/vmlinux`), 5.10+.
|
||||
- No per-node `spec.podCIDR` requirement: the fabric pool is flat and cluster-wide
|
||||
(`--cluster-cidr`), so cozyplane works with or without the node-ipam controller.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
helm install cozyplane ./chart/cozyplane --namespace cozy-cozyplane --create-namespace
|
||||
```
|
||||
|
||||
This chart installs the CNI and the `local.sdn.cozystack.io` group
|
||||
(`FabricIP` — underlay IPAM, which has to work before cert-manager, etcd and
|
||||
cozyplane's own apiserver, all of which are default-network pods).
|
||||
|
||||
The tenant kinds — `VPC`, `Port`, `SecurityGroup`, `HostFirewall` and the rest of
|
||||
`sdn.cozystack.io` — have no CRDs and are served only by
|
||||
[cozyplane-apiserver](../cozyplane-apiserver), so install that chart too for
|
||||
tenancy. The two groups are deliberately separate: serving one group through
|
||||
both a CRD and an APIService collides the kube-apiserver's OpenAPI merge, after
|
||||
which `kubectl apply` fails for every object in the group. See
|
||||
[docs/api-groups.md](../../docs/api-groups.md).
|
||||
|
||||
## Configuration
|
||||
|
||||
All knobs are documented inline in [`values.yaml`](values.yaml). The ones you are
|
||||
most likely to set:
|
||||
|
||||
- `image` — the cozyplane container image (digest-pinned by the release
|
||||
pipeline).
|
||||
- `mtu` — pod MTU (underlay MTU minus ~50 bytes of Geneve overhead).
|
||||
- `cniConfName` — the CNI conflist filename; use a low prefix such as
|
||||
`00-cozyplane.conflist` to sort ahead of a co-installed CNI (e.g. Cilium).
|
||||
- `genevePort` — override only to avoid a clash with another overlay on 6081.
|
||||
- `exportPolicy.enabled` — the VPCBinding export admission gate (needs k8s 1.30+).
|
||||
- `crds.enabled` — the `local.sdn.cozystack.io` CRDs (default true; disable
|
||||
only if you install them out-of-band). It does not affect the tenant group,
|
||||
which has no CRDs.
|
||||
- `egress.*` — cluster networking facts (pod/service CIDRs, cluster DNS) that
|
||||
drive node masquerade and the pool-less per-VPC egress gateway pod (a
|
||||
`VPCGateway` *with* a pool needs none -- its NAT is eBPF); add node/management networks to
|
||||
`egress.internalCIDRs`.
|
||||
|
||||
## What gets installed
|
||||
|
||||
- `cozyplane-agent` (DaemonSet, hostNetwork + privileged): the datapath manager
|
||||
and CNI binary installer, one per node.
|
||||
- `cozyplane-controller` (Deployment): assigns VNIs, reaps Ports on VPCBinding
|
||||
revocation, and maintains VPCPeering status.
|
||||
- The `local.sdn.cozystack.io` CRDs: `fabricips`. The tenant kinds
|
||||
(`vpcs`, `ports`, `securitygroups`, …) are served by
|
||||
[cozyplane-apiserver](../cozyplane-apiserver), not by this chart.
|
||||
- RBAC for both components, the aggregated tenant roles (`cozyplane-tenant-edit` /
|
||||
`-view`, docs/multitenancy.md), and the export
|
||||
ValidatingAdmissionPolicy.
|
||||
@@ -0,0 +1,15 @@
|
||||
{{/* Common metadata labels (not used as selectors — selectors stay stable). */}}
|
||||
{{- define "cozyplane.labels" -}}
|
||||
app.kubernetes.io/name: cozyplane
|
||||
app.kubernetes.io/part-of: cozyplane
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
helm.sh/chart: {{ printf "cozyplane-%s" .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end -}}
|
||||
|
||||
{{/* imagePullSecrets block, rendered only when set. Call with the root context. */}}
|
||||
{{- define "cozyplane.imagePullSecrets" -}}
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,274 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: cozyplane-agent
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cozyplane-agent
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
rules:
|
||||
# The agent learns remote pod CIDRs + addresses from Node objects, and patches
|
||||
# its own Node to advertise the address host traffic sources from (node_remotes).
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes"]
|
||||
verbs: ["get", "list", "watch", "patch"]
|
||||
# The plugin (using this SA) reads pod annotations to resolve VPC membership,
|
||||
# the agent reads pods to distinguish revocation from ordinary teardown, and
|
||||
# the NetworkPolicy compiler watches them for identities/membership
|
||||
# (docs/network-policy.md).
|
||||
# `patch` on pods: the CNI stamps a VPC pod with the address and MAC it just
|
||||
# allocated (sdn.cozystack.io/vpc-ip / -mac). That is the ONLY way a tenant can
|
||||
# learn its own network identity — status.podIP is the fabric IP, and the real
|
||||
# address lives on the cluster-scoped Port, which no tenant may read
|
||||
# (docs/multitenancy.md R1/R2).
|
||||
- apiGroups: [""]
|
||||
resources: ["pods"]
|
||||
verbs: ["get", "list", "watch", "patch"]
|
||||
# Namespace labels resolve namespaceSelector peers; NetworkPolicies are the
|
||||
# net-0 policy source (docs/network-policy.md).
|
||||
- apiGroups: [""]
|
||||
resources: ["namespaces"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["networking.k8s.io"]
|
||||
resources: ["networkpolicies"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# Tenant network ids from VPC objects (namespaced; read across all namespaces).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcs"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# VPCBindings authorize attachment; the plugin checks them at CNI ADD
|
||||
# (default-deny).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcbindings"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# VPCGateways: a VPC with no gateway admits no LoadBalancer ingress — the
|
||||
# agent programs that gate into the datapath (docs/north-south.md, tenet 7).
|
||||
# The CNI plugin (same SA) also reads them to give a gateway pod its VPC leg.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcgateways"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# VPCPeering halves: the agent programs the peers map from mutually-matched
|
||||
# specs (not status), so it only needs to observe them.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcpeerings"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# Port claims (the plugin allocates/releases; the agent watches for remotes,
|
||||
# releases the sever finalizer on terminating Ports, and patches spec.node to
|
||||
# itself when a migrated guest announces on this node — stage-3 cutover).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["ports"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
||||
# SecurityGroups: the agent compiles their rules into the datapath sg_rules map.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["securitygroups"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# FabricIPs: the CNI plugin claims and releases underlay addresses through
|
||||
# this SA (the agent writes its kubeconfig), and the agent watches them.
|
||||
# deletecollection lets a failed ADD's rollback return the pod's claims in one
|
||||
# round trip; it reaches nothing the list+delete above could not.
|
||||
- apiGroups: ["local.sdn.cozystack.io"]
|
||||
resources: ["fabricips"]
|
||||
verbs: ["get", "list", "watch", "create", "delete", "deletecollection"]
|
||||
# HostFirewalls: the agent compiles the objects selecting its node into the
|
||||
# hf_allow map and arms enforcement (docs/host-firewall.md).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["hostfirewalls"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# FloatingIPs: the agent programs the floating map and advertises the address
|
||||
# for those whose target Port is on this node.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["floatingips"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# ServiceVIPs: the agent programs the svc_vips datapath map from them, the
|
||||
# resolver answers attached ClusterIP services with the VIP, and the CNI
|
||||
# plugin counts them as used addresses when claiming a Port IP.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["servicevips"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# The split-horizon resolver (responder container) answers headless Services
|
||||
# annotated into a VPC from their EndpointSlices; the agent reads the
|
||||
# kube-system/kube-dns Service to discover the cluster DNS address; and the
|
||||
# LB-uplink watcher ensures the datapath serves the link carrying every
|
||||
# status.loadBalancer.ingress address (docs/external-addresses.md §9).
|
||||
- apiGroups: [""]
|
||||
resources: ["services"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["discovery.k8s.io"]
|
||||
resources: ["endpointslices"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: cozyplane-agent
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cozyplane-agent
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: cozyplane-agent
|
||||
namespace: {{ .Release.Namespace }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: cozyplane-agent
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: cozyplane-agent
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cozyplane-agent
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cozyplane-agent
|
||||
spec:
|
||||
hostNetwork: true
|
||||
hostPID: true
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
serviceAccountName: cozyplane-agent
|
||||
priorityClassName: {{ .Values.agent.priorityClassName }}
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
terminationGracePeriodSeconds: 5
|
||||
{{- include "cozyplane.imagePullSecrets" . | nindent 6 }}
|
||||
initContainers:
|
||||
# Install the CNI binaries onto the host before the agent advertises CNI.
|
||||
- name: install-cni
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
command: ["/bin/sh", "-c"]
|
||||
args:
|
||||
- cp -f /opt/cni/bin/cozyplane /opt/cni/bin/host-local /opt/cni/bin/loopback /host/opt/cni/bin/
|
||||
volumeMounts:
|
||||
- name: cni-bin
|
||||
mountPath: /host/opt/cni/bin
|
||||
containers:
|
||||
- name: agent
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
args:
|
||||
- "--mtu={{ .Values.mtu }}"
|
||||
- "--geneve-port={{ .Values.genevePort }}"
|
||||
- "--cni-conf-name={{ .Values.cniConfName }}"
|
||||
{{- if .Values.egress.clusterCIDR }}
|
||||
# Cluster-egress masquerade: pod traffic leaving the cluster is
|
||||
# SNATed to the node address, giving pods an off-cluster return path.
|
||||
- "--cluster-cidr={{ .Values.egress.clusterCIDR }}"
|
||||
- "--masquerade={{ .Values.egress.masquerade | default "bpf" }}"
|
||||
{{- end }}
|
||||
{{- $internal := concat (list .Values.egress.clusterCIDR .Values.egress.serviceCIDR) .Values.egress.internalCIDRs | compact }}
|
||||
{{- if $internal }}
|
||||
# Cluster-internal CIDRs a floating pod's public-IP egress skips
|
||||
# (routed to the gateway instead, which proxies DNS / denies the rest).
|
||||
- "--internal-cidrs={{ join "," $internal }}"
|
||||
{{- end }}
|
||||
ports:
|
||||
# Per-VPC traffic metrics (#2), Prometheus text at /metrics.
|
||||
- name: metrics
|
||||
containerPort: 9411
|
||||
hostPort: 9411
|
||||
env:
|
||||
- name: NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
# Gateway-attach is honored only for pods in the agent's namespace.
|
||||
- name: AGENT_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
{{- if .Values.kubeApiServer.host }}
|
||||
# Reach the kube-apiserver directly (not via the kubernetes.default
|
||||
# ClusterIP): with no kube-proxy, that VIP is unserved until
|
||||
# cozyplane-kpr is up — which needs the agent — so the agent must
|
||||
# bootstrap against a real endpoint (Talos: KubePrism localhost:7445).
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.kubeApiServer.host | quote }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.kubeApiServer.port | quote }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
privileged: true
|
||||
resources:
|
||||
{{- toYaml .Values.agent.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: cni-conf
|
||||
mountPath: /etc/cni/net.d
|
||||
- name: bpffs
|
||||
mountPath: /sys/fs/bpf
|
||||
mountPropagation: Bidirectional
|
||||
- name: run
|
||||
mountPath: /run/cozyplane
|
||||
- name: cni-cache
|
||||
mountPath: /var/lib/cni
|
||||
# The split-horizon DNS resolver for VPC pods (docs/services-in-vpc.md).
|
||||
# Unprivileged: a DNS socket on the node address (reserved port 15353,
|
||||
# reached only via the datapath's steering) and informers.
|
||||
- name: responder
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
command: ["/usr/local/bin/cozyplane-responder"]
|
||||
env:
|
||||
- name: NODE_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
{{- if .Values.kubeApiServer.host }}
|
||||
- name: KUBERNETES_SERVICE_HOST
|
||||
value: {{ .Values.kubeApiServer.host | quote }}
|
||||
- name: KUBERNETES_SERVICE_PORT
|
||||
value: {{ .Values.kubeApiServer.port | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.clusterDomain }}
|
||||
# Explicit override; unset, the resolver autodetects the domain
|
||||
# from its own kubelet-written search path.
|
||||
- name: CLUSTER_DOMAIN
|
||||
value: {{ .Values.clusterDomain | quote }}
|
||||
{{- end }}
|
||||
# Forward external names to the node's own upstreams, not the
|
||||
# cluster DNS the pod-level dnsPolicy would hand us.
|
||||
- name: RESOLV_CONF
|
||||
value: /host/etc/resolv.conf
|
||||
volumeMounts:
|
||||
- name: host-resolv
|
||||
mountPath: /host/etc/resolv.conf
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: cni-bin
|
||||
hostPath:
|
||||
path: /opt/cni/bin
|
||||
type: DirectoryOrCreate
|
||||
- name: cni-conf
|
||||
hostPath:
|
||||
path: /etc/cni/net.d
|
||||
type: DirectoryOrCreate
|
||||
- name: bpffs
|
||||
hostPath:
|
||||
path: /sys/fs/bpf
|
||||
type: Directory
|
||||
- name: run
|
||||
hostPath:
|
||||
path: /run/cozyplane
|
||||
type: DirectoryOrCreate
|
||||
- name: cni-cache
|
||||
hostPath:
|
||||
path: /var/lib/cni
|
||||
type: DirectoryOrCreate
|
||||
- name: host-resolv
|
||||
hostPath:
|
||||
path: /etc/resolv.conf
|
||||
type: File
|
||||
@@ -0,0 +1,94 @@
|
||||
{{- if .Values.exportPolicy.enabled }}
|
||||
# Gate VPCBinding creation on the 'export' verb of the referenced VPC. This is
|
||||
# the escalation gate that stops a tenant binding to a VPC it doesn't own (see
|
||||
# docs/control-plane.md §6). The 'export' check is only required when vpcRef is
|
||||
# set or changed, so the controller's finalizer writes are not blocked.
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingAdmissionPolicy
|
||||
metadata:
|
||||
name: cozyplane-vpcbinding-export
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
spec:
|
||||
failurePolicy: Fail
|
||||
matchConstraints:
|
||||
resourceRules:
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
apiVersions: ["v1alpha1"]
|
||||
operations: ["CREATE", "UPDATE"]
|
||||
resources: ["vpcbindings"]
|
||||
variables:
|
||||
- name: ref
|
||||
expression: object.spec.vpcRef
|
||||
- name: refUnchanged
|
||||
expression: >-
|
||||
oldObject != null &&
|
||||
oldObject.spec.vpcRef.namespace == object.spec.vpcRef.namespace &&
|
||||
oldObject.spec.vpcRef.name == object.spec.vpcRef.name
|
||||
validations:
|
||||
- expression: >-
|
||||
variables.refUnchanged ||
|
||||
authorizer.group('sdn.cozystack.io').resource('vpcs')
|
||||
.namespace(variables.ref.namespace).name(variables.ref.name)
|
||||
.check('export').allowed()
|
||||
reason: Forbidden
|
||||
messageExpression: >-
|
||||
"creating a VPCBinding to VPC " + variables.ref.namespace + "/" +
|
||||
variables.ref.name + " requires the 'export' verb on that VPC " +
|
||||
"(sdn.cozystack.io vpcs)"
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingAdmissionPolicyBinding
|
||||
metadata:
|
||||
name: cozyplane-vpcbinding-export
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
spec:
|
||||
policyName: cozyplane-vpcbinding-export
|
||||
validationActions: ["Deny"]
|
||||
---
|
||||
# Gate VPCPeering creation on the 'peer' verb of the LOCAL VPC (see
|
||||
# deploy/authz.yaml for the full rationale). Aggregated-apiserver mode enforces
|
||||
# the same check in the vpcpeering create strategy.
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingAdmissionPolicy
|
||||
metadata:
|
||||
name: cozyplane-vpcpeering-peer
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
spec:
|
||||
failurePolicy: Fail
|
||||
matchConstraints:
|
||||
resourceRules:
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
apiVersions: ["v1alpha1"]
|
||||
operations: ["CREATE", "UPDATE"]
|
||||
resources: ["vpcpeerings"]
|
||||
variables:
|
||||
- name: refUnchanged
|
||||
expression: >-
|
||||
oldObject != null &&
|
||||
oldObject.spec.vpcRef.name == object.spec.vpcRef.name
|
||||
validations:
|
||||
- expression: >-
|
||||
variables.refUnchanged ||
|
||||
authorizer.group('sdn.cozystack.io').resource('vpcs')
|
||||
.namespace(object.metadata.namespace).name(object.spec.vpcRef.name)
|
||||
.check('peer').allowed()
|
||||
reason: Forbidden
|
||||
messageExpression: >-
|
||||
"creating a VPCPeering for VPC " + object.metadata.namespace + "/" +
|
||||
object.spec.vpcRef.name + " requires the 'peer' verb on that VPC " +
|
||||
"(sdn.cozystack.io vpcs)"
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingAdmissionPolicyBinding
|
||||
metadata:
|
||||
name: cozyplane-vpcpeering-peer
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
spec:
|
||||
policyName: cozyplane-vpcpeering-peer
|
||||
validationActions: ["Deny"]
|
||||
{{- end }}
|
||||
---
|
||||
@@ -0,0 +1,215 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: cozyplane-controller
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cozyplane-controller
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcs"]
|
||||
verbs: ["get", "list", "watch", "update", "patch"]
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcs/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
# VPCBindings: maintain the reap finalizer and reap Ports on revocation.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcbindings"]
|
||||
verbs: ["get", "list", "watch", "update", "patch"]
|
||||
# Ports: reap on revocation; PortGC releases the sever finalizer when the
|
||||
# port's node is gone (needs nodes read).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["ports"]
|
||||
verbs: ["get", "list", "watch", "update", "patch", "delete"]
|
||||
# Port membership (SecurityGroup resolution) is written to ports/status.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["ports/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
# SecurityGroups: id allocation (status) + selector evaluation.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["securitygroups"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["securitygroups/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# VPCGateways: a VPC's north-south boundary (docs/north-south.md). The
|
||||
# controller owns their status (VPC resolution, one-per-VPC, NAT identity from
|
||||
# owned Services) and reads them to decide whether to realize the gateway pod.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcgateways"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcgateways/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
# VPCPeerings: surface matched/ready in status (observability only; the
|
||||
# agents key the datapath on the halves' specs).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcpeerings"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcpeerings/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
# FloatingIPs: own the delegated LoadBalancer Service that sources the address
|
||||
# and gate readiness on a live target Port (docs/external-addresses.md).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["floatingips"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["floatingips/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
# ServiceVIPs: materialize one per attached Service, allocate the VIP,
|
||||
# resolve backends from Services/EndpointSlices (services-in-vpc.md).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["servicevips"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "delete"]
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["servicevips/status"]
|
||||
verbs: ["get", "update", "patch"]
|
||||
# Services: read for ServiceVIP backend resolution; write for the FloatingIP's
|
||||
# owned LoadBalancer Service (its allocation+attraction vehicle, external-addresses.md).
|
||||
- apiGroups: [""]
|
||||
resources: ["services"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
||||
# EndpointSlices: read for ServiceVIP backend resolution; write for the one
|
||||
# cozyplane synthesizes to make the LB implementation advertise a FloatingIP's
|
||||
# address (MetalLB advertises only a Service with a ready endpoint).
|
||||
- apiGroups: ["discovery.k8s.io"]
|
||||
resources: ["endpointslices"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
||||
# VirtualMachineInstances: the migration controller reads status.nodeName /
|
||||
# status.migrationState as the cutover signal (the Kube-OVN model). Optional —
|
||||
# only present when KubeVirt is installed; the controller degrades to the
|
||||
# launcher-pod signal without it.
|
||||
- apiGroups: ["kubevirt.io"]
|
||||
resources: ["virtualmachineinstances"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# Gateway Deployments for a VPCGateway family with no eBPF identity yet
|
||||
# (one with addresses for every family is pure eBPF — docs/north-south.md §6a).
|
||||
# Read-only cluster-wide because the manager's informer cache is not namespace
|
||||
# scoped (cmd/sdn-controller: plain ctrl.NewManager), so the Deployment watch
|
||||
# is a cluster-wide LIST/WATCH. The write verbs are a Role in the release
|
||||
# namespace instead — the only namespace a gateway Deployment is ever created
|
||||
# in (gateway_controller.go builds them with Namespace: r.Config.Namespace,
|
||||
# and POD_NAMESPACE is what the chart passes).
|
||||
- apiGroups: ["apps"]
|
||||
resources: ["deployments"]
|
||||
verbs: ["get", "list", "watch"]
|
||||
# Severed-gateway heal: recreate a Ready gateway pod whose .1 Port is gone.
|
||||
# watch: the persistent-Port controller watches virt-launcher pods to drive
|
||||
# live-migration cutover (kubevirt.io/nodeName) and GC.
|
||||
- apiGroups: [""]
|
||||
resources: ["pods"]
|
||||
verbs: ["get", "list", "watch", "delete"]
|
||||
# FabricIPs: the controller reclaims an underlay address whose pod is gone —
|
||||
# the GC the host-local file store never had.
|
||||
- apiGroups: ["local.sdn.cozystack.io"]
|
||||
resources: ["fabricips"]
|
||||
verbs: ["get", "list", "watch", "delete"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: cozyplane-controller
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: cozyplane-controller
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: cozyplane-controller
|
||||
namespace: {{ .Release.Namespace }}
|
||||
---
|
||||
# Writing gateway Deployments, scoped to this namespace. Cluster-wide
|
||||
# create/update/delete on Deployments would let a compromised controller replace
|
||||
# any workload in the cluster, and it never needs to: it only ever realizes them
|
||||
# here.
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: cozyplane-controller-gateways
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
rules:
|
||||
- apiGroups: ["apps"]
|
||||
resources: ["deployments"]
|
||||
verbs: ["create", "update", "delete"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: cozyplane-controller-gateways
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: cozyplane-controller-gateways
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: cozyplane-controller
|
||||
namespace: {{ .Release.Namespace }}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: cozyplane-controller
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
app: cozyplane-controller
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.controller.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: cozyplane-controller
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: cozyplane-controller
|
||||
spec:
|
||||
serviceAccountName: cozyplane-controller
|
||||
priorityClassName: {{ .Values.controller.priorityClassName }}
|
||||
{{- include "cozyplane.imagePullSecrets" . | nindent 6 }}
|
||||
containers:
|
||||
- name: controller
|
||||
image: {{ .Values.image }}
|
||||
imagePullPolicy: {{ .Values.imagePullPolicy }}
|
||||
command: ["/usr/local/bin/sdn-controller"]
|
||||
args:
|
||||
- --leader-elect=false
|
||||
- --metrics-bind-address=0
|
||||
- --health-probe-bind-address=:8081
|
||||
{{- if .Values.egress.clusterCIDR }}
|
||||
- --gateway-image={{ .Values.image }}
|
||||
- --internal-cidrs={{ concat (list .Values.egress.clusterCIDR .Values.egress.serviceCIDR) .Values.egress.internalCIDRs | compact | join "," }}
|
||||
{{- with .Values.egress.clusterDNS }}
|
||||
- --cluster-dns={{ . }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: POD_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
resources:
|
||||
{{- toYaml .Values.controller.resources | nindent 12 }}
|
||||
livenessProbe:
|
||||
httpGet: { path: /healthz, port: 8081 }
|
||||
initialDelaySeconds: 10
|
||||
readinessProbe:
|
||||
httpGet: { path: /readyz, port: 8081 }
|
||||
@@ -0,0 +1,107 @@
|
||||
{{- /* The CRDs of the LOCAL group (local.sdn.cozystack.io) — the layer whose
|
||||
dependency floor is the kube API and nothing else: underlay IPAM, which
|
||||
must work before cert-manager, before etcd, and before cozyplane's own
|
||||
aggregated apiserver (all of which are default-network pods).
|
||||
|
||||
The TENANT kinds (VPC, Port, SecurityGroup, HostFirewall, ...) are NOT
|
||||
here and never will be: they are served only by the aggregated apiserver
|
||||
(chart/cozyplane-apiserver). One group served by two mechanisms makes the
|
||||
kube-apiserver's OpenAPI merge collide on duplicated paths, and the
|
||||
group's schema then never serves — which breaks `kubectl apply` for every
|
||||
object in it while core types keep working. See docs/api-groups.md. */ -}}
|
||||
{{- if .Values.crds.enabled }}
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.19.0
|
||||
name: fabricips.local.sdn.cozystack.io
|
||||
spec:
|
||||
group: local.sdn.cozystack.io
|
||||
names:
|
||||
kind: FabricIP
|
||||
listKind: FabricIPList
|
||||
plural: fabricips
|
||||
shortNames:
|
||||
- fip
|
||||
singular: fabricip
|
||||
scope: Cluster
|
||||
versions:
|
||||
- additionalPrinterColumns:
|
||||
- jsonPath: .spec.address
|
||||
name: Address
|
||||
type: string
|
||||
- jsonPath: .spec.node
|
||||
name: Node
|
||||
type: string
|
||||
- jsonPath: .spec.podName
|
||||
name: Pod
|
||||
type: string
|
||||
- jsonPath: .metadata.creationTimestamp
|
||||
name: Age
|
||||
type: date
|
||||
name: v1alpha1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: |-
|
||||
FabricIP is a claim on one underlay address — the cluster-wide, API-backed
|
||||
replacement for the `host-local` IPAM plugin's per-node file store
|
||||
(docs/api-groups.md).
|
||||
|
||||
The file store it replaces is released only by a CNI DEL, so a pod that
|
||||
disappears while kubelet is down leaks its address across the reboot, with no
|
||||
GC and no way to tell a live reservation from a ghost. A FabricIP is an
|
||||
object: the controller reaps it when its pod is gone, `kubectl get fabricips`
|
||||
shows who holds what, and the claim is atomic because the name IS the address.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: |-
|
||||
APIVersion defines the versioned schema of this representation of an object.
|
||||
Servers should convert recognized schemas to the latest internal value, and
|
||||
may reject unrecognized values.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
||||
type: string
|
||||
kind:
|
||||
description: |-
|
||||
Kind is a string value representing the REST resource this object represents.
|
||||
Servers may infer this from the endpoint the client submits requests to.
|
||||
Cannot be updated.
|
||||
In CamelCase.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: FabricIPSpec records who holds an underlay address.
|
||||
properties:
|
||||
address:
|
||||
description: |-
|
||||
Address is the canonical address this object claims (the name is its
|
||||
escaped form). This is the underlay identity of a pod: `status.podIP` for
|
||||
a default-network pod, and the fabric handle of a VPC pod.
|
||||
type: string
|
||||
node:
|
||||
description: |-
|
||||
Node is the node the claiming pod runs on. Informational for a flat pool
|
||||
(delivery keys on the address, not the node), but it is what makes a
|
||||
stranded address diagnosable.
|
||||
type: string
|
||||
podName:
|
||||
type: string
|
||||
podNamespace:
|
||||
description: |-
|
||||
PodNamespace, PodName and PodUID identify the claimant. The UID is the
|
||||
load-bearing one: GC keys on it, so a pod that reuses a name can never
|
||||
have its address reaped by the previous occupant's DEL.
|
||||
type: string
|
||||
podUID:
|
||||
type: string
|
||||
required:
|
||||
- address
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources: {}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
# The TENANT persona (docs/multitenancy.md).
|
||||
#
|
||||
# R2 ("a tenant enumerates nothing it does not own") is satisfied STRUCTURALLY, not
|
||||
# by vigilance: these roles list only NAMESPACED kinds, and a RoleBinding cannot
|
||||
# grant access to a cluster-scoped resource. So a tenant bound to these in its own
|
||||
# namespace *cannot* be given `list ports`, `list servicevips` or
|
||||
# `list hostfirewalls`.
|
||||
# Those are cluster-scoped precisely because allocation needs a global keyspace, and
|
||||
# that allocation detail must never become a tenant-visible surface: one `list ports`
|
||||
# would hand over every other tenant's pods, addresses, MACs and node placement.
|
||||
#
|
||||
# They aggregate into the built-in admin/edit/view ClusterRoles, so a namespace
|
||||
# admin gets cozyplane's tenant surface without anyone wiring it up per tenant.
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cozyplane-tenant-edit
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
rbac.authorization.k8s.io/aggregate-to-admin: "true"
|
||||
rbac.authorization.k8s.io/aggregate-to-edit: "true"
|
||||
rules:
|
||||
# A tenant's own network: its VPCs, who may use them, its boundary, its policy,
|
||||
# its external addresses. All namespaced; all its own.
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources:
|
||||
- vpcs
|
||||
- vpcbindings
|
||||
- vpcgateways
|
||||
- vpcpeerings
|
||||
- securitygroups
|
||||
- floatingips
|
||||
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources:
|
||||
- vpcs/status
|
||||
- vpcgateways/status
|
||||
- vpcpeerings/status
|
||||
- securitygroups/status
|
||||
- floatingips/status
|
||||
verbs: ["get"]
|
||||
|
||||
# The virtual verbs on a tenant's OWN VPCs.
|
||||
#
|
||||
# `export` gates creating a VPCBinding to a VPC; `peer` gates creating a peering
|
||||
# half. Granting them here is not an escalation, and this is the whole reason the
|
||||
# verbs are checked against the VPC rather than the binding: a RoleBinding in the
|
||||
# tenant's namespace can only ever authorize these on VPCs IN THAT NAMESPACE.
|
||||
# Reaching into someone else's namespace still needs their consent, from them.
|
||||
#
|
||||
# Without `export` a tenant could not attach a pod even to its own VPC (attach is
|
||||
# default-deny and a VPCBinding is required in every case, including same-namespace).
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources: ["vpcs"]
|
||||
verbs: ["export", "peer"]
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: cozyplane-tenant-view
|
||||
labels:
|
||||
{{- include "cozyplane.labels" . | nindent 4 }}
|
||||
rbac.authorization.k8s.io/aggregate-to-view: "true"
|
||||
rules:
|
||||
- apiGroups: ["sdn.cozystack.io"]
|
||||
resources:
|
||||
- vpcs
|
||||
- vpcbindings
|
||||
- vpcgateways
|
||||
- vpcpeerings
|
||||
- securitygroups
|
||||
- floatingips
|
||||
verbs: ["get", "list", "watch"]
|
||||
@@ -0,0 +1,67 @@
|
||||
suite: cozyplane CNI renders with the Talos overlay
|
||||
# The overlay is what the platform actually installs (valuesFiles values.yaml +
|
||||
# values-talos.yaml in sources/networking.yaml); the bare chart defaults are
|
||||
# the kind/dev path. Cozystack-side suite: the chart itself is vendored from
|
||||
# lllamnyp/cozyplane, so keep assertions to the contract the platform relies
|
||||
# on, not to chart internals.
|
||||
templates:
|
||||
- templates/agent.yaml
|
||||
- templates/controller.yaml
|
||||
- templates/crds.yaml
|
||||
release:
|
||||
name: cozyplane
|
||||
namespace: cozy-cozyplane
|
||||
values:
|
||||
- ../values-talos.yaml
|
||||
tests:
|
||||
# With no kube-proxy, the kubernetes.default ClusterIP is unserved until
|
||||
# cozyplane-kpr is up — which needs the agent — so the agent must bootstrap
|
||||
# against a real endpoint. On Talos that is KubePrism on localhost:7445;
|
||||
# without these env vars the agent deadlocks against the unserved VIP.
|
||||
- it: dials KubePrism instead of the unserved ClusterIP
|
||||
templates: [templates/agent.yaml]
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: DaemonSet
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: KUBERNETES_SERVICE_HOST
|
||||
value: localhost
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].env
|
||||
content:
|
||||
name: KUBERNETES_SERVICE_PORT
|
||||
value: "7445"
|
||||
|
||||
# 00- sorts before any co-installed CNI's conflist (Cilium ships 05-), so
|
||||
# the kubelet keeps cozyplane as the primary CNI.
|
||||
- it: writes the primary conflist under the 00- prefix
|
||||
templates: [templates/agent.yaml]
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: DaemonSet
|
||||
asserts:
|
||||
- contains:
|
||||
path: spec.template.spec.containers[0].args
|
||||
content: "--cni-conf-name=00-cozyplane.conflist"
|
||||
|
||||
- it: renders the controller
|
||||
templates: [templates/controller.yaml]
|
||||
documentSelector:
|
||||
path: kind
|
||||
value: Deployment
|
||||
asserts:
|
||||
- exists:
|
||||
path: spec.template.spec.containers[0].image
|
||||
|
||||
# Only the LOCAL group ships as CRDs: the tenant kinds (VPC, Port, …) are
|
||||
# served by the aggregated apiserver alone, and a CRD for them would break
|
||||
# the group's OpenAPI (docs/api-groups.md upstream).
|
||||
- it: ships only local.sdn.cozystack.io CRDs
|
||||
templates: [templates/crds.yaml]
|
||||
asserts:
|
||||
- matchRegex:
|
||||
path: spec.group
|
||||
pattern: ^local\.sdn\.cozystack\.io$
|
||||
@@ -0,0 +1,27 @@
|
||||
# Talos overlay for the cozyplane networking variant (cozyplane + cozyplane-kpr,
|
||||
# no Cilium, no kube-proxy).
|
||||
#
|
||||
# Applied as the SECOND valuesFile of the `cozyplane` component
|
||||
# (packages/packagesources/networking.yaml): the Cozystack operator applies the
|
||||
# first file with strategy Overwrite and every later one with Merge, so this
|
||||
# file must stay separate from values.yaml — folding it in would make these
|
||||
# settings the chart's defaults, and they are wrong off Talos.
|
||||
|
||||
# cozyplane is the sole CNI; its conflist sorts first (00-) so kubelet uses it as
|
||||
# the primary CNI over any co-installed one.
|
||||
cniConfName: "00-cozyplane.conflist"
|
||||
|
||||
# Talos runs KubePrism (a node-local apiserver load balancer) on localhost:7445 —
|
||||
# the real endpoint `kubeApiServer` asks for; see values.yaml.
|
||||
kubeApiServer:
|
||||
host: "localhost"
|
||||
port: "7445"
|
||||
|
||||
# The aggregated API server is NOT part of this package: cozyplane installs
|
||||
# FIRST (it is the CNI), before cert-manager, and the apiserver needs
|
||||
# cert-manager Certificates. It ships as the separate cozyplane-apiserver
|
||||
# package (packages/packagesources/apiserver.yaml, dependsOn cert-manager +
|
||||
# etcd-operator + the storage layer). This chart ships only the LOCAL group's
|
||||
# CRDs (local.sdn.cozystack.io — FabricIP); the tenant group sdn.cozystack.io
|
||||
# has no CRDs at all and is unserved until the apiserver lands, by design
|
||||
# (docs/api-groups.md).
|
||||
@@ -0,0 +1,103 @@
|
||||
# Container image for all cozyplane components (agent, CNI plugin, controller).
|
||||
# Digest-pinned (no floating tag). Built and published by .github/workflows/
|
||||
# release.yml on every push to main; see docs/packaging.md for how the digest is
|
||||
# refreshed and why pinning it does not change it.
|
||||
image: ghcr.io/lllamnyp/cozyplane@sha256:60111afff00d91883a63183a058d24f81620f250a4526a94dbb26b937bb327e7
|
||||
imagePullPolicy: IfNotPresent
|
||||
imagePullSecrets: []
|
||||
|
||||
# Pod MTU (underlay MTU minus Geneve overhead, ~50 bytes).
|
||||
mtu: 1450
|
||||
|
||||
# Geneve UDP destination port. Override (e.g. 6082) only to coexist with another
|
||||
# overlay still holding 6081 on the node.
|
||||
genevePort: 6081
|
||||
|
||||
# CNI conflist filename written to /etc/cni/net.d. Lower names sort first; use a
|
||||
# low prefix (e.g. "00-cozyplane.conflist") to win over a co-installed CNI such
|
||||
# as Cilium (which ships 05-cilium.conflist).
|
||||
cniConfName: "10-cozyplane.conflist"
|
||||
|
||||
# Kube-apiserver endpoint the hostNetwork agent/responder dial. Empty = the
|
||||
# in-cluster kubernetes.default ClusterIP (10.96.0.1) — correct once a service
|
||||
# proxy serves it. When cozyplane is the CNI AND there is no kube-proxy, that
|
||||
# ClusterIP is unserved until cozyplane-kpr (which needs the agent) is up, a
|
||||
# bootstrap cycle — so point the agent at a real endpoint (Talos: KubePrism
|
||||
# localhost:7445).
|
||||
kubeApiServer:
|
||||
host: ""
|
||||
port: ""
|
||||
|
||||
# The cluster DNS domain (kubelet's clusterDomain) — the zone the split-horizon
|
||||
# resolver answers authoritatively for VPC pods. Empty (the default)
|
||||
# autodetects it from the resolver's own kubelet-written search path (the
|
||||
# DaemonSet runs ClusterFirstWithHostNet, so the cluster domain is present
|
||||
# despite hostNetwork); set explicitly only to override.
|
||||
clusterDomain: ""
|
||||
|
||||
# Cluster networking facts for pod egress to the outside world. Not reliably
|
||||
# discoverable in-cluster, so declared here.
|
||||
egress:
|
||||
# The cluster pod supernet(s), comma-separated for dual-stack (e.g.
|
||||
# "10.244.0.0/16,fd00:10:244::/56"). Enables the cluster-egress masquerade
|
||||
# (pods get an off-cluster return path) and is denied to VPC tenants at
|
||||
# their gateways. Empty disables both.
|
||||
clusterCIDR: "10.244.0.0/16"
|
||||
# Masquerade implementation: "bpf" (eBPF SNAT at the uplink, no netfilter,
|
||||
# both families), "iptables" (legacy kernel rule, v4 only), or "off".
|
||||
masquerade: "bpf"
|
||||
# The Service CIDR, denied to VPC tenants at their gateways.
|
||||
serviceCIDR: "10.96.0.0/16"
|
||||
# Cluster DNS ClusterIP; the one cluster-internal door a VPC gateway opens
|
||||
# (:53 only), so tenant pods resolve with a stock resolv.conf.
|
||||
clusterDNS: "10.96.0.10"
|
||||
# Additional cluster-internal networks VPC tenants must not reach through
|
||||
# their gateways (e.g. the node/management network).
|
||||
internalCIDRs: []
|
||||
|
||||
agent:
|
||||
priorityClassName: system-node-critical
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
# The eBPF maps are charged to the agent's memory cgroup, and most of them
|
||||
# are PREALLOCATED at load: the LRU conntrack and service maps alone
|
||||
# (ct_fwd/ct_rev/svc_fwd/svc_rev at 262k entries each, np_ct at 131k) come
|
||||
# to ~100MB+ before the Go heap. Request enough that the scheduler knows.
|
||||
memory: 192Mi
|
||||
limits:
|
||||
# Sized for the same preallocated map footprint as the request above, with
|
||||
# headroom for new maps — not for the Go heap.
|
||||
memory: 512Mi
|
||||
|
||||
controller:
|
||||
replicas: 1
|
||||
priorityClassName: system-cluster-critical
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
memory: 128Mi
|
||||
|
||||
# The export ValidatingAdmissionPolicy that gates VPCBinding creation on the
|
||||
# 'export' verb of the referenced VPC. Requires Kubernetes >= 1.30. Disable only
|
||||
# if your cluster predates VAP (then VPCBinding/VPCPeering creation is governed
|
||||
# by plain create RBAC alone, with no export/peer verb check). Only relevant in
|
||||
# CRD mode: the aggregated apiserver enforces both verbs in its strategies.
|
||||
exportPolicy:
|
||||
enabled: true
|
||||
|
||||
# CRDs for the LOCAL group (local.sdn.cozystack.io): underlay IPAM (FabricIP).
|
||||
# This is the layer beneath everything — it must work before cert-manager,
|
||||
# before etcd, and before cozyplane's own aggregated apiserver, all of which run
|
||||
# as default-network pods.
|
||||
#
|
||||
# The tenant kinds (VPC, Port, SecurityGroup, HostFirewall, ...) are NOT CRDs.
|
||||
# They are served only by chart/cozyplane-apiserver: a group served by both a
|
||||
# CRD and an APIService makes the kube-apiserver's OpenAPI merge collide, and
|
||||
# `kubectl apply` then fails for every object in the group (docs/api-groups.md).
|
||||
#
|
||||
# Disable only if you install these CRDs out-of-band.
|
||||
crds:
|
||||
enabled: true
|
||||
Reference in new issue
Block a user