| Giorgi Lekveishvili | e8b2f01 | 2023-11-30 19:05:03 +0400 | [diff] [blame] | 1 | # ns-controller |
| 2 | // TODO(user): Add simple overview of use/purpose |
| 3 | |
| 4 | ## Description |
| 5 | // TODO(user): An in-depth paragraph about your project and overview of use |
| 6 | |
| 7 | ## Getting Started |
| 8 | You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster. |
| 9 | **Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows). |
| 10 | |
| 11 | ### Running on the cluster |
| 12 | 1. Install Instances of Custom Resources: |
| 13 | |
| 14 | ```sh |
| 15 | kubectl apply -f config/samples/ |
| 16 | ``` |
| 17 | |
| 18 | 2. Build and push your image to the location specified by `IMG`: |
| 19 | |
| 20 | ```sh |
| 21 | make docker-build docker-push IMG=<some-registry>/ns-controller:tag |
| 22 | ``` |
| 23 | |
| 24 | 3. Deploy the controller to the cluster with the image specified by `IMG`: |
| 25 | |
| 26 | ```sh |
| 27 | make deploy IMG=<some-registry>/ns-controller:tag |
| 28 | ``` |
| 29 | |
| 30 | ### Uninstall CRDs |
| 31 | To delete the CRDs from the cluster: |
| 32 | |
| 33 | ```sh |
| 34 | make uninstall |
| 35 | ``` |
| 36 | |
| 37 | ### Undeploy controller |
| 38 | UnDeploy the controller to the cluster: |
| 39 | |
| 40 | ```sh |
| 41 | make undeploy |
| 42 | ``` |
| 43 | |
| 44 | ## Contributing |
| 45 | // TODO(user): Add detailed information on how you would like others to contribute to this project |
| 46 | |
| 47 | ### How it works |
| 48 | This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/) |
| 49 | |
| 50 | It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/) |
| 51 | which provides a reconcile function responsible for synchronizing resources untile the desired state is reached on the cluster |
| 52 | |
| 53 | ### Test It Out |
| 54 | 1. Install the CRDs into the cluster: |
| 55 | |
| 56 | ```sh |
| 57 | make install |
| 58 | ``` |
| 59 | |
| 60 | 2. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running): |
| 61 | |
| 62 | ```sh |
| 63 | make run |
| 64 | ``` |
| 65 | |
| 66 | **NOTE:** You can also run this in one step by running: `make install run` |
| 67 | |
| 68 | ### Modifying the API definitions |
| 69 | If you are editing the API definitions, generate the manifests such as CRs or CRDs using: |
| 70 | |
| 71 | ```sh |
| 72 | make manifests |
| 73 | ``` |
| 74 | |
| 75 | **NOTE:** Run `make --help` for more information on all potential `make` targets |
| 76 | |
| 77 | More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) |
| 78 | |
| 79 | ## License |
| 80 | |
| 81 | Copyright 2023. |
| 82 | |
| 83 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 84 | you may not use this file except in compliance with the License. |
| 85 | You may obtain a copy of the License at |
| 86 | |
| 87 | http://www.apache.org/licenses/LICENSE-2.0 |
| 88 | |
| 89 | Unless required by applicable law or agreed to in writing, software |
| 90 | distributed under the License is distributed on an "AS IS" BASIS, |
| 91 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 92 | See the License for the specific language governing permissions and |
| 93 | limitations under the License. |
| 94 | |