Skip to content

Commit

Permalink
core: rename everyting from rbdpvc to mantle
Browse files Browse the repository at this point in the history
We changed the name of this tool. Let's change the corresponging
resources, apis, variables, and so on.

Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
  • Loading branch information
satoru-takeuchi committed Apr 15, 2024
1 parent 91a0112 commit c971e8f
Show file tree
Hide file tree
Showing 35 changed files with 272 additions and 269 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ $(LOCALBIN):
mkdir -p $(LOCALBIN)

## Tool Binaries
KUBECTL ?= kubectl
KUBECTL ?= $(LOCAKBIN)/kubectl-$(KUBERNETES_VERSION)
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
Expand Down
10 changes: 5 additions & 5 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
# 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: cybozu.com
domain: cybozu.io
layout:
- go.kubebuilder.io/v4
projectName: rbd-backup-system
repo: github.com/cybozu-go/rbd-backup-system
projectName: mantle
repo: github.com/cybozu-go/mantle
resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: cybozu.com
group: backup
kind: RBDPVCBackup
path: github.com/cybozu-go/rbd-backup-system/api/v1
kind: MantleBackup
path: github.com/cybozu-go/mantle/api/v1
version: v1
version: "3"
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
# rbd-backup-system
# mantle

The system for backup RBD PVC managed by Rook/Ceph. It can also copy the backup data to another Rook/Ceph cluster in another data center.

## Description

Users can manage backups by `RBDPVCBackup` resources.
Users can manage backups by `MantleBackup` resources.

## Getting Started

If you want to try rbd-backup-system on your local machine, see [e2e](e2e/) directory which provides scripts to run rbd-backup-system on [minikube][kind].
If you want to try mantle on your local machine, see [e2e](e2e/) directory which provides scripts to run rbd-backup-system on [minikube][kind].

To use rbd-backup-system on your real kubernetes cluster, read following sections.
To use mantle on your real kubernetes cluster, read following sections.

### Prerequisites
- go version v1.21.0+
- docker version 20.10+
- kubectl version v1.27.10+
- Access to a Kubernetes v1.27.10+ cluster
- Rook v1.13.1+
- Deploy
- Kubernetes cluster: v1.27.10+
- Rook: v1.13.1+
- build
- go: v1.21.0+
- docker: 20.10+
- kubectl: v1.27.10+
- kubebuilder: 3.14.0+

