Skip to content
This repository was archived by the owner on May 28, 2021. It is now read-only.

Commit 2944c3d

Browse files
prydieowainlewis
authored andcommitted
API Changes (#123)
* Clean up API (WIP) * Bump dependencies to track Kubernetes 1.10 * Update generated code * Mysql -> MySQL * Use conditions rather than a phase for Backups * Remove phase from BackupSchedule * Replace Restore phase with conditions * Typed backup StorageProviders * Refactor Backup executor API * Cluster Replicas -> Members
1 parent ddeb42a commit 2944c3d

File tree

1,456 files changed

+33584
-25949
lines changed

Some content is hidden

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

1,456 files changed

+33584
-25949
lines changed

Gopkg.lock

Lines changed: 28 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@
2222
# Code generation dependencies
2323
required = [
2424
"k8s.io/code-generator/cmd/client-gen",
25-
# needed by generated clientsets, but not an explicit dep in client-gen itself
26-
"k8s.io/apimachinery/pkg/apimachinery/registered",
27-
25+
"k8s.io/code-generator/cmd/conversion-gen",
2826
"k8s.io/code-generator/cmd/deepcopy-gen",
2927
"k8s.io/code-generator/cmd/defaulter-gen",
30-
"k8s.io/code-generator/cmd/lister-gen",
3128
"k8s.io/code-generator/cmd/informer-gen",
29+
"k8s.io/code-generator/cmd/lister-gen",
3230
]
3331

3432
[[constraint]]
@@ -49,23 +47,23 @@ required = [
4947

5048
[[constraint]]
5149
name = "k8s.io/api"
52-
branch = "release-1.9"
50+
version = "kubernetes-1.10.0"
5351

5452
[[constraint]]
5553
branch = "release-1.9"
5654
name = "k8s.io/apimachinery"
5755

5856
[[constraint]]
59-
branch = "release-1.9"
6057
name = "k8s.io/apiserver"
58+
version = "kubernetes-1.10.0"
6159

6260
[[constraint]]
6361
name = "k8s.io/client-go"
64-
version = "~6.0"
62+
version = "kubernetes-1.10.0"
6563

6664
[[constraint]]
67-
branch = "release-1.9"
6865
name = "k8s.io/code-generator"
66+
version = "kubernetes-1.10.0"
6967

7068
[[constraint]]
7169
branch = "master"
@@ -75,9 +73,12 @@ required = [
7573
branch = "master"
7674
name = "github.com/heptiolabs/healthcheck"
7775

76+
# gengo needs to be manually pinned to the version listed in code-generators
77+
# Gopkg.toml, because the k8s project does not produce Gopkg.toml files & dep
78+
# does not parse the Godeps.json file to determine revisions to use.
7879
[[override]]
79-
branch = "master"
8080
name = "k8s.io/gengo"
81+
revision = "b6c426f7730e6d66e6e476a85d1c3eb7633880e0"
8182

8283
[[constraint]]
8384
name = "github.com/robfig/cron"

cmd/mysql-agent/app/mysql_agent.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ func Run(opts *options.MySQLAgentOpts) error {
116116

117117
backupController := backupcontroller.NewAgentController(
118118
kubeclient,
119-
mysqlopClient.MysqlV1alpha1(),
120-
sharedInformerFactory.Mysql().V1alpha1().MySQLBackups(),
121-
sharedInformerFactory.Mysql().V1alpha1().MySQLClusters(),
119+
mysqlopClient.MySQLV1alpha1(),
120+
sharedInformerFactory.MySQL().V1alpha1().Backups(),
121+
sharedInformerFactory.MySQL().V1alpha1().Clusters(),
122122
kubeInformerFactory.Core().V1().Pods(),
123123
opts.Hostname,
124124
)
@@ -130,10 +130,10 @@ func Run(opts *options.MySQLAgentOpts) error {
130130

131131
restoreController := restorecontroller.NewAgentController(
132132
kubeclient,
133-
mysqlopClient.MysqlV1alpha1(),
134-
sharedInformerFactory.Mysql().V1alpha1().MySQLRestores(),
135-
sharedInformerFactory.Mysql().V1alpha1().MySQLClusters(),
136-
sharedInformerFactory.Mysql().V1alpha1().MySQLBackups(),
133+
mysqlopClient.MySQLV1alpha1(),
134+
sharedInformerFactory.MySQL().V1alpha1().Restores(),
135+
sharedInformerFactory.MySQL().V1alpha1().Clusters(),
136+
sharedInformerFactory.MySQL().V1alpha1().Backups(),
137137
kubeInformerFactory.Core().V1().Pods(),
138138
opts.Hostname,
139139
)

cmd/mysql-agent/app/options/options.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ type MySQLAgentOpts struct {
4343
Address string
4444

4545
// Namespace is the namespace in which the backup controller (and is
46-
// associated MySQLCluster) are running.
46+
// associated Cluster) are running.
4747
Namespace string
48-
// MySQLClusterName is the name of the MySQLCluster the backup controller
48+
// ClusterName is the name of the Cluster the backup controller
4949
// is responsible for.
50-
MySQLClusterName string
50+
ClusterName string
5151
// Hostname of the pod the backup operator is running in.
5252
Hostname string
5353

@@ -66,12 +66,12 @@ func NewMySQLAgentOpts() *MySQLAgentOpts {
6666
namespace := os.Getenv("POD_NAMESPACE")
6767
clusterName := os.Getenv("MYSQL_CLUSTER_NAME")
6868
return &MySQLAgentOpts{
69-
HealthcheckPort: DefaultMySQLAgentHeathcheckPort,
70-
Address: "0.0.0.0",
71-
Namespace: namespace,
72-
MySQLClusterName: clusterName,
73-
Hostname: hostname,
74-
MinResyncPeriod: metav1.Duration{Duration: 12 * time.Hour},
69+
HealthcheckPort: DefaultMySQLAgentHeathcheckPort,
70+
Address: "0.0.0.0",
71+
Namespace: namespace,
72+
ClusterName: clusterName,
73+
Hostname: hostname,
74+
MinResyncPeriod: metav1.Duration{Duration: 12 * time.Hour},
7575
}
7676
}
7777

@@ -81,7 +81,7 @@ func (s *MySQLAgentOpts) AddFlags(fs *pflag.FlagSet) *pflag.FlagSet {
8181
fs.StringVar(&s.Address, "address", s.Address, "The IP address to serve the mysql-agent's http service on (set to 0.0.0.0 for all interfaces).")
8282

8383
fs.StringVar(&s.Namespace, "namespace", s.Namespace, "The namespace to run in. Must be the same namespace as the associated MySQL cluster.")
84-
fs.StringVar(&s.MySQLClusterName, "mysql-cluster-name", s.MySQLClusterName, "The name of the MySQL cluster the mysql-agent is responsible for.")
84+
fs.StringVar(&s.ClusterName, "cluster-name", s.ClusterName, "The name of the MySQL cluster the mysql-agent is responsible for.")
8585
fs.StringVar(&s.Hostname, "hostname", s.Hostname, "The hostname of the pod the mysql-agent is running in.")
8686
fs.DurationVar(&s.MinResyncPeriod.Duration, "min-resync-period", s.MinResyncPeriod.Duration, "The resync period in reflectors will be random between MinResyncPeriod and 2*MinResyncPeriod.")
8787

@@ -93,10 +93,10 @@ func (s *MySQLAgentOpts) Validate() error {
9393
if len(s.Namespace) == 0 {
9494
return fmt.Errorf("must set --namespace or $POD_NAMESPACE")
9595
}
96-
if len(s.MySQLClusterName) == 0 {
97-
return fmt.Errorf("must set --mysql-cluster-name or $MYSQL_CLUSTER_NAME")
96+
if len(s.ClusterName) == 0 {
97+
return fmt.Errorf("must set --cluster-name or $MYSQL_CLUSTER_NAME")
9898
}
99-
if len(s.MySQLClusterName) == 0 {
99+
if len(s.ClusterName) == 0 {
100100
return fmt.Errorf("failed to detect hostname. Set --hostname")
101101
}
102102
return nil

cmd/mysql-operator/app/mysql_operator.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func Run(s *options.MySQLOperatorServer) error {
8383
*s,
8484
mysqlopClient,
8585
kubeClient,
86-
operatorInformerFactory.Mysql().V1alpha1().MySQLClusters(),
86+
operatorInformerFactory.MySQL().V1alpha1().Clusters(),
8787
kubeInformerFactory.Apps().V1beta1().StatefulSets(),
8888
kubeInformerFactory.Core().V1().Pods(),
8989
kubeInformerFactory.Core().V1().Services(),
@@ -98,9 +98,9 @@ func Run(s *options.MySQLOperatorServer) error {
9898

9999
backupController := backupcontroller.NewOperatorController(
100100
kubeClient,
101-
mysqlopClient.MysqlV1alpha1(),
102-
operatorInformerFactory.Mysql().V1alpha1().MySQLBackups(),
103-
operatorInformerFactory.Mysql().V1alpha1().MySQLClusters(),
101+
mysqlopClient.MySQLV1alpha1(),
102+
operatorInformerFactory.MySQL().V1alpha1().Backups(),
103+
operatorInformerFactory.MySQL().V1alpha1().Clusters(),
104104
kubeInformerFactory.Core().V1().Pods(),
105105
)
106106
wg.Add(1)
@@ -111,10 +111,10 @@ func Run(s *options.MySQLOperatorServer) error {
111111

112112
restoreController := restorecontroller.NewOperatorController(
113113
kubeClient,
114-
mysqlopClient.MysqlV1alpha1(),
115-
operatorInformerFactory.Mysql().V1alpha1().MySQLRestores(),
116-
operatorInformerFactory.Mysql().V1alpha1().MySQLClusters(),
117-
operatorInformerFactory.Mysql().V1alpha1().MySQLBackups(),
114+
mysqlopClient.MySQLV1alpha1(),
115+
operatorInformerFactory.MySQL().V1alpha1().Restores(),
116+
operatorInformerFactory.MySQL().V1alpha1().Clusters(),
117+
operatorInformerFactory.MySQL().V1alpha1().Backups(),
118118
kubeInformerFactory.Core().V1().Pods(),
119119
)
120120
wg.Add(1)
@@ -126,7 +126,7 @@ func Run(s *options.MySQLOperatorServer) error {
126126
backupScheduleController := backupschedule.NewController(
127127
mysqlopClient,
128128
kubeClient,
129-
operatorInformerFactory.Mysql().V1alpha1().MySQLBackupSchedules(),
129+
operatorInformerFactory.MySQL().V1alpha1().BackupSchedules(),
130130
30*time.Second,
131131
s.Namespace,
132132
)

0 commit comments

Comments
 (0)