-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add readme template to scaffold templates
Signed-off-by: Bryce Palmer <[email protected]>
- Loading branch information
1 parent
390e070
commit 45de7c3
Showing
6 changed files
with
537 additions
and
0 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
pkg/plugins/golang/v3/scaffolds/internal/templates/readme.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
Copyright 2022 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package templates | ||
|
||
import "sigs.k8s.io/kubebuilder/v3/pkg/machinery" | ||
|
||
var _ machinery.Template = &Readme{} | ||
|
||
// Readme scaffolds a README.md file | ||
type Readme struct { | ||
machinery.TemplateMixin | ||
machinery.BoilerplateMixin | ||
} | ||
|
||
// SetTemplateDefaults implements file.Template | ||
func (f *Readme) SetTemplateDefaults() error { | ||
if f.Path == "" { | ||
f.Path = "README.md" | ||
} | ||
|
||
f.TemplateBody = readmeFileTemplate | ||
|
||
return nil | ||
} | ||
|
||
//nolint:lll | ||
const readmeFileTemplate = `# Project Name | ||
// TODO(user): Add simple overview of use/purpose | ||
## Description | ||
// TODO(user): An in-depth paragraph about your project and overview of use | ||
## Getting Started | ||
In order to use this operator you will need to have a Kubernetes cluster to run against. | ||
If you need a local cluster for testing you can use [KinD](https://kind.sigs.k8s.io/) | ||
### Running the operator | ||
To run this operator locally (outside of a Kubernetes cluster): | ||
1. Install the CustomResourceDefinitions (CRDs) into the cluster: | ||
~~~shell | ||
make install | ||
~~~ | ||
2. Run the controller (this will run in the foreground): | ||
~~~shell | ||
make run | ||
~~~ | ||
**NOTE:** You can also run this in one step by running: <code>make install run</code> | ||
To stop running the operator locally, you can terminate the process by pressing <code>ctrl+c</code> in the terminal window the process is running in | ||
To run this operator on the cluster: | ||
1. Install the CRDs: | ||
~~~shell | ||
kubectl apply -f config/samples/ | ||
~~~ | ||
2. Build and push your image to the location specified by <code>IMG</code>: | ||
~~~shell | ||
make docker-build docker-push IMG=<some-registry>/<project-name>:tag | ||
~~~ | ||
3. Deploy the controller to the cluster with the image specified by <code>IMG</code>: | ||
~~~shell | ||
make deploy IMG=<some-registry>/project-name>:tag | ||
~~~ | ||
### Uninstall CRDs | ||
To delete the CRDs from the cluster: | ||
~~~shell | ||
make uninstall | ||
~~~ | ||
### Undeploy Controller | ||
If you deployed the controller on the cluster, you can undeploy it with: | ||
~~~shell | ||
make undeploy | ||
~~~ | ||
**NOTE:** Run <code>make --help</code> for more information on all potential <code>make</code> targets | ||
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) | ||
## 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/) | ||
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/) | ||
which provides a reconcile function responsible for synchronizing resources untile the desired state is reached on the cluster | ||
## License | ||
{{ .Boilerplate }} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Project Name | ||
// TODO(user): Add simple overview of use/purpose | ||
|
||
## Description | ||
// TODO(user): An in-depth paragraph about your project and overview of use | ||
|
||
## Getting Started | ||
In order to use this operator you will need to have a Kubernetes cluster to run against. | ||
If you need a local cluster for testing you can use [KinD](https://kind.sigs.k8s.io/) | ||
|
||
### Running the operator | ||
To run this operator locally (outside of a Kubernetes cluster): | ||
|
||
1. Install the CustomResourceDefinitions (CRDs) into the cluster: | ||
~~~shell | ||
make install | ||
~~~ | ||
|
||
2. Run the controller (this will run in the foreground): | ||
~~~shell | ||
make run | ||
~~~ | ||
|
||
**NOTE:** You can also run this in one step by running: <code>make install run</code> | ||
|
||
To stop running the operator locally, you can terminate the process by pressing <code>ctrl+c</code> in the terminal window the process is running in | ||
|
||
To run this operator on the cluster: | ||
|
||
1. Install the CRDs: | ||
~~~shell | ||
kubectl apply -f config/samples/ | ||
~~~ | ||
|
||
2. Build and push your image to the location specified by <code>IMG</code>: | ||
~~~shell | ||
make docker-build docker-push IMG=<some-registry>/<project-name>:tag | ||
~~~ | ||
|
||
3. Deploy the controller to the cluster with the image specified by <code>IMG</code>: | ||
~~~shell | ||
make deploy IMG=<some-registry>/project-name>:tag | ||
~~~ | ||
|
||
### Uninstall CRDs | ||
To delete the CRDs from the cluster: | ||
~~~shell | ||
make uninstall | ||
~~~ | ||
|
||
### Undeploy Controller | ||
If you deployed the controller on the cluster, you can undeploy it with: | ||
~~~shell | ||
make undeploy | ||
~~~ | ||
|
||
**NOTE:** Run <code>make --help</code> for more information on all potential <code>make</code> targets | ||
|
||
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) | ||
|
||
## 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/) | ||
|
||
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/) | ||
which provides a reconcile function responsible for synchronizing resources untile the desired state is reached on the cluster | ||
|
||
## License | ||
/* | ||
Copyright 2022 The Kubernetes authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Project Name | ||
// TODO(user): Add simple overview of use/purpose | ||
|
||
## Description | ||
// TODO(user): An in-depth paragraph about your project and overview of use | ||
|
||
## Getting Started | ||
In order to use this operator you will need to have a Kubernetes cluster to run against. | ||
If you need a local cluster for testing you can use [KinD](https://kind.sigs.k8s.io/) | ||
|
||
### Running the operator | ||
To run this operator locally (outside of a Kubernetes cluster): | ||
|
||
1. Install the CustomResourceDefinitions (CRDs) into the cluster: | ||
~~~shell | ||
make install | ||
~~~ | ||
|
||
2. Run the controller (this will run in the foreground): | ||
~~~shell | ||
make run | ||
~~~ | ||
|
||
**NOTE:** You can also run this in one step by running: <code>make install run</code> | ||
|
||
To stop running the operator locally, you can terminate the process by pressing <code>ctrl+c</code> in the terminal window the process is running in | ||
|
||
To run this operator on the cluster: | ||
|
||
1. Install the CRDs: | ||
~~~shell | ||
kubectl apply -f config/samples/ | ||
~~~ | ||
|
||
2. Build and push your image to the location specified by <code>IMG</code>: | ||
~~~shell | ||
make docker-build docker-push IMG=<some-registry>/<project-name>:tag | ||
~~~ | ||
|
||
3. Deploy the controller to the cluster with the image specified by <code>IMG</code>: | ||
~~~shell | ||
make deploy IMG=<some-registry>/project-name>:tag | ||
~~~ | ||
|
||
### Uninstall CRDs | ||
To delete the CRDs from the cluster: | ||
~~~shell | ||
make uninstall | ||
~~~ | ||
|
||
### Undeploy Controller | ||
If you deployed the controller on the cluster, you can undeploy it with: | ||
~~~shell | ||
make undeploy | ||
~~~ | ||
|
||
**NOTE:** Run <code>make --help</code> for more information on all potential <code>make</code> targets | ||
|
||
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) | ||
|
||
## 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/) | ||
|
||
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/) | ||
which provides a reconcile function responsible for synchronizing resources untile the desired state is reached on the cluster | ||
|
||
## License | ||
/* | ||
Copyright 2022 The Kubernetes authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Project Name | ||
// TODO(user): Add simple overview of use/purpose | ||
|
||
## Description | ||
// TODO(user): An in-depth paragraph about your project and overview of use | ||
|
||
## Getting Started | ||
In order to use this operator you will need to have a Kubernetes cluster to run against. | ||
If you need a local cluster for testing you can use [KinD](https://kind.sigs.k8s.io/) | ||
|
||
### Running the operator | ||
To run this operator locally (outside of a Kubernetes cluster): | ||
|
||
1. Install the CustomResourceDefinitions (CRDs) into the cluster: | ||
~~~shell | ||
make install | ||
~~~ | ||
|
||
2. Run the controller (this will run in the foreground): | ||
~~~shell | ||
make run | ||
~~~ | ||
|
||
**NOTE:** You can also run this in one step by running: <code>make install run</code> | ||
|
||
To stop running the operator locally, you can terminate the process by pressing <code>ctrl+c</code> in the terminal window the process is running in | ||
|
||
To run this operator on the cluster: | ||
|
||
1. Install the CRDs: | ||
~~~shell | ||
kubectl apply -f config/samples/ | ||
~~~ | ||
|
||
2. Build and push your image to the location specified by <code>IMG</code>: | ||
~~~shell | ||
make docker-build docker-push IMG=<some-registry>/<project-name>:tag | ||
~~~ | ||
|
||
3. Deploy the controller to the cluster with the image specified by <code>IMG</code>: | ||
~~~shell | ||
make deploy IMG=<some-registry>/project-name>:tag | ||
~~~ | ||
|
||
### Uninstall CRDs | ||
To delete the CRDs from the cluster: | ||
~~~shell | ||
make uninstall | ||
~~~ | ||
|
||
### Undeploy Controller | ||
If you deployed the controller on the cluster, you can undeploy it with: | ||
~~~shell | ||
make undeploy | ||
~~~ | ||
|
||
**NOTE:** Run <code>make --help</code> for more information on all potential <code>make</code> targets | ||
|
||
More information can be found via the [Kubebuilder Documentation](https://book.kubebuilder.io/introduction.html) | ||
|
||
## 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/) | ||
|
||
It uses [Controllers](https://kubernetes.io/docs/concepts/architecture/controller/) | ||
which provides a reconcile function responsible for synchronizing resources untile the desired state is reached on the cluster | ||
|
||
## License | ||
/* | ||
Copyright 2022 The Kubernetes authors. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ |
Oops, something went wrong.