### 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>/rbd-backup-system:tag
make docker-build docker-push IMG=<some-registry>/mantle:tag
```

**NOTE:** This image ought to be published in the personal registry you specified.
Expand All @@ -39,7 +42,7 @@ make install
**Deploy the Manager to the cluster with the image specified by `IMG`:**

```sh
make deploy IMG=<some-registry>/rbd-backup-system:tag
make deploy IMG=<some-registry>/mantle:tag
```

> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin
Expand Down
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1 +1 @@
The `CephBlockPool` and `StorageClass` in config/samples/backup_v1_rbdpvcbackup.yaml are copies of https://github.com/rook/rook/blob/2ae319eebce7d525be90b5aed6baba1afe1e2e6e/deploy/examples/csi/rbd/storageclass-test.yaml.
The `CephBlockPool` and `StorageClass` in config/samples/backup_v1_mantlebackup.yaml are copies of https://github.com/rook/rook/blob/2ae319eebce7d525be90b5aed6baba1afe1e2e6e/deploy/examples/csi/rbd/storageclass-test.yaml.
4 changes: 2 additions & 2 deletions api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package v1 contains API Schema definitions for the backup v1 API group
// +kubebuilder:object:generate=true
// +groupName=backup.cybozu.com
// +groupName=mantle.cybozu.io
package v1

import (
Expand All @@ -10,7 +10,7 @@ import (

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "backup.cybozu.com", Version: "v1"}
GroupVersion = schema.GroupVersion{Group: "mantle.cybozu.io", Version: "v1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
Expand Down
24 changes: 12 additions & 12 deletions api/v1/rbdpvcbackup_types.go → api/v1/mantlebackup_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
// 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.

// RBDPVCBackupSpec defines the desired state of RBDPVCBackup
type RBDPVCBackupSpec struct {
// MantleBackupSpec defines the desired state of MantleBackup
type MantleBackupSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

Expand All @@ -21,8 +21,8 @@ type RBDPVCBackupSpec struct {
Namespace string `json:"namespace,omitempty"`
}

// RBDPVCBackupStatus defines the observed state of RBDPVCBackup
type RBDPVCBackupStatus struct {
// MantleBackupStatus defines the observed state of MantleBackup
type MantleBackupStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file

Expand All @@ -44,24 +44,24 @@ const (
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// RBDPVCBackup is the Schema for the rbdpvcbackups API
type RBDPVCBackup struct {
// MantleBackup is the Schema for the mantlebackups API
type MantleBackup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec RBDPVCBackupSpec `json:"spec,omitempty"`
Status RBDPVCBackupStatus `json:"status,omitempty"`
Spec MantleBackupSpec `json:"spec,omitempty"`
Status MantleBackupStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// RBDPVCBackupList contains a list of RBDPVCBackup
type RBDPVCBackupList struct {
// MantleBackupList contains a list of MantleBackup
type MantleBackupList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RBDPVCBackup `json:"items"`
Items []MantleBackup `json:"items"`
}

func init() {
SchemeBuilder.Register(&RBDPVCBackup{}, &RBDPVCBackupList{})
SchemeBuilder.Register(&MantleBackup{}, &MantleBackupList{})
}
38 changes: 19 additions & 19 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log/zap"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

backupv1 "github.com/cybozu-go/rbd-backup-system/api/v1"
"github.com/cybozu-go/rbd-backup-system/internal/controller"
backupv1 "github.com/cybozu-go/mantle/api/v1"
"github.com/cybozu-go/mantle/internal/controller"
//+kubebuilder:scaffold:imports
)

Expand Down Expand Up @@ -73,11 +73,11 @@ func main() {
os.Exit(1)
}

if err = (&controller.RBDPVCBackupReconciler{
if err = (&controller.MantleBackupReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "RBDPVCBackup")
setupLog.Error(err, "unable to create controller", "controller", "MantleBackup")
os.Exit(1)
}
//+kubebuilder:scaffold:builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.13.0
name: rbdpvcbackups.backup.cybozu.com
name: mantlebackups.mantle.cybozu.io
spec:
group: backup.cybozu.com
group: mantle.cybozu.io
names:
kind: RBDPVCBackup
listKind: RBDPVCBackupList
plural: rbdpvcbackups
singular: rbdpvcbackup
kind: MantleBackup
listKind: MantleBackupList
plural: mantlebackups
singular: mantlebackup
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: RBDPVCBackup is the Schema for the rbdpvcbackups API
description: MantleBackup is the Schema for the mantlebackups API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand All @@ -32,7 +32,7 @@ spec:
metadata:
type: object
spec:
description: RBDPVCBackupSpec defines the desired state of RBDPVCBackup
description: MantleBackupSpec defines the desired state of MantleBackup
properties:
namespace:
description: '''namespace'' specifies backup target Namespace'
Expand All @@ -42,7 +42,7 @@ spec:
type: string
type: object
status:
description: RBDPVCBackupStatus defines the observed state of RBDPVCBackup
description: MantleBackupStatus defines the observed state of MantleBackup
properties:
conditions:
description: '''conditions'' specifies current backup conditions'
Expand Down
6 changes: 3 additions & 3 deletions config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/backup.cybozu.com_rbdpvcbackups.yaml
- bases/mantle.cybozu.io_mantlebackups.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patches:
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- path: patches/webhook_in_rbdpvcbackups.yaml
#- path: patches/webhook_in_mantlebackups.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- path: patches/cainjection_in_rbdpvcbackups.yaml
#- path: patches/cainjection_in_mantlebackups.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# [WEBHOOK] To enable webhook, uncomment the following section
Expand Down
2 changes: 1 addition & 1 deletion config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace: rook-ceph
# "wordpress" becomes "alices-wordpress".
# Note that it should also match with the prefix (text before '-') of the namespace
# field above.
namePrefix: rbd-backup-system-
namePrefix: mantle-

# Labels to add to all resources and selectors.
#labels:
Expand Down
4 changes: 2 additions & 2 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ metadata:
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: rbd-backup-system
app.kubernetes.io/part-of: rbd-backup-system
app.kubernetes.io/created-by: mantle
app.kubernetes.io/part-of: mantle
app.kubernetes.io/managed-by: kustomize
spec:
selector:
Expand Down
4 changes: 2 additions & 2 deletions config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ metadata:
app.kubernetes.io/name: servicemonitor
app.kubernetes.io/instance: controller-manager-metrics-monitor
app.kubernetes.io/component: metrics
app.kubernetes.io/created-by: rbd-backup-system
app.kubernetes.io/part-of: rbd-backup-system
app.kubernetes.io/created-by: mantle
app.kubernetes.io/part-of: mantle
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-monitor
namespace: system
Expand Down
Loading

0 comments on commit c971e8f

Please sign in to comment.