{"id":23564162,"url":"https://github.com/selectel/mks-go","last_synced_at":"2025-04-30T16:17:34.233Z","repository":{"id":37822803,"uuid":"239493707","full_name":"selectel/mks-go","owner":"selectel","description":"Go SDK for Managed Kubernetes Service ","archived":false,"fork":false,"pushed_at":"2025-01-17T06:19:14.000Z","size":173,"stargazers_count":8,"open_issues_count":1,"forks_count":10,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-30T16:17:24.458Z","etag":null,"topics":["go","go-sdk","kubernetes","mks","selectel-k8s"],"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/selectel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","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}},"created_at":"2020-02-10T11:17:45.000Z","updated_at":"2025-01-17T06:22:52.000Z","dependencies_parsed_at":"2024-02-19T16:09:09.150Z","dependency_job_id":"fe079f53-0af9-446f-aa2f-30b9150c451a","html_url":"https://github.com/selectel/mks-go","commit_stats":{"total_commits":83,"total_committers":11,"mean_commits":7.545454545454546,"dds":0.6385542168674698,"last_synced_commit":"1df072d3f22db1da171be6c81d89d8483fab834e"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fmks-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fmks-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fmks-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selectel%2Fmks-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selectel","download_url":"https://codeload.github.com/selectel/mks-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251739677,"owners_count":21635893,"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":["go","go-sdk","kubernetes","mks","selectel-k8s"],"created_at":"2024-12-26T17:13:12.588Z","updated_at":"2025-04-30T16:17:34.189Z","avatar_url":"https://github.com/selectel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mks-go: Go SDK for Managed Kubernetes Service\n[![Go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/selectel/mks-go/)\n[![Go Report Card](https://goreportcard.com/badge/github.com/selectel/mks-go)](https://goreportcard.com/report/github.com/selectel/mks-go)\n![Build Status](https://github.com/selectel/mks-go/actions/workflows/unit-tests.yml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/selectel/mks-go/badge.svg?branch=master)](https://coveralls.io/github/selectel/mks-go?branch=master)\n\nPackage mks-go provides Go SDK to work with the Selectel Managed Kubernetes Service.\n\n## Documentation\n\nThe Go library documentation is available at [go.dev](https://pkg.go.dev/github.com/selectel/mks-go/).\n\n## What this library is capable of\n\nYou can use this library to work with the following objects of the Selectel Managed Kubernetes Service:\n\n* [cluster](https://pkg.go.dev/github.com/selectel/mks-go/pkg/v1/cluster)\n* [nodegroup](https://pkg.go.dev/github.com/selectel/mks-go/pkg/v1/nodegroup)\n* [node](https://pkg.go.dev/github.com/selectel/mks-go/pkg/v1/node)\n* [task](https://pkg.go.dev/github.com/selectel/mks-go/pkg/v1/task)\n* [kubeversion](https://pkg.go.dev/github.com/selectel/mks-go/pkg/v1/kubeversion)\n* [kubeoptions](https://pkg.go.dev/github.com/selectel/mks-go/pkg/v1/kubeoptions)\n\n## Getting started\n\n### Installation\n\nYou can install needed `mks-go` packages via `go get` command:\n\n```bash\ngo get github.com/selectel/mks-go/pkg/v1/cluster github.com/selectel/mks-go/pkg/v1/task\n```\n\n### Authentication\n\nTo work with the Selectel Managed Kubernetes Service API you first need to:\n\n* Create a Selectel account: [registration page](https://my.selectel.ru/registration).\n* Create a project in Selectel Cloud Platform [projects](https://my.selectel.ru/vpc/projects).\n* Retrieve a token for your project via API or [go-selvpcclient](https://github.com/selectel/go-selvpcclient).\n\n### Endpoints\n\nSelectel Managed Kubernetes Service currently has the following API endpoints:\n\n| URL                             | Region |\n|---------------------------------|--------|\n| https://ru-1.mks.selcloud.ru/v1 | ru-1   |\n| https://ru-2.mks.selcloud.ru/v1 | ru-2   |\n| https://ru-3.mks.selcloud.ru/v1 | ru-3   |\n| https://ru-7.mks.selcloud.ru/v1 | ru-7   |\n| https://ru-8.mks.selcloud.ru/v1 | ru-8   |\n| https://ru-9.mks.selcloud.ru/v1 | ru-9   |\n| https://uz-1.mks.selcloud.ru/v1 | uz-1   |\n\nYou can also retrieve all available API endpoints from the Identity catalog.\n\n### Usage example\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\tv1 \"github.com/selectel/mks-go/pkg/v1\"\n\t\"github.com/selectel/mks-go/pkg/v1/cluster\"\n\t\"github.com/selectel/mks-go/pkg/v1/kubeversion\"\n\t\"github.com/selectel/mks-go/pkg/v1/nodegroup\"\n\t\"github.com/selectel/mks-go/pkg/v1/task\"\n)\n\nfunc main() {\n\t// Token to work with Selectel Cloud project.\n\ttoken := \"gAAAAABeVNzu-...\"\n\n\t// MKS endpoint to work with.\n\tendpoint := \"https://ru-3.mks.selcloud.ru/v1\"\n\n\t// Initialize the MKS V1 client.\n\tmksClient := v1.NewMKSClientV1(token, endpoint)\n\n\t// Prepare empty context.\n\tctx := context.Background()\n\n\t// Get supported Kubernetes versions.\n\tkubeVersions, _, err := kubeversion.List(ctx, mksClient)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tif len(kubeVersions) == 0 {\n\t\tlog.Fatal(\"There are no available Kubernetes versions\")\n\t}\n\n\t// Use the first version in list.\n\tkubeVersion := kubeVersions[0]\n\n\t// Nodegroup with nodes based on network volumes for root partition.\n\tfirstNodegroup := \u0026nodegroup.CreateOpts{\n\t\tCount:            3,\n\t\tCPUs:             1,\n\t\tRAMMB:            2048,\n\t\tVolumeGB:         50,\n\t\tVolumeType:       \"fast.ru-3a\",\n\t\tAvailabilityZone: \"ru-3a\",\n\t}\n\n\t// Nodegroup with nodes based on local volumes for root partition.\n\tsecondNodegroup := \u0026nodegroup.CreateOpts{\n\t\tCount:            2,\n\t\tCPUs:             2,\n\t\tRAMMB:            4096,\n\t\tVolumeGB:         20,\n\t\tLocalVolume:      true,\n\t\tAvailabilityZone: \"ru-3a\",\n\t}\n\n\t// Build final options for a new cluster.\n\tcreateOpts := \u0026cluster.CreateOpts{\n\t\tName:        \"test-cluster\",\n\t\tKubeVersion: kubeVersion.Version,\n\t\tRegion:      \"ru-3\",\n\t\tNodegroups: []*nodegroup.CreateOpts{\n\t\t\tfirstNodegroup,\n\t\t\tsecondNodegroup,\n\t\t},\n\t}\n\n\t// Create a cluster.\n\tnewCluster, _, err := cluster.Create(ctx, mksClient, createOpts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Print cluster fields.\n\tfmt.Printf(\"Created cluster: %+v\\n\", newCluster)\n\n\t// Get cluster tasks.\n\ttasks, _, err := task.List(ctx, mksClient, newCluster.ID)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// Print cluster tasks.\n\tfor _, t := range tasks {\n\t\tfmt.Printf(\"Cluster task: %+v\\n\", t)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselectel%2Fmks-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselectel%2Fmks-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselectel%2Fmks-go/lists"}