Skip to content

Commit

Permalink
apply suggestion
Browse files Browse the repository at this point in the history
apply suggestion
  • Loading branch information
jiuker authored and pjuarezd committed Jul 17, 2024
1 parent 6187af2 commit 7a73b3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/pools.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (c *Controller) waitUntilPoolPodAnnotated(ctx context.Context, tenant *mini
if generationMatch {
break
}
err = fmt.Errorf("Not all pods are generation %d", tenant.Generation)
err = fmt.Errorf("Not all pods have the same generation number -> %d", tenant.Generation)

}
return err
Expand Down
10 changes: 4 additions & 6 deletions sidecar/pkg/sidecar/sidecar_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func init() {

// StartSideCar instantiates kube clients and starts the side-car controller
func StartSideCar(tenantName string, secretName string) {
log.Println("Starting Minio123 Sidecar")
log.Println("Starting Sidecar")
cfg, err := rest.InClusterConfig()
if err != nil {
panic(err)
Expand Down Expand Up @@ -143,12 +143,10 @@ func NewSideCarController(kubeClient *kubernetes.Clientset, controllerClient *cl

tenantInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: func(new interface{}) {
fmt.Println("new")
tenant := new.(*v2.Tenant)
c.regenCfg(tenantName, namespace, tenant.Generation)
},
UpdateFunc: func(old, new interface{}) {
fmt.Println("update")
oldTenant := old.(*v2.Tenant)
newTenant := new.(*v2.Tenant)
if newTenant.ResourceVersion == oldTenant.ResourceVersion {
Expand Down Expand Up @@ -244,12 +242,12 @@ func (c *Controller) regenCfgWithCfg(tenantName string, namespace string, fileCo
if podName != "" && podNamespace != "" {
_, err := c.kubeClient.CoreV1().Pods(podNamespace).Patch(ctx, podName, types.MergePatchType, []byte(fmt.Sprintf(`{"metadata":{"annotations":{"%s":"%d"}}}`, common.AnnotationsEnvTenantGeneration, tenantGeneration)), metav1.PatchOptions{})
if err != nil {
fmt.Printf("failed to patch pod annotations: %s", err)
log.Printf("failed to patch pod annotations: %s", err)
} else {
fmt.Printf("patched pod annotations[%s:%d] succcess", common.AnnotationsEnvTenantGeneration, tenantGeneration)
log.Printf("patched pod annotations[%s:%d] succcess", common.AnnotationsEnvTenantGeneration, tenantGeneration)
}
} else {
fmt.Printf("Will not patch for podName[%s] or podNamespace[%s]", podName, podNamespace)
log.Printf("Will not patch for podName[%s] or podNamespace[%s]", podName, podNamespace)
}
}

Expand Down

0 comments on commit 7a73b3d

Please sign in to comment.