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

apply dry run not working #53

Closed
nab-gha opened this issue Sep 8, 2020 · 1 comment
Closed

apply dry run not working #53

nab-gha opened this issue Sep 8, 2020 · 1 comment
Assignees

Comments

@nab-gha
Copy link
Contributor

nab-gha commented Sep 8, 2020

I noticed that apply dry run is not working, when a helm release already exists on the server it is returning the helm release state as it is on the cluster rather than in the yaml file.

cat /tmp/kraan-5ww3fu/addons-config/./testdata/addons/bootstrap/microservice1.yaml

apiVersion: helm.fluxcd.io/v1
kind: HelmRelease
metadata:
  name: microservice-1
  namespace: bootstrap
  annotations:
    fluxcd.io/automated: "false"
spec:
  releaseName: microservice-test-1
  test:
    enable: true
    ignoreFailures: false
    timeout: 300
  chart:
    git: https://github.com/fidelity/kraan
    path: testdata/charts/podinfo
    ref: issue-36
  values:
    preHookBackoffLimit: 1
    preHookActiveDeadlineSeconds: 60
    preHookRestartPolicy: Never
    preHookDelaySeconds: 10
    preHookSucceed: "true"
    testHookBackoffLimit: 1
    testHookActiveDeadlineSeconds: 60
    testHookRestartPolicy: Never
    testHookDelaySeconds: 10
    testHookSucceed: "true"
    podinfo:
      service:
        enabled: true
        type: ClusterIP
      replicaCount: 1
      message: -Microservice Test 1

dry run apply show chart ref master rather than issue-9

kubectl apply -R -f /tmp/kraan-5ww3fu/addons-config/./testdata/addons/bootstrap/microservice1.yaml --dry-run -o json
W0908 09:28:26.148859   84008 helpers.go:535] --dry-run is deprecated and can be replaced with --dry-run=client.
{
    "apiVersion": "helm.fluxcd.io/v1",
    "kind": "HelmRelease",
    "metadata": {
        "annotations": {
            "fluxcd.io/automated": "false",
            "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"helm.fluxcd.io/v1\",\"kind\":\"HelmRelease\",\"metadata\":{\"annotations\":{\"fluxcd.io/automated\":\"false\"},\"name\":\"microservice-1\",\"namespace\":\"bootstrap\"},\"spec\":{\"chart\":{\"git\":\"https://github.com/fidelity/kraan\",\"path\":\"testdata/charts/podinfo\",\"ref\":\"master\"},\"releaseName\":\"microservice-test-1\",\"test\":{\"enable\":true,\"ignoreFailures\":false,\"timeout\":300},\"values\":{\"podinfo\":{\"message\":\"-Microservice Test 1\",\"replicaCount\":1,\"service\":{\"enabled\":true,\"type\":\"ClusterIP\"}},\"preHookActiveDeadlineSeconds\":60,\"preHookBackoffLimit\":1,\"preHookDelaySeconds\":10,\"preHookRestartPolicy\":\"Never\",\"preHookSucceed\":\"true\",\"testHookActiveDeadlineSeconds\":60,\"testHookBackoffLimit\":1,\"testHookDelaySeconds\":10,\"testHookRestartPolicy\":\"Never\",\"testHookSucceed\":\"true\"}}}\n"
        },
        "creationTimestamp": "2020-09-08T08:06:52Z",
        "generation": 1,
        "labels": {
            "kraan/owner": "bootstrap"
        },
        "name": "microservice-1",
        "namespace": "bootstrap",
        "ownerReferences": [
            {
                "apiVersion": "kraan.io/v1alpha1",
                "blockOwnerDeletion": true,
                "controller": true,
                "kind": "AddonsLayer",
                "name": "bootstrap",
                "uid": "a06a88c4-61b9-436f-a14b-9d79c35b081b"
            }
        ],
        "resourceVersion": "856421",
        "selfLink": "/apis/helm.fluxcd.io/v1/namespaces/bootstrap/helmreleases/microservice-1",
        "uid": "cd663723-b3ac-47d0-a174-4e6cb1eee009"
    },
    "spec": {
        "chart": {
            "git": "https://github.com/fidelity/kraan",
            "path": "testdata/charts/podinfo",
            "ref": "master"
        },
        "releaseName": "microservice-test-1",
        "rollback": {},
        "test": {
            "enable": true,
            "ignoreFailures": false,
            "timeout": 300
        },
        "values": {
            "podinfo": {
                "message": "-Microservice Test 1",
                "replicaCount": 1,
                "service": {
                    "enabled": true,
                    "type": "ClusterIP"
                }
            },
            "preHookActiveDeadlineSeconds": 60,
            "preHookBackoffLimit": 1,
            "preHookDelaySeconds": 10,
            "preHookRestartPolicy": "Never",
            "preHookSucceed": "true",
            "testHookActiveDeadlineSeconds": 60,
            "testHookBackoffLimit": 1,
            "testHookDelaySeconds": 10,
            "testHookRestartPolicy": "Never",
            "testHookSucceed": "true"
        }
    },
    "status": {
        "conditions": [
            {
                "lastTransitionTime": "2020-09-08T08:06:52Z",
                "lastUpdateTime": "2020-09-08T08:27:25Z",
                "message": "Chart fetch failed for Helm release 'microservice-test-1' in 'bootstrap'.",
                "reason": "ChartFetchFailed",
                "status": "False",
                "type": "ChartFetched"
            },
            {
                "lastTransitionTime": "2020-09-08T08:06:52Z",
                "lastUpdateTime": "2020-09-08T08:27:25Z",
                "message": "Chart fetch failed for Helm release 'microservice-test-1' in 'bootstrap'.",
                "reason": "ChartFetchFailed",
                "status": "False",
                "type": "Released"
            }
        ],
        "observedGeneration": 1,
        "phase": "ChartFetchFailed"
    }
}

showing the helm release currently applied, has master as ref

kubectl -n bootstrap get helmreleases.helm.fluxcd.io microservice-1 -o json
{
    "apiVersion": "helm.fluxcd.io/v1",
    "kind": "HelmRelease",
    "metadata": {
        "annotations": {
            "fluxcd.io/automated": "false",
            "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"helm.fluxcd.io/v1\",\"kind\":\"HelmRelease\",\"metadata\":{\"annotations\":{\"fluxcd.io/automated\":\"false\"},\"name\":\"microservice-1\",\"namespace\":\"bootstrap\"},\"spec\":{\"chart\":{\"git\":\"https://github.com/fidelity/kraan\",\"path\":\"testdata/charts/podinfo\",\"ref\":\"master\"},\"releaseName\":\"microservice-test-1\",\"test\":{\"enable\":true,\"ignoreFailures\":false,\"timeout\":300},\"values\":{\"podinfo\":{\"message\":\"-Microservice Test 1\",\"replicaCount\":1,\"service\":{\"enabled\":true,\"type\":\"ClusterIP\"}},\"preHookActiveDeadlineSeconds\":60,\"preHookBackoffLimit\":1,\"preHookDelaySeconds\":10,\"preHookRestartPolicy\":\"Never\",\"preHookSucceed\":\"true\",\"testHookActiveDeadlineSeconds\":60,\"testHookBackoffLimit\":1,\"testHookDelaySeconds\":10,\"testHookRestartPolicy\":\"Never\",\"testHookSucceed\":\"true\"}}}\n"
        },
        "creationTimestamp": "2020-09-08T08:06:52Z",
        "generation": 1,
        "labels": {
            "kraan/owner": "bootstrap"
        },
        "name": "microservice-1",
        "namespace": "bootstrap",
        "ownerReferences": [
            {
                "apiVersion": "kraan.io/v1alpha1",
                "blockOwnerDeletion": true,
                "controller": true,
                "kind": "AddonsLayer",
                "name": "bootstrap",
                "uid": "a06a88c4-61b9-436f-a14b-9d79c35b081b"
            }
        ],
        "resourceVersion": "856421",
        "selfLink": "/apis/helm.fluxcd.io/v1/namespaces/bootstrap/helmreleases/microservice-1",
        "uid": "cd663723-b3ac-47d0-a174-4e6cb1eee009"
    },
    "spec": {
        "chart": {
            "git": "https://github.com/fidelity/kraan",
            "path": "testdata/charts/podinfo",
            "ref": "master"
        },
        "releaseName": "microservice-test-1",
        "rollback": {},
        "test": {
            "enable": true,
            "ignoreFailures": false,
            "timeout": 300
        },
        "values": {
            "podinfo": {
                "message": "-Microservice Test 1",
                "replicaCount": 1,
                "service": {
                    "enabled": true,
                    "type": "ClusterIP"
                }
            },
            "preHookActiveDeadlineSeconds": 60,
            "preHookBackoffLimit": 1,
            "preHookDelaySeconds": 10,
            "preHookRestartPolicy": "Never",
            "preHookSucceed": "true",
            "testHookActiveDeadlineSeconds": 60,
            "testHookBackoffLimit": 1,
            "testHookDelaySeconds": 10,
            "testHookRestartPolicy": "Never",
            "testHookSucceed": "true"
        }
    },
    "status": {
        "conditions": [
            {
                "lastTransitionTime": "2020-09-08T08:06:52Z",
                "lastUpdateTime": "2020-09-08T08:27:25Z",
                "message": "Chart fetch failed for Helm release 'microservice-test-1' in 'bootstrap'.",
                "reason": "ChartFetchFailed",
                "status": "False",
                "type": "ChartFetched"
            },
            {
                "lastTransitionTime": "2020-09-08T08:06:52Z",
                "lastUpdateTime": "2020-09-08T08:27:25Z",
                "message": "Chart fetch failed for Helm release 'microservice-test-1' in 'bootstrap'.",
                "reason": "ChartFetchFailed",
                "status": "False",
                "type": "Released"
            }
        ],
        "observedGeneration": 1,
        "phase": "ChartFetchFailed"
    }
}

