https://github.com/gaocegege/k8s-example-operator
Feasibility research for using kind to support e2e tests for kubebuilder(v2)-generated Kubernetes operators.
https://github.com/gaocegege/k8s-example-operator
Last synced: about 1 month ago
JSON representation
Feasibility research for using kind to support e2e tests for kubebuilder(v2)-generated Kubernetes operators.
- Host: GitHub
- URL: https://github.com/gaocegege/k8s-example-operator
- Owner: gaocegege
- Created: 2019-06-28T08:54:05.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-07-01T03:07:14.000Z (almost 6 years ago)
- Last Synced: 2025-03-31T04:37:11.418Z (2 months ago)
- Language: Go
- Homepage:
- Size: 4.52 MB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kubernetes Example Operator
This repository contains a kubebuilder(v2)-generated Kubernetes operator.
It is a feasibility research for using kind to support e2e tests for kubebuilder(v2)-generated Kubernetes operators.
The CRD of the operator is simple:
```go
// ApplicationSpec defines the desired state of Application
type ApplicationSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
}// ApplicationStatus defines the observed state of Application
type ApplicationStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}// +kubebuilder:object:root=true
// Application is the Schema for the applications API
type Application struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`Spec ApplicationSpec `json:"spec,omitempty"`
Status ApplicationStatus `json:"status,omitempty"`
}
```The operator creates a nginx deployment for the application.
## Run E2E Tests with Kind
```bash
kind create cluster
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
make test
kind delete cluster
```