{"id":13684379,"url":"https://github.com/ExpediaGroup/kubernetes-sidecar-injector","last_synced_at":"2025-04-30T20:33:54.148Z","repository":{"id":37862910,"uuid":"170446278","full_name":"ExpediaGroup/kubernetes-sidecar-injector","owner":"ExpediaGroup","description":"Kuberbetes mutating webhook that injects a sidecar container to a pod","archived":false,"fork":false,"pushed_at":"2024-06-21T15:56:48.000Z","size":3122,"stargazers_count":75,"open_issues_count":2,"forks_count":35,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-11-12T05:37:22.191Z","etag":null,"topics":["golang","haystack","kubernetes","mutating-webhook","oss-portal-listed"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ExpediaGroup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-13T05:31:01.000Z","updated_at":"2024-10-22T21:15:10.000Z","dependencies_parsed_at":"2024-01-14T16:08:45.892Z","dependency_job_id":"465d9eda-a6f5-49cd-95b6-7f110911858b","html_url":"https://github.com/ExpediaGroup/kubernetes-sidecar-injector","commit_stats":null,"previous_names":["expediadotcom/kubernetes-sidecar-injector"],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpediaGroup%2Fkubernetes-sidecar-injector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpediaGroup%2Fkubernetes-sidecar-injector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpediaGroup%2Fkubernetes-sidecar-injector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ExpediaGroup%2Fkubernetes-sidecar-injector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ExpediaGroup","download_url":"https://codeload.github.com/ExpediaGroup/kubernetes-sidecar-injector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251777779,"owners_count":21642224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["golang","haystack","kubernetes","mutating-webhook","oss-portal-listed"],"created_at":"2024-08-02T14:00:32.936Z","updated_at":"2025-04-30T20:33:53.877Z","avatar_url":"https://github.com/ExpediaGroup.png","language":"Go","funding_links":[],"categories":["文章"],"sub_categories":[],"readme":"![helm-release-gha](https://github.com/ExpediaGroup/kubernetes-sidecar-injector/actions/workflows/helm_release.yaml/badge.svg?branch=main)\n[![semantic-release: conventionalcommits](https://img.shields.io/badge/semantic--release-conventionalcommits-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)\n[![License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg)](https://github.com/ExpediaGroup/kubernetes-sidecar-injector/blob/main/LICENSE)\n\nKubernetes Mutating Webhook\n===========\n\nhttps://hub.docker.com/r/expediagroup/kubernetes-sidecar-injector\n\nThis [mutating webhook](https://kubernetes.io/docs/reference/access-authn-authz/admission-controllers/#mutatingadmissionwebhook) was developed to inject sidecars to a Kubernetes pod. \n\n## Developing\n\nIf one is interested in contributing to this codebase, please read the [developer documentation](DEVELOP.md) on how to build and test this codebase.\n\n## Using this webhook\n\nWe have provided two ways to deploy this webhook. Using [Helm](https://helm.sh/) and using [kubectl](https://kubernetes.io/docs/reference/kubectl/overview/). Deployment files are in `deployment/helm` and `deployment/kubectl` respectively.\n\n### ConfigMap Sidecar Configuration\n\nNOTE: Applications only have access to sidecars in their own namespaces.\n\n```\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-app-sidecar\n  namespace: my-app-namespace\ndata:\n  sidecars.yaml: |\n    - name: # Sidcar Name\n      initContainers:\n        - name: # Example 1\n          image: # Example 1\n      containers:\n        - name: # Example 2\n          image: # Example 2\n      volumes:\n        - name: # Example 3\n          configMap:\n            name: # Example 3\n      imagePullSecrets:\n        - name: # Example 4\n```\n\n\n### How to enable sidecar injection using this webhook\n\n1. Deploy this mutating webhook by cloning this repository and running the following command (needs kubectl installed and configured to point to the kubernetes cluster or minikube)\n\n    ```bash\n    make helm-install\n    ```\n\n2. By default, all namespaces are watched except `kube-system` and `kube-public`. This can be configured in your [helm values](charts/kubernetes-sidecar-injector/values.yaml#L13-L19).\n\n3. Add the annotation ([`sidecar-injector.expedia.com/inject`](charts/kubernetes-sidecar-injector/values.yaml#L9-L10) by default) with ConfigMap sidecar name to inject in pod spec where sidecar needs to be injected. [This sample spec](sample/chart/echo-server/templates/deployment.yaml#L16) shows such an annotation added to a pod spec to inject `haystack-agent`.\n\n4. Create your ConfigMap sidecar configuration\n\n```\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: my-app-sidecar\n  namespace: {{ .Release.Namespace }}\ndata:\n  sidecars.yaml: |\n    - name: busybox\n      initContainers:\n        - name: busybox\n          image: busybox\n          command: [ \"/bin/sh\" ]\n          args: [ \"-c\", \"echo '\u003chtml\u003e\u003ch1\u003eHi!\u003c/h1\u003e\u003chtml\u003e' \u003e\u003e /work-dir/index.html\" ]\n          volumeMounts:\n            - name: workdir\n              mountPath: \"/work-dir\"\n```\n## How to use the kubernetes-sidecar-injector Helm repository\n\nYou need to add this repository to your Helm repositories:\n\n```\nhelm repo add kubernetes-sidecar-injector  https://opensource.expediagroup.com/kubernetes-sidecar-injector/\nhelm repo update\n```\n\n### Kind Testing\n```shell\nmake kind\nmake install-sample-init-container # or make install-sample-container\nmake follow-logs\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FExpediaGroup%2Fkubernetes-sidecar-injector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FExpediaGroup%2Fkubernetes-sidecar-injector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FExpediaGroup%2Fkubernetes-sidecar-injector/lists"}