deploy-tmp.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. ---
  2. apiVersion: apps/v1
  3. kind: $JNLP_CONTROL
  4. metadata:
  5. name: $DRONE_REPO_NAME
  6. namespace: $JNLP_ENV
  7. labels:
  8. app: $DRONE_REPO_NAME
  9. spec:
  10. serviceName: $DRONE_REPO_NAME
  11. replicas: $JNLP_REPLICAS
  12. selector:
  13. matchLabels:
  14. app: $DRONE_REPO_NAME
  15. template:
  16. metadata:
  17. labels:
  18. app: $DRONE_REPO_NAME
  19. spec:
  20. terminationGracePeriodSeconds: 180
  21. affinity:
  22. podAntiAffinity:
  23. preferredDuringSchedulingIgnoredDuringExecution:
  24. - weight: 100
  25. podAffinityTerm:
  26. labelSelector:
  27. matchExpressions:
  28. - key: app
  29. operator: In
  30. values:
  31. - $DRONE_REPO_NAME
  32. topologyKey: kubernetes.io/hostname
  33. initContainers:
  34. - name: init
  35. image: $JNLP_REPO/dev/busybox
  36. command: ["chmod","777","-R","$JNLP_MOUNT_PATH"]
  37. imagePullPolicy: Always
  38. volumeMounts:
  39. - name: volume
  40. mountPath: $JNLP_MOUNT_PATH
  41. #nodeSelector:
  42. # app.touchrs: touchrs
  43. containers:
  44. - name: $DRONE_REPO_NAME
  45. image: $JNLP_REPO/$JNLP_ENV/$DRONE_REPO_NAME:$JNLP_TAG
  46. imagePullPolicy: Always
  47. ports:
  48. - containerPort: $JNLP_CONTAINER_PORT
  49. name: port
  50. volumeMounts:
  51. - name: volume
  52. mountPath: $JNLP_MOUNT_PATH
  53. livenessProbe:
  54. tcpSocket:
  55. port: $JNLP_CONTAINER_PORT
  56. initialDelaySeconds: $JNLP_LIVENESS_INIT
  57. periodSeconds: $JNLP_LIVENESS_PER
  58. readinessProbe:
  59. tcpSocket:
  60. port: $JNLP_CONTAINER_PORT
  61. initialDelaySeconds: $JNLP_READINESS_INIT
  62. periodSeconds: $JNLP_READINESS_PER
  63. volumeClaimTemplates:
  64. - metadata:
  65. name: volume
  66. spec:
  67. accessModes: ["ReadWriteOnce"]
  68. storageClassName: rbd
  69. resources:
  70. requests:
  71. storage: $JNLP_STORAGE_CAPACITY
  72. ---
  73. apiVersion: v1
  74. kind: Service
  75. metadata:
  76. name: $DRONE_REPO_NAME-svc
  77. namespace: $JNLP_ENV
  78. labels:
  79. app: $DRONE_REPO_NAME-svc
  80. spec:
  81. type: NodePort
  82. ports:
  83. - port: $JNLP_CONTAINER_PORT
  84. targetPort: $JNLP_CONTAINER_PORT
  85. selector:
  86. app: $DRONE_REPO_NAME
  87. ---
  88. apiVersion: networking.k8s.io/v1
  89. kind: Ingress
  90. metadata:
  91. name: $DRONE_REPO_NAME-ingress
  92. namespace: $JNLP_ENV
  93. annotations:
  94. kubernetes.io/ingress.class: $JNLP_INGRESS
  95. spec:
  96. rules:
  97. - host: $JNLP_ENV-$DRONE_REPO_NAME$JNLP_DOMAIN
  98. http:
  99. paths:
  100. - path: /
  101. backend:
  102. serviceName: $DRONE_REPO_NAME-svc
  103. servicePort: $JNLP_CONTAINER_PORT