Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#3628 from camilamacedo86/fix-readme
Browse files Browse the repository at this point in the history
馃悰 (go/v4): fix readme content and instructions
  • Loading branch information
k8s-ci-robot committed Sep 19, 2023
2 parents 0827940 + 0885a2c commit c7c699a
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 242 deletions.
67 changes: 32 additions & 35 deletions docs/book/src/component-config-tutorial/testdata/project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,70 @@
// TODO(user): An in-depth paragraph about your project and overview of use

## Getting Started
You鈥檒l 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.
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).

### Running on the cluster
1. Install Instances of Custom Resources:
### Prerequisites
- go version v1.20.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.

```sh
kubectl apply -k config/samples/
```

2. Build and push your image to the location specified by `IMG`:
### To Deploy on the cluster
**Build and push your image to the location specified by `IMG`:**

```sh
make docker-build docker-push IMG=<some-registry>/project:tag
```

3. Deploy the controller to the cluster with the image specified by `IMG`:
**NOTE:** This image ought to be published in the personal registry you specified.
And it is required to have access to pull the image from the working environment.
Make sure you have the proper permission to the registry if the above commands don鈥檛 work.

**Install the CRDs into the cluster:**

```sh
make deploy IMG=<some-registry>/project:tag
make install
```

### Uninstall CRDs
To delete the CRDs from the cluster:
**Deploy the Manager to the cluster with the image specified by `IMG`:**

```sh
make uninstall
make deploy IMG=<some-registry>/project:tag
```

### Undeploy controller
UnDeploy the controller from the cluster:
> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
privileges or be logged in as admin.

**Create instances of your solution**
You can apply the samples (examples) from the config/sample:

```sh
make undeploy
kubectl apply -k config/samples/
```

## Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project

### How it works
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
>**NOTE**: Ensure that the samples has default values to test it out.
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/),
which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.

### Test It Out
1. Install the CRDs into the cluster:
### To Uninstall
**Delete the instances (CRs) from the cluster:**

```sh
make install
kubectl delete -k config/samples/
```

2. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
**Delete the APIs(CRDs) from the cluster:**

```sh
make run
make uninstall
```

**NOTE:** You can also run this in one step by running: `make install run`

### Modifying the API definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
**UnDeploy the controller from the cluster:**

```sh
make manifests
make undeploy
```

## Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project

**NOTE:** Run `make --help` for more information on all potential `make` targets

More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)
Expand Down
67 changes: 32 additions & 35 deletions docs/book/src/cronjob-tutorial/testdata/project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,73 +5,70 @@
// TODO(user): An in-depth paragraph about your project and overview of use

## Getting Started
You鈥檒l 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.
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).

### Running on the cluster
1. Install Instances of Custom Resources:
### Prerequisites
- go version v1.20.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.

```sh
kubectl apply -k config/samples/
```

2. Build and push your image to the location specified by `IMG`:
### To Deploy on the cluster
**Build and push your image to the location specified by `IMG`:**

```sh
make docker-build docker-push IMG=<some-registry>/project:tag
```

3. Deploy the controller to the cluster with the image specified by `IMG`:
**NOTE:** This image ought to be published in the personal registry you specified.
And it is required to have access to pull the image from the working environment.
Make sure you have the proper permission to the registry if the above commands don鈥檛 work.

**Install the CRDs into the cluster:**

```sh
make deploy IMG=<some-registry>/project:tag
make install
```

### Uninstall CRDs
To delete the CRDs from the cluster:
**Deploy the Manager to the cluster with the image specified by `IMG`:**

```sh
make uninstall
make deploy IMG=<some-registry>/project:tag
```

### Undeploy controller
UnDeploy the controller from the cluster:
> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
privileges or be logged in as admin.

**Create instances of your solution**
You can apply the samples (examples) from the config/sample:

```sh
make undeploy
kubectl apply -k config/samples/
```

## Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project

### How it works
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
>**NOTE**: Ensure that the samples has default values to test it out.
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/),
which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.

### Test It Out
1. Install the CRDs into the cluster:
### To Uninstall
**Delete the instances (CRs) from the cluster:**

```sh
make install
kubectl delete -k config/samples/
```

2. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
**Delete the APIs(CRDs) from the cluster:**

```sh
make run
make uninstall
```

**NOTE:** You can also run this in one step by running: `make install run`

### Modifying the API definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
**UnDeploy the controller from the cluster:**

```sh
make manifests
make undeploy
```

## Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project

**NOTE:** Run `make --help` for more information on all potential `make` targets

More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)
Expand Down
62 changes: 30 additions & 32 deletions pkg/plugins/golang/v4/scaffolds/internal/templates/readme.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ func (f *Readme) SetTemplateDefaults() error {
"*/", "", 1)

f.TemplateBody = fmt.Sprintf(readmeFileTemplate,
codeFence("kubectl apply -k config/samples/"),
codeFence("make docker-build docker-push IMG=<some-registry>/{{ .ProjectName }}:tag"),
codeFence("make install"),
codeFence("make deploy IMG=<some-registry>/{{ .ProjectName }}:tag"),
codeFence("kubectl apply -k config/samples/"),
codeFence("kubectl delete -k config/samples/"),
codeFence("make uninstall"),
codeFence("make undeploy"),
codeFence("make install"),
codeFence("make run"),
codeFence("make manifests"))
codeFence("make undeploy"))

return nil
}
Expand All @@ -65,57 +64,56 @@ const readmeFileTemplate = `# {{ .ProjectName }}
// TODO(user): An in-depth paragraph about your project and overview of use
## Getting Started
You鈥檒l 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.
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster ` + "`kubectl cluster-info`" + ` shows).
### Running on the cluster
1. Install Instances of Custom Resources:
### Prerequisites
- go version v1.20.0+
- docker version 17.03+.
- kubectl version v1.11.3+.
- Access to a Kubernetes v1.11.3+ cluster.
%s
2. Build and push your image to the location specified by ` + "`IMG`" + `:
### To Deploy on the cluster
**Build and push your image to the location specified by ` + "`IMG`" + `:**
%s
3. Deploy the controller to the cluster with the image specified by ` + "`IMG`" + `:
%s
**NOTE:** This image ought to be published in the personal registry you specified.
And it is required to have access to pull the image from the working environment.
Make sure you have the proper permission to the registry if the above commands don鈥檛 work.
### Uninstall CRDs
To delete the CRDs from the cluster:
**Install the CRDs into the cluster:**
%s
### Undeploy controller
UnDeploy the controller from the cluster:
**Deploy the Manager to the cluster with the image specified by ` + "`IMG`" + `:**
%s
## Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project
> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
privileges or be logged in as admin.
### How it works
This project aims to follow the Kubernetes [Operator pattern](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/).
**Create instances of your solution**
You can apply the samples (examples) from the config/sample:
%s
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/),
which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster.
>**NOTE**: Ensure that the samples has default values to test it out.
### Test It Out
1. Install the CRDs into the cluster:
### To Uninstall
**Delete the instances (CRs) from the cluster:**
%s
2. Run your controller (this will run in the foreground, so switch to a new terminal if you want to leave it running):
**Delete the APIs(CRDs) from the cluster:**
%s
**NOTE:** You can also run this in one step by running: ` + "`make install run`" + `
### Modifying the API definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
**UnDeploy the controller from the cluster:**
%s
## Contributing
// TODO(user): Add detailed information on how you would like others to contribute to this project
**NOTE:** Run ` + "`make --help`" + ` for more information on all potential ` + "`make`" + ` targets
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html)
Expand Down
Loading

0 comments on commit c7c699a

Please sign in to comment.