├── VERSION ├── examples ├── konfig │ ├── kcl.mod.lock │ ├── kcl.mod │ ├── Makefile │ ├── app │ │ ├── kcl.yaml │ │ └── main.k │ └── pkg │ │ ├── render │ │ └── render.k │ │ └── app │ │ └── app_module.k ├── definition │ ├── kcl.mod.lock │ ├── kcl.mod │ ├── Makefile │ ├── main.k │ └── app_module.k ├── gitops │ ├── config │ │ ├── kcl.mod │ │ ├── kcl.yaml │ │ └── main.k │ └── install │ │ └── kcl-cmp.yaml ├── codelab │ ├── schema │ │ ├── kcl.mod.lock │ │ ├── kcl.mod │ │ ├── makefile │ │ ├── pkg │ │ │ ├── server.k │ │ │ ├── pvc.k │ │ │ └── deploy.k │ │ ├── pkg_server.k │ │ └── k8spkg │ │ │ └── api │ │ │ ├── core │ │ │ └── v1 │ │ │ │ ├── sysctl.k │ │ │ │ ├── pod_readiness_gate.k │ │ │ │ ├── pod_dns_config_option.k │ │ │ │ ├── http_header.k │ │ │ │ ├── capabilities.k │ │ │ │ ├── session_affinity_config.k │ │ │ │ ├── namespace_spec.k │ │ │ │ ├── local_object_reference.k │ │ │ │ ├── downward_api_projection.k │ │ │ │ ├── node_config_source.k │ │ │ │ ├── host_alias.k │ │ │ │ ├── client_ip_config.k │ │ │ │ ├── node_selector.k │ │ │ │ ├── volume_device.k │ │ │ │ ├── object_field_selector.k │ │ │ │ ├── tcp_socket_action.k │ │ │ │ ├── config_map_key_selector.k │ │ │ │ ├── photon_persistent_disk_volume_source.k │ │ │ │ ├── exec_action.k │ │ │ │ ├── weighted_pod_affinity_term.k │ │ │ │ ├── secret_env_source.k │ │ │ │ ├── env_from_source.k │ │ │ │ ├── config_map_env_source.k │ │ │ │ ├── secret_key_selector.k │ │ │ │ ├── preferred_scheduling_term.k │ │ │ │ ├── resource_field_selector.k │ │ │ │ ├── azure_file_volume_source.k │ │ │ │ ├── node_selector_term.k │ │ │ │ ├── flocker_volume_source.k │ │ │ │ ├── handler.k │ │ │ │ ├── host_path_volume_source.k │ │ │ │ ├── pod_template_spec.k │ │ │ │ └── se_linux_options.k │ │ │ ├── apps │ │ │ └── v1 │ │ │ │ ├── rolling_update_stateful_set_strategy.k │ │ │ │ ├── deployment_strategy.k │ │ │ │ ├── daemon_set_update_strategy.k │ │ │ │ └── stateful_set_update_strategy.k │ │ │ ├── rbac │ │ │ └── v1 │ │ │ │ ├── role_ref.k │ │ │ │ └── aggregation_rule.k │ │ │ ├── networking │ │ │ └── v1 │ │ │ │ ├── service_backend_port.k │ │ │ │ ├── http_ingress_rule_value.k │ │ │ │ └── ingress_service_backend.k │ │ │ └── autoscaling │ │ │ └── v1 │ │ │ └── cross_version_object_reference.k │ ├── collaborative │ │ ├── kcl.mod.lock │ │ ├── kcl.mod │ │ ├── appops │ │ │ └── test_app │ │ │ │ ├── dev │ │ │ │ ├── kcl.yaml │ │ │ │ ├── main.k │ │ │ │ └── ci-test │ │ │ │ │ └── stdout.golden.yaml │ │ │ │ ├── prod │ │ │ │ ├── kcl.yaml │ │ │ │ ├── main.k │ │ │ │ └── ci-test │ │ │ │ │ └── stdout.golden.yaml │ │ │ │ └── base │ │ │ │ └── base.k │ │ ├── makefile │ │ └── pkg │ │ │ └── server.k │ ├── Makefile │ └── simple │ │ ├── makefile │ │ ├── my_config_test.k │ │ └── my_config.k ├── quickstart │ ├── hello.k │ ├── database.k │ └── server.k ├── secret-management │ └── vault │ │ ├── kcl.mod.lock │ │ ├── kcl.mod │ │ └── main.k ├── import │ ├── crd │ │ ├── main.k │ │ ├── kcl.mod │ │ ├── kcl.mod.lock │ │ └── Makefile │ ├── Makefile │ └── jsonschema │ │ └── Makefile ├── kubernetes │ ├── Makefile │ └── generate-manifests │ │ ├── Makefile │ │ ├── kcl.yaml │ │ └── main.k ├── server │ ├── Makefile │ ├── kcl.mod │ └── kcl.mod.lock ├── mutation │ ├── Makefile │ └── transformer.k ├── README.md ├── settings │ ├── Makefile │ ├── file.k │ └── settings.yaml ├── validation │ ├── Makefile │ ├── schema.k │ └── data.json ├── package-management │ ├── Makefile │ ├── git │ │ └── my_package │ │ │ ├── Makefile │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ └── oci │ │ └── my_package │ │ ├── Makefile │ │ ├── kcl.mod │ │ ├── kcl.mod.lock │ │ └── main.k ├── abstraction │ ├── kcl.mod │ ├── kcl.mod.lock │ ├── Makefile │ ├── main.k │ └── kubernetes_render_test.k ├── source │ ├── makefile │ ├── oci │ │ └── makefile │ └── git │ │ └── makefile ├── configuration │ ├── Makefile │ ├── db.k │ └── nginx.k ├── data-integration │ ├── Makefile │ ├── json.k │ └── yaml.k ├── automation │ ├── Makefile │ └── main.k ├── kubernetes.k ├── terraform │ └── validation │ │ ├── main.k │ │ ├── main.policy.failure.k │ │ └── main.tf ├── test.sh └── test.ps1 ├── pkg ├── options │ ├── testdata │ │ ├── run_pkg │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── run_opt │ │ │ ├── file1.k │ │ │ ├── file2.k │ │ │ └── file3.k │ │ └── run │ │ │ └── kubernetes.k │ └── constants.go └── version │ └── version_test.go ├── scripts ├── e2e │ ├── pkg_in_reg │ │ ├── kcl2 │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ └── kcl1 │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ ├── e2e-init.sh │ ├── e2e.sh │ └── pull_pkg.sh ├── verify-govet.sh ├── tag.sh ├── release.sh ├── update-gofmt.sh └── verify-gofmt.sh ├── test └── e2e │ ├── test_suites │ ├── test_kcl_run │ │ ├── stderr │ │ ├── input │ │ ├── stdout │ │ └── test_space │ │ │ └── main.k │ ├── test_kcl_run_0 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ └── main.k │ │ └── stdout │ ├── test_kcl_run_1 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── run.k │ │ │ └── run1.k │ │ ├── stdout │ │ └── input │ ├── test_kcl_run_10 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_11 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_12 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_13 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ ├── sub │ │ │ │ └── sub.k │ │ │ └── kcl.mod │ │ └── stdout │ ├── test_kcl_run_14 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ ├── sub │ │ │ │ └── sub.k │ │ │ ├── kcl.yaml │ │ │ └── kcl.mod │ │ └── stdout │ ├── test_kcl_run_15 │ │ ├── stderr │ │ ├── input │ │ ├── stdout │ │ └── test_space │ │ │ ├── vendor │ │ │ └── run_5_0.0.1 │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ ├── test_kcl_run_16 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl_6 │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── sub │ │ │ │ │ └── main.k │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ ├── kcl_7 │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── sub_7 │ │ │ │ │ └── main.k │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ └── kcl.yaml │ │ └── stdout │ ├── test_kcl_run_17 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── sub │ │ │ └── sub.k │ │ └── stdout │ ├── test_kcl_run_18 │ │ ├── stderr │ │ ├── input │ │ ├── stdout │ │ └── test_space │ │ │ └── main.k │ ├── test_kcl_run_19 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_2 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_20 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── base.k │ │ │ └── main.k │ │ ├── stdout │ │ └── input │ ├── test_kcl_run_21 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── sub │ │ │ │ └── sub.k │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_22 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ ├── sub │ │ │ │ └── sub.k │ │ │ ├── kcl.yaml │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_23 │ │ ├── stderr │ │ ├── input │ │ ├── stdout │ │ └── test_space │ │ │ └── main.k │ ├── test_kcl_run_24 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_25 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── base.k │ │ │ └── main.k │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_26 │ │ ├── stderr │ │ ├── stdout │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── sub │ │ │ │ └── sub.k │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ └── input │ ├── test_kcl_run_27 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ ├── sub │ │ │ │ └── sub.k │ │ │ ├── kcl.yaml │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_28 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ │ └── stdout │ ├── test_kcl_run_29 │ │ ├── stderr │ │ ├── stdout │ │ └── input │ ├── test_kcl_run_3 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ └── stdout │ ├── test_kcl_run_30 │ │ ├── stderr │ │ ├── stdout │ │ └── input │ ├── test_kcl_run_31 │ │ ├── stderr │ │ ├── stdout │ │ └── input │ ├── test_kcl_run_32 │ │ ├── stderr │ │ ├── stdout │ │ └── input │ ├── test_kcl_run_4 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_5 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_6 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_7 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_8 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_run_9 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_mod_graph │ │ ├── input │ │ ├── stderr │ │ ├── stdout │ │ └── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ ├── test_add_oci_ref_tag │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_add_git │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_oci │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_init │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_init_0 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ └── main.k │ │ └── stdout │ ├── test_kcl_mod_init_1 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ └── stdout │ ├── test_kcl_mod_init_2 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ └── main.k │ │ └── stdout │ ├── test_kcl_mod_pkg │ │ ├── stderr │ │ ├── stdout │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ └── input │ ├── test_kcl_mod_pull │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_pull_0 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_pull_1 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_pull_2 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_pull_3 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_pull_4 │ │ ├── stderr │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_push │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ └── stdout │ ├── test_kcl_mod_push_0 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_update │ │ ├── stderr │ │ ├── stdout │ │ ├── input │ │ └── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ ├── test_kcl_run_invalid │ │ ├── stdout │ │ ├── input │ │ └── stderr │ ├── test_kcl_run_print │ │ ├── stderr │ │ ├── input │ │ ├── stdout │ │ └── test_space │ │ │ └── main.k │ ├── test_mod_add_rename │ │ ├── stderr │ │ ├── input │ │ ├── stdout │ │ └── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ ├── test_kcl_mod_add_git_1 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_git_2 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_git_3 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_git_4 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_git_5 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_git_url │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_local │ │ ├── stderr │ │ ├── test_space │ │ │ ├── dep │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ └── pkg │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ ├── input │ │ ├── conf.json │ │ └── stdout │ ├── test_kcl_mod_add_local_0 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── pkg │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ └── dep │ │ │ │ ├── main.k │ │ │ │ ├── kcl.mod │ │ │ │ └── kcl.mod.lock │ │ ├── conf.json │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_add_oci_0 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ ├── test_kcl_mod_add_oci_1 │ │ ├── stderr │ │ ├── input │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ └── stdout │ ├── test_kcl_mod_add_oci_url │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_update_0 │ │ ├── stderr │ │ ├── stdout │ │ ├── test_space │ │ │ └── pkg │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ └── input │ ├── test_kcl_run_invalid_0 │ │ ├── stdout │ │ ├── input │ │ └── stderr │ ├── test_kcl_run_invalid_1 │ │ ├── stdout │ │ ├── input │ │ └── stderr │ ├── test_kcl_run_invalid_2 │ │ ├── stdout │ │ ├── stderr │ │ └── input │ ├── test_mod_add_rename_0 │ │ ├── stderr │ │ ├── stdout │ │ ├── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ │ └── input │ ├── test_mod_add_rename_1 │ │ ├── stderr │ │ ├── stdout │ │ ├── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ │ └── input │ ├── test_mod_add_rename_2 │ │ ├── stderr │ │ ├── stdout │ │ ├── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ │ └── input │ ├── test_kcl_mod_add_git_modspec │ │ ├── stderr │ │ ├── stdout │ │ ├── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ │ └── input │ ├── test_kcl_mod_add_git_modspec_0 │ │ ├── stderr │ │ ├── stdout │ │ ├── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ │ └── input │ ├── test_kcl_mod_add_git_url_1 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_git_url_2 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_git_url_3 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_git_url_4 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_oci_modspec │ │ ├── stderr │ │ ├── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_oci_modspec_0 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── main.k │ │ │ ├── kcl.mod │ │ │ └── kcl.mod.lock │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_oci_url_1 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_oci_url_2 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_oci_url_3 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_oci_url_4 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_add_oci_url_5 │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── stdout │ │ └── input │ ├── test_kcl_mod_push_existing_package_with_force │ │ ├── stderr │ │ ├── test_space │ │ │ ├── kcl.mod.lock │ │ │ ├── main.k │ │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ └── test_kcl_mod_push_existing_package_without_force │ │ ├── stderr │ │ ├── test_space │ │ ├── kcl.mod.lock │ │ ├── main.k │ │ └── kcl.mod │ │ ├── input │ │ └── stdout │ └── e2e_suite_test.go ├── cmd ├── kcl │ ├── commands │ │ ├── test_data │ │ │ ├── test_mod_add │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ ├── test_mod_push │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ ├── test_mod_graph │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ ├── test_mod_metadata │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ │ └── test_mod_update │ │ │ │ ├── kcl.mod.lock │ │ │ │ ├── main.k │ │ │ │ └── kcl.mod │ │ └── version.go │ └── main.go └── kclx │ ├── examples │ ├── Makefile │ └── main.k │ └── main.go ├── doc.go ├── .gitignore └── .github └── dependabot.yml /VERSION: -------------------------------------------------------------------------------- 1 | 0.12.3 2 | -------------------------------------------------------------------------------- /examples/konfig/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/definition/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/gitops/config/kcl.mod: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/codelab/schema/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/quickstart/hello.k: -------------------------------------------------------------------------------- 1 | hello = "KCL" -------------------------------------------------------------------------------- /pkg/options/testdata/run_pkg/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/e2e/pkg_in_reg/kcl2/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_1/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_10/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_11/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_12/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_13/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_14/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_17/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_18/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_19/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_2/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_20/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_21/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_22/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_23/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_24/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_25/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_26/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_27/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_28/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_29/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_3/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_30/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_31/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_32/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_4/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_5/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_6/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_7/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_8/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_9/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_graph/input: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_graph/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/definition/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | 3 | -------------------------------------------------------------------------------- /examples/secret-management/vault/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pkg/options/testdata/run_opt/file1.k: -------------------------------------------------------------------------------- 1 | file1 = 1 -------------------------------------------------------------------------------- /pkg/options/testdata/run_opt/file2.k: -------------------------------------------------------------------------------- 1 | file2 = 2 -------------------------------------------------------------------------------- /pkg/options/testdata/run_opt/file3.k: -------------------------------------------------------------------------------- 1 | file3 = 3 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_add_oci_ref_tag/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_1/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_2/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pkg/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pkg/stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_1/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_2/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_3/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_4/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update/stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_3/input: -------------------------------------------------------------------------------- 1 | kcl run -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid/stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_print/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_add/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_push/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmd/kclx/examples/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kclx main.k 3 | -------------------------------------------------------------------------------- /examples/codelab/schema/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | 3 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_1/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_2/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_3/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_4/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_5/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_1/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update_0/stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_13/input: -------------------------------------------------------------------------------- 1 | kcl run -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_14/input: -------------------------------------------------------------------------------- 1 | kcl run -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/input: -------------------------------------------------------------------------------- 1 | kcl run -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_17/input: -------------------------------------------------------------------------------- 1 | kcl run -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_26/stdout: -------------------------------------------------------------------------------- 1 | sub: SUB -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_28/input: -------------------------------------------------------------------------------- 1 | kcl run -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_0/stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_1/stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_2/stdout: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_print/input: -------------------------------------------------------------------------------- 1 | kcl run -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_1/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_2/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_graph/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_metadata/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_update/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | 3 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_1/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_2/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_3/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_4/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_1/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_2/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_3/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_4/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_5/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init/input: -------------------------------------------------------------------------------- 1 | kcl mod init -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_0/input: -------------------------------------------------------------------------------- 1 | kcl mod init -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_1/input: -------------------------------------------------------------------------------- 1 | kcl mod init -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_2/input: -------------------------------------------------------------------------------- 1 | kcl mod init -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push/input: -------------------------------------------------------------------------------- 1 | kcl mod push -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/input: -------------------------------------------------------------------------------- 1 | kcl run --vendor -------------------------------------------------------------------------------- /examples/konfig/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "konfig" 3 | 4 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pkg/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update/input: -------------------------------------------------------------------------------- 1 | kcl mod update -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_13/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_14/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_17/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_19/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_21/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_22/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_24/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_26/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_27/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_3/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_print/stdout: -------------------------------------------------------------------------------- 1 | Hello World ! -------------------------------------------------------------------------------- /examples/import/crd/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_add_oci_ref_tag/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_1/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_2/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_3/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_4/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_5/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_0/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_1/input: -------------------------------------------------------------------------------- 1 | kcl mod add kcl1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_1/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_0/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_1/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull/input: -------------------------------------------------------------------------------- 1 | kcl mod pull helloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_0/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl_6/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl_7/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_20/test_space/base.k: -------------------------------------------------------------------------------- 1 | base = "Base" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_21/test_space/sub/sub.k: -------------------------------------------------------------------------------- 1 | sub = "SUB" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_25/test_space/base.k: -------------------------------------------------------------------------------- 1 | base = "Base" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_26/test_space/sub/sub.k: -------------------------------------------------------------------------------- 1 | sub = "SUB" -------------------------------------------------------------------------------- /examples/kubernetes/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | make -C generate-manifests 3 | -------------------------------------------------------------------------------- /pkg/options/testdata/run_pkg/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /scripts/e2e/pkg_in_reg/kcl1/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /scripts/e2e/pkg_in_reg/kcl2/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_1/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_2/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_3/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_4/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/test_space/dep/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/test_space/pkg/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/test_space/pkg/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci/input: -------------------------------------------------------------------------------- 1 | kcl mod add helloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_1/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_2/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_3/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_4/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_5/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_with_force/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update_0/test_space/pkg/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_1/test_space/run.k: -------------------------------------------------------------------------------- 1 | run = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_23/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_24/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_25/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_26/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_27/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_0/input: -------------------------------------------------------------------------------- 1 | kcl run --tag v0.1.0 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_0/input: -------------------------------------------------------------------------------- 1 | kcl mod add helloworld:0.1.1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_0/input: -------------------------------------------------------------------------------- 1 | kcl mod pull helloworld:0.1.1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_without_force/stderr: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space/main.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_1/test_space/run1.k: -------------------------------------------------------------------------------- 1 | run_1 = 'Hello World 1 !' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/stdout: -------------------------------------------------------------------------------- 1 | a: A package in vendor path 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl_6/sub/main.k: -------------------------------------------------------------------------------- 1 | sub6 = "sub6" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_28/test_space/main.k: -------------------------------------------------------------------------------- 1 | hello = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_31/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_graph/stdout: -------------------------------------------------------------------------------- 1 | test_space@0.0.1 helloworld@0.1.4 -------------------------------------------------------------------------------- /cmd/kclx/examples/main.k: -------------------------------------------------------------------------------- 1 | import kcl_plugin.hello 2 | 3 | a = hello.add(1, 1) 4 | -------------------------------------------------------------------------------- /examples/definition/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl main.k 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /examples/server/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl server.k 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_add_oci_ref_tag/input: -------------------------------------------------------------------------------- 1 | kcl mod add helloworld --tag 0.1.1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/test_space/vendor/run_5_0.0.1/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl_7/sub_7/main.k: -------------------------------------------------------------------------------- 1 | sub7 = "sub7" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_18/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space/main.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_18/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_19/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space/main.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_19/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_21/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space/main.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_21/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_22/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space/main.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_22/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_23/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_24/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_27/stdout: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program: Hello Sub World! -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_3/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_32/stdout: -------------------------------------------------------------------------------- 1 | The_first_kcl_program: Hello World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_print/test_space/main.k: -------------------------------------------------------------------------------- 1 | print("Hello World !") -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_add/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_graph/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_push/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_update/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /examples/kubernetes/generate-manifests/Makefile: -------------------------------------------------------------------------------- 1 | default: 2 | kcl main.k -Y kcl.yaml 3 | -------------------------------------------------------------------------------- /examples/mutation/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl -Y kcl.yaml 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/input: -------------------------------------------------------------------------------- 1 | kcl mod add /test_space/dep -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pkg/input: -------------------------------------------------------------------------------- 1 | kcl mod pkg --target /test_space -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_13/stdout: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program: Hello Sub World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_14/stdout: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program: Hello Sub World! 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_17/sub/sub.k: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program = "Hello Sub World!" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_2/input: -------------------------------------------------------------------------------- 1 | kcl run oci://localhost:5001/test/helloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_29/stdout: -------------------------------------------------------------------------------- 1 | The_first_sub_kcl_program: Hello Sub World! -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_30/stdout: -------------------------------------------------------------------------------- 1 | The_first_sub_kcl_program: Hello Sub World! -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_metadata/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples 2 | 3 | This folder contains a collection of KCL examples: 4 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'konfig:0.10.0' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_1/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'konfig:0.14.0' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_2/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'konfig:0.14.0' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_3/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'konfig:0.14.0' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_4/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'konfig:0.14.0' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_5/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'konfig:0.14.0' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "cwd": "test_space/pkg" 3 | } -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "cwd": "test_space/pkg" 3 | } -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/input: -------------------------------------------------------------------------------- 1 | kcl mod add /test_space/dep -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_1/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'kcl1:0.0.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pkg/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_0/input: -------------------------------------------------------------------------------- 1 | kcl mod push oci://localhost:5001/myrepo:latest -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_with_force/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_without_force/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update_0/input: -------------------------------------------------------------------------------- 1 | kcl mod update /test_space/pkg -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_0/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space/main.k --format json -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_0/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_1/stdout: -------------------------------------------------------------------------------- 1 | run: Hello World! 2 | run_1: Hello World 1 ! 3 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_13/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_14/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/test_space/main.k: -------------------------------------------------------------------------------- 1 | import run_5 as r5 2 | 3 | a = r5.run5 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_17/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_18/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_19/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_20/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_21/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_22/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_23/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_24/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_25/stdout: -------------------------------------------------------------------------------- 1 | base: Base 2 | The_first_kcl_program: Hello World! -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_25/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_26/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_27/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_3/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename/input: -------------------------------------------------------------------------------- 1 | kcl mod add helloworld --rename newhelloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.4' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_graph/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | // KCL CLI is the whole CLI for kcl languages, tools and integrations. 2 | package main 3 | -------------------------------------------------------------------------------- /examples/konfig/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | cd app && kcl run && cd .. 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /examples/settings/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl run -Y settings.yaml 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /examples/settings/file.k: -------------------------------------------------------------------------------- 1 | env = option("env-type") 2 | deploy_topology = option("deploy-topology") -------------------------------------------------------------------------------- /examples/validation/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl vet data.json schema.k 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_add_oci_ref_tag/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.4' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_add_oci_ref_tag/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'dep:0.0.1' successfully 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.4' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_0/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.4' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_0/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_1/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_2/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_0/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_11/input: -------------------------------------------------------------------------------- 1 | kcl run --oci https://localhost:5001/test/helloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_13/test_space/sub/sub.k: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program = "Hello Sub World!" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_14/test_space/sub/sub.k: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program = "Hello Sub World!" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_20/stdout: -------------------------------------------------------------------------------- 1 | base: Base 2 | The_first_kcl_program: Hello World! 3 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_22/test_space/sub/sub.k: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program = "Hello Sub World!" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_27/test_space/sub/sub.k: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program = "Hello Sub World!" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_4/input: -------------------------------------------------------------------------------- 1 | kcl run oci://ghcr.io/kcl-lang/helloworld --tag 0.1.0 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_0/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.4' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_0/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_1/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'subhelloworld:0.0.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_1/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_2/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.2' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_2/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /examples/codelab/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | make -C simple 3 | make -C schema 4 | make -C collaborative 5 | -------------------------------------------------------------------------------- /examples/kubernetes/generate-manifests/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_options: 2 | - key: env 3 | value: prod 4 | -------------------------------------------------------------------------------- /examples/package-management/Makefile: -------------------------------------------------------------------------------- 1 | test: 2 | make -C git/my_package 3 | make -C oci/my_package 4 | -------------------------------------------------------------------------------- /examples/package-management/git/my_package/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl run 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /examples/package-management/oci/my_package/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl run 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_1/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_2/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_3/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_4/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_5/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'cc:0.0.1' successfully 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'cc:0.0.1' successfully 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'flask_manifests:0.0.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_1/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_2/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_3/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_4/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/test_space/dep/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/test_space/pkg/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_0/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_1/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url/input: -------------------------------------------------------------------------------- 1 | kcl mod add oci://localhost:5001/test/helloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_1/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_1/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_2/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.4' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_2/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_3/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_3/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_4/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.4' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_4/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_5/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'helloworld:0.1.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_5/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update_0/test_space/pkg/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_0/stdout: -------------------------------------------------------------------------------- 1 | { 2 | "The_first_kcl_program": "Hello World!" 3 | } 4 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_12/input: -------------------------------------------------------------------------------- 1 | kcl run --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.0 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/stdout: -------------------------------------------------------------------------------- 1 | kcl_6: KCL 6 2 | a: sub6 3 | kcl_7: KCL 7 4 | b: sub7 5 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_28/stdout: -------------------------------------------------------------------------------- 1 | hello: Hello World! 2 | The_first_kcl_program: Hello World! -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_0/stderr: -------------------------------------------------------------------------------- 1 | cannot specify tag, commit, or branch without modules -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_2/stderr: -------------------------------------------------------------------------------- 1 | only one of tag, commit, or branch can be specified -------------------------------------------------------------------------------- /examples/import/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | make test 3 | 4 | test: 5 | make -C crd 6 | make -C jsonschema 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_1/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'flask_manifests:0.0.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_2/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'flask_manifests:0.0.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_3/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'flask_manifests:0.0.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_4/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'flask_manifests:0.0.1' successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/test_space/dep/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/test_space/pkg/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/main.k: -------------------------------------------------------------------------------- 1 | The_first_kcl_program = 'Hello World!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_2/input: -------------------------------------------------------------------------------- 1 | kcl mod add --oci oci://localhost:5001/test/helloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_4/input: -------------------------------------------------------------------------------- 1 | kcl mod add --oci http://localhost:5001/test/helloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_1/input: -------------------------------------------------------------------------------- 1 | kcl mod pull oci://localhost:5001/test/helloworld --tag 0.1.1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_1/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space/run.k /test_space/run1.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_14/test_space/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | files: 3 | - sub/sub.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/test_space/vendor/run_5_0.0.1/main.k: -------------------------------------------------------------------------------- 1 | run5 = 'A package in vendor path' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_22/test_space/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | files: 3 | - sub/sub.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_27/test_space/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | files: 3 | - sub/sub.k -------------------------------------------------------------------------------- /examples/abstraction/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "abstraction" 3 | 4 | [dependencies] 5 | k8s = "1.29.1" 6 | -------------------------------------------------------------------------------- /examples/gitops/config/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | files: 3 | - main.k 4 | - kubernetes_render.k 5 | -------------------------------------------------------------------------------- /examples/source/makefile: -------------------------------------------------------------------------------- 1 | test: 2 | make -C oci 3 | 4 | oci: 5 | make -C oci 6 | 7 | git: 8 | make -C git 9 | -------------------------------------------------------------------------------- /examples/source/oci/makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl run oci://ghcr.io/kcl-lang/helloworld 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git/input: -------------------------------------------------------------------------------- 1 | kcl mod add --git https://github.com/kcl-lang/konfig --tag v0.10.0 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_4/input: -------------------------------------------------------------------------------- 1 | kcl mod add --git ssh://github.com/kcl-lang/konfig --branch main -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_5/input: -------------------------------------------------------------------------------- 1 | kcl mod add --git git://github.com/kcl-lang/konfig --branch main -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'subhelloworld:0.0.1' successfully 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/stdout: -------------------------------------------------------------------------------- 1 | add dependency 'subhelloworld:0.0.1' successfully 2 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_1/input: -------------------------------------------------------------------------------- 1 | kcl mod add oci://localhost:5001/test/helloworld --tag 0.1.1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_20/input: -------------------------------------------------------------------------------- 1 | kcl run /test_space/base.k /test_space/main.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_5/input: -------------------------------------------------------------------------------- 1 | kcl run git://github.com/kcl-lang/flask-demo-kcl-manifests --branch main -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_6/input: -------------------------------------------------------------------------------- 1 | kcl run git://github.com/kcl-lang/flask-demo-kcl-manifests --tag v0.1.0 -------------------------------------------------------------------------------- /scripts/e2e/pkg_in_reg/kcl2/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kcl2" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_1/input: -------------------------------------------------------------------------------- 1 | kcl mod add --git https://github.com/kcl-lang/konfig --branch main -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_2/input: -------------------------------------------------------------------------------- 1 | kcl mod add --git https://github.com/kcl-lang/konfig --commit f0daf4c -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_3/input: -------------------------------------------------------------------------------- 1 | kcl mod add --git ssh://github.com/kcl-lang/konfig --commit f0daf4c -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_4/input: -------------------------------------------------------------------------------- 1 | kcl mod pull --oci http://localhost:5001/test/helloworld --tag 0.1.1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl_6/main.k: -------------------------------------------------------------------------------- 1 | import sub 2 | kcl_6 = 'KCL 6' 3 | 4 | a = sub.sub6 5 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_29/input: -------------------------------------------------------------------------------- 1 | kcl run subhelloworld --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.4 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_7/input: -------------------------------------------------------------------------------- 1 | kcl run git://github.com/kcl-lang/flask-demo-kcl-manifests --commit ade147b -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_0/input: -------------------------------------------------------------------------------- 1 | kcl mod add oci://ghcr.io/kcl-lang/helloworld --rename newhelloworld -------------------------------------------------------------------------------- /examples/import/jsonschema/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl import -m jsonschema test.schema.json 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /examples/secret-management/vault/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "vault" 3 | edition = "0.0.1" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /pkg/options/testdata/run_pkg/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_pkg" 3 | edition = "0.0.1" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/stdout: -------------------------------------------------------------------------------- 1 | adding dependency 'dep' 2 | add dependency 'dep:0.0.1' successfully 3 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_3/input: -------------------------------------------------------------------------------- 1 | kcl mod add --oci oci://localhost:5001/test/helloworld --tag 0.1.1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_5/input: -------------------------------------------------------------------------------- 1 | kcl mod add --oci http://localhost:5001/test/helloworld --tag 0.1.1 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl_7/main.k: -------------------------------------------------------------------------------- 1 | import sub_7 2 | 3 | kcl_7 = 'KCL 7' 4 | 5 | b = sub_7.sub7 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_30/input: -------------------------------------------------------------------------------- 1 | kcl run subhelloworld:0.0.1 --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.4 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_8/input: -------------------------------------------------------------------------------- 1 | kcl run --git https://github.com/kcl-lang/flask-demo-kcl-manifests --branch main -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_9/input: -------------------------------------------------------------------------------- 1 | kcl run --git https://github.com/kcl-lang/flask-demo-kcl-manifests --tag v0.1.0 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_2/input: -------------------------------------------------------------------------------- 1 | kcl mod pull git://github.com/kcl-lang/flask-demo-kcl-manifests --commit ade147b -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_with_force/input: -------------------------------------------------------------------------------- 1 | kcl mod push --force oci://localhost:5001/myrepo:latest -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_with_force/test_space/main.k: -------------------------------------------------------------------------------- 1 | force_test_program = 'Hello Force Push!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_without_force/test_space/main.k: -------------------------------------------------------------------------------- 1 | force_test_program = 'Hello Force Push!' -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_10/input: -------------------------------------------------------------------------------- 1 | kcl run --git https://github.com/kcl-lang/flask-demo-kcl-manifests --commit ade147b -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_17/stdout: -------------------------------------------------------------------------------- 1 | The_sub_kcl_program: Hello Sub World! 2 | The_first_kcl_program: Hello World! 3 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_31/input: -------------------------------------------------------------------------------- 1 | kcl run cc --git https://github.com/kcl-lang/flask-demo-kcl-manifests --commit 8308200 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid/input: -------------------------------------------------------------------------------- 1 | kcl run --oci oci://ghcr.io/kcl-lang/helloworld oci://ghcr.io/kcl-lang/helloworld -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_push/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_mod" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | -------------------------------------------------------------------------------- /examples/source/git/makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl run https://github.com/kcl-lang/flask-demo-kcl-manifests 3 | 4 | test: 5 | make run 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_1/input: -------------------------------------------------------------------------------- 1 | kcl mod add git://github.com/kcl-lang/flask-demo-kcl-manifests.git --branch main -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_2/input: -------------------------------------------------------------------------------- 1 | kcl mod add ssh://github.com/kcl-lang/flask-demo-kcl-manifests.git --branch main -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_3/input: -------------------------------------------------------------------------------- 1 | kcl mod pull --git https://github.com/kcl-lang/flask-demo-kcl-manifests --branch main -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_without_force/input: -------------------------------------------------------------------------------- 1 | kcl mod push --force oci://localhost:5001/myrepo:latest -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | files: 3 | - kcl_6/main.k 4 | - kcl_7/main.k -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_2/input: -------------------------------------------------------------------------------- 1 | kcl run oci://ghcr.io/kcl-lang/helloworld --tag v0.1.0 --branch main --commit asdfaf -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_add/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_mod" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url/input: -------------------------------------------------------------------------------- 1 | kcl mod add git://github.com/kcl-lang/flask-demo-kcl-manifests.git --commit ade147b -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_3/input: -------------------------------------------------------------------------------- 1 | kcl mod add ssh://github.com/kcl-lang/flask-demo-kcl-manifests.git --commit ade147b -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_4/input: -------------------------------------------------------------------------------- 1 | kcl mod add git://github.com/kcl-lang/flask-demo-kcl-manifests.git --commit ade147b -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec/input: -------------------------------------------------------------------------------- 1 | kcl mod add subhelloworld --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.4 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_32/input: -------------------------------------------------------------------------------- 1 | kcl run cc:0.0.1 --git https://github.com/kcl-lang/flask-demo-kcl-manifests --commit 8308200 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_1/input: -------------------------------------------------------------------------------- 1 | kcl mod add subhelloworld --oci oci://ghcr.io/kcl-lang/helloworld --rename newhelloworld -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_2/input: -------------------------------------------------------------------------------- 1 | kcl mod add --oci oci://ghcr.io/kcl-lang/helloworld --tag 0.1.2 --rename newhelloworld -------------------------------------------------------------------------------- /examples/configuration/Makefile: -------------------------------------------------------------------------------- 1 | nginx: 2 | kcl nginx.k 3 | 4 | db: 5 | kcl db.k 6 | 7 | test: 8 | make nginx 9 | make db 10 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/input: -------------------------------------------------------------------------------- 1 | kcl mod add subhelloworld:0.0.1 --oci https://ghcr.io/kcl-lang/helloworld --tag 0.1.4 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_14/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_2" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_19/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_0" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_22/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_4" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_24/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_0" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_27/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_4" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_3/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_1/input: -------------------------------------------------------------------------------- 1 | kcl run --oci oci://ghcr.io/kcl-lang/helloworld oci://ghcr.io/kcl-lang/hellworld --tag v0.1.0 -------------------------------------------------------------------------------- /examples/data-integration/Makefile: -------------------------------------------------------------------------------- 1 | yaml: 2 | kcl yaml.k 3 | 4 | json: 5 | kcl json.k 6 | 7 | test: 8 | make yaml 9 | make json 10 | -------------------------------------------------------------------------------- /examples/import/crd/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "import" 3 | edition = "0.0.1" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | k8s = "1.29.1" 8 | -------------------------------------------------------------------------------- /examples/server/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "server" 3 | edition = "0.0.1" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | k8s = "1.28.1" 8 | -------------------------------------------------------------------------------- /scripts/verify-govet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # script credits : https://github.com/infracloudio/botkube 3 | 4 | set -x 5 | 6 | go vet . ./cmd/... 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec/input: -------------------------------------------------------------------------------- 1 | kcl mod add cc --git https://github.com/kcl-lang/flask-demo-kcl-manifests --commit 8308200 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/test_space/dep/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dep" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local/test_space/pkg/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pkg" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_1/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pkg/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.2" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_0/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update_0/test_space/pkg/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pkg" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /examples/server/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.k8s] 3 | name = "k8s" 4 | full_name = "k8s_1.28.1" 5 | version = "1.28.1" 6 | -------------------------------------------------------------------------------- /scripts/tag.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -e 3 | if [ "$1" == "" ]; then 4 | echo usage: "$0 VERSION" 5 | fi 6 | git tag $1 7 | git push origin $1 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_add_oci_ref_tag/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_1/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_2/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_3/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_4/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_5/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/input: -------------------------------------------------------------------------------- 1 | kcl mod add cc:0.0.1 --git https://github.com/kcl-lang/flask-demo-kcl-manifests --commit 8308200 -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_4/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/test_space/pkg/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "pkg" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_0/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_1/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push/stdout: -------------------------------------------------------------------------------- 1 | package 'test_space' will be pushed 2 | pushed [registry] localhost:5001/test/test_space 3 | digest: sha256: -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_0/stdout: -------------------------------------------------------------------------------- 1 | package 'test_space' will be pushed 2 | pushed [registry] localhost:5001/myrepo:latest 3 | digest: sha256: -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl_6/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kcl_6" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_16/test_space/kcl_7/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kcl_7" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid/stderr: -------------------------------------------------------------------------------- 1 | cannot specify multiple KCL modules [oci://ghcr.io/kcl-lang/helloworld oci://ghcr.io/kcl-lang/helloworld] -------------------------------------------------------------------------------- /examples/abstraction/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.k8s] 3 | name = "k8s" 4 | full_name = "k8s_1.29.1" 5 | version = "1.29.1" 6 | -------------------------------------------------------------------------------- /examples/import/crd/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.k8s] 3 | name = "k8s" 4 | full_name = "k8s_1.29.1" 5 | version = "1.29.1" 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_1/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_2/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_url_3/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_1/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_2/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_3/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_4/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_url_5/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_without_force/stdout: -------------------------------------------------------------------------------- 1 | package 'test_space' will be pushed 2 | package version '0.0.1' already exists -------------------------------------------------------------------------------- /examples/konfig/app/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | file: 3 | - main.k 4 | - ../pkg/render/render.k 5 | kcl_options: 6 | - key: env 7 | value: prod 8 | -------------------------------------------------------------------------------- /scripts/e2e/pkg_in_reg/kcl1/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "kcl1" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | helloworld = "0.1.1" 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_with_force/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_12/stdout: -------------------------------------------------------------------------------- 1 | downloading 'kcl-lang/helloworld:0.1.0' from 'ghcr.io/kcl-lang/helloworld:0.1.0' 2 | The_first_kcl_program: Hello World! -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/test_space/vendor/run_5_0.0.1/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_5" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_4/stdout: -------------------------------------------------------------------------------- 1 | downloading 'kcl-lang/helloworld:0.1.0' from 'ghcr.io/kcl-lang/helloworld:0.1.0' 2 | The_first_kcl_program: Hello World! -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_without_force/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" -------------------------------------------------------------------------------- /examples/codelab/simple/makefile: -------------------------------------------------------------------------------- 1 | default: 2 | kcl my_config.k -D priority=1 -D env='pre-prod' 3 | 4 | test: 5 | kcl my_config_test.k -D priority=1 -D env='pre-prod' 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_4" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | run_5 = "0.0.1" -------------------------------------------------------------------------------- /examples/codelab/collaborative/appops/test_app/dev/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | files: 3 | - ../base/base.k 4 | - main.k 5 | output: ./ci-test/stdout.golden.yaml 6 | -------------------------------------------------------------------------------- /examples/package-management/oci/my_package/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "my_package" 3 | edition = "0.0.1" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | k8s = "1.28.1" 8 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/appops/test_app/prod/kcl.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | files: 3 | - ../base/base.k 4 | - main.k 5 | output: ./ci-test/stdout.golden.yaml 6 | -------------------------------------------------------------------------------- /examples/package-management/oci/my_package/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.k8s] 3 | name = "k8s" 4 | full_name = "k8s_1.28.1" 5 | version = "1.28.1" 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_13/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_1" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | [profile] 7 | entries = ["sub/sub.k"] 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_21/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_3" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | [profile] 7 | entries = ["sub/sub.k"] 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_26/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_3" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | [profile] 7 | entries = ["sub/sub.k"] 8 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/appops/test_app/prod/main.k: -------------------------------------------------------------------------------- 1 | import pkg 2 | 3 | server: pkg.Server { 4 | # Union a new label env into base labels 5 | labels.env = "prod" 6 | } 7 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_graph/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | helloworld = "0.1.4" 8 | -------------------------------------------------------------------------------- /examples/automation/Makefile: -------------------------------------------------------------------------------- 1 | update: 2 | kcl main.k -O app.name=\'new_app\' 3 | 4 | delete: 5 | kcl main.k -O app.labels.key- 6 | 7 | test: 8 | make update 9 | make delete 10 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/test_space/dep/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dep" 3 | edition = "v0.7.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | helloworld = "0.1.1" 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | helloworld = "0.1.1" 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_17/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "main" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | [profile] 7 | entries = ["../sub/sub.k", "main.k"] 8 | -------------------------------------------------------------------------------- /examples/codelab/schema/makefile: -------------------------------------------------------------------------------- 1 | default: 2 | kcl my_config.k 3 | 4 | prod: 5 | kcl prod_config.k 6 | 7 | server: 8 | kcl server.k 9 | 10 | pkg_server: 11 | kcl pkg_server.k 12 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_invalid_1/stderr: -------------------------------------------------------------------------------- 1 | cannot specify tag, commit, or branch with multiple modules [oci://ghcr.io/kcl-lang/helloworld?tag=v0.1.0 oci://ghcr.io/kcl-lang/hellworld?tag=v0.1.0] -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_graph/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_mod" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | dep1 = { oci = "oci://127.0.0.1:50630/subpath"} 8 | -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_metadata/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_mod" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | dep1 = { oci = "oci://127.0.0.1:50630/subpath"} 8 | -------------------------------------------------------------------------------- /cmd/kcl/commands/test_data/test_mod_update/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_mod" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | dep1 = { oci = "oci://127.0.0.1:50630/subpath"} 8 | -------------------------------------------------------------------------------- /examples/codelab/schema/pkg/server.k: -------------------------------------------------------------------------------- 1 | schema Server(Deployment): 2 | mixin [PersistentVolumeClaimMixin] 3 | pvc?: {str:} 4 | """ pvc user interface data defined by PersistentVolumeClaimMixin """ 5 | -------------------------------------------------------------------------------- /examples/package-management/git/my_package/main.k: -------------------------------------------------------------------------------- 1 | import konfig.models.kube.frontend 2 | 3 | frontend.Server { 4 | name = "nginx-deployment" 5 | image = "nginx" 6 | mainContainer.name = name 7 | } 8 | -------------------------------------------------------------------------------- /examples/data-integration/json.k: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | schema Server: 4 | ports: [int] 5 | 6 | server: Server = json.decode('{"ports": [80, 8080]}') 7 | server_json = json.encode({ 8 | ports = [80, 8080] 9 | }) 10 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_0/stdout: -------------------------------------------------------------------------------- 1 | start to pull oci://localhost:5001/test/helloworld?tag=0.1.1 2 | downloading 'test/helloworld:0.1.1' from 'localhost:5001/test/helloworld:0.1.1' 3 | pulled helloworld 0.1.1 successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_1/stdout: -------------------------------------------------------------------------------- 1 | start to pull oci://localhost:5001/test/helloworld?tag=0.1.1 2 | downloading 'test/helloworld:0.1.1' from 'localhost:5001/test/helloworld:0.1.1' 3 | pulled helloworld 0.1.1 successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_4/stdout: -------------------------------------------------------------------------------- 1 | start to pull oci://localhost:5001/test/helloworld?tag=0.1.1 2 | downloading 'test/helloworld:0.1.1' from 'localhost:5001/test/helloworld:0.1.1' 3 | pulled helloworld 0.1.1 successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_push_existing_package_with_force/stdout: -------------------------------------------------------------------------------- 1 | package 'test_space' will be pushed 2 | package version '0.0.1' already exists, force pushing 3 | pushed [registry] localhost:5001/myrepo:latest 4 | digest: -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | newhelloworld = { package = "helloworld", version = "0.1.4" } 8 | -------------------------------------------------------------------------------- /examples/package-management/git/my_package/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "my_package" 3 | edition = "0.0.1" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | konfig = { git = "https://github.com/kcl-lang/konfig.git", tag = "v0.10.0" } 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init/stdout: -------------------------------------------------------------------------------- 1 | creating new :/test_space/kcl.mod 2 | creating new :/test_space/kcl.mod.lock 3 | creating new :/test_space/main.k 4 | package 'test_space' init finished 5 | -------------------------------------------------------------------------------- /examples/abstraction/Makefile: -------------------------------------------------------------------------------- 1 | docker: 2 | kcl main.k docker_compose_render.k 3 | 4 | k8s: 5 | kcl main.k kubernetes_render.k 6 | 7 | kcl-test: 8 | kcl test 9 | 10 | test: 11 | make docker 12 | make k8s 13 | make kcl-test 14 | -------------------------------------------------------------------------------- /scripts/release.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -e 3 | if [ "$1" == "" ]; then 4 | echo usage: "$0 VERSION" 5 | fi 6 | git tag $1 7 | git push origin $1 8 | gh release create $1 --draft --generate-notes --title "$1 Release" release/*.tgz 9 | -------------------------------------------------------------------------------- /examples/abstraction/main.k: -------------------------------------------------------------------------------- 1 | import app 2 | 3 | app.App { 4 | name = "app" 5 | containers.ngnix = { 6 | image = "ngnix" 7 | ports = [{containerPort = 80}] 8 | } 9 | service.ports = [{ port = 80 }] 10 | } 11 | -------------------------------------------------------------------------------- /examples/data-integration/yaml.k: -------------------------------------------------------------------------------- 1 | import yaml 2 | 3 | schema Server: 4 | ports: [int] 5 | 6 | server: Server = yaml.decode("""\ 7 | ports: 8 | - 80 9 | - 8080 10 | """) 11 | server_yaml = yaml.encode({ 12 | ports = [80, 8080] 13 | }) 14 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_3/stdout: -------------------------------------------------------------------------------- 1 | start to pull https://github.com/kcl-lang/flask-demo-kcl-manifests?branch=main 2 | cloning 'https://github.com/kcl-lang/flask-demo-kcl-manifests' with branch 'main' 3 | pulled flask_manifests 0.0.1 successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull_2/stdout: -------------------------------------------------------------------------------- 1 | start to pull https://github.com/kcl-lang/flask-demo-kcl-manifests?commit=ade147b 2 | cloning 'https://github.com/kcl-lang/flask-demo-kcl-manifests' with commit 'ade147b' 3 | pulled flask_manifests 0.0.1 successfully -------------------------------------------------------------------------------- /examples/import/crd/Makefile: -------------------------------------------------------------------------------- 1 | run: 2 | kcl import -m crd crd.yaml 3 | cd models && rm -r ./k8s 4 | rm -rf ./models/dapr_io_v1alpha1_subscription.k 5 | kcl mod init 6 | kcl mod add k8s 7 | kcl run ./models 8 | cd .. 9 | 10 | test: 11 | make run 12 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_2/stdout: -------------------------------------------------------------------------------- 1 | the latest version '0.1.4' will be downloaded 2 | downloading 'test/helloworld:0.1.4' from 'localhost:5001/test/helloworld:0.1.4' 3 | The_fisrt_schema_inst: 4 | msg: Hello Schema! 5 | The_first_kcl_program: Hello World! 6 | -------------------------------------------------------------------------------- /examples/automation/main.k: -------------------------------------------------------------------------------- 1 | schema App: 2 | """The application model.""" 3 | name: str 4 | replicas: int 5 | labels?: {str:str} = {app = name} 6 | 7 | app: App { 8 | name = "app" 9 | replicas = 1 10 | labels.key = "value" 11 | } 12 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_pull/stdout: -------------------------------------------------------------------------------- 1 | start to pull oci://localhost:5001/test/helloworld 2 | the latest version '0.1.4' will be downloaded 3 | downloading 'test/helloworld:0.1.4' from 'localhost:5001/test/helloworld:0.1.4' 4 | pulled helloworld 0.1.4 successfully -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_11/stdout: -------------------------------------------------------------------------------- 1 | the latest version '0.1.4' will be downloaded 2 | downloading 'test/helloworld:0.1.4' from 'localhost:5001/test/helloworld:0.1.4' 3 | The_fisrt_schema_inst: 4 | msg: Hello Schema! 5 | The_first_kcl_program: Hello World! 6 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_15/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.run_5] 3 | name = "run_5" 4 | full_name = "run_5_0.0.1" 5 | version = "0.0.1" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/run_5" 8 | oci_tag = "0.0.1" 9 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_28/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "run_7" 3 | edition = "v0.9.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | helloworld = "0.1.1" 8 | 9 | [profile] 10 | entries = ["main.k", "${helloworld:KCL_MOD}/main.k"] 11 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | subhelloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.4", version = "0.0.1" } 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | subhelloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.4", version = "0.0.1" } 8 | -------------------------------------------------------------------------------- /examples/validation/schema.k: -------------------------------------------------------------------------------- 1 | schema User: 2 | name: str 3 | age: int 4 | message?: str 5 | data: Data 6 | labels: {str:} 7 | hc: [int] 8 | 9 | check: 10 | age > 10 11 | 12 | schema Data: 13 | id: int 14 | value: str 15 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_2/stdout: -------------------------------------------------------------------------------- 1 | creating new :/test_space/kcl.mod 2 | creating new :/test_space/kcl.mod.lock 3 | creating new :/test_space/main.k 4 | '/test_space/main.k' already exists 5 | package 'test_space' init finished 6 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/makefile: -------------------------------------------------------------------------------- 1 | base: 2 | kcl appops/test_app/base/base.k 3 | 4 | dev: 5 | cd appops/test_app/dev && kcl -Y ./kcl.yaml 6 | 7 | prod: 8 | cd appops/test_app/prod && kcl -Y ./kcl.yaml 9 | 10 | default: 11 | make base 12 | make dev 13 | make prod 14 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | cc = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "8308200", version = "0.0.1" } 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.cc] 3 | name = "cc" 4 | full_name = "cc_0.0.1" 5 | version = "0.0.1" 6 | url = "https://github.com/kcl-lang/flask-demo-kcl-manifests" 7 | commit = "8308200" 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | cc = { git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", commit = "8308200", version = "0.0.1" } 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_git_modspec_0/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.cc] 3 | name = "cc" 4 | full_name = "cc_0.0.1" 5 | version = "0.0.1" 6 | url = "https://github.com/kcl-lang/flask-demo-kcl-manifests" 7 | commit = "8308200" 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_28/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.helloworld] 3 | name = "helloworld" 4 | full_name = "helloworld_0.1.1" 5 | version = "0.1.1" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.1" 9 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_0/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | newhelloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.4", package = "helloworld", version = "0.1.4" } 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_2/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | newhelloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.2", package = "helloworld", version = "0.1.2" } 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_graph/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.helloworld] 3 | name = "helloworld" 4 | full_name = "helloworld_0.1.4" 5 | version = "0.1.4" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.4" 9 | -------------------------------------------------------------------------------- /examples/validation/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Alice", 3 | "age": 18, 4 | "message": "This is Alice", 5 | "data": { 6 | "id": 1, 7 | "value": "value1" 8 | }, 9 | "labels": { 10 | "key": "value" 11 | }, 12 | "hc": [1, 2, 3] 13 | } 14 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_update/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.helloworld] 3 | name = "helloworld" 4 | full_name = "helloworld_0.1.1" 5 | version = "0.1.1" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.1" 9 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_1/test_space/kcl.mod: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "test_space" 3 | edition = "v0.10.0" 4 | version = "0.0.1" 5 | 6 | [dependencies] 7 | newhelloworld = { oci = "oci://ghcr.io/kcl-lang/helloworld", tag = "0.1.4", package = "subhelloworld", version = "0.0.1" } 8 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.newhelloworld] 3 | name = "newhelloworld" 4 | full_name = "helloworld_0.1.4" 5 | version = "0.1.4" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.4" 9 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_0/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.newhelloworld] 3 | name = "newhelloworld" 4 | full_name = "helloworld_0.1.4" 5 | version = "0.1.4" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.4" 9 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_2/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.newhelloworld] 3 | name = "newhelloworld" 4 | full_name = "helloworld_0.1.2" 5 | version = "0.1.2" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.2" 9 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_mod_add_rename_1/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.newhelloworld] 3 | name = "newhelloworld" 4 | full_name = "subhelloworld_0.0.1" 5 | version = "0.0.1" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.4" 9 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.subhelloworld] 3 | name = "subhelloworld" 4 | full_name = "subhelloworld_0.0.1" 5 | version = "0.0.1" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.4" 9 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_oci_modspec_0/test_space/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.subhelloworld] 3 | name = "subhelloworld" 4 | full_name = "subhelloworld_0.0.1" 5 | version = "0.0.1" 6 | reg = "ghcr.io" 7 | repo = "kcl-lang/helloworld" 8 | oci_tag = "0.1.4" 9 | -------------------------------------------------------------------------------- /examples/quickstart/database.k: -------------------------------------------------------------------------------- 1 | schema DatabaseConfig: 2 | enabled: bool = True 3 | ports: [int] = [8000, 8001, 8002] 4 | data: [[str|float]] = [["delta", "phi"], [3.14]] 5 | temp_targets: {str: float} = {cpu = 79.5, case = 72.0} 6 | 7 | database = DatabaseConfig { 8 | ports = [2020, 2021] 9 | } 10 | -------------------------------------------------------------------------------- /examples/settings/settings.yaml: -------------------------------------------------------------------------------- 1 | kcl_cli_configs: 2 | files: 3 | - file.k 4 | kcl_options: 5 | - key: env-type 6 | value: TEST 7 | - key: deploy-topology 8 | value: 9 | - cluster: my-cluster 10 | idc: my-idc 11 | replicas: 2 12 | workspace: my-workspace 13 | zone: my-zone 14 | -------------------------------------------------------------------------------- /scripts/e2e/pkg_in_reg/kcl1/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.helloworld] 3 | name = "helloworld" 4 | full_name = "helloworld_0.1.1" 5 | version = "0.1.1" 6 | sum = "7OO4YK2QuRWPq9C7KTzcWcti5yUnueCjptT3OXiPVeQ=" 7 | reg = "localhost:5001" 8 | repo = "test/helloworld" 9 | oci_tag = "0.1.1" 10 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_0/stdout: -------------------------------------------------------------------------------- 1 | creating new :/test_space/kcl.mod 2 | creating new :/test_space/kcl.mod.lock 3 | '/test_space/kcl.mod.lock' already exists 4 | creating new :/test_space/main.k 5 | '/test_space/main.k' already exists 6 | package 'test_space' init finished 7 | -------------------------------------------------------------------------------- /examples/gitops/config/main.k: -------------------------------------------------------------------------------- 1 | import app 2 | 3 | config = app.App { 4 | name = "kcl-guestbook-ui" 5 | containers.guestbook = { 6 | image = "gcr.io/heptio-images/ks-guestbook-demo:0.2" 7 | ports = [{containerPort = 80}] 8 | } 9 | service.ports = [{ port = 80 }] 10 | service.type = "LoadBalancer" 11 | } 12 | -------------------------------------------------------------------------------- /examples/codelab/simple/my_config_test.k: -------------------------------------------------------------------------------- 1 | import .my_config 2 | 3 | # debugging 4 | print(my_config.labels) # debugging by print 5 | 6 | # test 7 | assert len(my_config.labels) > 0, "labels can't be empty" # use len() to get list length 8 | assert "env" in my_config.labels, "env label is a must" 9 | assert my_config.cpu >= 256, "cpu cannot be less than256" 10 | -------------------------------------------------------------------------------- /examples/package-management/oci/my_package/main.k: -------------------------------------------------------------------------------- 1 | # Import and use the contents of the external dependency 'k8s'. 2 | import k8s.api.core.v1 as k8core 3 | 4 | k8core.Pod { 5 | metadata.name = "web-app" 6 | spec.containers = [{ 7 | name = "main-container" 8 | image = "nginx" 9 | ports = [{containerPort = 80}] 10 | }] 11 | } 12 | -------------------------------------------------------------------------------- /scripts/update-gofmt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # script credits : https://github.com/infracloudio/botkube 3 | 4 | set -o errexit 5 | set -o nounset 6 | set -o pipefail 7 | 8 | find_files() { 9 | find . -not \( \ 10 | \( \ 11 | -wholename '*/vendor/*' \ 12 | \) -prune \ 13 | \) -name '*.go' 14 | } 15 | 16 | find_files | xargs gofmt -w -s 17 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_add_local_0/test_space/dep/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.helloworld] 3 | name = "helloworld" 4 | full_name = "helloworld_0.1.1" 5 | version = "0.1.1" 6 | sum = "7OO4YK2QuRWPq9C7KTzcWcti5yUnueCjptT3OXiPVeQ=" 7 | reg = "ghcr.io" 8 | repo = "kcl-lang/helloworld" 9 | oci_tag = "0.1.1" 10 | -------------------------------------------------------------------------------- /cmd/kcl/main.go: -------------------------------------------------------------------------------- 1 | // Copyright The KCL Authors. All rights reserved. 2 | 3 | package main 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "strings" 9 | 10 | cmd "kcl-lang.io/cli/cmd/kcl/commands" 11 | ) 12 | 13 | func main() { 14 | if err := cmd.New().Execute(); err != nil { 15 | fmt.Fprintln(os.Stderr, strings.TrimLeft(err.Error(), "\n")) 16 | os.Exit(1) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/package-management/git/my_package/kcl.mod.lock: -------------------------------------------------------------------------------- 1 | [dependencies] 2 | [dependencies.k8s] 3 | name = "k8s" 4 | full_name = "k8s_1.31.2" 5 | version = "1.31.2" 6 | [dependencies.konfig] 7 | name = "konfig" 8 | full_name = "konfig_0.10.0" 9 | version = "0.10.0" 10 | url = "https://github.com/kcl-lang/konfig.git" 11 | git_tag = "v0.10.0" 12 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_mod_init_1/stdout: -------------------------------------------------------------------------------- 1 | creating new :/test_space/kcl.mod 2 | '/test_space/kcl.mod' already exists 3 | creating new :/test_space/kcl.mod.lock 4 | '/test_space/kcl.mod.lock' already exists 5 | creating new :/test_space/main.k 6 | '/test_space/main.k' already exists 7 | package 'test_space' init finished 8 | -------------------------------------------------------------------------------- /examples/definition/main.k: -------------------------------------------------------------------------------- 1 | import app_module # A relative path import 2 | 3 | app: app_module.App { 4 | domainType = "Standard" 5 | containerPort = 80 6 | volumes = [ 7 | { 8 | mountPath = "/tmp" 9 | } 10 | ] 11 | services = [ 12 | { 13 | clusterIP = "None" 14 | $type = "ClusterIP" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /examples/codelab/collaborative/appops/test_app/prod/ci-test/stdout.golden.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | replicas: 1 3 | image: nginx:1.14.2 4 | resource: 5 | cpu: 1 6 | memory: 1073741824 7 | disk: 10737418240 8 | mainContainer: 9 | name: main 10 | ports: 11 | - protocol: HTTP 12 | port: 80 13 | targetPort: 1100 14 | labels: 15 | app: test_app 16 | env: prod 17 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/appops/test_app/dev/main.k: -------------------------------------------------------------------------------- 1 | import pkg 2 | 3 | server: pkg.Server { 4 | # Override the base image. 5 | image = "nginx:1.14.2-dev" 6 | # Union a new label env into base labels. 7 | labels.env = "dev" 8 | # Append a port into base ports. 9 | mainContainer.ports += [{ 10 | protocol = "TCP" 11 | port = 443 12 | targetPort = 1100 13 | }] 14 | } 15 | -------------------------------------------------------------------------------- /examples/configuration/db.k: -------------------------------------------------------------------------------- 1 | env: str = option("env") or "dev" # The attribute `env` has a default value "den" 2 | database: str = option("database") 3 | hosts = { 4 | dev = "postgres.dev" 5 | stage = "postgres.stage" 6 | prod = "postgres.prod" 7 | } 8 | dbConfig = { 9 | host = hosts[env] 10 | database = database 11 | port = "2023" 12 | conn = "postgres://${host}:${port}/${database}" 13 | } 14 | -------------------------------------------------------------------------------- /examples/gitops/install/kcl-cmp.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: kcl-plugin-config 5 | namespace: argocd 6 | data: 7 | plugin.yaml: | 8 | apiVersion: argoproj.io/v1alpha1 9 | kind: ConfigManagementPlugin 10 | metadata: 11 | name: kcl 12 | spec: 13 | version: v1.0 14 | generate: 15 | command: ["sh"] 16 | args: 17 | - -c 18 | - kcl 19 | -------------------------------------------------------------------------------- /examples/konfig/app/main.k: -------------------------------------------------------------------------------- 1 | import pkg.app as app_pkg 2 | 3 | app: app_pkg.App { 4 | name: "app" 5 | domainType = "Standard" 6 | containerPort = 80 7 | if option("env") == "prod": 8 | volumes = [ 9 | { 10 | mountPath = "/tmp" 11 | } 12 | ] 13 | services = [ 14 | { 15 | clusterIP = "None" 16 | $type = "ClusterIP" 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/appops/test_app/dev/ci-test/stdout.golden.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | replicas: 1 3 | image: nginx:1.14.2-dev 4 | resource: 5 | cpu: 1 6 | memory: 1073741824 7 | disk: 10737418240 8 | mainContainer: 9 | name: main 10 | ports: 11 | - protocol: HTTP 12 | port: 80 13 | targetPort: 1100 14 | - protocol: TCP 15 | port: 443 16 | targetPort: 1100 17 | labels: 18 | app: test_app 19 | env: dev 20 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/appops/test_app/base/base.k: -------------------------------------------------------------------------------- 1 | import pkg 2 | 3 | server: pkg.Server { 4 | # Set the image with the value "nginx:1.14.2" 5 | image = "nginx:1.14.2" 6 | # Add a label app into labels 7 | labels.app = "test_app" 8 | # Add a mainContainer config, and its ports are [{protocol = "HTTP", port = 80, targetPort = 1100}] 9 | mainContainer.ports = [{ 10 | protocol = "HTTP" 11 | port = 80 12 | targetPort = 1100 13 | }] 14 | } 15 | -------------------------------------------------------------------------------- /examples/kubernetes.k: -------------------------------------------------------------------------------- 1 | apiVersion = "apps/v1" 2 | kind = "Deployment" 3 | metadata = { 4 | name = "nginx" 5 | labels.app = "nginx" 6 | } 7 | spec = { 8 | replicas = 3 9 | selector.matchLabels = metadata.labels 10 | template.metadata.labels = metadata.labels 11 | template.spec.containers = [ 12 | { 13 | name = metadata.name 14 | image = "${metadata.name}:1.14.2" 15 | ports = [{ containerPort = 80 }] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /pkg/options/testdata/run/kubernetes.k: -------------------------------------------------------------------------------- 1 | apiVersion = "apps/v1" 2 | kind = "Deployment" 3 | metadata = { 4 | name = "nginx" 5 | labels.app = "nginx" 6 | } 7 | spec = { 8 | replicas = 3 9 | selector.matchLabels = metadata.labels 10 | template.metadata.labels = metadata.labels 11 | template.spec.containers = [ 12 | { 13 | name = metadata.name 14 | image = "${metadata.name}:1.14.2" 15 | ports = [{ containerPort = 80 }] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /examples/kubernetes/generate-manifests/main.k: -------------------------------------------------------------------------------- 1 | apiVersion = "apps/v1" 2 | kind = "Deployment" 3 | metadata = { 4 | name = "nginx" 5 | labels.app = "nginx" 6 | } 7 | spec = { 8 | replicas = 3 9 | selector.matchLabels = metadata.labels 10 | template.metadata.labels = metadata.labels 11 | template.spec.containers = [ 12 | { 13 | name = metadata.name 14 | image = "${metadata.name}:1.14.2" 15 | ports = [{ containerPort = 80 }] 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /scripts/verify-gofmt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # script credits : https://github.com/infracloudio/botkube 3 | 4 | set -o errexit 5 | set -o nounset 6 | set -o pipefail 7 | 8 | find_files() { 9 | find . -not \( \ 10 | \( \ 11 | -wholename '*/vendor/*' \ 12 | \) -prune \ 13 | \) -name '*.go' 14 | } 15 | 16 | bad_files=$(find_files | xargs gofmt -d -s 2>&1) 17 | if [[ -n "${bad_files}" ]]; then 18 | echo "${bad_files}" >&2 19 | echo >&2 20 | echo "Run ./hack/update-gofmt.sh" >&2 21 | exit 1 22 | fi 23 | -------------------------------------------------------------------------------- /pkg/version/version_test.go: -------------------------------------------------------------------------------- 1 | package version 2 | 3 | import "testing" 4 | 5 | func TestGetVersionString(t *testing.T) { 6 | tests := []struct { 7 | name string 8 | want string 9 | }{ 10 | { 11 | name: "test get version in string", 12 | want: VersionTypeLatest.String(), 13 | }, 14 | } 15 | for _, tt := range tests { 16 | t.Run(tt.name, func(t *testing.T) { 17 | if got := GetVersionString(); got != tt.want { 18 | t.Errorf(" GetVersionString() = %v, want %v", got, tt.want) 19 | } 20 | }) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/terraform/validation/main.k: -------------------------------------------------------------------------------- 1 | schema TFPlan: 2 | # Omit other attributes 3 | [...str]: any 4 | resource_changes?: [AcceptableChange] 5 | 6 | schema AcceptableChange: 7 | # Omit other attributes 8 | [...str]: any 9 | check: 10 | # Reject AWS autoscaling group Resource delete action 11 | all action in change.actions { 12 | action not in ["delete"] 13 | } if type == "aws_autoscaling_group", "Disable AWS autoscaling group resource delete action for the resource ${type} ${name}" 14 | -------------------------------------------------------------------------------- /cmd/kcl/commands/version.go: -------------------------------------------------------------------------------- 1 | // Copyright The KCL Authors. All rights reserved. 2 | 3 | package cmd 4 | 5 | import ( 6 | "fmt" 7 | 8 | "github.com/spf13/cobra" 9 | 10 | "kcl-lang.io/cli/pkg/version" 11 | ) 12 | 13 | // NewVersionCmd returns the version command. 14 | func NewVersionCmd() *cobra.Command { 15 | return &cobra.Command{ 16 | Use: "version", 17 | Short: "Show version of the KCL CLI", 18 | Run: func(*cobra.Command, []string) { 19 | fmt.Println(version.GetVersionString()) 20 | }, 21 | SilenceUsage: true, 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/codelab/schema/pkg_server.k: -------------------------------------------------------------------------------- 1 | import pkg 2 | 3 | server = pkg.Server { 4 | name = "my-nginx" 5 | image = "nginx:1.14.2" 6 | volumes = [pkg.Volume { 7 | name = "mydir" 8 | mountPath = "/test-pd" 9 | hostPath = "/data" 10 | }] 11 | command = ["nginx"] 12 | labels = { 13 | run = "my-nginx" 14 | env = "pre-prod" 15 | } 16 | service.ports = [pkg.Port { 17 | name = "http" 18 | protocol = "TCP" 19 | port = 80 20 | targetPort = 9376 21 | }] 22 | } 23 | -------------------------------------------------------------------------------- /cmd/kclx/main.go: -------------------------------------------------------------------------------- 1 | // Copyright The KCL Authors. All rights reserved. 2 | //go:build cgo 3 | // +build cgo 4 | 5 | package main 6 | 7 | import ( 8 | "fmt" 9 | "os" 10 | "strings" 11 | 12 | cmd "kcl-lang.io/cli/cmd/kcl/commands" 13 | _ "kcl-lang.io/kcl-plugin/hello" // Import the hello plugin 14 | _ "kcl-lang.io/kcl-plugin/http" // Import the http plugin 15 | ) 16 | 17 | func main() { 18 | if err := cmd.NewWithName("kclx").Execute(); err != nil { 19 | fmt.Fprintln(os.Stderr, strings.TrimLeft(err.Error(), "\n")) 20 | os.Exit(1) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /pkg/options/constants.go: -------------------------------------------------------------------------------- 1 | // Copyright The KCL Authors. All rights reserved. 2 | 3 | package options 4 | 5 | const ( 6 | // Json is the JSON output format. 7 | Json string = "json" 8 | // Yaml is the YAML output format. 9 | Yaml string = "yaml" 10 | // Toml is the TOML output format. 11 | Toml string = "toml" 12 | GoStruct string = "gostruct" 13 | Auto string = "auto" 14 | Crd string = "crd" 15 | OpenAPI string = "openapi" 16 | JsonSchema string = "jsonschema" 17 | TerraformSchema string = "terraformschema" 18 | ) 19 | -------------------------------------------------------------------------------- /examples/abstraction/kubernetes_render_test.k: -------------------------------------------------------------------------------- 1 | import manifests 2 | 3 | import app 4 | 5 | # Convert the `App` model into Kubernetes Deployment and Service Manifests 6 | test_kubernetesRender = lambda { 7 | a = app.App { 8 | name = "app" 9 | containers.ngnix = { 10 | image = "ngnix" 11 | ports = [{containerPort = 80}] 12 | } 13 | service.ports = [{ port = 80 }] 14 | } 15 | deployment_got = kubernetesRender(a) 16 | assert deployment_got[0].kind == "Deployment" 17 | assert deployment_got[1].kind == "Service" 18 | } 19 | -------------------------------------------------------------------------------- /examples/quickstart/server.k: -------------------------------------------------------------------------------- 1 | # This is a KCL document 2 | 3 | schema ServerConfig: 4 | ip: str 5 | role: "frontend" | "backend" 6 | 7 | title = "KCL Example" 8 | 9 | owner = { 10 | name = "The KCL Authors" 11 | data = "2020-01-02T03:04:05" 12 | } 13 | 14 | database = { 15 | enabled = True 16 | ports = [8000, 8001, 8002] 17 | data = [["delta", "phi"], [3.14]] 18 | temp_targets = {cpu = 79.5, case = 72.0} 19 | } 20 | 21 | servers = [ 22 | ServerConfig {ip = "10.0.0.1", role = "frontend"} 23 | ServerConfig {ip = "10.0.0.2", role = "backend"} 24 | ] 25 | -------------------------------------------------------------------------------- /examples/terraform/validation/main.policy.failure.k: -------------------------------------------------------------------------------- 1 | schema TFPlan: 2 | # Omit other attributes 3 | [...str]: any 4 | resource_changes?: [AcceptableChange] 5 | 6 | schema AcceptableChange: 7 | # Omit other attributes 8 | [...str]: any 9 | check: 10 | # Reject AWS autoscaling group Resource delete action 11 | all action in change.actions { 12 | action not in ["create"] # Use create to mock a check failure. 13 | } if type == "aws_autoscaling_group", "Disable AWS autoscaling group resource create action for the resource ${type} ${name}" 14 | -------------------------------------------------------------------------------- /scripts/e2e/e2e-init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check if a directory name is provided 4 | if [ "$#" -ne 1 ]; then 5 | echo "Usage: " 6 | exit 1 7 | fi 8 | 9 | # Specify the directory 10 | dir="./test/e2e/test_suites/$1" 11 | 12 | # Create the subdirectory if it does not exist 13 | if [ ! -d "$dir" ]; then 14 | mkdir -p "$dir" 15 | fi 16 | 17 | # Create files in the directory 18 | 19 | touch "${dir}/input" 20 | echo "stdout" > "${dir}/stdout" 21 | echo "stderr" > "${dir}/stderr" 22 | mkdir -p "${dir}/test_space" 23 | 24 | 25 | echo "Test suite created successfully in $dir." -------------------------------------------------------------------------------- /examples/definition/app_module.k: -------------------------------------------------------------------------------- 1 | schema App: 2 | domainType: "Standard" | "Customized" | "Global" 3 | containerPort: int 4 | volumes: [Volume] 5 | services: [Service] 6 | 7 | check: 8 | 1 <= containerPort <= 65535 9 | 10 | schema Service: 11 | clusterIP: str 12 | $type: str 13 | 14 | check: 15 | clusterIP == "None" if $type == "ClusterIP" 16 | 17 | schema Volume: 18 | container: str = "*" # The default value of `container` is "*" 19 | mountPath: str 20 | 21 | check: 22 | mountPath not in ["/", "/boot", "/home", "dev", "/etc", "/root"] 23 | -------------------------------------------------------------------------------- /examples/konfig/pkg/render/render.k: -------------------------------------------------------------------------------- 1 | import pkg.app as app_pkg 2 | import manifests 3 | 4 | app: app_pkg.App { 5 | domainType = "Standard" 6 | containerPort = 80 7 | volumes = [ 8 | { 9 | mountPath = "/tmp" 10 | } 11 | ] 12 | services = [ 13 | { 14 | clusterIP = "None" 15 | $type = "ClusterIP" 16 | } 17 | ] 18 | } 19 | render = lambda app: app_pkg.App { 20 | { 21 | apiVersion = "v1" 22 | metadata.name = app.name 23 | } 24 | } 25 | 26 | manifests.yaml_stream([render(a) for a in app_pkg.App.instances()]) 27 | -------------------------------------------------------------------------------- /examples/configuration/nginx.k: -------------------------------------------------------------------------------- 1 | schema Nginx: 2 | """Schema for Nginx configuration files""" 3 | http: Http 4 | 5 | schema Http: 6 | server: Server 7 | 8 | schema Server: 9 | listen: int | str # The attribute `listen` can be int type or a string type. 10 | location?: Location # Optional, but must be non-empty when specified 11 | 12 | schema Location: 13 | root: str 14 | index: str 15 | 16 | nginx = Nginx { 17 | http.server = { 18 | listen = 80 19 | location = { 20 | root = "/var/www/html" 21 | index = "index.html" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/konfig/pkg/app/app_module.k: -------------------------------------------------------------------------------- 1 | schema App: 2 | name: str 3 | domainType: "Standard" | "Customized" | "Global" 4 | containerPort: int 5 | volumes?: [Volume] 6 | services: [Service] 7 | 8 | check: 9 | 1 <= containerPort <= 65535 10 | 11 | schema Service: 12 | clusterIP: str 13 | $type: str 14 | 15 | check: 16 | clusterIP == "None" if $type == "ClusterIP" 17 | 18 | schema Volume: 19 | container: str = "*" # The default value of `container` is "*" 20 | mountPath: str 21 | 22 | check: 23 | mountPath not in ["/", "/boot", "/home", "dev", "/etc", "/root"] 24 | -------------------------------------------------------------------------------- /examples/codelab/simple/my_config.k: -------------------------------------------------------------------------------- 1 | _priority = option("priority") # a non-exported and mutable variable 2 | _env = option("env") # a non-exported and mutable variable 3 | _priorityCpuMap = { 4 | "1" = 256 5 | "2" = 512 6 | "3" = 1024 7 | } 8 | # Using a dict to simplify logic and the default value is 2048 9 | _cpu = _priorityCpuMap[_priority] or 2048 10 | _name = "nginx" 11 | # exported variables 12 | cpu = _cpu 13 | memory = _cpu * 2 14 | command = [_name] # a list 15 | labels = { 16 | run = "my-{}".format(_name) 17 | env = _env 18 | } # a dict 19 | image = "{}:1.14.2".format(_name) # string format 20 | service = "my-service" 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/sysctl.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the sysctl module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema Sysctl: 9 | """ Sysctl defines a kernel parameter to be set 10 | 11 | Attributes 12 | ---------- 13 | name : str, default is Undefined, required 14 | Name of a property to set 15 | value : str, default is Undefined, required 16 | Value of a property to set 17 | """ 18 | 19 | 20 | name: str 21 | 22 | value: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/pod_readiness_gate.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the pod_readiness_gate module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema PodReadinessGate: 9 | """ PodReadinessGate contains the reference to a pod condition 10 | 11 | Attributes 12 | ---------- 13 | conditionType : str, default is Undefined, required 14 | ConditionType refers to a condition in the pod's condition list with matching type. 15 | """ 16 | 17 | 18 | conditionType: str 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/pod_dns_config_option.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the pod_dns_config_option module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema PodDNSConfigOption: 9 | """ PodDNSConfigOption defines DNS resolver options of a pod. 10 | 11 | Attributes 12 | ---------- 13 | name : str, default is Undefined, optional 14 | Required. 15 | value : str, default is Undefined, optional 16 | value 17 | """ 18 | 19 | 20 | name?: str 21 | 22 | value?: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/http_header.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the http_header module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema HTTPHeader: 9 | """ HTTPHeader describes a custom header to be used in HTTP probes 10 | 11 | Attributes 12 | ---------- 13 | name : str, default is Undefined, required 14 | The header field name 15 | value : str, default is Undefined, required 16 | The header field value 17 | """ 18 | 19 | 20 | name: str 21 | 22 | value: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/capabilities.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the capabilities module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema Capabilities: 9 | """ Adds and removes POSIX capabilities from running containers. 10 | 11 | Attributes 12 | ---------- 13 | add : [str], default is Undefined, optional 14 | Added capabilities 15 | drop : [str], default is Undefined, optional 16 | Removed capabilities 17 | """ 18 | 19 | 20 | add?: [str] 21 | 22 | drop?: [str] 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/session_affinity_config.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the session_affinity_config module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema SessionAffinityConfig: 9 | """ SessionAffinityConfig represents the configurations of session affinity. 10 | 11 | Attributes 12 | ---------- 13 | clientIP : ClientIPConfig, default is Undefined, optional 14 | clientIP contains the configurations of Client IP based session affinity. 15 | """ 16 | 17 | 18 | clientIP?: ClientIPConfig 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/collaborative/pkg/server.k: -------------------------------------------------------------------------------- 1 | import units 2 | 3 | type Unit = units.NumberMultiplier 4 | 5 | schema Server: 6 | replicas: int = 1 7 | image: str 8 | resource: Resource = {} 9 | mainContainer: Main = {} 10 | labels?: {str:str} 11 | annotations?: {str:str} 12 | 13 | schema Main: 14 | name: str = "main" 15 | command?: [str] 16 | args?: [str] 17 | ports?: [Port] 18 | 19 | schema Resource: 20 | cpu?: int = 1 21 | memory?: Unit = 1024Mi 22 | disk?: Unit = 10Gi 23 | 24 | schema Port: 25 | name?: str 26 | protocol: "HTTP" | "TCP" 27 | port: 80 | 443 28 | targetPort: int 29 | 30 | check: 31 | targetPort > 1024, "targetPort must be larger than 1024" 32 | -------------------------------------------------------------------------------- /examples/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Stop on error. 4 | 5 | # Note: Before you start tests, please install kcl 6 | # kcl Installation: https://kcl-lang.io/docs/user_docs/getting-started/install 7 | 8 | set -e 9 | 10 | pwd=$( 11 | cd $(dirname $0) 12 | pwd 13 | ) 14 | 15 | for path in "configuration" "validation" "abstraction" "definition" "konfig" "mutation" "data-integration" "automation" "package-management" "kubernetes" "codelab" "server" "settings" "source"; do 16 | echo "\033[1mTesting $path ...\033[0m" 17 | if (cd $pwd/$path && make test); then 18 | echo "\033[32mTest SUCCESSED - $path\033[0m\n" 19 | else 20 | echo "\033[31mTest FAILED - $path\033[0m\n" 21 | exit 1 22 | fi 23 | done 24 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/namespace_spec.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the namespace_spec module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema NamespaceSpec: 9 | """ NamespaceSpec describes the attributes on a Namespace. 10 | 11 | Attributes 12 | ---------- 13 | finalizers : [str], default is Undefined, optional 14 | Finalizers is an opaque list of values that must be empty to permanently remove object from storage. More info: https://kubernetes.io/docs/tasks/administer-cluster/namespaces/ 15 | """ 16 | 17 | 18 | finalizers?: [str] 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/local_object_reference.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the local_object_reference module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema LocalObjectReference: 9 | """ LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace. 10 | 11 | Attributes 12 | ---------- 13 | name : str, default is Undefined, optional 14 | Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 15 | """ 16 | 17 | 18 | name?: str 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/downward_api_projection.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the downward_api_projection module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema DownwardAPIProjection: 9 | """ Represents downward API info for projecting into a projected volume. Note that this is identical to a downwardAPI volume source without the default mode. 10 | 11 | Attributes 12 | ---------- 13 | items : [DownwardAPIVolumeFile], default is Undefined, optional 14 | Items is a list of DownwardAPIVolume file 15 | """ 16 | 17 | 18 | items?: [DownwardAPIVolumeFile] 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/node_config_source.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the node_config_source module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema NodeConfigSource: 9 | """ NodeConfigSource specifies a source of node configuration. Exactly one subfield (excluding metadata) must be non-nil. This API is deprecated since 1.22 10 | 11 | Attributes 12 | ---------- 13 | configMap : ConfigMapNodeConfigSource, default is Undefined, optional 14 | ConfigMap is a reference to a Node's ConfigMap 15 | """ 16 | 17 | 18 | configMap?: ConfigMapNodeConfigSource 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/host_alias.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the host_alias module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema HostAlias: 9 | """ HostAlias holds the mapping between IP and hostnames that will be injected as an entry in the pod's hosts file. 10 | 11 | Attributes 12 | ---------- 13 | hostnames : [str], default is Undefined, optional 14 | Hostnames for the above IP address. 15 | ip : str, default is Undefined, optional 16 | IP address of the host file entry. 17 | """ 18 | 19 | 20 | hostnames?: [str] 21 | 22 | ip?: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/terraform/validation/main.tf: -------------------------------------------------------------------------------- 1 | provider "aws" { 2 | region = "us-west-1" 3 | } 4 | resource "aws_instance" "web" { 5 | instance_type = "t2.micro" 6 | ami = "ami-09b4b74c" 7 | } 8 | resource "aws_autoscaling_group" "my_asg" { 9 | availability_zones = ["us-west-1a"] 10 | name = "my_asg" 11 | max_size = 5 12 | min_size = 1 13 | health_check_grace_period = 300 14 | health_check_type = "ELB" 15 | desired_capacity = 4 16 | force_delete = true 17 | launch_configuration = "my_web_config" 18 | } 19 | resource "aws_launch_configuration" "my_web_config" { 20 | name = "my_web_config" 21 | image_id = "ami-09b4b74c" 22 | instance_type = "t2.micro" 23 | } 24 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/apps/v1/rolling_update_stateful_set_strategy.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the rolling_update_stateful_set_strategy module in k8spkg.api.apps.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema RollingUpdateStatefulSetStrategy: 9 | """ RollingUpdateStatefulSetStrategy is used to communicate parameter for RollingUpdateStatefulSetStrategyType. 10 | 11 | Attributes 12 | ---------- 13 | partition : int, default is Undefined, optional 14 | Partition indicates the ordinal at which the StatefulSet should be partitioned. Default value is 0. 15 | """ 16 | 17 | 18 | partition?: int 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/client_ip_config.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the client_ip_config module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema ClientIPConfig: 9 | """ ClientIPConfig represents the configurations of Client IP based session affinity. 10 | 11 | Attributes 12 | ---------- 13 | timeoutSeconds : int, default is Undefined, optional 14 | timeoutSeconds specifies the seconds of ClientIP type session sticky time. The value must be >0 && <=86400(for 1 day) if ServiceAffinity == "ClientIP". Default value is 10800(for 3 hours). 15 | """ 16 | 17 | 18 | timeoutSeconds?: int 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/node_selector.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the node_selector module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema NodeSelector: 9 | """ A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms. 10 | 11 | Attributes 12 | ---------- 13 | nodeSelectorTerms : [NodeSelectorTerm], default is Undefined, required 14 | Required. A list of node selector terms. The terms are ORed. 15 | """ 16 | 17 | 18 | nodeSelectorTerms: [NodeSelectorTerm] 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/secret-management/vault/main.k: -------------------------------------------------------------------------------- 1 | # Secret Management using Vault and Vals 2 | 3 | apiVersion = "apps/v1" 4 | kind = "Deployment" 5 | metadata = { 6 | name = "nginx" 7 | labels.app = "nginx" 8 | annotations: { 9 | "secret-store": "vault" 10 | # Valid format: 11 | # "ref+vault://PATH/TO/KV_BACKEND#/KEY" 12 | "foo": "ref+vault://secret/foo#/foo" 13 | "bar": "ref+vault://secret/bar#/bar" 14 | } 15 | } 16 | spec = { 17 | replicas = 3 18 | selector.matchLabels = metadata.labels 19 | template.metadata.labels = metadata.labels 20 | template.spec.containers = [ 21 | { 22 | name = metadata.name 23 | image = "${metadata.name}:1.14.2" 24 | ports = [{ containerPort = 80 }] 25 | } 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/volume_device.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the volume_device module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema VolumeDevice: 9 | """ volumeDevice describes a mapping of a raw block device within a container. 10 | 11 | Attributes 12 | ---------- 13 | devicePath : str, default is Undefined, required 14 | devicePath is the path inside of the container that the device will be mapped to. 15 | name : str, default is Undefined, required 16 | name must match the name of a persistentVolumeClaim in the pod 17 | """ 18 | 19 | 20 | devicePath: str 21 | 22 | name: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/pkg/pvc.k: -------------------------------------------------------------------------------- 1 | import k8spkg.api.core.v1 2 | 3 | protocol PVCProtocol: 4 | pvc?: {str:} 5 | 6 | mixin PersistentVolumeClaimMixin for PVCProtocol: 7 | """ 8 | PersistentVolumeClaim (PVC) sample: 9 | Link: https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims 10 | """ 11 | 12 | # Mix in a new attribute `kubernetesPVC` 13 | kubernetesPVC?: v1.PersistentVolumeClaim 14 | 15 | if pvc: 16 | kubernetesPVC = v1.PersistentVolumeClaim { 17 | metadata.name = pvc.name 18 | metadata.labels = pvc.labels 19 | spec = { 20 | accessModes = pvc.accessModes 21 | resources = pvc.resources 22 | storageClassName = pvc.storageClassName 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/object_field_selector.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the object_field_selector module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema ObjectFieldSelector: 9 | """ ObjectFieldSelector selects an APIVersioned field of an object. 10 | 11 | Attributes 12 | ---------- 13 | apiVersion : str, default is Undefined, optional 14 | Version of the schema the FieldPath is written in terms of, defaults to "v1". 15 | fieldPath : str, default is Undefined, required 16 | Path of the field to select in the specified API version. 17 | """ 18 | 19 | 20 | apiVersion?: str 21 | 22 | fieldPath: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /scripts/e2e/e2e.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # start registry at 'localhost:5001' 4 | # include account 'test' and password '1234' 5 | ./scripts/e2e/reg.sh 6 | 7 | # set the kpm default registry and repository 8 | export KPM_REG="localhost:5001" 9 | export KPM_REPO="test" 10 | export OCI_REG_PLAIN_HTTP=on 11 | 12 | set -o errexit 13 | set -o nounset 14 | set -o pipefail 15 | 16 | # Install ginkgo 17 | GO111MODULE=on go install github.com/onsi/ginkgo/v2/ginkgo@v2.0.0 18 | 19 | # Build kpm binary 20 | make build 21 | 22 | # Prepare e2e test env 23 | # pull the package 'k8s' from 'ghcr.io/kcl-lang/k8s' 24 | ./scripts/e2e/pull_pkg.sh 25 | 26 | # push the package 'k8s' to 'localhost:5001/test' 27 | ./scripts/e2e/push_pkg.sh 28 | 29 | # Run e2e 30 | set +e 31 | ginkgo ./test/e2e/ 32 | TESTING_RESULT=$? 33 | 34 | 35 | exit $TESTING_RESULT 36 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/tcp_socket_action.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the tcp_socket_action module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema TCPSocketAction: 9 | """ TCPSocketAction describes an action based on opening a socket 10 | 11 | Attributes 12 | ---------- 13 | host : str, default is Undefined, optional 14 | Optional: Host name to connect to, defaults to the pod IP. 15 | port : int | str, default is Undefined, required 16 | Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. 17 | """ 18 | 19 | 20 | host?: str 21 | 22 | port: int | str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/rbac/v1/role_ref.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the role_ref module in k8spkg.api.rbac.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema RoleRef: 9 | """ RoleRef contains information that points to the role being used 10 | 11 | Attributes 12 | ---------- 13 | apiGroup : str, default is Undefined, required 14 | APIGroup is the group for the resource being referenced 15 | kind : str, default is Undefined, required 16 | Kind is the type of resource being referenced 17 | name : str, default is Undefined, required 18 | Name is the name of resource being referenced 19 | """ 20 | 21 | 22 | apiGroup: str 23 | 24 | kind: str 25 | 26 | name: str 27 | 28 | 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # If you prefer the allow list template instead of the deny list, see community template: 2 | # https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore 3 | # 4 | # Binaries for programs and plugins 5 | *.exe 6 | *.exe~ 7 | *.dll 8 | *.so 9 | *.dylib 10 | *.db 11 | 12 | # Test binary, built with `go test -c` 13 | *.test 14 | 15 | # Output of the go coverage tool, specifically when used with LiteIDE 16 | *.out 17 | bin 18 | release 19 | dist 20 | 21 | # Dependency directories (remove the comment below to include it) 22 | # vendor/ 23 | 24 | # Go workspace file 25 | go.work 26 | # Go coverage test 27 | coverage.out 28 | .terraform 29 | .terraform.lock.hcl 30 | 31 | build/ 32 | .vscode/ 33 | .kcl/ 34 | _kcl_test.k 35 | 36 | .DS_store 37 | 38 | # e2e test cases dir 39 | scripts/e2e/pkg_in_reg/* 40 | scripts/e2e/registry_auth/* 41 | scripts/registry_auth/* -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/rbac/v1/aggregation_rule.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the aggregation_rule module in k8spkg.api.rbac.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | import k8spkg.apimachinery.apis 7 | 8 | 9 | schema AggregationRule: 10 | """ AggregationRule describes how to locate ClusterRoles to aggregate into the ClusterRole 11 | 12 | Attributes 13 | ---------- 14 | clusterRoleSelectors : [apis.LabelSelector], default is Undefined, optional 15 | ClusterRoleSelectors holds a list of selectors which will be used to find ClusterRoles and create the rules. If any of the selectors match, then the ClusterRole's permissions will be added 16 | """ 17 | 18 | 19 | clusterRoleSelectors?: [apis.LabelSelector] 20 | 21 | 22 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "gomod" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | commit-message: 13 | prefix: "Chore: " 14 | include: "scope" 15 | ignore: 16 | - dependency-name: k8s.io/* 17 | - package-ecosystem: "github-actions" 18 | directory: "/" 19 | schedule: 20 | interval: "daily" 21 | commit-message: 22 | prefix: "chore: " 23 | include: "scope" 24 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/networking/v1/service_backend_port.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the service_backend_port module in k8spkg.api.networking.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema ServiceBackendPort: 9 | """ ServiceBackendPort is the service port being referenced. 10 | 11 | Attributes 12 | ---------- 13 | name : str, default is Undefined, optional 14 | Name is the name of the port on the Service. This is a mutually exclusive setting with "Number". 15 | number : int, default is Undefined, optional 16 | Number is the numerical port number (e.g. 80) on the Service. This is a mutually exclusive setting with "Name". 17 | """ 18 | 19 | 20 | name?: str 21 | 22 | number?: int 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/apps/v1/deployment_strategy.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the deployment_strategy module in k8spkg.api.apps.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema DeploymentStrategy: 9 | """ DeploymentStrategy describes how to replace existing pods with new ones. 10 | 11 | Attributes 12 | ---------- 13 | $type : str, default is Undefined, optional 14 | Type of deployment. Can be "Recreate" or "RollingUpdate". Default is RollingUpdate. 15 | rollingUpdate : RollingUpdateDeployment, default is Undefined, optional 16 | Rolling update config params. Present only if DeploymentStrategyType = RollingUpdate. 17 | """ 18 | 19 | 20 | $type?: str 21 | 22 | rollingUpdate?: RollingUpdateDeployment 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/networking/v1/http_ingress_rule_value.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the http_ingress_rule_value module in k8spkg.api.networking.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema HTTPIngressRuleValue: 9 | """ HTTPIngressRuleValue is a list of http selectors pointing to backends. In the example: http:///? -> backend where where parts of the url correspond to RFC 3986, this resource will be used to match against everything after the last '/' and before the first '?' or '#'. 10 | 11 | Attributes 12 | ---------- 13 | paths : [HTTPIngressPath], default is Undefined, required 14 | A collection of paths that map requests to backends. 15 | """ 16 | 17 | 18 | paths: [HTTPIngressPath] 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/networking/v1/ingress_service_backend.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the ingress_service_backend module in k8spkg.api.networking.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema IngressServiceBackend: 9 | """ IngressServiceBackend references a Kubernetes Service as a Backend. 10 | 11 | Attributes 12 | ---------- 13 | name : str, default is Undefined, required 14 | Name is the referenced service. The service must exist in the same namespace as the Ingress object. 15 | port : ServiceBackendPort, default is Undefined, optional 16 | Port of the referenced service. A port name or port number is required for a IngressServiceBackend. 17 | """ 18 | 19 | 20 | name: str 21 | 22 | port?: ServiceBackendPort 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/apps/v1/daemon_set_update_strategy.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the daemon_set_update_strategy module in k8spkg.api.apps.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema DaemonSetUpdateStrategy: 9 | """ DaemonSetUpdateStrategy is a struct used to control the update strategy for a DaemonSet. 10 | 11 | Attributes 12 | ---------- 13 | $type : str, default is Undefined, optional 14 | Type of daemon set update. Can be "RollingUpdate" or "OnDelete". Default is RollingUpdate. 15 | rollingUpdate : RollingUpdateDaemonSet, default is Undefined, optional 16 | Rolling update config params. Present only if type = "RollingUpdate". 17 | """ 18 | 19 | 20 | $type?: str 21 | 22 | rollingUpdate?: RollingUpdateDaemonSet 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/config_map_key_selector.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the config_map_key_selector module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema ConfigMapKeySelector: 9 | """ Selects a key from a ConfigMap. 10 | 11 | Attributes 12 | ---------- 13 | key : str, default is Undefined, required 14 | The key to select. 15 | name : str, default is Undefined, optional 16 | Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 17 | optional : bool, default is Undefined, optional 18 | Specify whether the ConfigMap or its key must be defined 19 | """ 20 | 21 | 22 | key: str 23 | 24 | name?: str 25 | 26 | optional?: bool 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/photon_persistent_disk_volume_source.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the photon_persistent_disk_volume_source module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema PhotonPersistentDiskVolumeSource: 9 | """ Represents a Photon Controller persistent disk resource. 10 | 11 | Attributes 12 | ---------- 13 | fsType : str, default is Undefined, optional 14 | Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. 15 | pdID : str, default is Undefined, required 16 | ID that identifies Photon Controller persistent disk 17 | """ 18 | 19 | 20 | fsType?: str 21 | 22 | pdID: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/exec_action.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the exec_action module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema ExecAction: 9 | """ ExecAction describes a "run in container" action. 10 | 11 | Attributes 12 | ---------- 13 | command : [str], default is Undefined, optional 14 | Command is the command line to execute inside the container, the working directory for the command is root ('/') in the container's filesystem. The command is simply exec'd, it is not run inside a shell, so traditional shell instructions ('|', etc) won't work. To use a shell, you need to explicitly call out to that shell. Exit status of 0 is treated as live/healthy and non-zero is unhealthy. 15 | """ 16 | 17 | 18 | command?: [str] 19 | 20 | 21 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/weighted_pod_affinity_term.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the weighted_pod_affinity_term module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema WeightedPodAffinityTerm: 9 | """ The weights of all of the matched WeightedPodAffinityTerm fields are added per-node to find the most preferred node(s) 10 | 11 | Attributes 12 | ---------- 13 | weight : int, default is Undefined, required 14 | weight associated with matching the corresponding podAffinityTerm, in the range 1-100. 15 | podAffinityTerm : PodAffinityTerm, default is Undefined, required 16 | Required. A pod affinity term, associated with the corresponding weight. 17 | """ 18 | 19 | 20 | weight: int 21 | 22 | podAffinityTerm: PodAffinityTerm 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/secret_env_source.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the secret_env_source module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema SecretEnvSource: 9 | """ SecretEnvSource selects a Secret to populate the environment variables with. 10 | The contents of the target Secret's Data field will represent the key-value pairs as environment variables. 11 | 12 | Attributes 13 | ---------- 14 | name : str, default is Undefined, optional 15 | Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 16 | optional : bool, default is Undefined, optional 17 | Specify whether the Secret must be defined 18 | """ 19 | 20 | 21 | name?: str 22 | 23 | optional?: bool 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/test.ps1: -------------------------------------------------------------------------------- 1 | # Stop on error. 2 | # Note: Before you start tests, please install kcl and kpm 3 | # kcl Installation: https://kcl-lang.io/docs/user_docs/getting-started/install 4 | # kpm Installation: https://kcl-lang.io/docs/user_docs/guides/package-management/installation 5 | $ErrorActionPreference = "Stop" 6 | $pwd = Split-Path -Parent $MyInvocation.MyCommand.Path 7 | 8 | $paths = @("configuration", "validation", "abstraction", "definition", "konfig", "mutation", "data-integration", "automation", "package-management", "kubernetes", "codelab", "server", "settings", "source") 9 | foreach ($path in $paths) { 10 | Write-Host "Testing $path ..." 11 | Set-Location -Path "$pwd\$path" 12 | try { 13 | & make test | Out-Host 14 | Write-Host "Test SUCCESSED - $path" -ForegroundColor Green 15 | } 16 | catch { 17 | Write-Host "Test FAILED - $path" -ForegroundColor Red 18 | exit 1 19 | } 20 | Write-Host "" 21 | } 22 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/env_from_source.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the env_from_source module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema EnvFromSource: 9 | """ EnvFromSource represents the source of a set of ConfigMaps 10 | 11 | Attributes 12 | ---------- 13 | prefix : str, default is Undefined, optional 14 | An optional identifier to prepend to each key in the ConfigMap. Must be a C_IDENTIFIER. 15 | configMapRef : ConfigMapEnvSource, default is Undefined, optional 16 | The ConfigMap to select from 17 | secretRef : SecretEnvSource, default is Undefined, optional 18 | The Secret to select from 19 | """ 20 | 21 | 22 | prefix?: str 23 | 24 | configMapRef?: ConfigMapEnvSource 25 | 26 | secretRef?: SecretEnvSource 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_6/stdout: -------------------------------------------------------------------------------- 1 | cloning 'https://github.com/kcl-lang/flask-demo-kcl-manifests' with tag 'v0.1.0' 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: flask-demo 6 | labels: 7 | app: flask-demo 8 | namespace: default 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: flask-demo 14 | template: 15 | metadata: 16 | labels: 17 | app: flask-demo 18 | spec: 19 | containers: 20 | - name: flaskdemo 21 | image: kcllang/flask_demo:8d31498e765ff67a2fa9933d4adffe067544b2fe 22 | ports: 23 | - protocol: TCP 24 | containerPort: 5000 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: flask-demo 30 | labels: 31 | app: flask-demo 32 | namespace: default 33 | spec: 34 | type: NodePort 35 | selector: 36 | app: flask-demo 37 | ports: 38 | - port: 5000 39 | protocol: TCP 40 | targetPort: 5000 41 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_9/stdout: -------------------------------------------------------------------------------- 1 | cloning 'https://github.com/kcl-lang/flask-demo-kcl-manifests' with tag 'v0.1.0' 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: flask-demo 6 | labels: 7 | app: flask-demo 8 | namespace: default 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: flask-demo 14 | template: 15 | metadata: 16 | labels: 17 | app: flask-demo 18 | spec: 19 | containers: 20 | - name: flaskdemo 21 | image: kcllang/flask_demo:8d31498e765ff67a2fa9933d4adffe067544b2fe 22 | ports: 23 | - protocol: TCP 24 | containerPort: 5000 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: flask-demo 30 | labels: 31 | app: flask-demo 32 | namespace: default 33 | spec: 34 | type: NodePort 35 | selector: 36 | app: flask-demo 37 | ports: 38 | - port: 5000 39 | protocol: TCP 40 | targetPort: 5000 41 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_10/stdout: -------------------------------------------------------------------------------- 1 | cloning 'https://github.com/kcl-lang/flask-demo-kcl-manifests' with commit 'ade147b' 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: flask-demo 6 | labels: 7 | app: flask-demo 8 | namespace: default 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: flask-demo 14 | template: 15 | metadata: 16 | labels: 17 | app: flask-demo 18 | spec: 19 | containers: 20 | - name: flaskdemo 21 | image: kcllang/flask_demo:8d31498e765ff67a2fa9933d4adffe067544b2fe 22 | ports: 23 | - protocol: TCP 24 | containerPort: 5000 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: flask-demo 30 | labels: 31 | app: flask-demo 32 | namespace: default 33 | spec: 34 | type: NodePort 35 | selector: 36 | app: flask-demo 37 | ports: 38 | - port: 5000 39 | protocol: TCP 40 | targetPort: 5000 41 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_5/stdout: -------------------------------------------------------------------------------- 1 | cloning 'https://github.com/kcl-lang/flask-demo-kcl-manifests' with branch 'main' 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: flask-demo 6 | labels: 7 | app: flask-demo 8 | namespace: default 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: flask-demo 14 | template: 15 | metadata: 16 | labels: 17 | app: flask-demo 18 | spec: 19 | containers: 20 | - name: flaskdemo 21 | image: kcllang/flask_demo:8d31498e765ff67a2fa9933d4adffe067544b2fe 22 | ports: 23 | - protocol: TCP 24 | containerPort: 5000 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: flask-demo 30 | labels: 31 | app: flask-demo 32 | namespace: default 33 | spec: 34 | type: NodePort 35 | selector: 36 | app: flask-demo 37 | ports: 38 | - port: 5000 39 | protocol: TCP 40 | targetPort: 5000 41 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_7/stdout: -------------------------------------------------------------------------------- 1 | cloning 'https://github.com/kcl-lang/flask-demo-kcl-manifests' with commit 'ade147b' 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: flask-demo 6 | labels: 7 | app: flask-demo 8 | namespace: default 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: flask-demo 14 | template: 15 | metadata: 16 | labels: 17 | app: flask-demo 18 | spec: 19 | containers: 20 | - name: flaskdemo 21 | image: kcllang/flask_demo:8d31498e765ff67a2fa9933d4adffe067544b2fe 22 | ports: 23 | - protocol: TCP 24 | containerPort: 5000 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: flask-demo 30 | labels: 31 | app: flask-demo 32 | namespace: default 33 | spec: 34 | type: NodePort 35 | selector: 36 | app: flask-demo 37 | ports: 38 | - port: 5000 39 | protocol: TCP 40 | targetPort: 5000 41 | -------------------------------------------------------------------------------- /test/e2e/test_suites/test_kcl_run_8/stdout: -------------------------------------------------------------------------------- 1 | cloning 'https://github.com/kcl-lang/flask-demo-kcl-manifests' with branch 'main' 2 | apiVersion: apps/v1 3 | kind: Deployment 4 | metadata: 5 | name: flask-demo 6 | labels: 7 | app: flask-demo 8 | namespace: default 9 | spec: 10 | replicas: 1 11 | selector: 12 | matchLabels: 13 | app: flask-demo 14 | template: 15 | metadata: 16 | labels: 17 | app: flask-demo 18 | spec: 19 | containers: 20 | - name: flaskdemo 21 | image: kcllang/flask_demo:8d31498e765ff67a2fa9933d4adffe067544b2fe 22 | ports: 23 | - protocol: TCP 24 | containerPort: 5000 25 | --- 26 | apiVersion: v1 27 | kind: Service 28 | metadata: 29 | name: flask-demo 30 | labels: 31 | app: flask-demo 32 | namespace: default 33 | spec: 34 | type: NodePort 35 | selector: 36 | app: flask-demo 37 | ports: 38 | - port: 5000 39 | protocol: TCP 40 | targetPort: 5000 41 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/config_map_env_source.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the config_map_env_source module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema ConfigMapEnvSource: 9 | """ ConfigMapEnvSource selects a ConfigMap to populate the environment variables with. 10 | The contents of the target ConfigMap's Data field will represent the key-value pairs as environment variables. 11 | 12 | Attributes 13 | ---------- 14 | name : str, default is Undefined, optional 15 | Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 16 | optional : bool, default is Undefined, optional 17 | Specify whether the ConfigMap must be defined 18 | """ 19 | 20 | 21 | name?: str 22 | 23 | optional?: bool 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/secret_key_selector.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the secret_key_selector module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema SecretKeySelector: 9 | """ SecretKeySelector selects a key of a Secret. 10 | 11 | Attributes 12 | ---------- 13 | key : str, default is Undefined, required 14 | The key of the secret to select from. Must be a valid secret key. 15 | name : str, default is Undefined, optional 16 | Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names 17 | optional : bool, default is Undefined, optional 18 | Specify whether the Secret or its key must be defined 19 | """ 20 | 21 | 22 | key: str 23 | 24 | name?: str 25 | 26 | optional?: bool 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/preferred_scheduling_term.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the preferred_scheduling_term module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema PreferredSchedulingTerm: 9 | """ An empty preferred scheduling term matches all objects with implicit weight 0 (i.e. it's a no-op). A null preferred scheduling term matches no objects (i.e. is also a no-op). 10 | 11 | Attributes 12 | ---------- 13 | weight : int, default is Undefined, required 14 | Weight associated with matching the corresponding nodeSelectorTerm, in the range 1-100. 15 | preference : NodeSelectorTerm, default is Undefined, required 16 | A node selector term, associated with the corresponding weight. 17 | """ 18 | 19 | 20 | weight: int 21 | 22 | preference: NodeSelectorTerm 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/resource_field_selector.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the resource_field_selector module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema ResourceFieldSelector: 9 | """ ResourceFieldSelector represents container resources (cpu, memory) and their output format 10 | 11 | Attributes 12 | ---------- 13 | containerName : str, default is Undefined, optional 14 | Container name: required for volumes, optional for env vars 15 | divisor : str, default is Undefined, optional 16 | Specifies the output format of the exposed resources, defaults to "1" 17 | resource : str, default is Undefined, required 18 | Required: resource to select 19 | """ 20 | 21 | 22 | containerName?: str 23 | 24 | divisor?: str 25 | 26 | resource: str 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/azure_file_volume_source.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the azure_file_volume_source module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema AzureFileVolumeSource: 9 | """ AzureFile represents an Azure File Service mount on the host and bind mount to the pod. 10 | 11 | Attributes 12 | ---------- 13 | readOnly : bool, default is Undefined, optional 14 | Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. 15 | secretName : str, default is Undefined, required 16 | the name of secret that contains Azure Storage Account Name and Key 17 | shareName : str, default is Undefined, required 18 | Share Name 19 | """ 20 | 21 | 22 | readOnly?: bool 23 | 24 | secretName: str 25 | 26 | shareName: str 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/node_selector_term.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the node_selector_term module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema NodeSelectorTerm: 9 | """ A null or empty node selector term matches no objects. The requirements of them are ANDed. The TopologySelectorTerm type implements a subset of the NodeSelectorTerm. 10 | 11 | Attributes 12 | ---------- 13 | matchExpressions : [NodeSelectorRequirement], default is Undefined, optional 14 | A list of node selector requirements by node's labels. 15 | matchFields : [NodeSelectorRequirement], default is Undefined, optional 16 | A list of node selector requirements by node's fields. 17 | """ 18 | 19 | 20 | matchExpressions?: [NodeSelectorRequirement] 21 | 22 | matchFields?: [NodeSelectorRequirement] 23 | 24 | 25 | -------------------------------------------------------------------------------- /test/e2e/e2e_suite_test.go: -------------------------------------------------------------------------------- 1 | package e2e 2 | 3 | import ( 4 | "fmt" 5 | "path/filepath" 6 | "testing" 7 | 8 | "github.com/onsi/ginkgo/v2" 9 | "github.com/onsi/gomega" 10 | ) 11 | 12 | func TestE2e(t *testing.T) { 13 | gomega.RegisterFailHandler(ginkgo.Fail) 14 | ginkgo.RunSpecs(t, "E2e Suite") 15 | } 16 | 17 | var _ = ginkgo.BeforeEach(func() { 18 | ginkgo.By("create kpm test workspace", func() { 19 | _ = CreateTestWorkspace() 20 | }) 21 | }) 22 | 23 | var _ = ginkgo.AfterEach(func() { 24 | ginkgo.By("clean up kpm test workspace", func() { 25 | _ = CleanUpTestWorkspace() 26 | }) 27 | }) 28 | 29 | var _ = ginkgo.AfterSuite(func() { 30 | ginkgo.By("clean up kpm bin", func() { 31 | path := filepath.Join(GetWorkDir(), "../..", "bin") 32 | cli := fmt.Sprintf("rm -rf %s", path) 33 | stdout, stderr, err := Exec(cli) 34 | gomega.Expect(err).ShouldNot(gomega.HaveOccurred()) 35 | gomega.Expect(stdout).To(gomega.BeEmpty()) 36 | gomega.Expect(stderr).To(gomega.BeEmpty()) 37 | }) 38 | }) 39 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/flocker_volume_source.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the flocker_volume_source module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema FlockerVolumeSource: 9 | """ Represents a Flocker volume mounted by the Flocker agent. One and only one of datasetName and datasetUUID should be set. Flocker volumes do not support ownership management or SELinux relabeling. 10 | 11 | Attributes 12 | ---------- 13 | datasetName : str, default is Undefined, optional 14 | Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated 15 | datasetUUID : str, default is Undefined, optional 16 | UUID of the dataset. This is unique identifier of a Flocker dataset 17 | """ 18 | 19 | 20 | datasetName?: str 21 | 22 | datasetUUID?: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/handler.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the handler module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema Handler: 9 | """ Handler defines a specific action that should be taken 10 | 11 | Attributes 12 | ---------- 13 | exec : ExecAction, default is Undefined, optional 14 | One and only one of the following should be specified. Exec specifies the action to take. 15 | httpGet : HTTPGetAction, default is Undefined, optional 16 | HTTPGet specifies the http request to perform. 17 | tcpSocket : TCPSocketAction, default is Undefined, optional 18 | TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported 19 | """ 20 | 21 | 22 | exec?: ExecAction 23 | 24 | httpGet?: HTTPGetAction 25 | 26 | tcpSocket?: TCPSocketAction 27 | 28 | 29 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/host_path_volume_source.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the host_path_volume_source module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema HostPathVolumeSource: 9 | """ Represents a host path mapped into a pod. Host path volumes do not support ownership management or SELinux relabeling. 10 | 11 | Attributes 12 | ---------- 13 | path : str, default is Undefined, required 14 | Path of the directory on the host. If the path is a symlink, it will follow the link to the real path. More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath 15 | $type : str, default is Undefined, optional 16 | Type for HostPath Volume Defaults to "" More info: https://kubernetes.io/docs/concepts/storage/volumes#hostpath 17 | """ 18 | 19 | 20 | path: str 21 | 22 | $type?: str 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/mutation/transformer.k: -------------------------------------------------------------------------------- 1 | items = lambda { 2 | # Construct resource and params 3 | resource = option("resource_list") 4 | items = resource.items 5 | params = resource.functionConfig.spec.params 6 | new_replicas: int = params.replicas 7 | min_replicas: int = params.min_replicas or 0 8 | max_replicas: int = params.max_replicas or 99999 9 | # Define the validation function 10 | validate_replica_limit = lambda item, min_replicas: int, max_replicas: int, new_replicas: int { 11 | replicas = item.spec.replicas or 0 12 | assert min_replicas < replicas < max_replicas, "The provided number of replicas ${replicas} is not allowed for ${item.kind}: ${item.metadata.name}. Allowed range: ${min} - ${max}" 13 | item | { 14 | if typeof(new_replicas) == "int": 15 | spec.replicas = new_replicas 16 | } 17 | } 18 | # Validate All resource 19 | [validate_replica_limit(i, min_replicas, max_replicas, new_replicas) for i in items] 20 | }() 21 | -------------------------------------------------------------------------------- /scripts/e2e/pull_pkg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # set the kpm default registry and repository 4 | export KPM_REG="ghcr.io" 5 | export KPM_REPO="kcl-lang" 6 | export OCI_REG_PLAIN_HTTP=off 7 | 8 | current_dir=$(pwd) 9 | 10 | mkdir -p ./scripts/e2e/pkg_in_reg/ 11 | 12 | cd ./scripts/e2e/pkg_in_reg/ 13 | 14 | 15 | # Check if file exists 16 | 17 | if [ ! -d "./oci/ghcr.io/kcl-lang/k8s/1.27/k8s/1.27" ]; then 18 | $current_dir/bin/kcl mod pull k8s:1.27 19 | fi 20 | 21 | if [ ! -d "./oci/ghcr.io/kcl-lang/k8s/1.28/k8s/1.28" ]; then 22 | $current_dir/bin/kcl mod pull k8s:1.28 23 | fi 24 | 25 | if [ ! -d "./oci/ghcr.io/kcl-lang/k8s/1.31.2/k8s/1.31.2" ]; then 26 | $current_dir/bin/kcl mod pull k8s:1.31.2 27 | fi 28 | 29 | if [ ! -d "./oci/ghcr.io/kcl-lang/helloworld/0.1.1/helloworld/0.1.1" ]; then 30 | $current_dir/bin/kcl mod pull helloworld:0.1.1 31 | fi 32 | 33 | if [ ! -d "./oci/ghcr.io/kcl-lang/helloworld/0.1.4/helloworld/0.1.4" ]; then 34 | $current_dir/bin/kcl mod pull helloworld:0.1.4 35 | fi 36 | 37 | cd "$current_dir" 38 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/pod_template_spec.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the pod_template_spec module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | import k8spkg.apimachinery.apis 7 | 8 | 9 | schema PodTemplateSpec: 10 | """ PodTemplateSpec describes the data a pod should have when created from a template 11 | 12 | Attributes 13 | ---------- 14 | metadata : apis.ObjectMeta, default is Undefined, optional 15 | Standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata 16 | spec : PodSpec, default is Undefined, optional 17 | Specification of the desired behavior of the pod. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status 18 | """ 19 | 20 | 21 | metadata?: apis.ObjectMeta 22 | 23 | spec?: PodSpec 24 | 25 | 26 | -------------------------------------------------------------------------------- /examples/codelab/schema/pkg/deploy.k: -------------------------------------------------------------------------------- 1 | import regex 2 | 3 | schema Deployment: 4 | name: str 5 | cpu: int = 512 6 | memory: int = cpu * 2 7 | volumes?: [Volume] 8 | image: str 9 | service?: Service 10 | replica: int = 1 11 | command: [str] 12 | labels?: {str:str} 13 | 14 | check: 15 | multiplyof(cpu, 256), "cpu must be a multiplier of 256" 16 | regex.match(image, "^[a-zA-Z]+:\d+\.\d+\.\d+$"), "image name should be like 'nginx:1.14.2'" 17 | 1 <= replica < 100, "replica should be in range (1, 100)" 18 | len(labels) >= 2 if labels, "the length of labels should be large or equal to 2" 19 | "env" in labels, "'env' must be in labels" 20 | len(command) > 0, "the command list should be non-empty" 21 | 22 | schema Port: 23 | name: str 24 | protocol: str 25 | port: int 26 | targetPort: int 27 | 28 | schema Service: 29 | name: "my-service" = "my-service" 30 | ports: [Port] 31 | 32 | schema Volume: 33 | name: str 34 | mountPath: str 35 | hostPath: str 36 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/core/v1/se_linux_options.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the se_linux_options module in k8spkg.api.core.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema SELinuxOptions: 9 | """ SELinuxOptions are the labels to be applied to the container 10 | 11 | Attributes 12 | ---------- 13 | level : str, default is Undefined, optional 14 | Level is SELinux level label that applies to the container. 15 | role : str, default is Undefined, optional 16 | Role is a SELinux role label that applies to the container. 17 | $type : str, default is Undefined, optional 18 | Type is a SELinux type label that applies to the container. 19 | user : str, default is Undefined, optional 20 | User is a SELinux user label that applies to the container. 21 | """ 22 | 23 | 24 | level?: str 25 | 26 | role?: str 27 | 28 | $type?: str 29 | 30 | user?: str 31 | 32 | 33 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/apps/v1/stateful_set_update_strategy.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the stateful_set_update_strategy module in k8spkg.api.apps.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema StatefulSetUpdateStrategy: 9 | """ StatefulSetUpdateStrategy indicates the strategy that the StatefulSet controller will use to perform updates. It includes any additional parameters necessary to perform the update for the indicated strategy. 10 | 11 | Attributes 12 | ---------- 13 | $type : str, default is Undefined, optional 14 | Type indicates the type of the StatefulSetUpdateStrategy. Default is RollingUpdate. 15 | rollingUpdate : RollingUpdateStatefulSetStrategy, default is Undefined, optional 16 | RollingUpdate is used to communicate parameters when Type is RollingUpdateStatefulSetStrategyType. 17 | """ 18 | 19 | 20 | $type?: str 21 | 22 | rollingUpdate?: RollingUpdateStatefulSetStrategy 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/codelab/schema/k8spkg/api/autoscaling/v1/cross_version_object_reference.k: -------------------------------------------------------------------------------- 1 | """ 2 | This is the cross_version_object_reference module in k8spkg.api.autoscaling.v1 package. 3 | This file was generated by the KCL auto-gen tool. DO NOT EDIT. 4 | Editing this file might prove futile when you re-run the KCL auto-gen generate command. 5 | """ 6 | 7 | 8 | schema CrossVersionObjectReference: 9 | """ CrossVersionObjectReference contains enough information to let you identify the referred resource. 10 | 11 | Attributes 12 | ---------- 13 | apiVersion : str, default is Undefined, optional 14 | API version of the referent 15 | kind : str, default is Undefined, required 16 | Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds" 17 | name : str, default is Undefined, required 18 | Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names 19 | """ 20 | 21 | 22 | apiVersion?: str 23 | 24 | kind: str 25 | 26 | name: str 27 | 28 | 29 | --------------------------------------------------------------------------------