Delete the helm release from Cluster

kubectl -n bootstrap delete helmreleases.helm.fluxcd.io microservice-1 
helmrelease.helm.fluxcd.io "microservice-1" deleted
kubectl -n bootstrap get helmreleases.helm.fluxcd.io microservice-1 -o json
Error from server (NotFound): helmreleases.helm.fluxcd.io "microservice-1" not found

dry run again, this time ok

kubectl apply -R -f /tmp/kraan-5ww3fu/addons-config/./testdata/addons/bootstrap/microservice1.yaml --dry-run -o json
W0908 09:29:29.261976   85555 helpers.go:535] --dry-run is deprecated and can be replaced with --dry-run=client.
{
    "apiVersion": "helm.fluxcd.io/v1",
    "kind": "HelmRelease",
    "metadata": {
        "annotations": {
            "fluxcd.io/automated": "false",
            "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"helm.fluxcd.io/v1\",\"kind\":\"HelmRelease\",\"metadata\":{\"annotations\":{\"fluxcd.io/automated\":\"false\"},\"name\":\"microservice-1\",\"namespace\":\"bootstrap\"},\"spec\":{\"chart\":{\"git\":\"https://github.com/fidelity/kraan\",\"path\":\"testdata/charts/podinfo\",\"ref\":\"issue-36\"},\"releaseName\":\"microservice-test-1\",\"test\":{\"enable\":true,\"ignoreFailures\":false,\"timeout\":300},\"values\":{\"podinfo\":{\"message\":\"-Microservice Test 1\",\"replicaCount\":1,\"service\":{\"enabled\":true,\"type\":\"ClusterIP\"}},\"preHookActiveDeadlineSeconds\":60,\"preHookBackoffLimit\":1,\"preHookDelaySeconds\":10,\"preHookRestartPolicy\":\"Never\",\"preHookSucceed\":\"true\",\"testHookActiveDeadlineSeconds\":60,\"testHookBackoffLimit\":1,\"testHookDelaySeconds\":10,\"testHookRestartPolicy\":\"Never\",\"testHookSucceed\":\"true\"}}}\n"
        },
        "name": "microservice-1",
        "namespace": "bootstrap"
    },
    "spec": {
        "chart": {
            "git": "https://github.com/fidelity/kraan",
            "path": "testdata/charts/podinfo",
            "ref": "issue-36"
        },
        "releaseName": "microservice-test-1",
        "test": {
            "enable": true,
            "ignoreFailures": false,
            "timeout": 300
        },
        "values": {
            "podinfo": {
                "message": "-Microservice Test 1",
                "replicaCount": 1,
                "service": {
                    "enabled": true,
                    "type": "ClusterIP"
                }
            },
            "preHookActiveDeadlineSeconds": 60,
            "preHookBackoffLimit": 1,
            "preHookDelaySeconds": 10,
            "preHookRestartPolicy": "Never",
            "preHookSucceed": "true",
            "testHookActiveDeadlineSeconds": 60,
            "testHookBackoffLimit": 1,
            "testHookDelaySeconds": 10,
            "testHookRestartPolicy": "Never",
            "testHookSucceed": "true"
        }
    }
}
@nab-gha nab-gha self-assigned this Sep 9, 2020
@nab-gha
Copy link
Contributor Author

nab-gha commented Sep 9, 2020

version 18 of kubectl issue, version 17 works fine

@nab-gha nab-gha closed this as completed Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant