-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47a973e
commit 2827859
Showing
48 changed files
with
2,030 additions
and
3 deletions.
There are no files selected for viewing
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,3 @@ | ||
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
# Ignore build and test binaries. | ||
bin/ |
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,40 @@ | ||
run: | ||
timeout: 5m | ||
allow-parallel-runners: true | ||
|
||
issues: | ||
# don't skip warning about doc comments | ||
# don't exclude the default set of lint | ||
exclude-use-default: false | ||
# restore some of the defaults | ||
# (fill in the rest as needed) | ||
exclude-rules: | ||
- path: "api/*" | ||
linters: | ||
- lll | ||
- path: "internal/*" | ||
linters: | ||
- dupl | ||
- lll | ||
linters: | ||
disable-all: true | ||
enable: | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- goconst | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
- staticcheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused |
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
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,23 @@ | ||
# Code generated by tool. DO NOT EDIT. | ||
# This file is used to track the info used to scaffold your project | ||
# and allow the plugins properly work. | ||
# More info: https://book.kubebuilder.io/reference/project-config.html | ||
domain: openstack.org | ||
layout: | ||
- go.kubebuilder.io/v3 | ||
plugins: | ||
manifests.sdk.operatorframework.io/v2: {} | ||
scorecard.sdk.operatorframework.io/v2: {} | ||
projectName: watcher-operator | ||
repo: github.com/openstack-k8s-operators/watcher-operator | ||
resources: | ||
- api: | ||
crdVersion: v1 | ||
namespaced: true | ||
controller: true | ||
domain: openstack.org | ||
group: watcher | ||
kind: WatcherAPI | ||
path: github.com/openstack-k8s-operators/watcher-operator/api/v1beta1 | ||
version: v1beta1 | ||
version: "3" |
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,114 @@ | ||
# watcher-operator | ||
// TODO(user): Add simple overview of use/purpose | ||
|
||
## Description | ||
// TODO(user): An in-depth paragraph about your project and overview of use | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
- go version v1.21.0+ | ||
- docker version 17.03+. | ||
- kubectl version v1.11.3+. | ||
- Access to a Kubernetes v1.11.3+ cluster. | ||
|
||
### 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>/watcher-operator:tag | ||
``` | ||
|
||
**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’t work. | ||
|
||
**Install the CRDs into the cluster:** | ||
|
||
```sh | ||
make install | ||
``` | ||
|
||
**Deploy the Manager to the cluster with the image specified by `IMG`:** | ||
|
||
```sh | ||
make deploy IMG=<some-registry>/watcher-operator:tag | ||
``` | ||
|
||
> **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 | ||
kubectl apply -k config/samples/ | ||
``` | ||
|
||
>**NOTE**: Ensure that the samples has default values to test it out. | ||
### To Uninstall | ||
**Delete the instances (CRs) from the cluster:** | ||
|
||
```sh | ||
kubectl delete -k config/samples/ | ||
``` | ||
|
||
**Delete the APIs(CRDs) from the cluster:** | ||
|
||
```sh | ||
make uninstall | ||
``` | ||
|
||
**UnDeploy the controller from the cluster:** | ||
|
||
```sh | ||
make undeploy | ||
``` | ||
|
||
## Project Distribution | ||
|
||
Following are the steps to build the installer and distribute this project to users. | ||
|
||
1. Build the installer for the image built and published in the registry: | ||
|
||
```sh | ||
make build-installer IMG=<some-registry>/watcher-operator:tag | ||
``` | ||
|
||
NOTE: The makefile target mentioned above generates an 'install.yaml' | ||
file in the dist directory. This file contains all the resources built | ||
with Kustomize, which are necessary to install this project without | ||
its dependencies. | ||
|
||
2. Using the installer | ||
|
||
Users can just run kubectl apply -f <URL for YAML BUNDLE> to install the project, i.e.: | ||
|
||
```sh | ||
kubectl apply -f https://raw.githubusercontent.com/<org>/watcher-operator/<tag or branch>/dist/install.yaml | ||
``` | ||
|
||
## 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) | ||
|
||
## License | ||
|
||
Copyright 2024. | ||
|
||
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,50 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.11.1 | ||
creationTimestamp: null | ||
name: watcherapis.watcher.openstack.org | ||
spec: | ||
group: watcher.openstack.org | ||
names: | ||
kind: WatcherAPI | ||
listKind: WatcherAPIList | ||
plural: watcherapis | ||
singular: watcherapi | ||
scope: Namespaced | ||
versions: | ||
- name: v1beta1 | ||
schema: | ||
openAPIV3Schema: | ||
description: WatcherAPI is the Schema for the watcherapis API | ||
properties: | ||
apiVersion: | ||
description: 'APIVersion defines the versioned schema of this representation | ||
of an object. Servers should convert recognized schemas to the latest | ||
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' | ||
type: string | ||
kind: | ||
description: 'Kind is a string value representing the REST resource this | ||
object represents. Servers may infer this from the endpoint the client | ||
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: WatcherAPISpec defines the desired state of WatcherAPI | ||
properties: | ||
foo: | ||
description: Foo is an example field of WatcherAPI. Edit watcherapi_types.go | ||
to remove/update | ||
type: string | ||
type: object | ||
status: | ||
description: WatcherAPIStatus defines the observed state of WatcherAPI | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
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,36 @@ | ||
/* | ||
Copyright 2024. | ||
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 v1beta1 contains API Schema definitions for the watcher v1beta1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=watcher.openstack.org | ||
package v1beta1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/scheme" | ||
) | ||
|
||
var ( | ||
// GroupVersion is group version used to register these objects | ||
GroupVersion = schema.GroupVersion{Group: "watcher.openstack.org", Version: "v1beta1"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} | ||
|
||
// AddToScheme adds the types in this group-version to the given scheme. | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) |
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,64 @@ | ||
/* | ||
Copyright 2024. | ||
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 v1beta1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! | ||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. | ||
|
||
// WatcherAPISpec defines the desired state of WatcherAPI | ||
type WatcherAPISpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
// Foo is an example field of WatcherAPI. Edit watcherapi_types.go to remove/update | ||
Foo string `json:"foo,omitempty"` | ||
} | ||
|
||
// WatcherAPIStatus defines the observed state of WatcherAPI | ||
type WatcherAPIStatus struct { | ||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// WatcherAPI is the Schema for the watcherapis API | ||
type WatcherAPI struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec WatcherAPISpec `json:"spec,omitempty"` | ||
Status WatcherAPIStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// WatcherAPIList contains a list of WatcherAPI | ||
type WatcherAPIList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []WatcherAPI `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&WatcherAPI{}, &WatcherAPIList{}) | ||
} |
Oops, something went wrong.