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

Re-connected Ankaios agent not receiving deleted workload when no added workloads are sent #358

Closed
inf17101 opened this issue Aug 23, 2024 · 3 comments
Assignees
Labels
bug Something isn't working. Issue will appear in the change log "Bug Fixes"
Milestone

Comments

@inf17101
Copy link
Contributor

When an Ankaios agent has assigned one workload and the workload will be deleted during the Ankaios agent is disconnected, then the Agent does not delete this workload once it reconnects to the Ankaios server.

Current Behavior

A reconnected agent with only one workload that will be deleted during the agent is disconnected will lead to a running workload that is not anymore in the desired state and the deleted workload will not be deleted. The agent is blind and does nothing with this workload on startup because the Ankaios server does only sent the added workloads and the workload states when an agent connects.

If the agent has assigned more then one workload and other workloads are not deleted during the agent is disconnected then the Agent receives added workloads from the server and the initial resume/replace logic of the agent runs which correctly deletes the deleted workload. The agent enforces correctly the desired state in this situation.

Expected Behavior

An Ankaios agent shall always enforce the desired state of the Ankaios server and shall not be out of sync.

Steps to Reproduce

  1. Start an Ankaios server with server/resources/startConfig.yaml
  2. Start one Ankaios agent with name agent_A to make sure that only the nginx workloads runs (the rest of the workloads inside the startConfig can be ignored for this situation)
  3. Disconnect the agent after its workload nginx has the running state
  4. Execute an ank -k set state desiredState emptyState.yaml containing an empty state to delete all workloads or use ank -k delete workload nginx
  5. Start the agent_A again in the other terminal window.
  6. Check the logs of server and agent

The agent connects to the server awaiting new commands of it, but since there are no new workloads of that agent inside the desired state, the server sends nothing to this agent.

Context (Environment)

Logs

Additional Information

Final result

To be filled by the one closing the issue.

@inf17101 inf17101 added the bug Something isn't working. Issue will appear in the change log "Bug Fixes" label Aug 23, 2024
@inf17101 inf17101 changed the title Re-connected Ankaios agent does not receive deleted workload of the server when no added workloads are sent Re-connected Ankaios agent not receiving deleted workload when no added workloads are sent Aug 23, 2024
@krucod3 krucod3 added this to the v0.5 milestone Sep 2, 2024
@GabyUnalaq
Copy link
Contributor

Currently working on this.

@GabyUnalaq
Copy link
Contributor

After discussions with @krucod3 and @inf17101, the preferred approach will be as follows.

A new message is created, called ServerHello (name can be changed) as a response to the AgentHello, with information regarding the added workloads of the agent that connected. This way, the functionality remains the same and also this corner-case is covered.

This way, we separate the first response of the server from the regular updates, improving the overall logic of the code and making possible future improvements regarding configuration for the agents.

@krucod3
Copy link
Contributor

krucod3 commented Sep 10, 2024

@GabyUnalaq, PR merged.

@krucod3 krucod3 closed this as completed Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. Issue will appear in the change log "Bug Fixes"
Projects
None yet
Development

No branches or pull requests

3 participants