Skip to content

Commit

Permalink
Fix compatibility for 2.0.0 release (oceanbase#85)
Browse files Browse the repository at this point in the history
Fix compatibility for 2.0.0 release
  • Loading branch information
powerfooI authored Oct 24, 2023
1 parent 1ed4147 commit 28530ce
Show file tree
Hide file tree
Showing 50 changed files with 8,551 additions and 1,201 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: release helm chart

on:
push:
branches:
- 'master'
- '*release'
- 'helm-chart'

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include make/*

VERSION ?= 2.0.0
# Image URL to use all building/pushing image targets
IMG ?= oceanbasedev/ob-operator:${VERSION}
IMG ?= oceanbase/ob-operator:${VERSION}
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.26.1

Expand Down
119 changes: 46 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,94 +1,67 @@
# ob-operator-generate
// TODO(user): Add simple overview of use/purpose
# What is ob-operator
The ob-operator is a Kubernetes operator that simplifies the deployment and management of OceanBase cluster and related resources on Kubernetes.

## Description
// TODO(user): An in-depth paragraph about your project and overview of use
# Quick Start
## Requirement
In order to run ob-operator properly, [cert-manager](https://cert-manager.io/docs) needs to be deployed as its dependency, for more details about how to install it, please refer to the [installation](https://cert-manager.io/docs/installation/) document.

## Getting Started
You’ll 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).
## Deploy ob-operator
### Using helm
[Helm](https://github.com/helm/helm) is a package management tool for Kubernetes, please refer to the helm documentation to install the helm client.

### Running on the cluster
1. Install Instances of Custom Resources:

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

2. Build and push your image to the location specified by `IMG`:

```sh
make docker-build docker-push IMG=<some-registry>/ob-operator-generate:tag
helm repo add ob-operator https://oceanbase.github.io/ob-operator/
helm install ob-operator ob-operator/ob-operator --namespace=oceanbase-system --create-namespace --version=2.0.0
```

3. Deploy the controller to the cluster with the image specified by `IMG`:

```sh
make deploy IMG=<some-registry>/ob-operator-generate:tag
### Using configuration file
The configuration files are located under deploy directory, using the following commands to deploy ob-operator.
```

### Uninstall CRDs
To delete the CRDs from the cluster:

```sh
make uninstall
# Deploy ob-operator
kubectl apply -f deploy/operator.yaml
```

### Undeploy controller
UnDeploy the controller from the cluster:
## Deploy OceanBase cluster
### Customize configuration file
`deploy/obcluster.yaml` defines an OceanBase cluster, including deployment topology, resources, storages etc. You can configure your own OceanBase based on this file.

```sh
make undeploy
### Deploy OceanBase
Create namespace if needed, namespace should match the one in configuration file `deploy/obcluster.yaml`
```

## 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 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:

```sh
make install
kubectl create namespace oceanbase
```

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

```sh
make run
Create secret for users, secret name must be the same as these configed in deploy/obcluster.yaml under spec.userSecrets
```
# create secret to hold password for user root
kubectl create secret -n oceanbase generic test-user-root --from-literal=password='******'
**NOTE:** You can also run this in one step by running: `make install run`
# create secret to hold password for user proxyro, proxyro is a readonly user for obproxy to query meta info
kubectl create secret -n oceanbase generic test-user-proxyro --from-literal=password='******'
### Modifying the API definitions
If you are editing the API definitions, generate the manifests such as CRs or CRDs using:
# create secret to hold password for user monitor, monitor is a readonly user for obagent to query metric data
kubectl create secret -n oceanbase generic test-user-monitor --from-literal=password='******'
```sh
make manifests
# create secret to hold password for user operator, operator is the admin user for obproxy to maintain obcluster
kubectl create secret -n oceanbase generic test-user-operator --from-literal=password='******'
```
Using the following command to deploy OceanBase Cluster
```
kubectl apply -f deploy/obcluster.yaml
```
It may take a while to complete the whole process to deploy OceanBase cluster, you can use the following command to check whether it's finished
```
kubectl get obclusters test -n oceanbase -o yaml
```
wait until the status of obclster resource turns into running.

**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 2023.

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
### Connect to OceanBase Cluster
After successfully deployed OceanBase cluster, you can connect to OceanBase cluster via any observer pod's ip.

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.
# Contributing
Contributions are warmly welcomed and greatly appreciated. Here are a few ways you can contribute:
- Raise us an [Issue](https://github.com/oceanbase/ob-operator/issues).
- Create a [Pull Request](https://github.com/oceanbase/ob-operator/pulls).

# License
Ob-operator is licensed under the [MulanPSL - 2.0](http://license.coscl.org.cn/MulanPSL2) license. You can copy and use the source code freely. When you modify or distribute the source code, please follow the MulanPSL - 2.0 license.
5 changes: 2 additions & 3 deletions api/v1alpha1/monitor_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ See the Mulan PSL v2 for more details.
package v1alpha1

type MonitorTemplate struct {
Image string `json:"image"`
Resource *ResourceSpec `json:"resource,omitempty"`
Storage *ObagentStorageSpec `json:"storage"`
Image string `json:"image"`
Resource *ResourceSpec `json:"resource,omitempty"`
}
64 changes: 0 additions & 64 deletions api/v1alpha1/obclusterbackup_types.go

This file was deleted.

64 changes: 0 additions & 64 deletions api/v1alpha1/obclusterrestore_types.go

This file was deleted.

14 changes: 7 additions & 7 deletions api/v1alpha1/obtenantbackup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ type OBTenantBackupSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

Type apitypes.BackupJobType `json:"type"`
TenantName string `json:"tenantName"`
TenantSecret string `json:"tenantSecret"`
ObClusterName string `json:"obClusterName"`
Path string `json:"path,omitempty"`
Type apitypes.BackupJobType `json:"type"` // Type of backup job
TenantName string `json:"tenantName"` // Name of tenant in database
TenantSecret string `json:"tenantSecret"` // Secret that stores root password of tenant
ObClusterName string `json:"obClusterName"` // Name of obcluster resource
Path string `json:"path,omitempty"` // Path to store backup files

EncryptionSecret string `json:"encryptionSecret,omitempty"`
EncryptionSecret string `json:"encryptionSecret,omitempty"` // Secret that stores backup encryption key
}

// +kubebuilder:object:generate=false
Expand All @@ -44,7 +44,7 @@ type OBTenantBackupStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Status apitypes.BackupJobStatus `json:"status"`
Progress string `json:"progress,omitempty"`
Progress string `json:"progress,omitempty"` // Not support yet
OperationContext *OperationContext `json:"operationContext,omitempty"`
StartedAt string `json:"startedAt,omitempty"`
EndedAt string `json:"endedAt,omitempty"`
Expand Down
5 changes: 3 additions & 2 deletions api/v1alpha1/obtenantbackuppolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ type OBTenantBackupPolicySpec struct {
// Important: Run "make" to regenerate code after modifying this file

ObClusterName string `json:"obClusterName"`
TenantName string `json:"tenantName"` // Name of obtenant resource
TenantSecret string `json:"tenantSecret,omitempty"` // Deprecated
TenantName string `json:"tenantName,omitempty"` // Name of tenant in database
TenantSecret string `json:"tenantSecret,omitempty"` // Recommend to use 'credentials' of OBTenant instead
TenantCRName string `json:"tenantCRName,omitempty"` // Name of obtenant resource
JobKeepWindow string `json:"jobKeepWindow,omitempty"`
Suspend bool `json:"suspend,omitempty"`
LogArchive LogArchiveConfig `json:"logArchive"`
Expand Down
Loading

0 comments on commit 28530ce

Please sign in to comment.