{"id":21314472,"url":"https://github.com/polyconseil/k8s-proxy-image-swapper","last_synced_at":"2025-03-15T21:15:50.811Z","repository":{"id":44551725,"uuid":"408427470","full_name":"Polyconseil/k8s-proxy-image-swapper","owner":"Polyconseil","description":null,"archived":false,"fork":false,"pushed_at":"2022-02-08T13:44:41.000Z","size":86,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-22T10:16:56.657Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Polyconseil.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":null,"security":null,"support":null}},"created_at":"2021-09-20T12:06:47.000Z","updated_at":"2022-01-05T15:53:08.000Z","dependencies_parsed_at":"2022-09-03T04:43:01.498Z","dependency_job_id":null,"html_url":"https://github.com/Polyconseil/k8s-proxy-image-swapper","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polyconseil%2Fk8s-proxy-image-swapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polyconseil%2Fk8s-proxy-image-swapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polyconseil%2Fk8s-proxy-image-swapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polyconseil%2Fk8s-proxy-image-swapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Polyconseil","download_url":"https://codeload.github.com/Polyconseil/k8s-proxy-image-swapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243790999,"owners_count":20348385,"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":[],"created_at":"2024-11-21T18:13:11.474Z","updated_at":"2025-03-15T21:15:50.782Z","avatar_url":"https://github.com/Polyconseil.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# K8s proxy image swapper\n\nThis project patches pods' images on container and initContainers to\nproxy them from dockerhub to another registry (configurable via the variable\nPROXY\\_URL).\n\nThe goal is to counteract dockerhub rate limit by caching locally.\n(Note that this project only patches images name, to redirect them on a proxy registry;\nthe official docker-registry can be configured as a proxy registry).\n\nPatching is done automatically, there is no need to change anything on\nyour deployments.\n\nImages patched by k8s-proxy-image-swapper (k8s-pisw) also have a label\n\"k8s-proxy-image-swapper: patched-image\", to recognize them.\n\n# Setup\n\nTo use this you need to create a secret which is a valid k8s secret.\nIn order to do that the script `./create-cert.sh` will help you.\n\nCurrently the following command should be used :\n```\n./create-cert.sh --secret k8s-proxy-image-swapper-tls-secret --namespace kube-system --service k8s-pisw\n```\n\nCertificate is valid for one year.\n\nAfterwards you can use the helm chart in ./chart to deploy this software.\nYou need to have the image of the patcher built and pushed on a custom registry,\nbecause no exception is currently made on k8s-proxy-image-swapper (self).\nYou need to provide the base64 of the CA for the cluster. Further details\nare available in ./chart/values.yaml.\n\n# Troubleshouting\n\nIn case of issue with image patching, to remove image-swapper, use the following command:\n\n`kubectl delete mutatingwebhookconfiguration k8s-proxy-image-swapper-webhook`\n\nThis will delete the webhook and unblock your cluster. Upgrade the chart to reinstate\nthe webhook.\n\n# Inner working\n\nThis software uses MutatingWebHook (from dynamic admission control in k8s)\nto patch the `image` field in a pod (`containers` and `initContainers`) to\nuse a proxy registry (docker registry for instance).\n\nSee the unit tests in `mutate/mutate_test.go` for patching examples.\nNote that the image must be stored in a registry different than the\nDocker Hub. Otherwise you may have a chicken and egg problem.\n\nThe simple solution to unblock yourself when the proxy doesn't work for instance\nis to simply delete the mutating webhook :\n`kubectl delete MutatingWebHookConfiguration -n kube-system k8s-proxy-image-swapper-webhook`\n\n# Contributing\n\nContributions implies licensing those contributions under the terms of LICENSE.\n\nThe GitHub repository https://github.com/Polyconseil/k8s-proxy-image-swapper\nis the official repository.\n\nTo contribute you need a GitHub account.\n\n## Opening issues\n\nPlease make sure there is no open issue on the topic.\n\n## Submitting changes\n\nPlease format the commit messages according to semantic-release.\n\nA good commit message includes relevant information about *why* a change\nhas been made (this might also be a good idea to put this kind of information\nin comments), so that other developers can later understand why a change was made.\n\nThe project follows a semver versionning scheme.\n\n# Architecture\n\n- ./main.go contains the setup code and configuration code.\n- ./mutate contains the code that patches the images. (if you ever modify this\ncode, please run the tests and add or modify the tests accordingly).\n- ./chart contains the chart to deploy the software.\n- ./tests contains some manifests to help test the software.\n\n\n## Building\nThe Docker image can be build with the Dockerfile with :\n\n```\ndocker build .\n```\n\nOr with Nix :\n\n```\nnix build .#packages.x86_64-linux.oci-k8s-proxy-image-swapper\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyconseil%2Fk8s-proxy-image-swapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolyconseil%2Fk8s-proxy-image-swapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyconseil%2Fk8s-proxy-image-swapper/lists"}