sassoftware / viya4-deployment

This project contains Ansible code that creates a baseline in an existing Kubernetes environment for use with the SAS Viya Platform, generates the manifest for an order, and then can also deploy that order into the Kubernetes environment specified.
Apache License 2.0
70 stars 64 forks source link

is there a better way to catch errors from Kustomize ? #470

Closed biohazd closed 9 months ago

biohazd commented 1 year ago

Running the deploy/ansible all works, and does not show any errros. is there a better way to catch errors from Kustomize ?

I have this error in pod "sas-deployment-operator-reconcile-xxxxxx".

The error is: "[EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.\nError: accumulating resources: accumulation err='accumulating resources from 'generation': '/work/deploy/resources/generation' must resolve to a file': recursed accumulation of path '/work/deploy/resources/generation': add operation does not apply: doc is missing path: \"/template/spec/containers/0/volumeMounts/-\": missing value]"}"

I was trying to add the file "data-mounts-deployment.yaml" to my deploy and it dfoesnt like the "/template/spec/containers/0/volumeMounts/-"

{"level":"info","version":1,"source":"sas-orchestration","messageKey":"[While processing 'default', key 'SAS_SPRE_APP_CONNECT' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_SPRE_VAR_PATH' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple e..
...
sas-programming-environment-java-policy-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value # Warning: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.\n# Warning: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.\n# Warning: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.\nError: accumulating resources: accumulation err='accumulating resources from 'generation': '/work/deploy/resources/generation' must resolve to a file': recursed accumulation of path '/work/deploy/resources/generation': add operation does not apply: doc is missing path: \"/template/spec/containers/0/volumeMounts/-\": missing value]","messageParameters":{},"properties":{"logger":"pkg/orchestration/reconcileonce","caller":"reconcileonce/reconcileonceflavor.go:44"},"timeStamp":"2023-08-02T14:49:14.311532+00:00","message":"[While processing 'default', key 'SAS_SPRE_APP_CONNECT' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_SPRE_VAR_PATH' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_SPRE_VAR_PATH_LOG' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_SPRE_VAR_PATH_RUN' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_SPRE_VAR_PATH_SPOOL' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_SPRE_VAR_PATH_TMP' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_SPRE_APP_BATCH' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_SPRE_APP_COMPUTE' in ConfigMap 'sas-programming-environment-path-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_INIT_JRE_POLICY_RUNTIME' in ConfigMap 'sas-programming-environment-java-policy-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_INIT_JRE_POLICY_FILE' in ConfigMap 'sas-programming-environment-java-policy-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_INIT_JRE_POLICY_PROPERTY' in ConfigMap 'sas-programming-environment-java-policy-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value\nWhile processing 'default', key 'SAS_INIT_JRE_POLICY_SOCKET' in ConfigMap 'sas-programming-environment-java-policy-config' was defined by multiple components 'sas-batch, sas-compute, sas-connect, sas-job-flow-scheduling, sas-launcher' with the same value # Warning: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.\n# Warning: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.\n# Warning: 'vars' is deprecated. Please use 'replacements' instead. [EXPERIMENTAL] Run 'kustomize edit fix' to update your Kustomization automatically.\nError: accumulating resources: accumulation err='accumulating resources from 'generation': '/work/deploy/resources/generation' must resolve to a file': recursed accumulation of path '/work/deploy/resources/generation': add operation does not apply: doc is missing path: \"/template/spec/containers/0/volumeMounts/-\": missing value]"}
jarpat commented 9 months ago

Since the kustomize build process happens within the sas-deployment-operator-reconcile-* pod that's the place were any build errors would be exposed.

You could run

kubectl \
  get sasdeployments \
  -n name-of-SAS-Viya-namespace \
  -o yaml

Which is formatted and a little easier to view than the logs.

Troubleshooting doc: https://go.documentation.sas.com/doc/en/itopscdc/default/dplyml0phy0dkr/p127f6y30iimr6n17x2xe9vlt54q.htm#p11o2ghzdkqm6kn1qkxqr2wr3nkh

Alternatively and a little more involved, you could do the following:

  1. In your ansible-vars.yaml set DEPLOY: false
  2. Run the viya,install task, since DEPLOY is false only the kustomization and CRD will be generated and not applied into the cluster.
  3. From there you could manually run kustomization build and catch without having to go through the sas-deployment-operator-reconcile pod
  4. When you resolved your issues, set DEPLOY: true and rerun the viya,install tasks