Skip to content

Commit be69c0f

Browse files
committed
Refactor konfig for kclipper
1 parent 7b4137d commit be69c0f

File tree

181 files changed

+117511
-1348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

181 files changed

+117511
-1348
lines changed

.taskfiles/kcl/Taskfile.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
# yaml-language-server: $schema=https://taskfile.dev/schema.json
3+
version: "3"
4+
5+
tasks:
6+
default:
7+
desc: Run KCL for app
8+
requires:
9+
vars: [APP]
10+
vars:
11+
F: '{{.F | default "base"}}'
12+
dir: "{{.ROOT_DIR}}/apps/{{.APP}}/{{.F}}"
13+
cmds:
14+
- kcl run
15+
16+
gen:
17+
desc: Generate KCL code
18+
dir: "{{.ROOT_DIR}}/konfig"
19+
cmds:
20+
- kcl chart update

.vscode/settings.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"terminal.integrated.profiles.osx": {
3+
"devboxCompatibleShell": {
4+
"path": "/opt/homebrew/bin/fish",
5+
"args": [
6+
"--no-config"
7+
]
8+
}
9+
},
10+
"terminal.integrated.defaultProfile.osx": "devboxCompatibleShell",
11+
"editor.inlayHints.enabled": "offUnlessPressed"
12+
}

Taskfile.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ includes:
4141
turingpi:
4242
taskfile: ./.taskfiles/turing-pi/taskfile.yaml
4343
aliases: [tpi]
44+
kcl:
45+
taskfile: ./.taskfiles/kcl/Taskfile.yaml
4446

4547
tasks:
4648
default:
File renamed without changes.

konfig/apps/kube/kcl.mod apps/argo/_tenant/kcl.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
2-
name = "kube"
3-
version = "0.0.1"
2+
name = "argo_tenant"
3+
version = "0.1.0"
44

55
[dependencies]
66
konfig = { path = "../../../konfig" }

apps/argo/_tenant/kcl.mod.lock

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[dependencies]
2+
[dependencies.cilium]
3+
name = "cilium"
4+
full_name = "cilium_0.4.1"
5+
version = "0.4.1"
6+
sum = "YmVvSokDKgHSwDc7XRfVyNdniLwF+lA57/Vgi60MDGo="
7+
reg = "ghcr.io"
8+
repo = "kcl-lang/cilium"
9+
oci_tag = "0.4.1"
10+
[dependencies.filepath]
11+
name = "filepath"
12+
full_name = "filepath_0.11.0"
13+
version = "0.11.0"
14+
sum = "cMqronmlitsA3LmU8lpwKyEA6w4aB3OuwnRrU6cBEHA="
15+
reg = "ghcr.io"
16+
repo = "macropower/kclipper/filepath"
17+
oci_tag = "0.11.0"
18+
[dependencies.helm]
19+
name = "helm"
20+
full_name = "helm_0.11.0"
21+
version = "0.11.0"
22+
sum = "fDoGuQYTIPj8jKmZHatWcTcFPNLTe3cwTK94XXwoLiw="
23+
reg = "ghcr.io"
24+
repo = "macropower/kclipper/helm"
25+
oci_tag = "0.11.0"
26+
[dependencies.json_merge_patch]
27+
name = "json_merge_patch"
28+
full_name = "json_merge_patch_0.1.1"
29+
version = "0.1.1"
30+
sum = "o1aamShk1L2MGjnN9u3IErRZ3xBNDxgmFxXsGVMt8Wk="
31+
reg = "ghcr.io"
32+
repo = "kcl-lang/json_merge_patch"
33+
oci_tag = "0.1.1"
34+
[dependencies.k8s]
35+
name = "k8s"
36+
full_name = "k8s_1.31.2"
37+
version = "1.31.2"
38+
sum = "xBZgPsnpVVyWBpahuPQHReeRx28eUHGFoaPeqbct+vs="
39+
reg = "ghcr.io"
40+
repo = "kcl-lang/k8s"
41+
oci_tag = "1.31.2"
42+
[dependencies.konfig]
43+
name = "konfig"
44+
full_name = "konfig_0.0.1"
45+
version = "0.0.1"

konfig/apps/argo/main.k apps/argo/_tenant/main.k

-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,4 @@ import konfig.models.frontend
22

33
tenantConfiguration: frontend.Tenant {
44
name = "argo"
5-
6-
destinations.legacy = {
7-
namespace = "argocd"
8-
}
95
}

apps/argo/cd/base/kcl.mod

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[package]
2+
name = "argo_cd_base"
3+
version = "0.1.0"
4+
5+
[dependencies]
6+
argo_tenant = { path = "../../_tenant" }

