We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please answer these questions before submitting your issue. Thanks!
when i generate yaml from kcl, it have repeat run the if conditional .
kind.k
_nodes=[{ role = "control-plane", image = option("kindimage",default="kindest/node:v1.30.0") extraMounts = [ { hostPath = "/home/runner/work/lanactions/lanactions/config/apiserver-audit-policy.yaml", containerPath = "/etc/kubernetes/audit-policy/apiserver-audit-policy.yaml" } ] kubeadmConfigPatches = [ """\ kind: ClusterConfiguration etcd: external: endpoints: [${ETCD_ENDPOINTS}] apiServer: extraArgs: runtime-config: api/all=true storage-media-type: ${REALLY_STORAGE_MEDIA_TYPE} audit-log-path: /var/log/audit/kube-apiserver-audit.log audit-policy-file: /etc/kubernetes/audit-policy/apiserver-audit-policy.yaml extraVolumes: - name: "audit-logs" hostPath: /var/log/audit mountPath: /var/log/audit - name: audit-policy hostPath: /etc/kubernetes/audit-policy mountPath: /etc/kubernetes/audit-policy """ ] } ] _count = option("count",default="default") if _count == 3: print("The value of a is", _count) _nodes+=[{ role = "worker" image = option("kindimage",default="kindest/node:v1.30.0") } ] elif _count == 5: _nodes+=[ { role = "worker" image = option("kindimage",default="kindest/node:v1.30.0") },{ role = "worker" image = option("kindimage",default="kindest/node:v1.30.0") },{ role = "worker" image = option("kindimage",default="kindest/node:v1.30.0") },{ role = "worker" image = option("kindimage",default="kindest/node:v1.30.0") },{ role = "worker" image = option("kindimage",default="kindest/node:v1.30.0") } ] #print("The value of a is", _count) #print(_count==3) #print(_count==5) kind = "Cluster" apiVersion = "kind.x-k8s.io/v1alpha4" networking = { #https://kcl-lang.io/docs/user_docs/support/faq-kcl#39-how-to-set-default-value-for-option-function-in-kcl apiServerAddress = option("apiaddress",default="0.0.0.0") ipFamily = option("ipFamily",default="ipv4") kubeProxyMode = option("kubeProxyMode",default="iptables") } nodes=_nodes
do not run repeat if condition.
You can see that print was executed repeatedly, and i just print once. Remind me if i missed something,Thanks.
$ kcl kind2.k -D count=3 The value of a is 3 The value of a is 3 The value of a is 3 The value of a is 3 kind: Cluster apiVersion: kind.x-k8s.io/v1alpha4 networking: apiServerAddress: '0.0.0.0' ipFamily: ipv4 kubeProxyMode: iptables nodes: - role: control-plane image: kindest/node:v1.30.0 extraMounts: - hostPath: /home/runner/work/lanactions/lanactions/config/apiserver-audit-policy.yaml containerPath: /etc/kubernetes/audit-policy/apiserver-audit-policy.yaml kubeadmConfigPatches: - | kind: ClusterConfiguration etcd: external: endpoints: [http://192.168.66.2:2379] apiServer: extraArgs: runtime-config: api/all=true storage-media-type: application/json audit-log-path: /var/log/audit/kube-apiserver-audit.log audit-policy-file: /etc/kubernetes/audit-policy/apiserver-audit-policy.yaml extraVolumes: - name: "audit-logs" hostPath: /var/log/audit mountPath: /var/log/audit - name: audit-policy hostPath: /etc/kubernetes/audit-policy mountPath: /etc/kubernetes/audit-policy - role: worker image: kindest/node:v1.30.0 - role: worker image: kindest/node:v1.30.0 - role: worker image: kindest/node:v1.30.0
$ kcl version 0.9.0-beta.1-linux-amd64
The text was updated successfully, but these errors were encountered:
Minimal reproduce step
_a = 1 if True: _a += 1 elif False: _a += 1 a=_a
Sorry, something went wrong.
Closed by #1416, #1418 and #1423
Peefy
No branches or pull requests
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
when i generate yaml from kcl, it have repeat run the if conditional .
kind.k
2. What did you expect to see? (Required)
do not run repeat if condition.
3. What did you see instead (Required)
You can see that print was executed repeatedly, and i just print once. Remind me if i missed something,Thanks.
4. What is your KCL components version? (Required)
The text was updated successfully, but these errors were encountered: