{"id":16482737,"url":"https://github.com/jensneuse/kube-utils","last_synced_at":"2025-08-01T22:33:07.218Z","repository":{"id":64306553,"uuid":"131966227","full_name":"jensneuse/kube-utils","owner":"jensneuse","description":"This repository offers utility functions for easy integrating go applications in kubernetes","archived":false,"fork":false,"pushed_at":"2018-05-07T05:09:33.000Z","size":5473,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-23T00:42:03.476Z","etag":null,"topics":["go","golang","integration","integration-test","integration-testing","integration-tests","integration-tool","kubernetes","kubernetes-deployment"],"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/jensneuse.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":"2018-05-03T08:39:07.000Z","updated_at":"2024-03-06T20:28:21.000Z","dependencies_parsed_at":"2023-01-15T10:45:21.629Z","dependency_job_id":null,"html_url":"https://github.com/jensneuse/kube-utils","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/jensneuse%2Fkube-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensneuse%2Fkube-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensneuse%2Fkube-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jensneuse%2Fkube-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jensneuse","download_url":"https://codeload.github.com/jensneuse/kube-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228413888,"owners_count":17915914,"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","golang","integration","integration-test","integration-testing","integration-tests","integration-tool","kubernetes","kubernetes-deployment"],"created_at":"2024-10-11T13:11:47.288Z","updated_at":"2024-12-06T04:57:43.992Z","avatar_url":"https://github.com/jensneuse.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kube-utils\nThis repository offers utility functions for easy integrating go applications in kubernetes\n\nWorks for both client side and in-cluster testing.\n\nLets say you'd like to spin up your test environment, run integration tests and cleanup everything, this is all you have to do:\n\n```go\nfunc TestMinioTemplate(t *testing.T) {\n\n\tg := Goblin(t)\n\tRegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })\n\n\tpodName := \"minio-simple-test\"\n\tendpoint := \"localhost:9000\"\n\taccessKey := \"AKIAIOSFODNN7EXAMPLE\"\n\tsecretKey := \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"\n\n\tl := New()\n\n\tg.Describe(\"minio\", func() {\n\n\t\tg.After(func() {\n\t\t\t// tear down\n\t\t\tl.Cleanup()\n\t\t})\n\n\t\tg.It(\"should be ready to connect\", func() {\n\n\t\t\t// request whatever we need\n\t\t\tl.CreateAndForwardMinio(config.NAMESPACE, podName, accessKey, secretKey)\n\n\t\t\tminioClient, err := minio.New(endpoint, accessKey, secretKey, false)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t_, err = minioClient.ListBuckets()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t})\n\t})\n}\n```\n\nYour environment might be a bit more complex. Working with multiple pods is as easy as:\n\n````go\nfunc TestCreateAndForwardPods(t *testing.T) {\n\tg := Goblin(t)\n\tRegisterFailHandler(func(m string, _ ...int) { g.Fail(m) })\n\n\tg.Describe(\"CreateAndForwardPods\", func() {\n\n\t\tl := New()\n\n\t\tg.After(func() {\n\t\t\tl.Cleanup()\n\t\t})\n\n\t\tminioPodName := \"minio-multitest\"\n\t\tendpoint := \"localhost:9000\"\n\t\taccessKey := \"AKIAIOSFODNN7EXAMPLE\"\n\t\tsecretKey := \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\"\n\n\t\tpostgresPodName := \"postgres-multitest\"\n\t\tdsn := \"postgresql://postgres@localhost:15432/postgres?sslmode=disable\"\n\n\t\tg.It(\"should provide minio + postgres\", func() {\n\t\t\tl.CreateAndForwardPods(config.NAMESPACE,\n\t\t\t\tpodtemplates.Minio(minioPodName, accessKey, secretKey),\n\t\t\t\tpodtemplates.Postgresql(postgresPodName),\n\t\t\t)\n\n\t\t\tminioClient, err := minio.New(endpoint, accessKey, secretKey, false)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t_, err = minioClient.ListBuckets()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\tdb, err := sql.Open(\"postgres\", dsn)\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\tdefer db.Close()\n\n\t\t\tExpect(db.Ping()).To(BeNil())\n\t\t})\n\t})\n}\n````\n\n## Running tests\n\n````bash\ngo test ./pkg/... -namespace=default\n````\n\n## Contributions\n\nFeel free to submit additions (e.g. more pod templates) via pull requests.\nDon't forget to add tests.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjensneuse%2Fkube-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjensneuse%2Fkube-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjensneuse%2Fkube-utils/lists"}