diff --git a/README.md b/README.md index ab14e61..1c64743 100644 --- a/README.md +++ b/README.md @@ -338,42 +338,52 @@ spec: ### Deployment -| Name | Description | Value | -| -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | --------------- | -| `deployment.annotations` | Additional deployment annotations. | `{}` | -| `deployment.labels` | Additional deployment labels. | `{}` | -| `deployment.additionalContainers` | List of additional containers. | `[]` | -| `deployment.affinity` | Affinity for the athens-proxy deployment. | `{}` | -| `deployment.initContainers` | List of additional init containers. | `[]` | -| `deployment.dnsConfig` | dnsConfig of the athens-proxy deployment. | `{}` | -| `deployment.dnsPolicy` | dnsPolicy of the athens-proxy deployment. | `""` | -| `deployment.hostname` | Individual hostname of the pod. | `""` | -| `deployment.subdomain` | Individual domain of the pod. | `""` | -| `deployment.hostNetwork` | Use the kernel network namespace of the host system. | `false` | -| `deployment.imagePullSecrets` | Secret to use for pulling the image. | `[]` | -| `deployment.athensProxy.args` | Arguments passed to the athens-proxy container. | `[]` | -| `deployment.athensProxy.command` | Command passed to the athens-proxy container. | `[]` | -| `deployment.athensProxy.env` | List of environment variables for the athens-proxy container. | `[]` | -| `deployment.athensProxy.envFrom` | List of environment variables mounted from configMaps or secrets for the athens-proxy container. | `[]` | -| `deployment.athensProxy.image.registry` | Image registry, eg. `docker.io`. | `docker.io` | -| `deployment.athensProxy.image.repository` | Image repository, eg. `library/busybox`. | `gomods/athens` | -| `deployment.athensProxy.image.tag` | Custom image tag, eg. `0.1.0`. Defaults to `appVersion`. | `""` | -| `deployment.athensProxy.image.pullPolicy` | Image pull policy. | `IfNotPresent` | -| `deployment.athensProxy.resources` | CPU and memory resources of the pod. | `{}` | -| `deployment.athensProxy.securityContext` | Security context of the container of the deployment. | `{}` | -| `deployment.athensProxy.volumeMounts` | Additional volume mounts. | `[]` | -| `deployment.nodeSelector` | NodeSelector of the athens-proxy deployment. | `{}` | -| `deployment.priorityClassName` | PriorityClassName of the athens-proxy deployment. | `""` | -| `deployment.replicas` | Number of replicas for the athens-proxy deployment. | `1` | -| `deployment.restartPolicy` | Restart policy of the athens-proxy deployment. | `""` | -| `deployment.securityContext` | Security context of the athens-proxy deployment. | `{}` | -| `deployment.strategy.type` | Strategy type - `Recreate` or `RollingUpdate`. | `RollingUpdate` | -| `deployment.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods during a rolling update. | `1` | -| `deployment.strategy.rollingUpdate.maxUnavailable` | The maximum number of pods that can be unavailable during a rolling update. | `1` | -| `deployment.terminationGracePeriodSeconds` | How long to wait until forcefully kill the pod. | `60` | -| `deployment.tolerations` | Tolerations of the athens-proxy deployment. | `[]` | -| `deployment.topologySpreadConstraints` | TopologySpreadConstraints of the athens-proxy deployment. | `[]` | -| `deployment.volumes` | Additional volumes to mount into the pods of the athens-proxy deployment. | `[]` | +| Name | Description | Value | +| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | --------------- | +| `deployment.annotations` | Additional deployment annotations. | `{}` | +| `deployment.labels` | Additional deployment labels. | `{}` | +| `deployment.additionalContainers` | List of additional containers. | `[]` | +| `deployment.affinity` | Affinity for the athens-proxy deployment. | `{}` | +| `deployment.initContainers` | List of additional init containers. | `[]` | +| `deployment.dnsConfig` | dnsConfig of the athens-proxy deployment. | `{}` | +| `deployment.dnsPolicy` | dnsPolicy of the athens-proxy deployment. | `""` | +| `deployment.hostname` | Individual hostname of the pod. | `""` | +| `deployment.subdomain` | Individual domain of the pod. | `""` | +| `deployment.hostNetwork` | Use the kernel network namespace of the host system. | `false` | +| `deployment.imagePullSecrets` | Secret to use for pulling the image. | `[]` | +| `deployment.athensProxy.args` | Arguments passed to the athens-proxy container. | `[]` | +| `deployment.athensProxy.command` | Command passed to the athens-proxy container. | `[]` | +| `deployment.athensProxy.env` | List of environment variables for the athens-proxy container. | `[]` | +| `deployment.athensProxy.envFrom` | List of environment variables mounted from configMaps or secrets for the athens-proxy container. | `[]` | +| `deployment.athensProxy.image.registry` | Image registry, eg. `docker.io`. | `docker.io` | +| `deployment.athensProxy.image.repository` | Image repository, eg. `library/busybox`. | `gomods/athens` | +| `deployment.athensProxy.image.tag` | Custom image tag, eg. `0.1.0`. Defaults to `appVersion`. | `""` | +| `deployment.athensProxy.image.pullPolicy` | Image pull policy. | `IfNotPresent` | +| `deployment.athensProxy.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `3` | +| `deployment.athensProxy.livenessProbe.initialDelaySeconds` | Number of seconds after the container has started before liveness probes are initiated. | `5` | +| `deployment.athensProxy.livenessProbe.periodSeconds` | How often (in seconds) to perform the probe. | `60` | +| `deployment.athensProxy.livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `deployment.athensProxy.livenessProbe.timeoutSeconds` | Number of seconds after which the probe times out. | `3` | +| `deployment.athensProxy.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | `3` | +| `deployment.athensProxy.readinessProbe.initialDelaySeconds` | Number of seconds after the container has started before liveness probes are initiated. | `5` | +| `deployment.athensProxy.readinessProbe.periodSeconds` | How often (in seconds) to perform the probe. | `15` | +| `deployment.athensProxy.readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | `1` | +| `deployment.athensProxy.readinessProbe.timeoutSeconds` | Number of seconds after which the probe times out. | `3` | +| `deployment.athensProxy.resources` | CPU and memory resources of the pod. | `{}` | +| `deployment.athensProxy.securityContext` | Security context of the container of the deployment. | `{}` | +| `deployment.athensProxy.volumeMounts` | Additional volume mounts. | `[]` | +| `deployment.nodeSelector` | NodeSelector of the athens-proxy deployment. | `{}` | +| `deployment.priorityClassName` | PriorityClassName of the athens-proxy deployment. | `""` | +| `deployment.replicas` | Number of replicas for the athens-proxy deployment. | `1` | +| `deployment.restartPolicy` | Restart policy of the athens-proxy deployment. | `""` | +| `deployment.securityContext` | Security context of the athens-proxy deployment. | `{}` | +| `deployment.strategy.type` | Strategy type - `Recreate` or `RollingUpdate`. | `RollingUpdate` | +| `deployment.strategy.rollingUpdate.maxSurge` | The maximum number of pods that can be scheduled above the desired number of pods during a rolling update. | `1` | +| `deployment.strategy.rollingUpdate.maxUnavailable` | The maximum number of pods that can be unavailable during a rolling update. | `1` | +| `deployment.terminationGracePeriodSeconds` | How long to wait until forcefully kill the pod. | `60` | +| `deployment.tolerations` | Tolerations of the athens-proxy deployment. | `[]` | +| `deployment.topologySpreadConstraints` | TopologySpreadConstraints of the athens-proxy deployment. | `[]` | +| `deployment.volumes` | Additional volumes to mount into the pods of the athens-proxy deployment. | `[]` | ### Horizontal Pod Autoscaler (HPA) diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 6f6e0f1..b4579a1 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -52,27 +52,27 @@ spec: livenessProbe: exec: {{- if not .Values.certificate.enabled }} - command: [ "wget", "-T", "3", "-O", "/dev/null", "http://localhost:3000" ] + command: [ "wget", "-T", "{{ .Values.deployment.athensProxy.livenessProbe.timeoutSeconds }}", "-O", "/dev/null", "http://localhost:3000" ] {{- else }} - command: [ "wget", "--no-check-certificate", "-T", "3", "-O", "/dev/null", "https://localhost:3000" ] + command: [ "wget", "--no-check-certificate", "-T", "{{ .Values.deployment.athensProxy.livenessProbe.timeoutSeconds }}", "-O", "/dev/null", "https://localhost:3000" ] {{- end }} - failureThreshold: 3 - initialDelaySeconds: 5 - periodSeconds: 60 - successThreshold: 1 - timeoutSeconds: 3 + failureThreshold: {{ .Values.deployment.athensProxy.livenessProbe.failureThreshold }} + initialDelaySeconds: {{ .Values.deployment.athensProxy.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.deployment.athensProxy.livenessProbe.periodSeconds }} + successThreshold: {{ .Values.deployment.athensProxy.livenessProbe.successThreshold }} + timeoutSeconds: {{ .Values.deployment.athensProxy.livenessProbe.timeoutSeconds }} readinessProbe: exec: {{- if not .Values.certificate.enabled }} - command: [ "wget", "-T", "3", "-O", "/dev/null", "http://localhost:3000" ] + command: [ "wget", "-T", "{{ .Values.deployment.athensProxy.readinessProbe.timeoutSeconds }}", "-O", "/dev/null", "http://localhost:3000" ] {{- else }} - command: [ "wget", "--no-check-certificate", "-T", "3", "-O", "/dev/null", "https://localhost:3000" ] + command: [ "wget", "--no-check-certificate", "-T", "{{ .Values.deployment.athensProxy.readinessProbe.timeoutSeconds }}", "-O", "/dev/null", "https://localhost:3000" ] {{- end }} - failureThreshold: 3 - initialDelaySeconds: 5 - periodSeconds: 15 - successThreshold: 1 - timeoutSeconds: 3 + failureThreshold: {{ .Values.deployment.athensProxy.readinessProbe.failureThreshold }} + initialDelaySeconds: {{ .Values.deployment.athensProxy.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.deployment.athensProxy.readinessProbe.periodSeconds }} + successThreshold: {{ .Values.deployment.athensProxy.readinessProbe.successThreshold }} + timeoutSeconds: {{ .Values.deployment.athensProxy.readinessProbe.timeoutSeconds }} ports: - name: http containerPort: 3000 diff --git a/unittests/deployment/deployment.yaml b/unittests/deployment/deployment.yaml index d64a5e0..db7d325 100644 --- a/unittests/deployment/deployment.yaml +++ b/unittests/deployment/deployment.yaml @@ -67,6 +67,46 @@ tests: path: spec.template.spec.containers[0].imagePullPolicy value: IfNotPresent template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.failureThreshold + value: 3 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.initialDelaySeconds + value: 5 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.periodSeconds + value: 60 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.successThreshold + value: 1 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.timeoutSeconds + value: 3 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.failureThreshold + value: 3 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.initialDelaySeconds + value: 5 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.periodSeconds + value: 15 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.successThreshold + value: 1 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.timeoutSeconds + value: 3 + template: templates/deployment.yaml - notExists: path: spec.template.spec.containers[0].resources template: templates/deployment.yaml @@ -221,6 +261,77 @@ tests: value: Always template: templates/deployment.yaml +- it: Test custom livenessProbe + set: + # Normal test values + deployment.athensProxy.livenessProbe: + failureThreshold: 5 + initialDelaySeconds: 10 + periodSeconds: 120 + successThreshold: 3 + timeoutSeconds: 5 + asserts: + - equal: + path: spec.template.spec.containers[0].livenessProbe.failureThreshold + value: 5 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.initialDelaySeconds + value: 10 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.periodSeconds + value: 120 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.successThreshold + value: 3 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].livenessProbe.timeoutSeconds + value: 5 + template: templates/deployment.yaml + - contains: + path: spec.template.spec.containers[0].livenessProbe.exec.command + content: "5" + template: templates/deployment.yaml + +- it: Test custom readinessProbe + set: + # Normal test values + deployment.athensProxy.readinessProbe: + failureThreshold: 10 + initialDelaySeconds: 10 + periodSeconds: 30 + successThreshold: 5 + timeoutSeconds: 5 + + asserts: + - equal: + path: spec.template.spec.containers[0].readinessProbe.failureThreshold + value: 10 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.initialDelaySeconds + value: 10 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.periodSeconds + value: 30 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.successThreshold + value: 5 + template: templates/deployment.yaml + - equal: + path: spec.template.spec.containers[0].readinessProbe.timeoutSeconds + value: 5 + template: templates/deployment.yaml + - contains: + path: spec.template.spec.containers[0].readinessProbe.exec.command + content: "5" + template: templates/deployment.yaml + - it: Test custom resource limits and requests set: # Ensure that the secrets and config maps are well configured. diff --git a/values.yaml b/values.yaml index c2b89b7..77a1af6 100644 --- a/values.yaml +++ b/values.yaml @@ -415,6 +415,30 @@ deployment: tag: "" pullPolicy: IfNotPresent + ## @param deployment.athensProxy.livenessProbe.failureThreshold Minimum consecutive failures for the probe to be considered failed after having succeeded. + ## @param deployment.athensProxy.livenessProbe.initialDelaySeconds Number of seconds after the container has started before liveness probes are initiated. + ## @param deployment.athensProxy.livenessProbe.periodSeconds How often (in seconds) to perform the probe. + ## @param deployment.athensProxy.livenessProbe.successThreshold Minimum consecutive successes for the probe to be considered successful after having failed. + ## @param deployment.athensProxy.livenessProbe.timeoutSeconds Number of seconds after which the probe times out. + livenessProbe: + failureThreshold: 3 + initialDelaySeconds: 5 + periodSeconds: 60 + successThreshold: 1 + timeoutSeconds: 3 + + ## @param deployment.athensProxy.readinessProbe.failureThreshold Minimum consecutive failures for the probe to be considered failed after having succeeded. + ## @param deployment.athensProxy.readinessProbe.initialDelaySeconds Number of seconds after the container has started before liveness probes are initiated. + ## @param deployment.athensProxy.readinessProbe.periodSeconds How often (in seconds) to perform the probe. + ## @param deployment.athensProxy.readinessProbe.successThreshold Minimum consecutive successes for the probe to be considered successful after having failed. + ## @param deployment.athensProxy.readinessProbe.timeoutSeconds Number of seconds after which the probe times out. + readinessProbe: + failureThreshold: 3 + initialDelaySeconds: 5 + periodSeconds: 15 + successThreshold: 1 + timeoutSeconds: 3 + ## @param deployment.athensProxy.resources CPU and memory resources of the pod. resources: {} # limits: