shalb / cluster.dev

Cloud-native infrastructure templating. Creating cloud installers for SaaS. Replication of complex cloud-native infrastructures.
https://docs.cluster.dev/
GNU Affero General Public License v3.0
401 stars 36 forks source link

The kubernetes unit does not find the source file if it is above the current directory #277

Closed kinseii closed 1 month ago

kinseii commented 3 months ago

Problem: The kubernetes unit does not find the source file if it is above the current directory (with relative path ../):

---
kind: StackTemplate
name: service
units:
  - name: test-configmap
    type: kubernetes
    provider_conf:
      config_context: {{ .variables.cluster_name }}
    source: ../../_templates/test-configmap/test-configmap.yaml

Error output:

19:25:12 [FATAL] Fatal error: load project configuration: read units: stack 'qwerty-aks-us-1', reading units: reading kubernetes unit 'qwerty-aks-us-1.test-configmap': reading kubernetes manifests form source '../../_templates/test-configmap/test-configmap.yaml': stat ../../_templates/test-configmap/test-configmap.yaml: no such file or directory
Unit data:
name: test-configmap
provider_conf:
    config_context: qwerty-aks-us-1
source: ../../_templates/test-configmap/test-configmap.yaml
type: kubernetes

If you don't use exit above the current directory, everything works. Example:

kind: StackTemplate
name: service
units:
  - name: test-configmap
    type: kubernetes
    provider_conf:
      config_context: {{ .variables.cluster_name }}
    source: ./test-configmap/test-configmap.yaml

Cluster.dev Version: cdev version v0.9.5

kinseii commented 3 months ago

Successfully works from the current directory with ./, thus: source: ./../../_templates/test-configmap/test-configmap.yaml. But it may be worthwhile to provide for operation without specifying ./.

romanprog commented 2 months ago

Bug. Thanks for report.

romanprog commented 1 month ago

Should work correct in https://github.com/shalb/cluster.dev/releases/tag/v0.9.6 Check pls

kinseii commented 1 month ago

Worked, thanx!