Closed riven-blade closed 2 months ago
General Question
dev % kcl run main.k error[E2L23]: CompileError --> /Users/doudou/.kcl/kpm/k8s_1.28/api/apps/v1/deployment.k:26:12 | 26 | spec?: DeploymentSpec | ^ name 'DeploymentSpec' is not defined, did you mean '["Deployment"]'?
import k8s.api.apps.v1.deployment app: deployment.Deployment { apiVersion = "apps/v1" kind = "Deployment" metadata = { ..... spec = { progressDeadlineSeconds = 600 replicas = 2 revisionHistoryLimit = 10 selector = {
You can write the following code
import k8s.api.apps.v1 # Import the full package instead of the single deployment.k
app: v1.Deployment {
apiVersion = "apps/v1"
kind = "Deployment"
metadata = {
.....
spec = {
progressDeadlineSeconds = 600
replicas = 2
revisionHistoryLimit = 10
selector = {
This is because KCL supports importing a single file, and the single file only contains the definition of Deployment but not the definition of Deployment Spec
Yes, you are right. Thank you
General Question
dev % kcl run main.k error[E2L23]: CompileError --> /Users/doudou/.kcl/kpm/k8s_1.28/api/apps/v1/deployment.k:26:12 | 26 | spec?: DeploymentSpec | ^ name 'DeploymentSpec' is not defined, did you mean '["Deployment"]'?