databus23 / helm-diff

A helm plugin that shows a diff explaining what a helm upgrade would change
Apache License 2.0
2.66k stars 278 forks source link

normalize-manifests flag does not work #572

Open dudicoco opened 6 months ago

dudicoco commented 6 months ago

Hi,

When adding the normalize-manifests flag to the helm diff command the manifests are not getting normalized.

helm diff version 3.8.1

helm diff upgrade --allow-unreleased amazing-app my-repo/amazing-app --version 2.0.50 --suppress-secrets --normalize-manifests --namespace devops --values ./dev.yaml 

devops, amazing-app, Deployment (apps) has changed:
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: amazing-app
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: amazing-app
        release: amazing-app
    strategy:
      rollingUpdate:
        maxSurge: 20%
        maxUnavailable: 0
      type: RollingUpdate
    template:
      metadata:
        annotations:
          prometheus.io/port: "9898"
          prometheus.io/scrape: "true"
        labels:
          app: amazing-app
          release: amazing-app
      spec:
        containers:
        - command:
+         - --level=info
          - ./podinfo
          - --port=9898
          - --port-metrics=9797
          - --grpc-port=9999
          - --grpc-service-name=backend
          - --otel-service-name=backend
-         - --level=info
          name: amazing-app
          ports:
-         - containerPort: 9898
-           name: http
-           protocol: TCP
          - containerPort: 9797
            name: metrics
+           protocol: TCP
+         - containerPort: 9898
+           name: http
            protocol: TCP
          resources:
            limits:
              cpu: 256m
              memory: 256Mi
            requests:
              cpu: 32m
              memory: 64Mi

devops, amazing-app, Service (v1) has changed:
  apiVersion: v1
  kind: Service
  metadata:
    name: amazing-app
  spec:
    ports:
-   - name: http
-     port: 9898
-     protocol: TCP
    - name: metrics
      port: 9797
+     protocol: TCP
+   - name: http
+     port: 9898
      protocol: TCP
    selector:
      app: amazing-app
      release: amazing-app
    type: ClusterIP
yxxhero commented 6 months ago

@dudicoco which version is worked?

yxxhero commented 6 months ago

@dudicoco please try upgrade your helm-diff version.

dudicoco commented 6 months ago

@yxxhero I have not tried the feature until now so I don't know if it worked in previous versions. I have tried upgrading helm diff to v3.9.5 and still seeing the same issue.

dudicoco commented 5 months ago

@yxxhero any updates?

yxxhero commented 5 months ago

@dudicoco I'll try to fix this issue.

yxxhero commented 5 months ago

@dudicoco try to use https://github.com/databus23/helm-diff/tree/fix-normalize-manifests-issue , and show me the output.

yxxhero commented 5 months ago

@dudicoco any updates?

yxxhero commented 5 months ago

@dudicoco ping

dudicoco commented 5 months ago

@yxxhero sorry for the delay. Is there a release binary which I can test?

yxxhero commented 5 months ago

@dudicoco you can build it by youself. if you need help. I will do.

yxxhero commented 4 months ago

ping

dudicoco commented 3 months ago

@yxxhero sorry for the delay.

I've tried building and got the following errors:

scripts/verify-staticcheck.sh
bash: line 1: staticcheck: command not found
bash: line 1: staticcheck: command not found
bash: line 1: staticcheck: command not found
bash: line 1: staticcheck: command not found
mkdir -p bin/
go build -v -o bin/diff -ldflags="-X github.com/databus23/helm-diff/v3/cmd.Version=3.9.5"
github.com/databus23/helm-diff/v3
Error: unknown command "home" for "helm"
Run 'helm --help' for usage.
Error: unknown command "home" for "helm"
Run 'helm --help' for usage.
Error: unknown command "home" for "helm"
Run 'helm --help' for usage.
mkdir -p /plugins/helm-diff/bin
mkdir: /plugins: Read-only file system
make: *** [install] Error 1
yxxhero commented 3 months ago

clone code

go build -o bin/diff main.go

yxxhero commented 3 months ago

@dudicoco

dudicoco commented 3 months ago

@yxxhero thanks, managed to build it.

Unfortunately the new version did not solve the issue.

yxxhero commented 3 months ago

@dudicoco I need the log.

dudicoco commented 3 months ago

@yxxhero please elaborate, which log?

yxxhero commented 3 months ago

@yxxhero please elaborate, which log?

stdout.

yxxhero commented 3 months ago

@dudicoco

dudicoco commented 3 months ago

@yxxhero the stdout is the same as the diff in the first comment in the issue.

yxxhero commented 3 months ago

@dudicoco did you see any context like this:

log.Printf("Normalizing content: \n%s", content)
yxxhero commented 2 months ago

ping