{"id":38022826,"url":"https://github.com/mariusmagureanu/vingress","last_synced_at":"2026-01-16T19:31:00.137Z","repository":{"id":251431081,"uuid":"832012500","full_name":"mariusmagureanu/vingress","owner":"mariusmagureanu","description":"Lite implementation of a Varnish Ingress controller in Rust","archived":false,"fork":false,"pushed_at":"2025-10-30T14:36:59.000Z","size":317,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-30T16:40:37.727Z","etag":null,"topics":["ingress","ingress-controller","kubernetes","varnish","varnish-cache"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mariusmagureanu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-22T07:17:10.000Z","updated_at":"2025-10-30T14:37:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"e22ebc3b-eb93-4216-ab7b-e6653016339d","html_url":"https://github.com/mariusmagureanu/vingress","commit_stats":null,"previous_names":["mariusmagureanu/vingress"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/mariusmagureanu/vingress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariusmagureanu%2Fvingress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariusmagureanu%2Fvingress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariusmagureanu%2Fvingress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariusmagureanu%2Fvingress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mariusmagureanu","download_url":"https://codeload.github.com/mariusmagureanu/vingress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mariusmagureanu%2Fvingress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28481775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ingress","ingress-controller","kubernetes","varnish","varnish-cache"],"created_at":"2026-01-16T19:30:59.508Z","updated_at":"2026-01-16T19:31:00.128Z","avatar_url":"https://github.com/mariusmagureanu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build master](https://github.com/mariusmagureanu/vingress/actions/workflows/rust.yml/badge.svg)](https://github.com/mariusmagureanu/vingress/actions/workflows/rust.yml)\n![Audit](https://github.com/mariusmagureanu/vingress/actions/workflows/audit.yaml/badge.svg)\n![Clippy Lint](https://github.com/mariusmagureanu/vingress/actions/workflows/clippy.yaml/badge.svg)\n![Docker Pulls](https://img.shields.io/docker/pulls/mariusm/vingress)\n![Varnish Cache](https://img.shields.io/badge/Varnish-8.0-blue)\n[![Rust Version](https://img.shields.io/badge/rustc-1.92-blue.svg)](https://www.rust-lang.org)\n[![dependency status](https://deps.rs/repo/github/mariusmagureanu/vingress/status.svg)](https://deps.rs/repo/github/mariusmagureanu/vingress)\n[![Maintenance](https://img.shields.io/badge/maintenance-actively%20maintained-green.svg)](https://github.com/mariusmagureanu/vingress)\n[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/varnish-ingress-controller)](https://artifacthub.io/packages/search?repo=varnish-ingress-controller)\n![License](https://img.shields.io/badge/license-BSD%202--Clause-blue.svg)\n\n### Varnish Ingress controller\n\nLite implementation of a Varnish Ingress controller.\n\n---\n\n### Table of contents\n\n- [How does it work](#how-does-it-work)\n- [Installation and usage](#installation-and-usage)\n- [More VCL](#more-vcl)\n- [Misc](#misc)\n\n---\n\n### How does it work\n\nThe `varnish-ingress-controller` watches over Ingress objects in the cluster. The watcher is configured to\nfilter through Ingress objects with the following label:\n\n```yaml\nkubernetes.io/ingress: varnish\n```\n\n**and** Ingress class name:\n\n```yaml\nspec.ingressClassName: varnish\n```\n\nThe spec of the Ingress objects is then translated into Varnish [VCL](https://varnish-cache.org/docs/trunk/users-guide/vcl.html).\n\nThe `varnish-ingress-controller` watches over `INIT | ADD | UPDATE | DELETE` Ingress events and updates\nthe Varnish VCL accordingly. After a succesfull VCL file update, Varnish will reload its VCL just so it becomes aware of the latest configuration.\n\nExample:\n\nThe following Ingress spec:\n\n```yaml\napiVersion: networking.k8s.io/v1\nkind: Ingress\nmetadata:\n  generation: 4\n  labels:\n    kubernetes.io/ingress: varnish\n  name: media\n  namespace: demo\n  resourceVersion: \"146788664\"\n  uid: b386a268-0006-446c-9844-3e004712070f\nspec:\n  ingressClassName: varnish\n  rules:\n    - host: foo.bar.com\n      http:\n        paths:\n          - backend:\n              service:\n                name: media-v1-svc\n                port:\n                  number: 80\n            path: /foo\n            pathType: Prefix\n    - host: qux.bar.com\n      http:\n        paths:\n          - backend:\n              service:\n                name: media-v2-svc\n                port:\n                  number: 80\n            path: /qux\n            pathType: Exact\n```\n\nyields the following VCL:\n\n```c\nvcl 4.1;\n\nimport directors;\nimport std;\n\nbackend default none;\n\nbackend demo-media-media-v1-svc {\n  .host = \"media-v1-svc.demo.svc.cluster.local\";\n  .port = \"80\";\n}\n\nbackend demo-media-media-v2-svc {\n  .host = \"media-v2-svc.demo.svc.cluster.local\";\n  .port = \"80\";\n}\n\n\nsub vcl_recv {\n if (req.http.host == \"foo.bar.com\" \u0026\u0026 req.url ~ \"^/foo\") {\n        set req.backend_hint = demo-media-media-v1-svc;\n    }\n if (req.http.host == \"qux.bar.com\" \u0026\u0026 req.url == \"/qux\") {\n        set req.backend_hint = demo-media-media-v2-svc;\n    }\n}\n```\n\n---\n\n### Installation and usage\n\nAt the time of writing this, the installation is available only via Helm from your local machine.\nMake sure you're connected to a Kubernetes cluster and run the following:\n\n```sh\n$ helm package chart/\n$ helm upgrade varnish-ingress-controller --install --namespace vingress --create-namespace ./varnish-ingress-controller-0.4.0.tgz -f charts/values.yaml\n```\n\nUpdate the spec of your Ingress(es) with the following requirements:\n\n1. add the following label: `kubernetes.io/ingress: varnish`\n2. set the ingress class: `spec.ingressClassName: varnish`\n\nInvestigate the logs of the `varnish-ingress-controller` pod, they should reflect the updates mentioned above on your Ingress object(s):\n\nExample:\n\n```sh\n$ kubectl -n \u003cyour-namespace\u003e logs po/varnish-ingress-controller-xxxxxxxxxx-yyyyy\n```\n\nA Kubernetes service is available to be used for reaching the Varnish containers. It is up to you whether this service\nshould be used in conjuction with a load-balancer or not.\nFor quick testing and shorter feedback loops it's easier to just port forward it locally:\n\nExample:\n\n```\n$ kubectl -n vingress port-forward svc/varnish-ingress-service 6081:80\n$ curl http://127.1:6081/foo -H \"Host: foo.bar.com\" -v\n```\n\n---\n\n### More VCL\n\nThe `varnish-ingress-controller` translates the Ingress spec into VCL syntax. However, there's often the\ncase that the generated VCL needs to be extended to accomodate the various use cases.\n\nCheck for the `varnish-vcl` configmap in the namespace where the `varnish-ingress-controller` is installed.\nThe Configmap has the following fields which is watched by the ingress-controller:\n\n- `vcl_recv_snippet`: snippet added in the `vcl_recv` subroutine after the backends selection\n- `snippet`: snippet added after the `vcl_rec` subroutine\n\nWhenever these 2 mentioned fields in the Configmap are updated - the following happens:\n\n1.  update the generated VCL file\n2.  issue a `varnishreload` command just so Varnish picks up the new updates\n\nExample:\n\n```sh\n$ kubectl -n vingress get cm/varnish-vcl -o yaml\n```\n\n```yaml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  annotations:\n    meta.helm.sh/release-name: varnish-ingress-controller\n    meta.helm.sh/release-namespace: vingress\n  labels:\n    app.kubernetes.io/managed-by: Helm\n  name: varnish-vcl\n  namespace: vingress\n  resourceVersion: \"154768231\"\ndata:\n  vcl_recv_snippet: |\n    if (! req.backend_hint) {\n      return (synth(200, \"We get here now!\"));\n    }\n  snippet: |\n    sub vcl_backend_response {\n      if (beresp.status == 200) {\n          set beresp.ttl = 5m; \n      }\n      unset beresp.http.Cache-Control;\n    }\n\n    sub vcl_deliver {\n      if (obj.hits \u003e 0) {\n          set resp.http.X-Cache = \"HIT\"; \n      } else {\n          set resp.http.X-Cache = \"MISS\";\n      }\n      set resp.http.X-Varnish = \"X-Varnish-foo\";\n    }\n```\n\n---\n\n### Misc\n\nThis paragraph highlights some assumptions made in this implementation.\n\n- Single container pod, the Varnish process is started within the controller code\n- The `vcl_recv` subroutine is configurable only via editing the vcl.hbs template\n- There is no fancy editing of the VCL file, when either the Ingress objects or the `varnish-vcl` Configmap changes, then the VCL file is rewritten entirely\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariusmagureanu%2Fvingress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmariusmagureanu%2Fvingress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmariusmagureanu%2Fvingress/lists"}