Skip to content

Auto-deploy Manifests Should Periodically Re-evaluate #3711

Description

@ekristen

Environmental Info:
K3s Version:

k3s version v1.21.3+k3s1 (1d1f220f)
go version go1.16.6

Node(s) CPU architecture, OS, and Version:

Linux ip-10-130-0-25 5.8.0-1041-aws #43~20.04.1-Ubuntu SMP Thu Jul 15 11:07:29 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Cluster Configuration:

1 server

Describe the bug:

This could easily be a bug or a feature request. Technically the behavior 15 months ago was preferred from my perspective, but due to issues with HA and upgrades was altered.

As it stands today, once the server does the initial auto-deploy, it will only pick up changes IF the modtime on the file has changed.

Previously it behaved more like gitops model where the manifests were treated as a source of truth, whatever was in manifests directory was always applied against the cluster, so if you made changes directly to the cluster that contradicted the manifest files, they'd be overwritten on the next evaluation loop.

In my opinion, the previous way was better.

From a HelmChart use case, when it deploys a service along with a deployment and said service is deleted, the service will never come back.

The behavior of the auto-deploy is a bit inconsistent too, the first run of the deploy controller will always evaluate all manifests but subsequent runs will not unless the modtime has changed. This means that after k3s is up if someone goes and modifies the traefic or metrics-server deployment directly on the cluster it'll be 100% ok, but as soon as the deploy controller restarts for any reason, all those changes will be overwritten, which could be 1 hour from now or 30 days from now.

I suggest that the manifests directory should always be applied therefore being a reliable source of truth.

I currently have a work around for this. I place an entry in /etc/cron.d with a script that literally runs touch against every file in the /var/lib/rancher/k3s/server/manifests directory every minute. This forces k3s to re-evaluate on it's 15 second interval and will see the modtime changed and then apply the changes against the cluster.

Steps To Reproduce:

  • Install K3s
  • Place manifest file that creates a deployment
  • Delete the deployment

Expected behavior:

I would expect the auto-deploy to re-evaluate and have the deployment return eventually.

Actual behavior:

The deployment never returns unless the modtime of the file is modified.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions