Ballerina extension was installed successfully in visual code. Also I configured ballerina.home
to point to the installed package
ballerina.home = "/Library/Ballerina/ballerina-0.975.1"
Visual code is linting correctly. However, when I introduced @kubernetes:*
annotations:
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 reports an error :
undefined package "kubernetes"
undefined annotation "Deployment"
Nevertheless, I have minikube up and running, and I don't know if I need another extension, so VisualCode can detect running clusters?
Or is it a package that is missing and should be installed inside Ballerina SDK/ Platform?
I am running ballerina build file.bal
, and I can see this errors :
Any thoughts ?
Solved! Just add the import
instruction at the beginning of the file
import ballerinax/kubernetes;
Note, it is ballerinax/kubernetes
and not ballerina/kubernetes
(add x
)
The fine manual very clearly shows that one must import the kubernetes package just like any other. I agree it's a bad error message on their part, so feel free to submit a bug in their repo explaining how to improve your experience