spinkube / spin-plugin-kube

A Spin plugin for interacting with Kubernetes.
Other
27 stars 7 forks source link

memory limit not indented properly #68

Closed bacongobbler closed 7 months ago

bacongobbler commented 7 months ago

There's an indentation bug in spin kube scaffold with --memory-limit set. This causes some commands like helmify to fail.

><> spin kube scaffold -f bacongobbler/myapp:1.0.0 --replicas 3 --autoscaler hpa --cpu-limit 100m --memory-limit 128Mi
apiVersion: core.spinoperator.dev/v1alpha1
kind: SpinApp
metadata:
  name: myapp
spec:
  image: "bacongobbler/myapp:1.0.0"
  executor: containerd-shim-spin
  enableAutoscaling: true
  resources:
    limits:
      cpu: 100m
      memory: 128Mi
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: myapp-autoscaler
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: myapp
  minReplicas: 3
  maxReplicas: 3
  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 60
  - type: Resource
    resource:
     name: memory
      target:
        type: Utilization
        averageUtilization: 60

Expected:

  - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 60

Error:

><> spin kube scaffold -f bacongobbler/myapp:1.0.0 --replicas 3 --autoscaler hpa --cpu-limit 100m --memory-limit 128Mi | ./helmify
INFO[0000] Chart name is not set. Using default name 'chart
ERRO[0000] unable to decode yaml from input              error="error converting YAML to JSON: yaml: line 22: mapping values are not allowed in this context"