gpt4 book ai didi

kubernetes - 芭蕾舞女 Actor “undefined package ”与Visual Code中的kubernetes

转载 作者:行者123 更新时间:2023-12-02 11:51:07 25 4
gpt4 key购买 nike

在可视代码中已成功安装Ballerina extension
我还配置了ballerina.home指向已安装的软件包

ballerina.home = "/Library/Ballerina/ballerina-0.975.1"

可视代码正确无误。但是,当我介绍 @kubernetes:*批注时:
import ballerina/http;
import ballerina/log;

@kubernetes:Deployment {
enableLiveness: true,
image: "ballerina/ballerina-platform",
name: "ballerina-abdennour-demo"
}

@kubernetes:Service {
serviceType: "NodePort",
name: "ballerina-abdennour-demo"

}
service<http:Service> hello bind { port: 9090 } {
sayHello (endpoint caller, http:Request request) {
http:Response res = new;
res.setPayload("Hello World from Ballerina Service");
caller ->respond(res) but { error e => log:printError("Error sending response", err = e)};

}
}

VisualCode报告错误:
undefined package "kubernetes"
undefined annotation "Deployment"

但是,我已经启动并运行了minikube,并且我不知道是否需要其他扩展,因此VisualCode可以检测正在运行的群集吗?

还是它是缺少的软件包,应该安装在Ballerina SDK / Platform中?

更新

我正在运行 ballerina build file.bal,我可以看到此错误:

enter image description here

有什么想法吗 ?

最佳答案

解决了!只需在文件开头添加import指令

import ballerinax/kubernetes;

注意,它是 ballerinax/kubernetes而不是 ballerina/kubernetes(添加 x)

关于kubernetes - 芭蕾舞女 Actor “undefined package ”与Visual Code中的kubernetes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51340851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com