remove teams api client from controller and make it per cluster
This commit is contained in:
		
							parent
							
								
									9c19a22a7f
								
							
						
					
					
						commit
						941bfb3cc5
					
				|  | @ -104,6 +104,7 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec spec.Postgresql | ||||||
| 		deleteOptions:    &meta_v1.DeleteOptions{OrphanDependents: &orphanDependents}, | 		deleteOptions:    &meta_v1.DeleteOptions{OrphanDependents: &orphanDependents}, | ||||||
| 		podEventsQueue:   podEventsQueue, | 		podEventsQueue:   podEventsQueue, | ||||||
| 		KubeClient:       kubeClient, | 		KubeClient:       kubeClient, | ||||||
|  | 		teamsAPIClient:   teams.NewTeamsAPI(cfg.OpConfig.TeamsAPIUrl, logger.Logger), | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return cluster | 	return cluster | ||||||
|  |  | ||||||
|  | @ -15,7 +15,6 @@ import ( | ||||||
| 	"github.com/zalando-incubator/postgres-operator/pkg/util/config" | 	"github.com/zalando-incubator/postgres-operator/pkg/util/config" | ||||||
| 	"github.com/zalando-incubator/postgres-operator/pkg/util/constants" | 	"github.com/zalando-incubator/postgres-operator/pkg/util/constants" | ||||||
| 	"github.com/zalando-incubator/postgres-operator/pkg/util/k8sutil" | 	"github.com/zalando-incubator/postgres-operator/pkg/util/k8sutil" | ||||||
| 	"github.com/zalando-incubator/postgres-operator/pkg/util/teams" |  | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| type Config struct { | type Config struct { | ||||||
|  | @ -32,10 +31,9 @@ type Controller struct { | ||||||
| 	config   Config | 	config   Config | ||||||
| 	opConfig *config.Config | 	opConfig *config.Config | ||||||
| 
 | 
 | ||||||
| 	logger         *logrus.Entry | 	logger     *logrus.Entry | ||||||
| 	KubeClient     k8sutil.KubernetesClient | 	KubeClient k8sutil.KubernetesClient | ||||||
| 	RestClient     rest.Interface | 	RestClient rest.Interface | ||||||
| 	TeamsAPIClient *teams.API |  | ||||||
| 
 | 
 | ||||||
| 	clustersMu sync.RWMutex | 	clustersMu sync.RWMutex | ||||||
| 	clusters   map[spec.NamespacedName]*cluster.Cluster | 	clusters   map[spec.NamespacedName]*cluster.Cluster | ||||||
|  | @ -113,8 +111,6 @@ func (c *Controller) initController() { | ||||||
| 		c.logger.Level = logrus.DebugLevel | 		c.logger.Level = logrus.DebugLevel | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	c.TeamsAPIClient = teams.NewTeamsAPI(c.opConfig.TeamsAPIUrl, c.logger.Logger) |  | ||||||
| 
 |  | ||||||
| 	if err := c.createTPR(); err != nil { | 	if err := c.createTPR(); err != nil { | ||||||
| 		c.logger.Fatalf("could not register ThirdPartyResource: %v", err) | 		c.logger.Fatalf("could not register ThirdPartyResource: %v", err) | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue