helm-diff icon indicating copy to clipboard operation
helm-diff copied to clipboard

normalize-manifests flag does not work

Open dudicoco opened this issue 1 year ago • 22 comments

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

dudicoco avatar Mar 07 '24 14:03 dudicoco

@dudicoco which version is worked?

yxxhero avatar Mar 09 '24 23:03 yxxhero

@dudicoco please try upgrade your helm-diff version.

yxxhero avatar Mar 10 '24 04:03 yxxhero

@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 avatar Mar 10 '24 08:03 dudicoco

@yxxhero any updates?

dudicoco avatar Apr 01 '24 12:04 dudicoco

@dudicoco I'll try to fix this issue.

yxxhero avatar Apr 01 '24 13:04 yxxhero

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

yxxhero avatar Apr 02 '24 12:04 yxxhero

@dudicoco any updates?

yxxhero avatar Apr 04 '24 13:04 yxxhero

@dudicoco ping

yxxhero avatar Apr 07 '24 08:04 yxxhero

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

dudicoco avatar Apr 11 '24 09:04 dudicoco

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

yxxhero avatar Apr 14 '24 02:04 yxxhero

ping

yxxhero avatar Apr 28 '24 14:04 yxxhero

@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

dudicoco avatar May 19 '24 06:05 dudicoco

clone code

go build -o bin/diff main.go

yxxhero avatar May 19 '24 07:05 yxxhero

@dudicoco

yxxhero avatar May 19 '24 08:05 yxxhero

@yxxhero thanks, managed to build it.

Unfortunately the new version did not solve the issue.

dudicoco avatar May 20 '24 16:05 dudicoco

@dudicoco I need the log.

yxxhero avatar May 20 '24 22:05 yxxhero

@yxxhero please elaborate, which log?

dudicoco avatar May 21 '24 06:05 dudicoco

@yxxhero please elaborate, which log?

stdout.

yxxhero avatar May 21 '24 07:05 yxxhero

@dudicoco

yxxhero avatar May 21 '24 08:05 yxxhero

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

dudicoco avatar May 22 '24 19:05 dudicoco

@dudicoco did you see any context like this:

log.Printf("Normalizing content: \n%s", content)

yxxhero avatar May 23 '24 00:05 yxxhero

ping

yxxhero avatar Jun 19 '24 09:06 yxxhero

Sorry for the delay @yxxhero.

I think I've misunderstood the purpose of this flag, I believe it's supposed to exclude style differences such as indentation from the output, although I didn't encounter nor could I recreate style differences even without using the flag.

Changes in list order actually should be displayed as list could be critical (for example in cmd/args).

Thank you for your help!

dudicoco avatar Dec 17 '24 14:12 dudicoco