job.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. apiVersion: batch/v1
  2. kind: Job
  3. metadata:
  4. name: kaniko
  5. annotations:
  6. # Setting spec.force to true will make Flux recreate the Job when any
  7. # immutable field is changed, forcing the Job to run.
  8. kustomize.toolkit.fluxcd.io/force: enabled
  9. spec:
  10. template:
  11. spec:
  12. initContainers:
  13. - name: copy-workspace
  14. image: busybox
  15. command: ["/bin/cp"]
  16. args:
  17. - "-r" # Recurse
  18. - "-L" # Follow all symlinks
  19. - "/mnt/workspace"
  20. - "/"
  21. volumeMounts:
  22. - name: dockerfile-storage
  23. mountPath: /mnt/workspace/build.sh
  24. subPath: build.sh
  25. - name: dockerfile-storage
  26. mountPath: /mnt/workspace/Dockerfile
  27. subPath: Dockerfile
  28. - name: dockerfile-storage
  29. mountPath: /mnt/workspace/rootfs/bin/entrypoint
  30. subPath: entrypoint
  31. - name: dockerfile-storage
  32. mountPath: /mnt/workspace/rootfs/home/oleg/.config/systemd/user/foot.service
  33. subPath: foot.service
  34. - name: dockerfile-storage
  35. mountPath: /mnt/workspace/rootfs/home/oleg/.config/systemd/user/idea.service
  36. subPath: idea.service
  37. - name: dockerfile-storage
  38. mountPath: /mnt/workspace/rootfs/home/oleg/.config/systemd/user/pycharm.service
  39. subPath: pycharm.service
  40. - name: dockerfile-storage
  41. mountPath: /mnt/workspace/rootfs/home/oleg/.config/systemd/user/vscode.service
  42. subPath: vscode.service
  43. - name: dockerfile-storage
  44. mountPath: /mnt/workspace/rootfs/home/oleg/.config/systemd/user/firefox.service
  45. subPath: firefox.service
  46. - name: dockerfile-storage
  47. mountPath: /mnt/workspace/rootfs/home/oleg/.config/aichat/config.yaml
  48. subPath: aichat.yaml
  49. - name: dockerfile-storage
  50. mountPath: /mnt/workspace/rootfs/etc/systemd/system/getty@tty10.service.d/autologin.conf
  51. subPath: autologin.conf
  52. - name: workspace
  53. mountPath: /workspace
  54. resources:
  55. limits:
  56. cpu: 10m
  57. memory: 10Mi
  58. requests:
  59. cpu: 10m
  60. memory: 10Mi
  61. securityContext:
  62. capabilities:
  63. drop:
  64. - ALL
  65. readOnlyRootFilesystem: true
  66. runAsNonRoot: true
  67. runAsUser: 1000
  68. runAsGroup: 998
  69. - name: chmod-hooks
  70. image: busybox
  71. command: ["/bin/sh"]
  72. args:
  73. - "-xc"
  74. - |
  75. chmod +x /workspace/build.sh /workspace/rootfs/bin/entrypoint
  76. volumeMounts:
  77. - name: workspace
  78. mountPath: /workspace
  79. resources:
  80. limits:
  81. cpu: 10m
  82. memory: 10Mi
  83. requests:
  84. cpu: 10m
  85. memory: 10Mi
  86. securityContext:
  87. capabilities:
  88. drop:
  89. - ALL
  90. readOnlyRootFilesystem: true
  91. runAsNonRoot: true
  92. runAsUser: 1000
  93. runAsGroup: 998
  94. containers:
  95. - name: kaniko
  96. image: gcr.io/kaniko-project/executor:v1.23.2
  97. args:
  98. - "--push-retry=10"
  99. - "--destination=harbor.home.wugi.info/library/archlinux-systemd:316b4536" # git rev-parse HEAD | cut -c -8
  100. volumeMounts:
  101. - name: kaniko-secret
  102. mountPath: /kaniko/.docker
  103. - name: workspace
  104. mountPath: /workspace
  105. restartPolicy: Never
  106. volumes:
  107. - name: kaniko-secret
  108. secret:
  109. secretName: regcred
  110. items:
  111. - key: .dockerconfigjson
  112. path: config.json
  113. - name: dockerfile-storage
  114. configMap:
  115. name: data
  116. - name: workspace
  117. emptyDir:
  118. sizeLimit: 300M
  119. backoffLimit: 0