{"id":17322404,"url":"https://github.com/jenting/k8s-crd-example","last_synced_at":"2025-04-14T16:18:13.621Z","repository":{"id":129093414,"uuid":"167065283","full_name":"jenting/k8s-crd-example","owner":"jenting","description":"Kubernetes CRD example","archived":false,"fork":false,"pushed_at":"2025-03-24T10:32:09.000Z","size":12742,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-14T16:17:58.016Z","etag":null,"topics":["crd","customresourcedefinitions","k8s","kubernetes"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenting.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-22T20:50:56.000Z","updated_at":"2025-03-24T10:32:12.000Z","dependencies_parsed_at":"2025-01-20T16:21:18.367Z","dependency_job_id":"4a779482-3e6b-4b6b-a514-8503d364aa25","html_url":"https://github.com/jenting/k8s-crd-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenting%2Fk8s-crd-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenting%2Fk8s-crd-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenting%2Fk8s-crd-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenting%2Fk8s-crd-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenting","download_url":"https://codeload.github.com/jenting/k8s-crd-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248914118,"owners_count":21182359,"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":["crd","customresourcedefinitions","k8s","kubernetes"],"created_at":"2024-10-15T13:42:00.557Z","updated_at":"2025-04-14T16:18:13.599Z","avatar_url":"https://github.com/jenting.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kubernetes Custom Resource Definition\n\n## What is this?\n\nAn example of a custom Kubernetes controller that with HTTP router endpoint `/health`, by default `GET` method supports. But the HTTP method could be changed via Custom Resource Definition to enable/disable other HTTP method on endpoint `/health`.\n\n## Development environment\n\n### Golang\n\nEnsure you got Go 1.11 installed with `go mod` support.\n\n```sh\nbrew install go\nexport GO111MODULE=on\ngo mod vendor\n```\n\n### Docker\n\nDocker is required. You may download and install [the installation package](https://store.docker.com/editions/community/docker-ce-desktop-mac), or install it via [Homebrew Cask](https://brew.sh/).\n\n```sh\nbrew cask install docker\n```\n\n### Kubernetes cluster\n\nkubernetes is required. You may setup a K8s cluster by [docker-for-desktop](https://codefresh.io/kubernetes-tutorial/local-kubernetes-mac-minikube-vs-docker-desktop/) or [minikube](https://kubernetes.io/docs/tasks/tools/install-minikube/)\n\n### Kubectl\n\nkubectl is required. You could install [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/), or install it via [Homebrew](https://brew.sh/).\n\n```sh\nbrew install kubernetes-cli\n```\n\n### Helm\n\nHelm is required. You may download and install [the binary releases](https://github.com/helm/helm/releases), or install it via [Homebrew](https://brew.sh/).\n\n```sh\nbrew install kubernetes-helm\n```\n\nTiller is required. You can install it via command.\n\n```sh\nkubectl -n kube-system create sa tiller\nkubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller\nhelm init --service-account tiller\n```\n\n### Draft\n\nDraft is required. You may download and install [the binary releases](https://github.com/Azure/draft/releases), or install it via [Homebrew](https://brew.sh/).\n\n```sh\nbrew tap azure/draft \u0026\u0026 brew install draft\n```\n\n## Deploy container and helm chart via Draft\n\n1. Set up draft (after Development environment are prepared)\n\n```sh\ndraft init\n```\n\n2. To deploy the application to a Kubernetes dev sandbox, accessible using draft connect over a secured tunnel\n\n```sh\ndraft up\n```\n\n3. Show information\n\n```sh\nhelm list\nkubectl get all\n```\n\n## Test CRD behavior\n\n1. Apply CRD deployment\n\n```sh\nkubectl apply -f patch/deploy.yaml\n```\n\n2. Test default CRD behavior (GET enabled; PUT disabled)\n\n```sh\ncurl -XGET -i 'localhost:8888/health'\ncurl -XPUT -i 'localhost:8888/health'\n```\n\n3. Enable PUT method\n\n```sh\nkubectl replace -f patch/put-on.yaml\n```\n\n4. Test CRD behavior (GET and enabled)\n\n```sh\ncurl -XGET -i 'localhost:8888/health'\ncurl -XPUT -i 'localhost:8888/health'\n```\n\n5. Disable PUT method\n\n```sh\nkubectl replace -f patch/put-off.yaml\n```\n\n6. Test CRD behavior (GET enabled; PUT disabled)\n\n```sh\ncurl -XGET -i 'localhost:8888/health'\ncurl -XPUT -i 'localhost:8888/health'\n```\n\n7. You could try other HTTP method on/off behavior with `patch/xxx-on.yaml` or `patch/xxx-off.yaml`\n\n## Clean k8s enviroment\n\n```sh\ndraft delete\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenting%2Fk8s-crd-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenting%2Fk8s-crd-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenting%2Fk8s-crd-example/lists"}