When deploying harbor reconciliation, it fails with the error Templating dir: exit status 1
kubectl get app -A NAMESPACE NAME DESCRIPTION SINCE-DEPLOY AGE tanzu-system-ingress contour Reconcile succeeded 2m45s 16m tanzu-system-registry harbor Reconcile failed: Templating dir: exit status 1 31s
To find out more details about this error and the error description, run the following commands:
kubectl describe app -n tanzu-system-registry harbor Friendly Description: Reconcile failed: Templating dir: exit status 1 Inspect: Error: Inspecting: exit status 1 Exit Code: 1 Stderr: kapp: Error: App 'harbor-ctrl' (namespace: tanzu-system-registry) does not exist: configmaps "harbor-ctrl" not found Stdout: Target cluster 'https://100.64.0.1:443' Updated At: 2020-10-31T15:03:00Z Observed Generation: 1 Template: Error: Templating dir: exit status 1 Exit Code: 1 Stderr: ytt: Error: - cannot load /values.star: Evaluating starlark template: in <toplevel> 01-certificate.yaml:1 | #@ load("/values.star", "values") reason: - module has no .failed field or method (did you mean .fail?) in validate_core 34 | len(values.core.xsrfKey) == 32 or assert.failed("The core xsrf key must be a string of 32 chars") in validate_harbor 96 | validate_func() in <toplevel> 104 | validate_harbor()
The failure occurs because of a mismatch in the length of xsrfKey. The length of the key should be exactly 32 characters. To resolve this issue, correct the length of xsrfKey under tkg-extensions-v1.2.0+vmware.1/extensions/registry/harbor/harbor-data-values.yaml.
Example:grep xsrfKey tkg-extensions-v1.2.0+vmware.1/extensions/registry/harbor/harbor-data-values.yaml xsrfKey: changemechangemechangemechangeme
# Delete secret kubectl delete secret -n tanzu-system-registry harbor-data-values # Edit the harbor-data-values.yaml with a 32 character xsrfKey and create secret kubectl create secret generic harbor-data-values --from-file=values.yaml=tkg-extensions-v1.2.0+vmware.1/extensions/registry/harbor/harbor-data-values.yaml -n tanzu-system-registry
kubectl get app -n tanzu-system-registry NAME DESCRIPTION SINCE-DEPLOY AGE harbor Reconcile succeeded 2m20s 16m