File tree Expand file tree Collapse file tree 3 files changed +14
-11
lines changed
Expand file tree Collapse file tree 3 files changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -111,11 +111,12 @@ publish: images
111111# ##############
112112CHART_TEMPLATE_PATH := deploy/
113113CRDS := mysqlclusters.mysql.presslabs.org mysqlbackups.mysql.presslabs.org
114+ GROUP_NAME := mysql.presslabs.org
114115
115116CRD_GEN_FILES := $(addprefix $(CHART_TEMPLATE_PATH ) ,$(addsuffix .yaml,$(CRDS ) ) )
116117
117118$(CRD_GEN_FILES ) :
118- bin/gen-crds-yaml_$(GOOS ) _$(GOARCH ) --crd $(basename $(notdir $@ ) ) >> $(@:.mysql.presslabs.org .yaml=.yaml )
119+ bin/gen-crds-yaml_$(GOOS ) _$(GOARCH ) --crd $(basename $(notdir $@ ) ) > $(@:.$( GROUP_NAME ) .yaml=.yaml )
119120
120121.PHONY : gen-crds gen-crds-verify gen-crds-clean
121122gen-crds : gen-crds-clean $(CRD_GEN_FILES )
@@ -124,10 +125,10 @@ gen-crds-verify: SHELL := /bin/bash
124125gen-crds-verify : $(addsuffix -verify,$(CRD_GEN_FILES ) )
125126 @echo " Verifying generated CRDs"
126127
127- $(addsuffix -verify,$(CRD_GEN_FILES ) ) :
128+ $(addsuffix -verify,$(CRD_GEN_FILES ) ) : bin/gen-crds-yaml_ $( GOOS ) _ $( GOARCH )
128129 $(eval FILE := $(subst -verify,,$@ ) )
129130 $(eval CRD := $(basename $(notdir $@ ) ) )
130- diff -Naupr $(FILE ) <( bin/gen-crds-yaml_$( GOOS) _$( GOARCH) --crd $( CRD) )
131+ diff -Naupr $(FILE:. $( GROUP_NAME ) .yaml=.yaml ) <( bin/gen-crds-yaml_$( GOOS) _$( GOARCH) --crd $( CRD) )
131132
132133gen-crds-clean :
133134 rm -f $(CRD_GEN_FILES )
Original file line number Diff line number Diff line change @@ -119,10 +119,6 @@ func New(ctx *controllerpkg.Context) *Controller {
119119func (c * Controller ) Start (workers int , stopCh <- chan struct {}) error {
120120 glog .Info ("Starting controller ..." )
121121
122- if ! cache .WaitForCacheSync (stopCh , c .syncedFuncs ... ) {
123- return fmt .Errorf ("error waiting for informer cache to sync" )
124- }
125-
126122 if c .InstallCRDs {
127123 if err := kube .InstallCRD (c .CRDClient , api .ResourceMysqlBackupCRD ); err != nil {
128124 glog .Fatalf (err .Error ())
@@ -138,6 +134,10 @@ func (c *Controller) Start(workers int, stopCh <-chan struct{}) error {
138134 c .SharedInformerFactory .Start (stopCh )
139135 c .KubeSharedInformerFactory .Start (stopCh )
140136
137+ if ! cache .WaitForCacheSync (stopCh , c .syncedFuncs ... ) {
138+ return fmt .Errorf ("error waiting for informer cache to sync" )
139+ }
140+
141141 for i := 0 ; i < workers ; i ++ {
142142 c .workerWg .Add (1 )
143143 go wait .Until (func () { c .work (stopCh ) }, workerPeriodTime , stopCh )
Original file line number Diff line number Diff line change @@ -127,17 +127,15 @@ func New(ctx *controllerpkg.Context) *Controller {
127127func (c * Controller ) Start (workers int , stopCh <- chan struct {}) error {
128128 glog .Info ("Starting controller ..." )
129129
130- if ! cache .WaitForCacheSync (stopCh , c .syncedFuncs ... ) {
131- return fmt .Errorf ("error waiting for informer cache to sync" )
132- }
133-
134130 if c .InstallCRDs {
131+ glog .V (3 ).Info ("Installing mysql crd..." )
135132 if err := kube .InstallCRD (c .CRDClient , api .ResourceMysqlClusterCRD ); err != nil {
136133 glog .Fatalf (err .Error ())
137134 return fmt .Errorf ("fail to create crd: %s" , err )
138135 }
139136 }
140137
138+ glog .V (3 ).Info ("Wait for mysql crd..." )
141139 if err := kube .WaitForCRD (c .CRDClient , api .ResourceMysqlClusterCRD ); err != nil {
142140 return fmt .Errorf ("crd does not exists: %s" , err )
143141 }
@@ -146,6 +144,10 @@ func (c *Controller) Start(workers int, stopCh <-chan struct{}) error {
146144 c .SharedInformerFactory .Start (stopCh )
147145 c .KubeSharedInformerFactory .Start (stopCh )
148146
147+ if ! cache .WaitForCacheSync (stopCh , c .syncedFuncs ... ) {
148+ return fmt .Errorf ("error waiting for informer cache to sync" )
149+ }
150+
149151 for i := 0 ; i < workers ; i ++ {
150152 c .workerWg .Add (1 )
151153 go wait .Until (func () { c .workerController (stopCh ) }, workerPeriodTime , stopCh )
You can’t perform that action at this time.
0 commit comments