{"id":48543089,"url":"https://github.com/vatesfr/xenorchestra-k8s-common","last_synced_at":"2026-04-08T05:31:09.680Z","repository":{"id":343494823,"uuid":"1177736594","full_name":"vatesfr/xenorchestra-k8s-common","owner":"vatesfr","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-10T15:39:52.000Z","size":46,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-10T21:27:56.338Z","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/vatesfr.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,"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":"2026-03-10T10:16:35.000Z","updated_at":"2026-03-10T15:26:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vatesfr/xenorchestra-k8s-common","commit_stats":null,"previous_names":["vatesfr/xenorchestra-k8s-common"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/vatesfr/xenorchestra-k8s-common","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatesfr%2Fxenorchestra-k8s-common","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatesfr%2Fxenorchestra-k8s-common/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatesfr%2Fxenorchestra-k8s-common/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatesfr%2Fxenorchestra-k8s-common/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vatesfr","download_url":"https://codeload.github.com/vatesfr/xenorchestra-k8s-common/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vatesfr%2Fxenorchestra-k8s-common/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31542381,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"online","status_checked_at":"2026-04-08T02:00:06.127Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-04-08T05:31:08.945Z","updated_at":"2026-04-08T05:31:09.672Z","avatar_url":"https://github.com/vatesfr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xenorchestra-k8s-common\n\nShared Go module for Xen Orchestra Kubernetes integrations.\n\nThis project centralizes logic used by multiple Kubernetes components\n(such as Xen Orchestra Cloud Controller Manager and CSI-related code), so\nProviderID parsing, cloud config validation, XO lookups, and label keys stay\nconsistent across repositories.\n\n## 🧐 Why This Exists\n\nWithout a shared module, the same logic tends to be duplicated and drifts over\ntime. `xenorchestra-k8s-common` provides one source of truth for:\n\n- Xen Orchestra cloud config parsing and validation\n- Kubernetes ProviderID generation/parsing for Xen Orchestra\n- Node-to-VM lookup helpers through the XO SDK\n- Shared Kubernetes node label constants\n\n### What should stay out of this module\n\n- Consumer-specific business logic (for example, CCM controller loops or\n  CSI attach/detach workflows).\n- Code used by only one consumer until a second consumer needs it.\n\n## 🛠️ Installation\n\n```bash\ngo get github.com/vatesfr/xenorchestra-k8s-common\n```\n\n## 🧩 Configuration\n\nExample cloud config (`xo-config.yaml`):\n\n```yaml\nurl: https://xo.example.com\ninsecure: false\ntoken: \"YOUR_API_TOKEN\"\n```\n\nValidation rules:\n\n- `url` is required and must start with `http`\n- Authentication is required:\n  - either `token`\n  - or both `username` and `password`\n- `token` cannot be set together with `username/password`\n\n## 🧑🏻‍💻 Usage Examples\n\n### Read Config\n\n```go\ncfg, err := xok8scommon.ReadCloudConfigFromFile(\"/etc/kubernetes/xo-config.yaml\")\nif err != nil {\n    return err\n}\n```\n\n### Build and Parse ProviderID\n\n```go\nproviderID := xok8scommon.GetProviderID(poolID, vm)\n// xenorchestra://\u003cpoolUUID\u003e/\u003cvmUUID\u003e or xenorchestra:///\u003cvmUUID\u003e\n\nvmID, err := xok8scommon.GetVMID(providerID)\nif err != nil {\n    return err\n}\n_ = vmID\n```\n\n### Create XO Client and Resolve VM From Node\n\n```go\nclient, err := xok8scommon.NewXOClient(\u0026cfg)\nif err != nil {\n    return err\n}\n\nif err := client.CheckClient(ctx); err != nil {\n    return err\n}\n\nvm, poolID, err := client.FindVMByNode(ctx, node)\nif err != nil {\n    return err\n}\n_, _ = vm, poolID\n```\n\n\n## ➤ License\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvatesfr%2Fxenorchestra-k8s-common","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvatesfr%2Fxenorchestra-k8s-common","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvatesfr%2Fxenorchestra-k8s-common/lists"}