apps/argo/cd/base/kcl.mod.lock

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[dependencies]
2+
[dependencies.argo_tenant]
3+
name = "argo_tenant"
4+
full_name = "argo_tenant_0.1.0"
5+
version = "0.1.0"
6+
[dependencies.cilium]
7+
name = "cilium"
8+
full_name = "cilium_0.4.1"
9+
version = "0.4.1"
10+
sum = "YmVvSokDKgHSwDc7XRfVyNdniLwF+lA57/Vgi60MDGo="
11+
reg = "ghcr.io"
12+
repo = "kcl-lang/cilium"
13+
oci_tag = "0.4.1"
14+
[dependencies.filepath]
15+
name = "filepath"
16+
full_name = "filepath_0.11.0"
17+
version = "0.11.0"
18+
sum = "cMqronmlitsA3LmU8lpwKyEA6w4aB3OuwnRrU6cBEHA="
19+
reg = "ghcr.io"
20+
repo = "macropower/kclipper/filepath"
21+
oci_tag = "0.11.0"
22+
[dependencies.helm]
23+
name = "helm"
24+
full_name = "helm_0.11.0"
25+
version = "0.11.0"
26+
sum = "fDoGuQYTIPj8jKmZHatWcTcFPNLTe3cwTK94XXwoLiw="
27+
reg = "ghcr.io"
28+
repo = "macropower/kclipper/helm"
29+
oci_tag = "0.11.0"
30+
[dependencies.json_merge_patch]
31+
name = "json_merge_patch"
32+
full_name = "json_merge_patch_0.1.1"
33+
version = "0.1.1"
34+
sum = "o1aamShk1L2MGjnN9u3IErRZ3xBNDxgmFxXsGVMt8Wk="
35+
reg = "ghcr.io"
36+
repo = "kcl-lang/json_merge_patch"
37+
oci_tag = "0.1.1"
38+
[dependencies.k8s]
39+
name = "k8s"
40+
full_name = "k8s_1.31.2"
41+
version = "1.31.2"
42+
sum = "xBZgPsnpVVyWBpahuPQHReeRx28eUHGFoaPeqbct+vs="
43+
reg = "ghcr.io"
44+
repo = "kcl-lang/k8s"
45+
oci_tag = "1.31.2"
46+
[dependencies.konfig]
47+
name = "konfig"
48+
full_name = "konfig_0.0.1"
49+
version = "0.0.1"

apps/argo/cd/base/main.k

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import file
2+
3+
import argo_tenant
4+
import filepath
5+
import konfig.charts.argo_cd
6+
import konfig.models.frontend
7+
8+
_current_dir = filepath.dir(file.current())
9+
10+
app: frontend.App {
11+
name = "cd"
12+
tenantName = argo_tenant.tenantConfiguration.name
13+
14+
charts.argo_cd = argo_cd.Chart {
15+
valueFiles: [
16+
filepath.join([_current_dir, "values.yaml"]),
17+
]
18+
}
19+
}

apps/argo/cd/base/values.yaml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# yaml-language-server: $schema=../../../../konfig/charts/argo_cd/values.schema.json
2+
3+
# https://artifacthub.io/packages/helm/argo/argo-cd
4+
5+
nameOverride: argo-cd
6+
7+
global:
8+
logging:
9+
format: json
10+
11+
configs:
12+
# General Argo CD configuration
13+
## Ref: https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/argocd-cm.yaml
14+
cm:
15+
application.resourceTrackingMethod: annotation
16+
17+
resource.exclusions: |
18+
- apiGroups:
19+
- cilium.io
20+
kinds:
21+
- CiliumIdentity
22+
clusters:
23+
- "*"
24+
25+
# Argo CD configuration parameters
26+
## Ref: https://github.com/argoproj/argo-cd/blob/master/docs/operator-manual/argocd-cmd-params-cm.yaml
27+
params:
28+
server.insecure: true
29+
server.disable.auth: true
30+
31+
cmp:
32+
create: true
33+
plugins:
34+
kcl:
35+
generate:
36+
command: [kcl]
37+
args:
38+
- run
39+
- --no_style
40+
- --quiet
41+
- --log_level=info
42+
- --log_format=json
43+
discover:
44+
fileName: "*.k"
45+
46+
repoServer:
47+
extraContainers:
48+
- name: kcl-plugin
49+
image: ghcr.io/macropower/kclipper:v0.11.1
50+
command: [/var/run/argocd/argocd-cmp-server]
51+
securityContext:
52+
runAsNonRoot: true
53+
runAsUser: 999
54+
runAsGroup: 999
55+
volumeMounts:
56+
- name: var-files
57+
mountPath: /var/run/argocd
58+
- name: plugins
59+
mountPath: /home/argocd/cmp-server/plugins
60+
- name: kcl-plugin-config
61+
mountPath: /home/argocd/cmp-server/config/plugin.yaml
62+
subPath: kcl.yaml
63+
- name: cmp-tmp
64+
mountPath: /tmp
65+
env:
66+
- name: KPM_FEATURE_GATES
67+
value: SupportMVS=true
68+
volumes:
69+
- name: kcl-plugin-config
70+
configMap:
71+
name: argocd-cmp-cm
72+
- name: cmp-tmp
73+
emptyDir: {}
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[package]
2-
name = "bootstrap"
3-
version = "0.0.1"
2+
name = "argo_cd_mgmt"
3+
version = "0.1.0"
44

