Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility for 2.0.0 release #85

Merged
merged 44 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ecda640
add helm chart
chris-sun-star Sep 25, 2023
4e85f94
Fix uninitialized event recorder caused panic (#73)
powerfooI Sep 25, 2023
74f762d
add namespace
chris-sun-star Sep 25, 2023
cf8e9da
check connection with liveness probe port
chris-sun-star Sep 25, 2023
813195f
no need to test
chris-sun-star Sep 25, 2023
a75b0b9
add release workflow
chris-sun-star Sep 25, 2023
c3c922f
fix workflow yaml
chris-sun-star Sep 25, 2023
14b2c17
fix release
chris-sun-star Sep 25, 2023
3cbe67a
release helm chart
chris-sun-star Sep 25, 2023
8e15099
test release
chris-sun-star Sep 25, 2023
e562f03
Update release.yml
chris-sun-star Sep 25, 2023
4b66a03
test release
chris-sun-star Sep 25, 2023
7a65701
sync from master
chris-sun-star Sep 25, 2023
c650173
sync from master
chris-sun-star Sep 25, 2023
02a21f7
test
chris-sun-star Sep 25, 2023
bc23e9e
fix grammar
chris-sun-star Sep 25, 2023
50a7f95
fix filter
chris-sun-star Sep 25, 2023
afc8c02
build obagent docker image, set proper env name for obagent
chris-sun-star Sep 25, 2023
8b65f1a
support new obagent
chris-sun-star Sep 25, 2023
0165387
Merge pull request #75 from chris-sun-star/opt_obagent
powerfooI Sep 25, 2023
646cf7a
filter tags
chris-sun-star Sep 26, 2023
222f2a2
filter tags and branch
chris-sun-star Sep 26, 2023
ea3ea5a
fix tag filter
chris-sun-star Sep 26, 2023
b635aaf
fix tag filter
chris-sun-star Sep 26, 2023
8500323
change chart version
chris-sun-star Sep 26, 2023
d3dd8a4
change chart version
chris-sun-star Sep 26, 2023
e465ecf
update release workflow
chris-sun-star Sep 26, 2023
020c228
update chart version
chris-sun-star Sep 26, 2023
75e594e
Merge branch '2.0.0_release' into helm-chart
chris-sun-star Sep 26, 2023
5ef89f8
use oceanbase
chris-sun-star Sep 26, 2023
18a5d92
regenerate
chris-sun-star Sep 26, 2023
029282a
update observer image
chris-sun-star Sep 26, 2023
2ab1c60
omit unused image
chris-sun-star Sep 26, 2023
62118ad
Merge pull request #76 from chris-sun-star/helm-chart
powerfooI Sep 26, 2023
17a756b
update README (#78)
chris-sun-star Sep 26, 2023
33ef18a
clean task info (#79)
chris-sun-star Sep 27, 2023
f910abe
Update README.md
chris-sun-star Sep 28, 2023
24a3368
Update README.md
chris-sun-star Sep 28, 2023
69399e8
chore: compatibility patch for 2.0.0 -> 2.0.1; remove obclusterbackup…
powerfooI Oct 19, 2023
11bcc17
fix: test for 2.0.0 compatibility
powerfooI Oct 19, 2023
b968a79
merge: branch origin/2.0.0_release
powerfooI Oct 20, 2023
09ba7aa
fix: replay log only if restore until is not unlimited and replayEnab…
powerfooI Oct 23, 2023
ea6aeeb
fix: typo gmt_create_time to gmt_create
powerfooI Oct 24, 2023
04a8256
chore: fmt change tab to space
powerfooI Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
powerfooI marked this conversation as resolved.
Show resolved Hide resolved
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