You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feat: Initial refactor for dynamic multi-agent architecture (Part 1)
This commit lays the groundwork for a new architecture where the main
vm-dhcp-controller dynamically manages individual vm-dhcp-agent Deployments,
one per active IPPool.
Changes include:
1. Controller RBAC: Updated the main controller's RBAC permissions to allow
full lifecycle management (create, get, list, watch, update, patch, delete)
of Deployments and ServiceAccounts in its namespace, and ClusterRoleBindings
cluster-wide.
2. IPPool Controller Refactor (`pkg/controller/ippool/controller.go`):
- Removed the previous `syncAgentDeployment` function (which managed a single
static agent deployment).
- Introduced `reconcileAgentForIPPool` as the new core reconciliation logic.
- Implemented resource naming helpers (`sanitizeNameForKubernetes`,
`getAgentResourceName`).
- Implemented deletion logic for agent resources (Deployment, SA, CRB)
when an IPPool is deleted or paused.
- Implemented create/get logic for agent ServiceAccounts and
ClusterRoleBindings (binding to a shared agent ClusterRole),
including setting OwnerReferences to the IPPool.
- `OnChange` and `OnRemove` handlers now call `reconcileAgentForIPPool`.
- The creation/update logic for the agent Deployment itself within
`reconcileAgentForIPPool` is still a TODO.
3. Static Agent Helm Templates Removed/Modified:
- Deleted `chart/templates/agent-deployment.yaml` and
`chart/templates/agent-serviceaccount.yaml`.
- Updated `chart/templates/rbac.yaml` to define a new shared ClusterRole
for dynamic agent instances (`{{ .Release.Name }}-vm-dhcp-agent-shared-permissions`)
and removed the ClusterRoleBinding for the old static agent.
- Cleaned up obsolete fields related to the static agent in `chart/values.yaml`.
The controller now expects environment variables like
`SHARED_AGENT_CLUSTERROLE_NAME` to correctly reference shared resources.
0 commit comments