forked from redhat-developer/app-services-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request redhat-developer#5 from bf2fc6cc711aee1a0c2a/opera…
…torv1
- Loading branch information
Showing
18 changed files
with
499 additions
and
16 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,20 @@ | ||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.15.x | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Build | ||
run: make |
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 @@ | ||
## Running Operator: | ||
|
||
1. Regenerate operator and resources | ||
`make generate` | ||
`make manifests` | ||
|
||
2. Install operator | ||
|
||
`make install` | ||
|
||
3. Disable webhooks `make run ENABLE_WEBHOOKS=false` | ||
see [operator-sdk documentation](https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/) for further info | ||
|
||
## Commands Used to Create Operator | ||
|
||
Operator has muliple names embeeded that we need to clarify | ||
Any rename will possibly mean changes in multiple places. | ||
Renames on this project should be handled by recreating project completely. | ||
|
||
|
||
> NOTE: Make sure you have latest version of the Operator-SDK CLI (used 1.2) | ||
1. Init operator | ||
|
||
operator-sdk init --domain=redhat.com --plugins=go.kubebuilder.io/v2 --project-name=oas-operator --repo=github.com/bf2fc6cc711aee1a0c2a/operator | ||
|
||
2. Create API (without controller) | ||
``` | ||
operator-sdk create api --version=v1 --group=oas --kind=ManagedKafkaConnection --namespaced=false --resource=true --controller=false | ||
``` | ||
|
||
3. Add controller to your API if needed (later phase) | ||
|
||
``` | ||
operator-sdk create api --version=v1 --group=oas --kind=ManagedKafkaConnection --namespaced=false --resource=false --controller=true | ||
``` |
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
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,20 @@ | ||
// Package v1 contains API Schema definitions for the oas v1 API group | ||
// +kubebuilder:object:generate=true | ||
// +groupName=oas.redhat.com | ||
package v1 | ||
|
||
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: "oas.redhat.com", Version: "v1"} | ||
|
||
// 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,69 @@ | ||
package v1 | ||
|
||
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. | ||
|
||
// ManagedKafkaConnectionSpec defines the desired state of ManagedKafkaConnection | ||
type ManagedKafkaConnectionSpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
BootstrapServer BootstrapServerSpec `json:"bootstrapServer"` | ||
Credentials CredentialsSpec `json:"credentials"` | ||
} | ||
|
||
// BootstrapServerSpec contains server host information | ||
type BootstrapServerSpec struct { | ||
Host string `json:"host,omitempty"` | ||
} | ||
|
||
// CredentialType enumeration for types of credentails | ||
type CredentialType string | ||
|
||
const ( | ||
// ClientCredentials ... type | ||
ClientCredentials CredentialType = "ClientCredentials" | ||
) | ||
|
||
// CredentialsSpec specification | ||
type CredentialsSpec struct { | ||
Kind CredentialType `json:"kind,omitempty"` | ||
CientID string `json:"clientID,omitempty"` | ||
ClientSecret string `json:"clientSecret,omitempty"` | ||
} | ||
|
||
// ManagedKafkaConnectionStatus defines the observed state of ManagedKafkaConnection | ||
type ManagedKafkaConnectionStatus 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 | ||
// +kubebuilder:resource:scope=Cluster | ||
|
||
// ManagedKafkaConnection is the Schema for the managedkafkaconnections API | ||
type ManagedKafkaConnection struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ManagedKafkaConnectionSpec `json:"spec,omitempty"` | ||
Status ManagedKafkaConnectionStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
|
||
// ManagedKafkaConnectionList contains a list of ManagedKafkaConnection | ||
type ManagedKafkaConnectionList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []ManagedKafkaConnection `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&ManagedKafkaConnection{}, &ManagedKafkaConnectionList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.