Closed wilsonwang371 closed 8 months ago
The instance function calling requires the schema instances which are in the main package. This is because it is necessary to control the impact of configuration changes as much as possible, so this limitation is added.
if this is the case, how do I call a function and get a list of objects that I want to access later? Assuming I no longer have a direct reference to the return value.
Does your scenario still assume that the instance method of a schema is called in the function? Or can be used as follows
schema InputSchema:
schema OutputSchema:
getSchemaList = lambda input: InputSchema -> [OutputSchema] {
[OutputSchema {}]
}
alist = getSchemaList(InputSchema {})
here is my code
import pkg.abc.clusters as cl
import pkg.abc.environ as env
import manifests
clusters = env.getClusters()
appTemplates = [
cl.AppTemplate {
appName = "myapp"
revision = "master"
valueFiles = ["values.yaml"]
}
cl.AppTemplate {
appName = "myapp"
revision = "master"
valueFiles = ["values.yaml"]
}
cl.AppTemplate {
appName = "myapp"
revision = "master"
}
]
cl.Project {
project = "myproject1"
repoURL = "https://github.com/abc.git"
path = "a/b/c"
autoSync = True
}
clusteredAppTemplates = cl.genClusteredAppTemplates(appTemplates, clusters) # in this function, it need access all single instances in clusterdeploys list
print(clusteredAppTemplates)
res = cl.createAllApps()
manifests.yaml_stream(res)
However, in my code, it is printing null at the last line
I see. We usually recommend this method to do it here https://github.com/kcl-lang/konfig/blob/main/examples/appops/nginx-example/dev/main.k
Here, a render file is used to perform rendering or deploy logic
ideally, I assume all elements in clusteredAppTemplates can be accessed by their schema's instances() call.
I see. We usually recommend this method to do it here https://github.com/kcl-lang/konfig/blob/main/examples/appops/nginx-example/dev/main.k
Here, a render file is used to perform rendering or deploy logic
let me take a look
General Question
If I am creating a list of schema A inside one of my lambdas, how do I later get the returned list items through schema A's instances() call?
The result is null