KusionStack / konfig

Shared repository of application models and components, and CI suite for GitOps workflows
Apache License 2.0
27 stars 32 forks source link

Attribute error occurs during compiling #18

Closed LeoLiuYan closed 2 years ago

LeoLiuYan commented 2 years ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

konfig/appops/guestbook-frontend/test/main.k

import base.pkg.kusion_models.kube.frontend
import base.pkg.kusion_models.kube.frontend.container
import base.pkg.kusion_models.kube.frontend.container.probe
import base.pkg.kusion_models.kube.frontend.container.lifecycle as lc
import base.pkg.kusion_models.kube.templates.resource as res_tpl

# The application configuration in stack will overwrite
# the configuration with the same attribute in base.
appConfiguration: frontend.Server {
    image = "gcr.io/google-samples/gb-frontend:v4-test"
    schedulingStrategy.resource = res_tpl.tiny

    mainContainer: container.Main {
        lifecycle: lc.Lifecycle {
           preStop = probe.Exec {
               command = ["/bin/sh", "-c", "echo 1"]
           }
        }
    }
}

2. What did you expect to see? (Required)

Kusion compile success.

3. What did you see instead (Required)

 ---> File /Users/liuyan_1/Projects/github/konfig/base/pkg/kusion_models/kube/utils/container_frontend2kube.k:96
      96 |                } if c.lifecycle.preStop.type == "exec" else Undefined -> Failure
      schema 'base.pkg.kusion_models.kube.frontend.container.probe.Exec' attribute 'type' not found

4. What is your KusionStack components version? (Required)

releaseVersion: v0.5.3
gitInfo:
    latestTag: v0.5.3
    commit: 7611976b68b1a5124e801a18a94072222ea88851
    treeState: clean
buildInfo:
    goVersion: go1.17.12
    GOOS: linux
    GOARCH: amd64
    numCPU: 2
    compiler: gc
    buildTime: "2022-08-05 09:10:29"
dependency:
    kclvmgoVersion: v0.4.3-alpha.1
    kclPluginVersion: v0.4.1-alpha2