job.yaml 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. apiVersion: batch/v1
  2. kind: Job
  3. metadata:
  4. name: skopeo-copy
  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 every time the
  8. # container image tag changes.
  9. kustomize.toolkit.fluxcd.io/force: enabled
  10. spec:
  11. backoffLimit: 0
  12. template:
  13. spec:
  14. restartPolicy: Never
  15. containers:
  16. - command:
  17. - bash
  18. - -e
  19. - -c
  20. - "cat /docker-credentials | skopeo login -u kubernetes --password-stdin $SKOPEO_DESTINATION_REGISTRY; if skopeo inspect --config $SKOPEO_DESTINATION_IMAGE; then :; else HTTP_PROXY=$HTTP_PROXY HTTPS_PROXY=$HTTPS_PROXY skopeo copy $SKOPEO_SOURCE_IMAGE $SKOPEO_DESTINATION_IMAGE; fi"
  21. image: nixery.dev/shell/skopeo
  22. name: skopeo-copy
  23. resources:
  24. limits:
  25. cpu: 8000m
  26. memory: 4096Mi
  27. requests:
  28. cpu: 1000m
  29. memory: 512Mi
  30. securityContext:
  31. allowPrivilegeEscalation: false
  32. capabilities:
  33. drop:
  34. - ALL
  35. readOnlyRootFilesystem: true
  36. runAsNonRoot: true
  37. runAsUser: 65534 # nobody
  38. runAsGroup: 65534 # nobody
  39. volumeMounts:
  40. - mountPath: /etc/containers/policy.json
  41. name: skopeo-configuration
  42. subPath: policy.json
  43. readOnly: true
  44. - mountPath: /docker-credentials
  45. name: docker-credentials
  46. subPath: password
  47. readOnly: true
  48. - mountPath: /run
  49. name: run
  50. volumes:
  51. - name: skopeo-configuration
  52. configMap:
  53. name: skopeo-configuration
  54. - name: docker-credentials
  55. secret:
  56. secretName: docker-credentials
  57. - name: run
  58. emptyDir:
  59. sizeLimit: 1M