Giter VIP home page Giter VIP logo

onechart's Introduction

One chart to rule them all

A generic Helm chart for your application deployments.

Because no-one can remember the Kubernetes yaml syntax.

https://gimlet.io/docs/onechart-reference

Getting started

OneChart is a generic Helm Chart for web applications. The idea is that most Kubernetes manifest look alike, only very few parts actually change.

Add the Onechart Helm repository:

helm repo add onechart https://chart.onechart.dev

Set your image name and version, the boilerplate is generated.

helm template my-release onechart/onechart \
  --set image.repository=nginx \
  --set image.tag=1.19.3

The example below deploys your application image, sets environment variables and configures the Kubernetes Ingress domain name:

helm repo add onechart https://chart.onechart.dev
helm template my-release onechart/onechart -f values.yaml

# values.yaml
image:
  repository: my-app
  tag: fd803fc
vars:
  VAR_1: "value 1"
  VAR_2: "value 2"
ingress:
  annotations:
    kubernetes.io/ingress.class: nginx
  host: my-app.mycompany.com

Alternative: using an OCI repository

You can also template and install onechart from an OCI repository as follows:

Check the generated Kubernetes yaml:

helm template my-release oci://ghcr.io/gimlet-io/onechart --version 0.62.0 \
  --set image.repository=nginx \
  --set image.tag=1.19.3

Deploy with Helm:

helm install my-release oci://ghcr.io/gimlet-io/onechart --version 0.62.0 \
  --set image.repository=nginx \
  --set image.tag=1.19.3

See all Examples

Contribution Guidelines

Thank you for your interest in contributing to the Gimlet project.

Below are some guidelines and best practices for contributing to this repository:

Issues

If you are running a fork of OneChart and would like to upstream a feature, please open a pull request for it.

New Features

If you are planning to add a new feature to OneChart, please open an issue for it first. Helm charts are prone to having too many features, and OneChart want to keep the supported use-cases in-check. Proposed features have to be generally applicable, targeting newcomers to the Kubernetes ecosystem.

Pull Request Process

  • Fork the repository.
  • Create a new branch and make your changes.
  • Open a pull request with detailed commit message and reference issue number if applicable.
  • A maintainer will review your pull request, and help you throughout the process.

Development

Development of OneChart does not differ from developing a regular Helm chart.

The source for OneChart is under charts/onechart where you can locate the Chart.yaml, values.yaml and the templates.

We write unit tests for our helm charts. Pull requests are only accepted with proper test coverage.

The tests are located under charts/onechart/test and use the https://github.com/helm-unittest/helm-unittest Helm plugin to run the tests.

For installation, refer to the CI workflow at .github/workflows/build.yaml.

Release process

make all to test and package the Helm chart. The chart archives are put under docs/ together with the Helm repository manifest (index.yaml) It is then served with Github Pages on https://chart.onechart.dev

Github Actions is used to automate the make calls on git tag events.

onechart's People

Contributors

actions-user avatar backbencher00 avatar davidfrickert avatar dzsak avatar jirayut-opsta avatar lalyos avatar laszlocph avatar marcel-lambacher avatar msbsh avatar pnieweglowski avatar ramir-savvy avatar soniasingla avatar szabogabor91 avatar victorswed avatar winggundamth avatar youcefguichi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

onechart's Issues

License

Hi,

Can you tell us what license this project is under?

Chart version v0.41.0 does not seem to have existingFileSecrets changes

Hi there.

I was trying to use the changes from #53 which include support for referencing existing secrets and mounting them in the container filesystem. This however is not working when I reference the v0.41.0 version of the chart (which is the latest) where this change was added.

If I look the released version diff I can see the changes here: afcfc36#diff-bf919b6b281151a677d8090da5f1de872cca2fd7d56a7ec3935555a4e9d583e3

However if I download the chart tarball from here: https://chart.onechart.dev/onechart-0.41.0.tgz

and look at the file: onechart/charts/common/templates/_volumesRef.yaml I don't see the existingFileSecrets change.

So it looks like something's not quite right with that packaged version. Am I missing something?

Thanks in advance!

Request for HPA Support Contribution

I am interested in contributing to the project and would like to propose the addition of Horizontal Pod Autoscaling (HPA) support. Before investing time in the development, I want to discuss the feasibility and gather feedback from the maintainers and the community.


hpa:
  enabled: true
  minReplicas: 2
  maxReplicas: 4

    
  metrics:
  - resource:
      name: cpu
      target: 
        type: Utilization
        averageUtilization: 70
    type: Resource
  - resource:
      name: memory
      target: 
        type: Utilization
        averageUtilization: 85
    type: Resource

thank you

Document releases on Github

Right now we manually bump the chart version, run make all locally and push to git.
Since the chart repo is hosted on Github Pages, this makes the new version available immediately.

In order to start using git tags and document changes in Github Releases, we should move the release process to Github Actions.

The release experience should be:

  • git tag v1.0.0
  • git push origin v1.0.0

This will update the chart version and publishes it to Github Pages.

See how a manual release was done in this commit: 35831ac
The changes were achieved by updating the Chart.yaml version field manually to 0.17 and calling make all

Automatic chart version bump is not mandatory, but then we should have a manual process defined.

Support host path volumes

I use onechart a lot for setting up local integration test environments. Sometimes I need to mount test data from the host but it seems onechart doesn't allow that, unless I'm missing something.

Allow additional arbitrary resources

Hello again!

The bitnami charts have a very useful extraDeploy value, that can be used to add any number of additional, arbitrary resources to a helm release. Would it be possible to have something similar here?

My use case: I need to add a Traefik IngressRoute, a Calico NetworkPolicy, and a SealedSecret.

Cheers,
Loïc

"robust names" commit breaks the ingress host name

helm upgrade xxx --install onechart/onechart --set image.repository=yyy --set image.tag=latest --set ingress.host=aaa.bbb.eu --dry-run
Error: Ingress.extensions "xxx" is invalid: spec.rules[0].host: Invalid value: "-aaa-bbb-eu": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')

Investigate if OneChart can be rendered to Cloud Run / KNative serving API

  • Values files for OneChart carry all meaningful info that is needed for a containerized deployment to work
  • OneChart is a Helm chart. helm template renders the chart into plain text.

The above two statements suggests that we can make a Helm chart that renders KNative serving API yamls. Not Kubernetes yamls, but yamls that KNative and Google Cloud Run understands.

The goal of this issue is to render a basic KNative manifest that is driven by a OneChart values file, like the following:

image:
  repository: nginx
  tag: latest
replicas: 3
containerPort: 5000
vars:
  DUMMY: "test-me"

and after a helm template command, the result can be deployed to Google Cloud Run.

Some info:

When we are done, we should review the project by KNative community members: salaboy and tvitale

[charts/onechart] Specifying ports in values doesn't work as expected

Specifying ports in values doesn't work as expected.

E.g.:

ports:
  - name: 445
    svcPort: 445

The template tries to fill the name in both the actual name and in targetPort, which doesn't work, as port needs to be a number and name needs to be a string:

Error: INSTALLATION FAILED: Service in version "v1" cannot be handled as a Service: json: cannot unmarshal number into Go struct field ServicePort.spec.ports.name of type string

{{- else }}
{{- range .Values.ports }}
- name: {{ .name }}
port: {{ if .svcPort }}{{ .svcPort }}{{ else }}{{ .containerPort }}{{ end }}
{{- if .nodePort }}
nodePort: {{ .nodePort }}
{{- end }}
targetPort: {{ .name }}
protocol: TCP

Instead, maybe support passing targetPort?

ports:
  - name: tcp-445
    svcPort: 445
    targetPort: 445

Offtopic

Name could also be optional:

ports:
  - svcPort: 445
    targetPort: 445

The template could then fill the port name with a concatenation of tcp and the port.

[charts/onechart] add hostNetwork

Would it be possible to add the spec.hostNetwork parameter for pods?
This i very helpful for pod whuch need access to the nodes networks.

Thanks!

Sanitize Helm labels

error when creating \"e13a0f99-0947-4a4d-83aa-ebc252b41580.yaml\": ConfigMap \"myapp-deploy-preview\" is invalid: metadata.labels: Invalid value: \"myapp-deploy/preview\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')

Adding promtheus scraping?

Since the chart already supports (optional) prometheus rules, would it make sense to support (optional) Prometheus service scraping?

The following is not debugged, just a rough draft to show what I mean:

{{ if .Values.monitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ template "robustName" .Release.Name }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "helm-chart.labels" . | nindent 4 }}
  {{- if or .Values.gitRepository .Values.gitSha }}
  annotations:
    {{- if .Values.gitRepository }}
    gimlet.io/git-repository: {{ .Values.gitRepository }}
    {{- end }}
    {{- if .Values.gitSha }}
    gimlet.io/git-sha: {{ .Values.gitSha }}
    {{- end }}
  {{- end }}
spec:
  endpoints:
  - interval: 60s
    params:
      format:
      - prometheus
    path: /metrics # TBD: Needs to also be templated-with-default
    {{ if .Values.monitor.portName }}
    name: {{ .Values.monitor.portName }}
    {{- else if not .Values.ports }}
    name: http
    {{ else }}
    name: {{ Values.ports[0].name }}
    {{ endif }}
    scheme: {{ .Values.monitor.scheme or "http" }}
    {{ if .Values.monitor.scrapeTimeout }}
    scrapeTimeout: {{ .Values.monitor.scrapeTimeout }}
    {{ end }}
  namespaceSelector:
    matchNames:
    - "{{ .Release.Namespace }}"
  selector:
    {{- include "helm-chart.selectorLabels" . | nindent 4 }}
{{ end }}

Support using file configmap and avoiding custom command on CronJob

It would be nice to be able to use the file configmap on the cron-job chart - even better if multiple are supported.
It would also be nice to be able to not override the command as this causes issues with some images.

Changes

  • Allow use of File ConfigMap on cron-job
  • Allow use of multiple File ConfigMap
  • Allow disabling the custom command on the container

Details

Allow use of File ConfigMap on cron-job

Rather trivial. Only need to use the template exposed on the common chart.

Allow use of multiple File ConfigMap

Also trivial. Only need to add YAML file separator "---" at the beggining of each rendered ConfigMap in the common chart.

Allow disabling the custom command on the container

Proposed addition to values.yml:

overrideCommand: true

Default true to not break exisiting behaviour. Can be set to false to just use the default command of the image.

I already implemented both of these so will be opening a PR.

Init container support

Usecase: there are a lot of images which are almost perfect, but I'd like to modify the entrypoint.

Instead of maintaining a docker image:

  • create a deployment with an initContainer and an empty volume
  • the init container could create a custom entrypoint.sh on the volume
  • map the volume in the main container (let's say: /scripts)
  • you can refer the custom entrypoint in the main container

The init container could be used for example:

  • git clone a repo to the volume
  • git clone a static website repo (hugo,jekyll) build the html
  • serve it with nginx

Alternatively instead of creating the entrypoint.sh in an initscript, you could write the script as a configmap (or maybe as a sealed secret if its sensitive)

No way to mount Single FIle.

I have usecase where i can't mount a directory but only a file.

Application uses a config /etc/tinyproxy.conf. Mounting /etc overrides all other configs. Hence there is need to just map single file.

Possible ways to do this

  1. File using subPath from ConfigMap. But Voulmes don't support Config map currently.
    https://stackoverflow.com/questions/44325048/kubernetes-configmap-only-one-file

  2. Init Script that can run before Pod Start.

  • Here i can mount my files /etc/tiny/tinyproxy.conf.
  • Init Script can then copy /etc/tiny/tinyproxy.conf to /etc/tinyproxy.conf before starting Container.

Fix non valid yaml

We should add more ifs in the template to not generate nil fields like volumes: bellow.

      containers:
        - name: fosdem-2021
          securityContext:
            {}
          image: "xxx"
          imagePullPolicy: 
          envFrom:
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          volumeMounts:
          resources:
            limits:
              cpu: 200m
              memory: 200Mi
            requests:
              cpu: 200m
              memory: 200Mi
      volumes:

Cert-Manager

Hey thanks for your aweseome work!

How about integrating cert-manager into the mix?

robustName should not allow `.`

DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character

Allow to set the ingress tls secretName

For wildcard deployments we already have a tls-secret and would like to reuse it for multiple deployments. Therefore it would be helpful to have an option like ingress.tls.secretName.

PS: pretty cool approach. I had a short test on creating a cli tool to deploy a local project by building the image, automatically pushing it to some configured registry and deploying it using onechart.

Flatten `secret` field, make it configurable

Follow the Helm best practice

In most cases, flat should be favored over nested. The reason for this is that it is simpler for template developers and users.

The task is to change

secret:
  enabled: true

to

secretEnabled: true

And enable the secret name to be configurable with the secretName field.

  • Flatten secret field
  • Add support for secretName, with {{ template "robustName" .Release.Name }}
  • Document the changes

Publish Onechart to an OCI registry

https://helm.sh/docs/topics/registries/

The task is to modify Onechart's build and CI jobs to publish to an OCI registry. We would like to use the Github Package registry to host onechart.

Since you don't have access to our registry, publish it under your Github account and let us know what we need to replace when we merge.

Please provide a two liner on how to use it: helm repo add, helm repo install.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.