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

feat(#29): set imagePullPolicy: Always #30

Merged
merged 5 commits into from
Nov 4, 2024
Merged

Conversation

dianabarsan
Copy link
Member

Fixes not being able to upgrade to a newer build of the same branch.

#29

Copy link
Contributor

@henokgetachew henokgetachew left a comment

Choose a reason for hiding this comment

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

Cool initiative @dianabarsan. Thanks! Left a comment inline.

@@ -33,6 +33,7 @@ spec:
- name: API_PORT
value: '5988'
image: {{ .Values.upstream_servers.docker_registry }}/cht-api:{{ .Values.cht_image_tag }}
imagePullPolicy: Always
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of setting the value here directly, we should add a variable in values and pull from there.
Something like adding to the values.yaml
imagePullPolicy: IfNotPresent # default value
The reason for this is that for production deployments images should have an immutable tag with the cluster pulling only if it's not present. Otherwise, it causes issues like increasing egress costs and network activity/load on the cluster. Always is okay for CI/CD and for dev or debugging deployments.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm afraid we will run into a situation where we will need this in production too, where some prod instance is on a branch build because they needed some urgent hotpatch, and we can't upgrade them.
We don't do upgrades often enough to have frequent image pulls?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm also reluctant to be so opinionated in the values file. Someone would need to have knowledge about what the consequences are for changing this value, and choose from either a preset (and no make any typos) or it would be a true/false that we would convert to the preset in the template.
I'm not convinced there is much gain from this.

We already know:

  • we need this in dev
  • we have production instances that are on branch builds when they need urgent hotpatches

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also reluctant to be so opinionated in the values file. Someone would need to have knowledge about what the consequences are for changing this value

Folks could even leave out the key from the values.yaml and helm will apply the defaults you originally build it with in this PR.

I'm afraid we will run into a situation where we will need this in production too, where some prod instance is on a branch build because they needed some urgent hotpatch, and we can't upgrade them.

If we need to make an urgent patch to the production deployment, these should be rare and one-off and therefore editing the deployment object in k8s is the way to go.

We have things in the values.yml that we expect to change rarely. This setting could sit next to those. I think the main thing here though is that for production deployments we need to stick to the principle that images should have an immutable tag.

Copy link
Contributor

Choose a reason for hiding this comment

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

Otherwise, we can't have deterministic deployments in production and we'd have to introduce image digests which I believe would be an overkill and very much like to avoid.

Copy link
Member Author

Choose a reason for hiding this comment

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

deterministic deployments

When would the images be pulled, in normal operations?

Copy link
Contributor

Choose a reason for hiding this comment

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

If the policy is set to Always, that could happen if the pod restarts for whatever reason. Not just at the time of install.

charts/cht-chart-4x/templates/haproxy-deployment.yaml Outdated Show resolved Hide resolved
…lways-pull-images

# Conflicts:
#	charts/cht-chart-4x/templates/haproxy-deployment.yaml
Copy link
Contributor

@henokgetachew henokgetachew left a comment

Choose a reason for hiding this comment

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

Awesome. I like it. Approving. Just need one more commit to update the Chart version so that the build makes a new release.

@dianabarsan dianabarsan merged commit 39ad21a into main Nov 4, 2024
1 check passed
@dianabarsan dianabarsan deleted the 29-always-pull-images branch November 4, 2024 07:37
@henokgetachew
Copy link
Contributor

@dianabarsan we also need to set this version to be the default one to use - here.

@dianabarsan
Copy link
Member Author

wow. ok... I think we should just remove this part, we shouldn't need a core release to get the correct helm charts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants