-
Notifications
You must be signed in to change notification settings - Fork 39
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
Tests for tenant restore progress; definition of API types; Fix lints #68
Changes from 2 commits
012dde3
6c330c8
9608fa8
d95afe0
5bed661
1da79f5
9a535d6
10644dc
9a4793d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
Copyright (c) 2023 OceanBase | ||
ob-operator is licensed under Mulan PSL v2. | ||
You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
You may obtain a copy of Mulan PSL v2 at: | ||
http://license.coscl.org.cn/MulanPSL2 | ||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
See the Mulan PSL v2 for more details. | ||
*/ | ||
|
||
package constants | ||
|
||
type TenantRole string | ||
|
||
const ( | ||
TenantRolePrimary TenantRole = "PRIMARY" | ||
TenantRoleStandby TenantRole = "STANDBY" | ||
) | ||
|
||
type TenantOperationType string | ||
|
||
const ( | ||
TenantOpSwitchover TenantOperationType = "SWITCHOVER" | ||
TenantOpFailover TenantOperationType = "FAILOVER" | ||
TenantOpChangePwd TenantOperationType = "CHANGE_PASSWORD" | ||
) | ||
|
||
type TenantOperationStatus string | ||
|
||
const ( | ||
TenantOpStarting TenantOperationStatus = "STARTING" | ||
TenantOpRunning TenantOperationStatus = "RUNNING" | ||
TenantOpSuccessful TenantOperationStatus = "SUCCESSFUL" | ||
TenantOpFailed TenantOperationStatus = "FAILED" | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
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 | ||
|
||
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. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
"github.com/oceanbase/ob-operator/api/constants" | ||
corev1 "k8s.io/api/core/v1" | ||
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. | ||
|
||
// OBTenantOperationSpec defines the desired state of OBTenantOperation | ||
type OBTenantOperationSpec struct { | ||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
|
||
Type constants.TenantOperationType `json:"type"` | ||
Switchover *OBTenantOpSwitchoverSpec `json:"switchover,omitempty"` | ||
Failover *OBTenantOpFailoverSpec `json:"failover,omitempty"` | ||
ChangePwd *OBTenantOpChangePwdSpec `json:"changePwd,omitempty"` | ||
} | ||
|
||
type OBTenantOpSwitchoverSpec struct { | ||
PrimaryTenant string `json:"primaryTenant"` | ||
StandbyTenant string `json:"standbyTenant"` | ||
} | ||
|
||
type OBTenantOpFailoverSpec struct { | ||
StandbyTenant string `json:"standbyTenant"` | ||
} | ||
|
||
type OBTenantOpChangePwdSpec struct { | ||
Tenant string `json:"tenant"` | ||
SecretRef corev1.SecretReference `json:"secretRef"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what will be stored in secret, username and password? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Username and password will be here, it's possible to contain other information. Designs for tenant credentials are in pending, now they are just placeholders here hahah. |
||
} | ||
|
||
// OBTenantOperationStatus defines the observed state of OBTenantOperation | ||
type OBTenantOperationStatus struct { | ||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster | ||
// Important: Run "make" to regenerate code after modifying this file | ||
Status constants.TenantOperationStatus `json:"status"` | ||
OperationContext *OperationContext `json:"operationContext,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
//+kubebuilder:subresource:status | ||
|
||
// OBTenantOperation is the Schema for the obtenantoperations API | ||
type OBTenantOperation struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec OBTenantOperationSpec `json:"spec,omitempty"` | ||
Status OBTenantOperationStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// OBTenantOperationList contains a list of OBTenantOperation | ||
type OBTenantOperationList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []OBTenantOperation `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&OBTenantOperation{}, &OBTenantOperationList{}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to specify certain users when create tenant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's ok to store users' information in credentials.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's ok, but certain users must be specified, like root and standbyro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users' credentials in tenant will be implemented on next step. Some designs are not clear now, maybe user management will be put in OBTenantOperation CR.
I decide to focus on tenant restore first :)