Skip to content

Commit d30e84e

Browse files
authored
K8SPS-61: Rename CRD to PerconaServerMySQL (#45)
* K8SPS-61: Rename CRD to PerconaServerMySQL We're also changing the api version (from v2 to v1alpha1) of our CRD. It may break the new deployments if the old CRDs installed in the cluster. In case of any errors, delete the old ones: ``` kubectl delete crd perconaserverformysqls.ps.percona.com kubectl delete crd perconaserverformysqlbackups.ps.percona.com kubectl delete crd perconaserverformysqlrestores.ps.percona.com ``` * Remove suffixes from RBAC object names
1 parent a1c4b18 commit d30e84e

File tree

61 files changed

+535
-540
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+535
-540
lines changed

.dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ testbin/
55

66
!bin/bootstrap
77
!bin/healthcheck
8-
!bin/percona-server-for-mysql-operator
8+
!bin/percona-server-mysql-operator

Jenkinsfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,13 @@ pipeline {
256256
-v $WORKSPACE/src/github.com/percona/percona-server-mysql-operator:/go/src/github.com/percona/percona-server-mysql-operator \
257257
-w /go/src/github.com/percona/percona-server-mysql-operator \
258258
-e GO111MODULE=on \
259-
golang:1.17 sh -c 'go build -v -mod=vendor -o percona-server-for-mysql-operator github.com/percona/percona-server-mysql-operator/cmd/manager'
259+
golang:1.17 sh -c 'go build -v -mod=vendor -o percona-server-mysql-operator github.com/percona/percona-server-mysql-operator/cmd/manager'
260260
"
261261
'''
262262

263263
withCredentials([string(credentialsId: 'GITHUB_API_TOKEN', variable: 'GITHUB_TOKEN')]) {
264264
sh """
265-
golicense -plain ./percona-server-for-mysql-operator \
265+
golicense -plain ./percona-server-mysql-operator \
266266
| grep -v 'license not found' \
267267
| sed -r 's/^[^ ]+[ ]+//' \
268268
| sort \

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# To re-generate a bundle for another specific version without changing the standard setup, you can:
44
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
55
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
6-
NAME ?= percona-server-for-mysql-operator
6+
NAME ?= percona-server-mysql-operator
77
VERSION ?= $(shell git rev-parse --abbrev-ref HEAD | sed -e 's^/^-^g; s^[.]^-^g;' | tr '[:upper:]' '[:lower:]')
88
ROOT_REPO ?= ${PWD}
99

@@ -81,7 +81,7 @@ help: ## Display this help.
8181
##@ Development
8282

8383
generate: controller-gen
84-
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=$(NAME)-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases ## Generate WebhookConfiguration, Role and CustomResourceDefinition objects.
84+
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=$(NAME) webhook paths="./..." output:crd:artifacts:config=config/crd/bases ## Generate WebhookConfiguration, Role and CustomResourceDefinition objects.
8585
$(CONTROLLER_GEN) object:headerFile="LICENSE-HEADER" paths="./..." ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
8686

8787
fmt: ## Run go fmt against code.
@@ -98,7 +98,7 @@ kuttl-shfmt:
9898
find e2e-tests/tests/ -type f -not -name '*-assert.yaml' -name '*.yaml' | xargs ./e2e-tests/format
9999

100100
e2e-test: kuttl-shfmt
101-
kubectl kuttl test --config e2e-tests/kuttl.yaml
101+
ROOT_REPO=$(ROOT_REPO) kubectl kuttl test --config e2e-tests/kuttl.yaml
102102

103103
manifests: kustomize generate
104104
$(KUSTOMIZE) build config/crd/ > $(DEPLOYDIR)/crd.yaml

PROJECT

+12-17
Original file line numberDiff line numberDiff line change
@@ -8,35 +8,30 @@ projectName: percona-server-mysql-operator
88
repo: github.com/percona/percona-server-mysql-operator
99
resources:
1010
- api:
11-
crdVersion: v1
11+
crdVersion: v1alpha1
1212
namespaced: true
1313
controller: true
1414
domain: percona.com
1515
group: ps
16-
kind: PerconaServerForMySQL
17-
path: github.com/percona/percona-server-mysql-operator/api/v2
18-
version: v2
16+
kind: PerconaServerMySQL
17+
path: github.com/percona/percona-server-mysql-operator/api/v1alpha1
18+
version: v1alpha1
1919
- api:
20-
crdVersion: v1
20+
crdVersion: v1alpha1
2121
namespaced: true
2222
controller: true
2323
domain: percona.com
2424
group: ps
25-
kind: PerconaServerForMySQLBackup
26-
path: github.com/percona/percona-server-mysql-operator/api/v2
27-
version: v2
25+
kind: PerconaServerMySQLBackup
26+
path: github.com/percona/percona-server-mysql-operator/api/v1alpha1
27+
version: v1alpha1
2828
- api:
29-
crdVersion: v1
29+
crdVersion: v1alpha1
3030
namespaced: true
3131
controller: true
3232
domain: percona.com
3333
group: ps
34-
kind: PerconaServerForMySQLRestore
35-
path: github.com/percona/percona-server-mysql-operator/api/v2
36-
version: v2
37-
- controller: true
38-
group: core
39-
kind: Pod
40-
path: k8s.io/api/core/v1
41-
version: v1
34+
kind: PerconaServerMySQLRestore
35+
path: github.com/percona/percona-server-mysql-operator/api/v1alpha1
36+
version: v1alpha1
4237
version: "3"

api/v2/groupversion_info.go api/v1alpha1/groupversion_info.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package v2 contains API Schema definitions for the ps v2 API group
17+
// Package v1alpha1 contains API Schema definitions for the ps v1alpha1 API group
1818
//+kubebuilder:object:generate=true
1919
//+groupName=ps.percona.com
20-
package v2
20+
package v1alpha1
2121

2222
import (
2323
"k8s.io/apimachinery/pkg/runtime/schema"
@@ -26,7 +26,7 @@ import (
2626

2727
var (
2828
// GroupVersion is group version used to register these objects
29-
GroupVersion = schema.GroupVersion{Group: "ps.percona.com", Version: "v2"}
29+
GroupVersion = schema.GroupVersion{Group: "ps.percona.com", Version: "v1alpha1"}
3030

3131
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
3232
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

api/v2/perconaserverformysql_types.go api/v1alpha1/perconaservermysql_types.go

+22-22
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package v1alpha1
1818

1919
import (
2020
"fmt"
@@ -32,8 +32,8 @@ import (
3232
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
3333
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
3434

35-
// PerconaServerForMySQLSpec defines the desired state of PerconaServerForMySQL
36-
type PerconaServerForMySQLSpec struct {
35+
// PerconaServerMySQLSpec defines the desired state of PerconaServerMySQL
36+
type PerconaServerMySQLSpec struct {
3737
CRVersion string `json:"crVersion,omitempty"`
3838
Pause bool `json:"pause,omitempty"`
3939
SecretsName string `json:"secretsName,omitempty"`
@@ -174,36 +174,36 @@ type StatefulAppStatus struct {
174174
State StatefulAppState `json:"state,omitempty"`
175175
}
176176

177-
// PerconaServerForMySQLStatus defines the observed state of PerconaServerForMySQL
178-
type PerconaServerForMySQLStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
177+
// PerconaServerMySQLStatus defines the observed state of PerconaServerMySQL
178+
type PerconaServerMySQLStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
179179
// Important: Run "make" to regenerate code after modifying this file
180180
MySQL StatefulAppStatus `json:"mysql,omitempty"`
181181
Orchestrator StatefulAppStatus `json:"orchestrator,omitempty"`
182182
}
183183

184-
// PerconaServerForMySQL is the Schema for the perconaserverformysqls API
184+
// PerconaServerMySQL is the Schema for the perconaservermysqls API
185185
//+kubebuilder:object:root=true
186186
//+kubebuilder:subresource:status
187187
//+kubebuilder:printcolumn:name="MySQL",type=string,JSONPath=".status.mysql.state"
188188
//+kubebuilder:printcolumn:name="Orchestrator",type=string,JSONPath=".status.orchestrator.state"
189189
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
190190
//+kubebuilder:resource:scope=Namespaced
191191
//+kubebuilder:resource:shortName=ps
192-
type PerconaServerForMySQL struct {
192+
type PerconaServerMySQL struct {
193193
metav1.TypeMeta `json:",inline"`
194194
metav1.ObjectMeta `json:"metadata,omitempty"`
195195

196-
Spec PerconaServerForMySQLSpec `json:"spec,omitempty"`
197-
Status PerconaServerForMySQLStatus `json:"status,omitempty"`
196+
Spec PerconaServerMySQLSpec `json:"spec,omitempty"`
197+
Status PerconaServerMySQLStatus `json:"status,omitempty"`
198198
}
199199

200200
//+kubebuilder:object:root=true
201201

202-
// PerconaServerForMySQLList contains a list of PerconaServerForMySQL
203-
type PerconaServerForMySQLList struct {
202+
// PerconaServerMySQLList contains a list of PerconaServerMySQL
203+
type PerconaServerMySQLList struct {
204204
metav1.TypeMeta `json:",inline"`
205205
metav1.ListMeta `json:"metadata,omitempty"`
206-
Items []PerconaServerForMySQL `json:"items"`
206+
Items []PerconaServerMySQL `json:"items"`
207207
}
208208

209209
type SystemUser string
@@ -220,19 +220,19 @@ const (
220220
UserPMMServer SystemUser = "pmmserver"
221221
)
222222

223-
func (cr *PerconaServerForMySQL) MySQLSpec() *MySQLSpec {
223+
func (cr *PerconaServerMySQL) MySQLSpec() *MySQLSpec {
224224
return &cr.Spec.MySQL
225225
}
226226

227-
func (cr *PerconaServerForMySQL) PMMSpec() *PMMSpec {
227+
func (cr *PerconaServerMySQL) PMMSpec() *PMMSpec {
228228
return cr.Spec.PMM
229229
}
230230

231-
func (cr *PerconaServerForMySQL) OrchestratorSpec() *OrchestratorSpec {
231+
func (cr *PerconaServerMySQL) OrchestratorSpec() *OrchestratorSpec {
232232
return &cr.Spec.Orchestrator
233233
}
234234

235-
func (cr *PerconaServerForMySQL) CheckNSetDefaults(serverVersion *platform.ServerVersion) error {
235+
func (cr *PerconaServerMySQL) CheckNSetDefaults(serverVersion *platform.ServerVersion) error {
236236
if cr.Spec.MySQL.SizeSemiSync.IntVal >= cr.Spec.MySQL.Size {
237237
return errors.New("mysql.sizeSemiSync can't be greater than or equal to mysql.size")
238238
}
@@ -427,7 +427,7 @@ const (
427427
ExposedLabel = "percona.com/exposed"
428428
)
429429

430-
func (cr *PerconaServerForMySQL) Labels() map[string]string {
430+
func (cr *PerconaServerMySQL) Labels() map[string]string {
431431
return map[string]string{
432432
NameLabel: "percona-server",
433433
InstanceLabel: cr.Name,
@@ -436,7 +436,7 @@ func (cr *PerconaServerForMySQL) Labels() map[string]string {
436436
}
437437
}
438438

439-
func (cr *PerconaServerForMySQL) ClusterHint() string {
439+
func (cr *PerconaServerMySQL) ClusterHint() string {
440440
return fmt.Sprintf("%s.%s", cr.Name, cr.Namespace)
441441
}
442442

@@ -450,7 +450,7 @@ func GetClusterNameFromObject(obj client.Object) (string, error) {
450450
}
451451

452452
// ClusterHash returns FNV hash of the CustomResource UID
453-
func (cr *PerconaServerForMySQL) ClusterHash() string {
453+
func (cr *PerconaServerMySQL) ClusterHash() string {
454454
serverIDHash := fnv.New32()
455455
serverIDHash.Write([]byte(string(cr.UID)))
456456

@@ -467,14 +467,14 @@ func (cr *PerconaServerForMySQL) ClusterHash() string {
467467
return serverIDHashStr
468468
}
469469

470-
func (cr *PerconaServerForMySQL) InternalSecretName() string {
470+
func (cr *PerconaServerMySQL) InternalSecretName() string {
471471
return "internal-" + cr.Name
472472
}
473473

474-
func (cr *PerconaServerForMySQL) PMMEnabled() bool {
474+
func (cr *PerconaServerMySQL) PMMEnabled() bool {
475475
return cr.Spec.PMM != nil && cr.Spec.PMM.Enabled
476476
}
477477

478478
func init() {
479-
SchemeBuilder.Register(&PerconaServerForMySQL{}, &PerconaServerForMySQLList{})
479+
SchemeBuilder.Register(&PerconaServerMySQL{}, &PerconaServerMySQLList{})
480480
}

api/v2/perconaserverformysqlbackup_types.go api/v1alpha1/perconaservermysqlbackup_types.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package v1alpha1
1818

1919
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2020

2121
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2222
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2323

24-
// PerconaServerForMySQLBackupSpec defines the desired state of PerconaServerForMySQLBackup
25-
type PerconaServerForMySQLBackupSpec struct {
24+
// PerconaServerMySQLBackupSpec defines the desired state of PerconaServerMySQLBackup
25+
type PerconaServerMySQLBackupSpec struct {
2626
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
2727
// Important: Run "make" to regenerate code after modifying this file
2828

29-
// Foo is an example field of PerconaServerForMySQLBackup. Edit perconaserverformysqlbackup_types.go to remove/update
29+
// Foo is an example field of PerconaServerMySQLBackup. Edit perconaservermysqlbackup_types.go to remove/update
3030
Foo string `json:"foo,omitempty"`
3131
}
3232

33-
// PerconaServerForMySQLBackupStatus defines the observed state of PerconaServerForMySQLBackup
34-
type PerconaServerForMySQLBackupStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
33+
// PerconaServerMySQLBackupStatus defines the observed state of PerconaServerMySQLBackup
34+
type PerconaServerMySQLBackupStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
3535
// Important: Run "make" to regenerate code after modifying this file
3636
}
3737

@@ -40,24 +40,24 @@ type PerconaServerForMySQLBackupStatus struct { // INSERT ADDITIONAL STATUS FIEL
4040
//+kubebuilder:resource:scope=Namespaced
4141
//+kubebuilder:resource:shortName=ps-backup
4242

43-
// PerconaServerForMySQLBackup is the Schema for the perconaserverformysqlbackups API
44-
type PerconaServerForMySQLBackup struct {
43+
// PerconaServerMySQLBackup is the Schema for the perconaservermysqlbackups API
44+
type PerconaServerMySQLBackup struct {
4545
metav1.TypeMeta `json:",inline"`
4646
metav1.ObjectMeta `json:"metadata,omitempty"`
4747

48-
Spec PerconaServerForMySQLBackupSpec `json:"spec,omitempty"`
49-
Status PerconaServerForMySQLBackupStatus `json:"status,omitempty"`
48+
Spec PerconaServerMySQLBackupSpec `json:"spec,omitempty"`
49+
Status PerconaServerMySQLBackupStatus `json:"status,omitempty"`
5050
}
5151

5252
//+kubebuilder:object:root=true
5353

54-
// PerconaServerForMySQLBackupList contains a list of PerconaServerForMySQLBackup
55-
type PerconaServerForMySQLBackupList struct {
54+
// PerconaServerMySQLBackupList contains a list of PerconaServerMySQLBackup
55+
type PerconaServerMySQLBackupList struct {
5656
metav1.TypeMeta `json:",inline"`
5757
metav1.ListMeta `json:"metadata,omitempty"`
58-
Items []PerconaServerForMySQLBackup `json:"items"`
58+
Items []PerconaServerMySQLBackup `json:"items"`
5959
}
6060

6161
func init() {
62-
SchemeBuilder.Register(&PerconaServerForMySQLBackup{}, &PerconaServerForMySQLBackupList{})
62+
SchemeBuilder.Register(&PerconaServerMySQLBackup{}, &PerconaServerMySQLBackupList{})
6363
}

api/v2/perconaserverformysqlrestore_types.go api/v1alpha1/perconaservermysqlrestore_types.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
package v2
17+
package v1alpha1
1818

1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -23,17 +23,17 @@ import (
2323
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
2424
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2525

26-
// PerconaServerForMySQLRestoreSpec defines the desired state of PerconaServerForMySQLRestore
27-
type PerconaServerForMySQLRestoreSpec struct {
26+
// PerconaServerMySQLRestoreSpec defines the desired state of PerconaServerMySQLRestore
27+
type PerconaServerMySQLRestoreSpec struct {
2828
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
2929
// Important: Run "make" to regenerate code after modifying this file
3030

31-
// Foo is an example field of PerconaServerForMySQLRestore. Edit perconaserverformysqlrestore_types.go to remove/update
31+
// Foo is an example field of PerconaServerMySQLRestore. Edit perconaservermysqlrestore_types.go to remove/update
3232
Foo string `json:"foo,omitempty"`
3333
}
3434

35-
// PerconaServerForMySQLRestoreStatus defines the observed state of PerconaServerForMySQLRestore
36-
type PerconaServerForMySQLRestoreStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
35+
// PerconaServerMySQLRestoreStatus defines the observed state of PerconaServerMySQLRestore
36+
type PerconaServerMySQLRestoreStatus struct { // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
3737
// Important: Run "make" to regenerate code after modifying this file
3838
}
3939

@@ -42,24 +42,24 @@ type PerconaServerForMySQLRestoreStatus struct { // INSERT ADDITIONAL STATUS FIE
4242
//+kubebuilder:resource:scope=Namespaced
4343
//+kubebuilder:resource:shortName=ps-restore
4444

45-
// PerconaServerForMySQLRestore is the Schema for the perconaserverformysqlrestores API
46-
type PerconaServerForMySQLRestore struct {
45+
// PerconaServerMySQLRestore is the Schema for the perconaservermysqlrestores API
46+
type PerconaServerMySQLRestore struct {
4747
metav1.TypeMeta `json:",inline"`
4848
metav1.ObjectMeta `json:"metadata,omitempty"`
4949

50-
Spec PerconaServerForMySQLRestoreSpec `json:"spec,omitempty"`
51-
Status PerconaServerForMySQLRestoreStatus `json:"status,omitempty"`
50+
Spec PerconaServerMySQLRestoreSpec `json:"spec,omitempty"`
51+
Status PerconaServerMySQLRestoreStatus `json:"status,omitempty"`
5252
}
5353

5454
//+kubebuilder:object:root=true
5555

56-
// PerconaServerForMySQLRestoreList contains a list of PerconaServerForMySQLRestore
57-
type PerconaServerForMySQLRestoreList struct {
56+
// PerconaServerMySQLRestoreList contains a list of PerconaServerMySQLRestore
57+
type PerconaServerMySQLRestoreList struct {
5858
metav1.TypeMeta `json:",inline"`
5959
metav1.ListMeta `json:"metadata,omitempty"`
60-
Items []PerconaServerForMySQLRestore `json:"items"`
60+
Items []PerconaServerMySQLRestore `json:"items"`
6161
}
6262

6363
func init() {
64-
SchemeBuilder.Register(&PerconaServerForMySQLRestore{}, &PerconaServerForMySQLRestoreList{})
64+
SchemeBuilder.Register(&PerconaServerMySQLRestore{}, &PerconaServerMySQLRestoreList{})
6565
}

0 commit comments

Comments
 (0)