Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of setting revisionHistoryLimit #386

Merged
merged 5 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions helm/polaris/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ A Helm chart for Polaris.
**Homepage:** <https://polaris.apache.org/>

## Maintainers
* [MonkeyCanCode](https://github.com/MonkeyCanCode)
* [adutra](https://github.com/adutra)

## Source Code

Expand Down Expand Up @@ -105,6 +107,7 @@ $ helm uninstall --namespace polaris polaris
| readinessProbe.timeoutSeconds | int | `10` | Number of seconds after which the probe times out. Minimum value is 1. |
| replicaCount | int | `1` | The number of replicas to deploy (horizontal scaling). Beware that replicas are stateless; don't set this number > 1 when using in-memory meta store manager. |
| resources | object | `{}` | Configures the resources requests and limits for polaris pods. We usually recommend not to specify default resources and to leave this as a conscious choice for the user. This also increases chances charts run on environments with little resources, such as Minikube. If you do want to specify resources, uncomment the following lines, adjust them as necessary, and remove the curly braces after 'resources:'. |
| revisionHistoryLimit | string | `nil` | The number of old ReplicaSets to retain to allow rollback (if not set, the default Kubernetes value is set to 10). |
| securityContext | object | `{}` | Security context for the polaris container. See https://kubernetes.io/docs/tasks/configure-pod-container/security-context/. |
| service.annotations | object | `{}` | Annotations to add to the service. |
| service.ports | object | `{"polaris-metrics":8182,"polaris-service":8181}` | The ports the service will listen on. Two ports are required: one for the Polaris service and one for the metrics API. Note: port names must be unique and no more than 15 characters long. |
Expand Down
3 changes: 3 additions & 0 deletions helm/polaris/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- if not (has (quote .Values.revisionHistoryLimit) (list "" (quote ""))) }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MonkeyCanCode we just merged support for helm-unit. If you update your branch, maybe you could add a small unit test for this field? Especially for the logic around differentiating 0 from nil or "". Thanks 🙏

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Will look into this later today.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adutra this had being added. I really like this approach with validating helm (compared to how I was doing it earlier via helm template). I can add the remaining test cases in for the next PR if there is no concern on your end and no one is already working on it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent tests 👍
And OK to add missing test cases little by little.

revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
{{- end }}
selector:
matchLabels:
{{- include "polaris.selectorLabels" . | nindent 6 }}
Expand Down
34 changes: 33 additions & 1 deletion helm/polaris/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,38 @@ tests:
- notExists:
path: spec.replicas

# spec.revisionHistoryLimit
- it: should not set revisionHistoryLimit by default with null
asserts:
- notExists:
path: spec.revisionHistoryLimit
- it: should not set revisionHistoryLimit with quote empty string
set:
revisionHistoryLimit: ""
asserts:
- notExists:
path: spec.revisionHistoryLimit
- it: should not set revisionHistoryLimit with empty string
set:
revisionHistoryLimit:
asserts:
- notExists:
path: spec.revisionHistoryLimit
- it: should set revisionHistoryLimit
set:
revisionHistoryLimit: 1
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 1
- it: should set revisionHistoryLimit (disabled revision history)
set:
revisionHistoryLimit: 0
asserts:
- equal:
path: spec.revisionHistoryLimit
value: 0

# spec.selector.matchLabels + spec.template.metadata.labels
- it: should set deployment selector labels
asserts:
Expand Down Expand Up @@ -515,4 +547,4 @@ tests:
- key: "key"
operator: "Equal"
value: "value"
effect: "NoSchedule"
effect: "NoSchedule"
3 changes: 3 additions & 0 deletions helm/polaris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ podLabels: {}
# -- Additional Labels to apply to polaris configmap.
configMapLabels: {}

# -- The number of old ReplicaSets to retain to allow rollback (if not set, the default Kubernetes value is set to 10).
revisionHistoryLimit: ~

# -- Security context for the polaris pod. See https://kubernetes.io/docs/tasks/configure-pod-container/security-context/.
podSecurityContext:
{}
Expand Down