{"id":37093483,"url":"https://github.com/jkrivas/k8s-ha-git-sync","last_synced_at":"2026-02-11T22:54:49.993Z","repository":{"id":245929268,"uuid":"819562515","full_name":"jkrivas/k8s-ha-git-sync","owner":"jkrivas","description":"Home Assistant configuration sync from Git in Kubernetes","archived":false,"fork":false,"pushed_at":"2025-12-18T03:12:57.000Z","size":181,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-21T13:02:08.823Z","etag":null,"topics":["gitops","home-assistant","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jkrivas.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-06-24T18:56:59.000Z","updated_at":"2025-12-04T08:56:11.000Z","dependencies_parsed_at":"2024-06-27T06:42:01.789Z","dependency_job_id":"465883a8-2f6c-413c-89a3-2f2c3ffda3c9","html_url":"https://github.com/jkrivas/k8s-ha-git-sync","commit_stats":null,"previous_names":["jkrivas/k8s-ha-git-sync"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/jkrivas/k8s-ha-git-sync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkrivas%2Fk8s-ha-git-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkrivas%2Fk8s-ha-git-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkrivas%2Fk8s-ha-git-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkrivas%2Fk8s-ha-git-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkrivas","download_url":"https://codeload.github.com/jkrivas/k8s-ha-git-sync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkrivas%2Fk8s-ha-git-sync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28418284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["gitops","home-assistant","kubernetes"],"created_at":"2026-01-14T11:22:03.633Z","updated_at":"2026-01-14T11:22:04.332Z","avatar_url":"https://github.com/jkrivas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# k8s-ha-git-sync\n\nToll that allows to sync Kubernetes deployed Home Assistant configuration with Git.\n\nInspired by [Home Assistant Git Pull addon](https://github.com/home-assistant/addons/tree/master/git_pull).\n\n## Introduction\n\nThe tool works by periodically executing a `git pull` command (default interval: 60s). It then checks the validity of the configuration by calling the Home Assistant API. If the configuration is valid, it triggers a deployment restart using the Kubernetes API.\n\n\u003e [!WARNING]\n\u003e The developer of this tool takes no responsibility for any unexpected changes or deletions to your Home Assistant configuration. It is your responsibility to ensure that you have a backup of your configuration before using this tool.\n\n## Pre-setup\n\n### Home Assistant\n\nIn order to validate configuration in Home Assistant, `api` integration needs to be enabled: [documentation](https://www.home-assistant.io/integrations/api/).\n\nThen in users profile a long-lived access token for this tool needs to be generated.\n\n### Git\n\nBefore deploying this tool you must correctly setup the Home Assistant configuration directory as a Git repository with a remote repository.\nCurrently the tool does not support initializing a git repository, or cloning one.\n\nOfficial Home Assistant container image has git tool pre-installed, and can be used by getting a shell in the pod.\n\n```sh\nkubectl -n \u003cnamespace\u003e exec --stdin --tty \u003cpod\u003e -- /bin/bash\ncd /config \ngit init -b \u003cbranch\u003e\ngit remote add origin \u003crepo\u003e\ngit branch --set-upstream-to=origin/\u003cbranch\u003e \u003cbranch\u003e\n```\n\n#### .gitignore\n\nSince Home Assistants keeps other various service files like logs, databases, backups etc... , it is recommended to ignore everything in `.gitignore` file and then only allow synced files.\n\nExample `.gitignore`:\n\n```text\n# Ignore everything\n/*\n\n# Synced files\n!.gitignore\n!configuration.yaml\n!configuration/\n```\n\n## Deployment\n\n### Options\n\n| Option             | Environment variable | Description                                                   | Default                  | Required |\n| ------------------ | -------------------- | ------------------------------------------------------------- | ------------------------ | -------- |\n| --interval         | INTERVAL             | Interval in seconds between synchronizations                  | 60                       | Yes      |\n| --ha-config-path   | CONFIG_PATH          | Path to the Home Assistant configuration directory            | /homeassistant           | Yes      |\n| --ha-url           | HA_URL               | URL of the Home Assistant instance                            | http://homeassitant:8123 | Yes      |\n| --ha-token         | HA_TOKEN             | Long-Lived Access Token for the Home Assistant instance       |                          | Yes      |\n| --git-ssh-key-path | GIT_SSH_KEY_PATH     | Path to the SSH key for Git authentication                    |                          | No       |\n| --git-token        | GIT_TOKEN            | Token for Git HTTPS authentication                            |                          | No       |\n| --kube-namespace   | KUBE_NAMEPSACE       | Name of the Home Assistant deployment namespace in Kubernetes | homeassistant            | Yes      |\n| --kube-deployment  | KUBE_DEPLOYMENT      | Name of the Home Assistant deployment in Kubernetes           | homeassistant            | Yes      |\n| --metrics          | METRICS              | Enable Prometheus metrics                                     | false                    | No       |\n| --metrics-port     | METRICS_PORT         | Port for Prometheus metrics service                           | 8080                     | No       | ~~~~ |\n\n### Kubernetes service account\n\nSince this tool uses native Kubernetes API, it uses in-cluster authentication with permissions from the service account of the pod.\nIn order for it to restart deployments, a role and a role binding needs to be created.\n\nExample:\n\n```yaml\n---\napiVersion: v1\nkind: ServiceAccount\nmetadata:\n  name: homeassistant-sync\n  namespace: homeassistant\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n  name: edit-deployments\n  namespace: homeassistant\nrules:\n  - apiGroups: [\"apps\"]\n    resources: [\"deployments\"]\n    verbs: [\"get\", \"update\"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n  name: edit-deployments-homeassistant-sync\n  namespace: homeassistant\nroleRef:\n  apiGroup: rbac.authorization.k8s.io\n  kind: Role\n  name: edit-deployments\nsubjects:\n  - kind: ServiceAccount\n    name: homeassistant-sync\n    namespace: homeassistant\n```\n\n## Observability\n\nThe tool has capability to expose Prometheus metrics. It can be enabled by setting env variable `METRICS` to `true`.\n\nExported metrics:\n\n| Metric                    | Type  | Description                                             |\n| ------------------------- | ----- | ------------------------------------------------------- |\n| ha_git_sync_config_status | Gauge | Shows if pulled configuration is valid. Returns 1 or 0. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkrivas%2Fk8s-ha-git-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkrivas%2Fk8s-ha-git-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkrivas%2Fk8s-ha-git-sync/lists"}