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

fix: error if annotation patch path can't be found, update dependencies #99

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

raffis
Copy link
Member

@raffis raffis commented Apr 29, 2024

Current situation

A helmrelease having an annotation patch does not fail if there is no annotation: {} in the resource.

apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: x
spec:
  interval: 15m0s
  chart:
    spec:
      chart: x
      version: '1.17.3'
      sourceRef:
        kind: HelmRepository
        name: x
        namespace: flux-system
      interval: 30m
  postRenderers:
    - kustomize:
        patchesJson6902:
          - target:
              kind: StatefulSet
              name: x
            patch:
              - op: add
                path: /metadata/annotations/x
                value: "true"

The expected result would be error while running post render on files: add operation does not apply: doc is missing path: "/metadata/annotations/x": missing value however flux-build v0.2.2 builds the release without any error.

This happens because of the current way the namespace post rendered is used. Internally that kustomize builtin adds annotations hence the patch above does not work

Proposal

Do not directly use the transformer but rather create an actual kustomization using it.
Despite this the pr also updates all dependencies.

@raffis raffis requested a review from a team as a code owner April 29, 2024 15:33
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8881324544

Details

  • 2 of 21 (9.52%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-16.3%) to 52.622%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/build/helm.go 0 1 0.0%
internal/helm/postrenderer/post_renderer_namespace.go 0 18 0.0%
Files with Coverage Reduction New Missed Lines %
internal/helm/postrenderer/post_renderer_namespace.go 2 0.0%
Totals Coverage Status
Change from base Build 8520168382: -16.3%
Covered Lines: 1746
Relevant Lines: 3318

💛 - Coveralls

@raffis raffis merged commit ea81c11 into master Apr 29, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants