{"id":15638610,"url":"https://github.com/rohankanojia/podsetoperatorinjava","last_synced_at":"2025-11-01T00:30:24.570Z","repository":{"id":44354484,"uuid":"206572471","full_name":"rohanKanojia/podsetoperatorinjava","owner":"rohanKanojia","description":"Java Implementation of https://github.com/hrishin/podset-operator using Fabric8 Kubernetes Client","archived":false,"fork":false,"pushed_at":"2024-08-13T14:32:04.000Z","size":72,"stargazers_count":57,"open_issues_count":2,"forks_count":26,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-09T07:07:49.671Z","etag":null,"topics":["fabric8-kubernetes-client","java","kubernetes-operators"],"latest_commit_sha":null,"homepage":"https://github.com/fabric8io/kubernetes-client","language":"Java","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/rohanKanojia.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","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":"2019-09-05T13:36:46.000Z","updated_at":"2024-08-13T14:32:08.000Z","dependencies_parsed_at":"2023-01-31T00:45:58.496Z","dependency_job_id":"727f7352-eec1-4680-8902-b01ea067f3a3","html_url":"https://github.com/rohanKanojia/podsetoperatorinjava","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/rohanKanojia%2Fpodsetoperatorinjava","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohanKanojia%2Fpodsetoperatorinjava/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohanKanojia%2Fpodsetoperatorinjava/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rohanKanojia%2Fpodsetoperatorinjava/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rohanKanojia","download_url":"https://codeload.github.com/rohanKanojia/podsetoperatorinjava/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239102818,"owners_count":19582051,"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":["fabric8-kubernetes-client","java","kubernetes-operators"],"created_at":"2024-10-03T11:22:12.749Z","updated_at":"2025-11-01T00:30:24.528Z","avatar_url":"https://github.com/rohanKanojia.png","language":"Java","readme":"# PodSet Operator in Java Using Fabric8 Kubernetes Client\n\n![Build](https://github.com/rohanKanojia/podsetoperatorinjava/workflows/Java%20CI%20with%20Maven/badge.svg?branch=master)\n![License](https://img.shields.io/github/license/rohanKanojia/podsetoperatorinjava)\n[![Twitter](https://img.shields.io/twitter/follow/fabric8io?style=social)](https://twitter.com/fabric8io)\n\n## Note\n\u003e This project is a demo project for blog for writing a simple Kubernetes operation in Java using [Fabric8 Kubernetes Client](https://github.com/fabric8io/kubernetes-client). You can find full blog here: [Writing a simple Kubernetes Operation in Java](https://developers.redhat.com/blog/2019/10/07/write-a-simple-kubernetes-operator-in-java-using-the-fabric8-kubernetes-client/)\n\nThis is a demo operator which implements a simple operator for a custom resource called PodSet which is somewhat equal to ReplicaSet. Here \nis what this resource looks like:\n```\napiVersion: demo.fabric8.io/v1alpha1\nkind: PodSet\nmetadata:\n  name: example-podset\nspec:\n  replicas: 5\n```\n\nEach PodSet object would have 'x' number of replicas, so this operator just tries to maintain x number of replicas checking whether that number\nof pods are running in cluster or not.\n\n## How to Build\n```\n   mvn clean install\n```\n\n## How to Run\n```\n   mvn exec:java -Dexec.mainClass=io.fabric8.podset.operator.PodSetOperatorMain\n```\n\nMake Sure that PodSet Custom Resource Definition is already applied onto the cluster. If not, just apply it using this command:\n```\nkubectl apply -f src/main/resources/crd.yaml\n```\n\nOnce everything is set, you can see that operator creating pods in your cluster for PodSet resource:\n![Demo Screenshot](https://i.imgur.com/ECNKBjG.png)\n\n## Deploying onto Kubernetes(minikube) using [Eclipse JKube](https://github.com/eclipse/jkube)\n- Make Sure that PodSet Custom Resource Definition is already applied onto the cluster. If not, just apply it using this command:\n ```\n kubectl apply -f src/main/resources/crd.yaml\n ```\n- Make sure that you have given correct privileges to `ServiceAccount` that would be used by the `Pod`, it's `default` in our case. Otherwise you might get 403 from Kubernetes API server.\n```\nkubectl create clusterrolebinding default-pod --clusterrole cluster-admin --serviceaccount=default:default\n\n# In case of some other namespace:\nkubectl create clusterrolebinding default-pod --clusterrole cluster-admin --serviceaccount=\u003cnamespace\u003e:default\n```\n- Build Docker Image\n```\nmvn k8s:build\n```\n![JKube Build Docker Image](https://i.imgur.com/IXVlZ8e.png)\n\n- Generate Kubernetes Manifests\n```\nmvn k8s:resource\n```\n![JKube Generate Kubernetes Manifests](https://i.imgur.com/slDdq3X.png)\n- Apply generated Kubernetes Manifests onto Kubernetes\n```\nmvn k8s:apply\n```\nOnce generated resources are applied, try creating one of `PodSet` objects in `src/main/resources`\n```\nkubectl apply -f src/main/resources/cr.yaml\n```\n![JKube Apply Generated Kubernetes Manifests](https://i.imgur.com/dgp8lX5.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohankanojia%2Fpodsetoperatorinjava","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frohankanojia%2Fpodsetoperatorinjava","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frohankanojia%2Fpodsetoperatorinjava/lists"}