🌳
pt0/deployF/k8sF/initialSetupF/regcacheF/zotResTmplF.mts
3import { getZotCfgJson } from './zotCfgAI.mts'
6export const zotImg = 'ghcr.io/project-zot/zot-linux-amd64:v2.1.5'
7export const zotPortNo = 8080
9export const getZotCfgMap = ({zotCfgName}: {zotCfgName: string}) => {
10 return {
11 apiVersion: 'v1',
12 kind: 'ConfigMap',
13 metadata: {
14 name: zotCfgName,
15 },
16 data: {
17 'config.json': getZotCfgJson(),
18 }
19 }
22export const getZotDeploymentTmpl = ({zotCfgName, htpasswdSecretName}: {zotCfgName: string, htpasswdSecretName: string}) => {
23 const name = regcacheName
25 return {
26 apiVersion: 'apps/v1',
27 kind: 'Deployment',
28 metadata: {
29 name,
30 labels: {
31 name,
32 },
33 },
34 spec: {
35 selector: {
36 matchLabels: { name }
37 },
38 strategy: {type: 'Recreate'},
39 replicas: 1,
40 template: {
41 metadata: {
42 labels: {
43 name,
44 [deployLabel]: name,
45 }
46 },
47 spec: {
48 priorityClassName: k8CriticalStorClass,
49 containers: [
50 {
51 name,
52 image: zotImg,
53 imagePullPolicy: 'IfNotPresent',
54 args: ['serve', '/etc/zot/config.json'],
55 ports: [
56 {
57 containerPort: zotPortNo
58 }
59 ],
60 volumeMounts: [
61 {
62 mountPath: '/var/lib/registry',
63 name: 'registry-data'
64 },
65 {
66 mountPath: '/etc/zot',
67 name: zotCfgName,
68 readOnly: true
69 },
70 {
71 mountPath: '/auth',
72 name: 'htpasswd',
73 readOnly: true
74 },
75 ]
76 }
77 ],
78 volumes: [
79 {
80 name: 'registry-data',
81 persistentVolumeClaim: {
82 claimName: name
83 }
84 },
85 {
86 name: zotCfgName,
87 configMap: {
88 name: zotCfgName
89 }
90 },
91 {
92 name: 'htpasswd',
93 secret: {
94 secretName: htpasswdSecretName
95 }
96 }
97 ]
98 }
99 }
100 }
101 }