Skip to content

Add troubleshooting docs for inventory policy

Alisan Stoll requested to merge stollapps/gitlab:master into master

What does this MR do and why?

Getting started with GitOps I dived right into deploying a GitLab Kubernetes Agent following the docs. I created a manifest repository for an already deployed app and created an agent for the repository with the default configuration (I wasn't as thorough here as I should have ...). I kept getting this error for all my resources:

{
  "error":"inventory policy prevented actuation (strategy: Apply, status: Empty, policy: MustMatch)",
  "group":"networking.k8s.io",
  "kind":"Deployment",
  "name":"resource-name",
  "namespace":"namespace",
  "status":"Skipped",
  "timestamp":"2022-10-29T15:34:21Z",
  "type":"apply"
}

Unfortunately I didn't find any direct explanation for handling this error message. Even after going through the configuration docs and looking at the inventory_policy setting, I could not find the solution to my problem. Only after finding the inventory_policy options I could understand what was going on.

With this change I hope to support other beginners in the future.

This is the added documentation, which also directly references the inventory_policy options:

[log message from above]

This error occurs when the GitLab agent wants to update an object, which doesn't have the required annotations. Most likely the object already existed when you deployed the GitLab agent. To fix this error you can add the required annotations manually, delete the object and let the agent recreate it or change the inventory_policy setting.

Note: I received this error message from the gitlab-agent pod alongside other logs, but these have a different format ({ "level": "warn" ...}). Maybe anyone can clarify why the log message from above has a different format.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

-

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports