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

helm: initContainer in defaultBackend #12334

Open
framctr opened this issue Nov 9, 2024 · 6 comments
Open

helm: initContainer in defaultBackend #12334

framctr opened this issue Nov 9, 2024 · 6 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@framctr
Copy link

framctr commented Nov 9, 2024

In the Helm chart, I would like to add an initContainer to the defaultBackend to customize some files mounted from a ConfigMap.

Example:

defaultBackend:
  enabled: true
  name: custom-error-codes
  initContainer:
    image: xyz
    args: xyz
    env:
      - a
      - b
  image:
    image: custom-error-pages
    tag: "v1.0.2"
  extraVolumeMounts:
    - name: custom-error-pages
      mountPath: /www
  extraVolumes:
    - name: custom-error-pages
      configMap:
        name: custom-error-pages
        items:
          - key: "index.html"
            path: "404.html"
@framctr framctr added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 9, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority labels Nov 9, 2024
@longwuyuan
Copy link
Contributor

longwuyuan commented Nov 9, 2024

what are the differences between what is current and what you propose.
What are the differences between you maintaining your own custom-default-backend and current.

@framctr
Copy link
Author

framctr commented Nov 9, 2024

The image is the registry.k8s.io/ingress-nginx/nginx-errors. With an initContainer I could avoid to create and maintain my own images and just keep the official one, then changing only the static pages depending on the project.

It would also be helpful for downloading data in a volume if it does not fit on a configMap.

@longwuyuan
Copy link
Contributor

Is the configMap yours.
Will it contain contain files that you want to mount, to alter the content of current default-backend.

@framctr
Copy link
Author

framctr commented Nov 9, 2024

Yes, the configmap is mine and it has the index.html etc to be mounted in the backend. The problem is that This index.html should be customized with different error messages depending on the HTTP status (aka different html files in the container). I would like to do that with a simple shell file in the initContainer. At the same time it would help in downloading images that are too large for a ConfigMap.

As stated in the ingress-nginx example the errors are recognized depending on the name of the html file. In other words, starting from a single template (index.html in the ConfigMap) the shell creates multiple HTML files with the error code (e.g., 500.html) and specific message inside (e.g. Oops! Server error!!). Each HTML will then use an image downloaded from a certain endpoint by the initContainer.

If there is another way to do the same with the existing chart, I will be happy to use that solution. I would only avoid to recreate multiple container images for different projects. Just change ConfigMap.

@longwuyuan
Copy link
Contributor

That is a good-to-have feature.
We don't want to support/maintain it, if other users ask only because there are no resources available.
Also, this looks like your need and not a generic need for all users of the default-backend image.

Please wait for other comments.

Please join the community meeting and discuss this https://github.com/kubernetes/community/tree/master/sig-network. All focus is on security & Gateway-API now. So unless there is a bugfix, that impacts all users, I am not sure if there can be much traction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. needs-priority needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
Development

No branches or pull requests

3 participants