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

Kustomize: apply patch results in error "add operation does not apply: doc is missing path" #5695

Open
edtshuma opened this issue May 9, 2024 · 1 comment
Labels
kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@edtshuma
Copy link

edtshuma commented May 9, 2024

I am trying to do a kustomize patch to an existing Helm deployment via a CI/CD pipeline. The CI pipeline is failing kustomize checks with error:

`error: accumulating components: accumulateDirectory: "recursed accumulation of path '/runner/_work/ops-infra/ops-infra/current/components/mimir-prod/alertmanager/ops': add operation does not apply: doc is missing path: "/spec/values/alertmanager/fallbackConfig/receivers/-": missing value``

The patch is defined in receivers-patch.yaml as follows:

- op: add path: /spec/chart/spec/values/alertmanager/fallbackConfig/receivers/- value: name: 'slack_receiver' slack_configs: - channel: "#ops" send_resolved: true slack_api_url: "https://hooks.slack.com/services/Txxxxx"

This patch adds a new "receiver" entry to the Mimir AlertManager Helm deployment. The patch is applied in kustomization.yaml file as:

apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
patches:
  - path: receivers-patch.yaml
    target:
      kind: HelmRelease
      name: mimir-prod

The deployment on which the patch is being applied is defined as below:

apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: mimir-prod
  namespace: monitoring
spec:
  ...
  ...
  values:
    alertmanager:
      fallbackConfig: |
        global:
          pagerduty_url: https://events.pagerduty.com/v2/enqueue
          resolve_timeout: 5m
        receivers:
          - name: 'null'
        route:
          group_by: ['alertname']
          group_interval: 5m
          group_wait: 30s
          receiver: 'null'

I have looked at other questions here of similar nature but I cant quite find a match to my issue.

What am I doing wrong?

@k8s-ci-robot k8s-ci-robot added needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 9, 2024
@stormqueen1990
Copy link
Member

Hi there, @edtshuma!

Could you please add a minimal kustomization.yaml configuration that reproduces the problem you're describing?

I can't quite verify whether this happens in standalone Kustomize without knowing how it's being configured and processed.

/kind support
/triage needs-information

@k8s-ci-robot k8s-ci-robot added kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

3 participants