55
[dependencies]
6-
konfig = { path = "../../konfig" }
6+
argo_cd_base = { path = "../base" }
77

88
[profile]
99
entries = ["main.k", "${konfig:KCL_MOD}/models/render/render.k"]

apps/argo/cd/mgmt/kcl.mod.lock

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
[dependencies]
2+
[dependencies.argo_cd_base]
3+
name = "argo_cd_base"
4+
full_name = "argo_cd_base_0.1.0"
5+
version = "0.1.0"
6+
[dependencies.argo_tenant]
7+
name = "argo_tenant"
8+
full_name = "argo_tenant_0.1.0"
9+
version = "0.1.0"
10+
[dependencies.cilium]
11+
name = "cilium"
12+
full_name = "cilium_0.4.1"
13+
version = "0.4.1"
14+
sum = "YmVvSokDKgHSwDc7XRfVyNdniLwF+lA57/Vgi60MDGo="
15+
reg = "ghcr.io"
16+
repo = "kcl-lang/cilium"
17+
oci_tag = "0.4.1"
18+
[dependencies.filepath]
19+
name = "filepath"
20+
full_name = "filepath_0.11.0"
21+
version = "0.11.0"
22+
sum = "cMqronmlitsA3LmU8lpwKyEA6w4aB3OuwnRrU6cBEHA="
23+
reg = "ghcr.io"
24+
repo = "macropower/kclipper/filepath"
25+
oci_tag = "0.11.0"
26+
[dependencies.helm]
27+
name = "helm"
28+
full_name = "helm_0.11.0"
29+
version = "0.11.0"
30+
sum = "fDoGuQYTIPj8jKmZHatWcTcFPNLTe3cwTK94XXwoLiw="
31+
reg = "ghcr.io"
32+
repo = "macropower/kclipper/helm"
33+
oci_tag = "0.11.0"
34+
[dependencies.json_merge_patch]
35+
name = "json_merge_patch"
36+
full_name = "json_merge_patch_0.1.1"
37+
version = "0.1.1"
38+
sum = "o1aamShk1L2MGjnN9u3IErRZ3xBNDxgmFxXsGVMt8Wk="
39+
reg = "ghcr.io"
40+
repo = "kcl-lang/json_merge_patch"
41+
oci_tag = "0.1.1"
42+
[dependencies.k8s]
43+
name = "k8s"
44+
full_name = "k8s_1.31.2"
45+
version = "1.31.2"
46+
sum = "xBZgPsnpVVyWBpahuPQHReeRx28eUHGFoaPeqbct+vs="
47+
reg = "ghcr.io"
48+
repo = "kcl-lang/k8s"
49+
oci_tag = "1.31.2"
50+
[dependencies.konfig]
51+
name = "konfig"
52+
full_name = "konfig_0.0.1"
53+
version = "0.0.1"

konfig/apps/argo/cd/home/main.k apps/argo/cd/mgmt/main.k

+19-15
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
1+
import file
12
import json
2-
import konfig.models.frontend
3-
import konfig.models.frontend.secret
4-
import tenant
53

6-
tenantConfiguration = tenant.tenantConfiguration
4+
import argo_cd_base
5+
import filepath
6+
import konfig.models.frontend.secret
77

8-
appConfiguration: frontend.App {
9-
name = "cd"
10-
tenantName = tenantConfiguration.name
11-
namespace = "argocd"
8+
_current_dir = filepath.dir(file.current())
129

13-
secretStores.clusters = secret.SecretStore {
14-
name = "clusters"
15-
provider.doppler.auth.secretRef.dopplerToken = {
16-
name = "doppler-credentials"
17-
key = "token"
18-
}
10+
secretStoreClusters = secret.SecretStore {
11+
name = "clusters"
12+
provider.doppler.auth.secretRef.dopplerToken = {
13+
name = "doppler-credentials"
14+
key = "token"
1915
}
16+
}
17+
18+
app = argo_cd_base.app | {
19+
secretStores.clusters = secretStoreClusters
20+
21+
charts.argo_cd.valueFiles += [
22+
filepath.join([_current_dir, "values.yaml"]),
23+
]
2024

2125
externalSecrets.nas01 = secret.ExternalSecret {
2226
name = "nas01-credentials"
23-
secretStoreRef = secretStores.clusters.getRef()
27+
secretStoreRef = secretStoreClusters.getRef()
2428
data = {
2529
NAS01_API_SERVER = {}
2630
NAS01_CA_DATA = {}

0 commit comments

Comments
 (0)