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

[incubator/thumbor] add container probes #173

Merged
merged 1 commit into from Sep 24, 2018

Conversation

hairmare
Copy link
Contributor

what

  • adds livenessProbe and readinessProbe
  • name the container port "http" so it can be referenced by name

why

  • make it easier to rollout changes to the thumbor install without downtime
  • naming ports helps reference them in other places (like probes)
  • Thumbor has some info on the /healthcheck endpoint in their docs and they recommend if for use behind a load balancer (and K8s Services are kinda loadbalancers).

@osterman osterman added this to Ready to Implement in Open Source Community Support via automation Sep 21, 2018
@osterman
Copy link
Member

Thanks @hairmare ! I'm going to give at @goruha a chance to review as well, but LGTM.

@alebabai
Copy link
Contributor

@hairmare looks good!
but what do you think about following solution? It will add more flexibility and avoid spec. hardcoding.

{{- with .Values.probes }}
{{ toYaml . | indent 10 }}
{{- end }}

and values.yaml part can be like this:

probes
  livenessProbe:
     httpGet:
       path: /healthcheck
       port: http
    initialDelaySeconds: 120
    periodSeconds: 10
    timeoutSeconds: 5
    failureThreshold: 6
    successThreshold: 1
  readinessProbe:
     httpGet:
       path: /healthcheck
       port: http
    initialDelaySeconds: 30
    periodSeconds: 10
    timeoutSeconds: 5
    failureThreshold: 6
    successThreshold: 1

@hairmare
Copy link
Contributor Author

@alebabai I was mostly looking at existing helm/charts charts for inspiration and found quite some that follow this explicit style of configuration. Sadly the helm best practices don't really go into any detail on this.

I did helm create with 2.10 and it currently creates the following probes in a new deployment template.

          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http

How about something like this:

        probes:
          {{- if .Values.livenessProbe.enabled }}
          livenessProbe:
            httpGet:
              path: /healthcheck
              port: http
{{- with .Values.livenessProbe.config }}
{{ toYaml . | indent 12 }}
{{- end }}
          {{- end }}

This way the default from K8s are used if no values are specified and the actual checks are still in the template in a fashion close to what is proposed by helm create.

I feel like moving the complete probes to values.yaml kind of defeats the purpose of having a helm template in the first place.

The individual enable flags also make it nice and easy to spin up a broken thubmor pod that I can exec into if I need to to further debug failing healthchecks.

I'm not sure about the .Values.livenessProbe.config in my example above since it doesn't feel very natural.

@osterman
Copy link
Member

defeats the purpose of having a helm template in the first place
@hairmare understand your point. There's a fine (somewhat arbitrary) line drawn and no rule when to do it. I like to think of values.yaml as a declarative interface to deploying resources on kubernetes. For the current case-in-point, there's a 1-to-1 mapping between elements for the probes (with exception of enabled), thus explicitly passing them doesn't really busy us anything other than extra maintenance =)

The approach @alebabai suggests is pretty common in the official helm/charts. Here are some examples:

I don't have a strong feeling either way. @goruha mention to me via Slack he prefers @alebabai way too.

We are though leaning towards this approach and adopted it in our monochart as well:

https://github.com/cloudposse/charts/blob/master/incubator/monochart/templates/deployment.yaml#L60-L62

Our monochart represents our stab at creating a one-size-fits-all chart for deploying the most "common" types of apps.

I'm not sure about the .Values.livenessProbe.config in my example above since it doesn't feel very natural.

Yea, don't like adding the extra level of config.

@hairmare
Copy link
Contributor Author

@osterman @alebabai I updated by PR to look like the examples linked by @osterman.

@osterman osterman merged commit 1b4e8d7 into cloudposse:master Sep 24, 2018
Open Source Community Support automation moved this from Ready to Implement to Completed Sep 24, 2018
@osterman
Copy link
Member

thanks @hairmare !

@hairmare hairmare deleted the feature/thumbor-probes branch September 24, 2018 18:25
@hairmare
Copy link
Contributor Author

Thanks for the feedback and merge!

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

Successfully merging this pull request may close these issues.

None yet

4 participants