fix name
This commit is contained in:
		
							parent
							
								
									e30b6a5670
								
							
						
					
					
						commit
						2a4de7f153
					
				| 
						 | 
				
			
			@ -165,6 +165,7 @@ class EndToEndTestCase(unittest.TestCase):
 | 
			
		|||
            }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        self.eventuallyEqual(lambda: self.k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
 | 
			
		||||
        self.eventuallyEqual(lambda: self.k8s.get_deployment_replica_count(name="acid-minimal-cluster-pooler"), 2,
 | 
			
		||||
                             "Operator did not succeed in overwriting labels")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -177,6 +178,7 @@ class EndToEndTestCase(unittest.TestCase):
 | 
			
		|||
            }
 | 
			
		||||
        })
 | 
			
		||||
 | 
			
		||||
        self.eventuallyEqual(lambda: self.k8s.get_operator_state(), {"0": "idle"}, "Operator does not get in sync")
 | 
			
		||||
        self.eventuallyEqual(lambda: self.k8s.count_running_pods("connection-pooler=acid-minimal-cluster-pooler"),
 | 
			
		||||
                             0, "Pooler pods not scaled down")
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,7 +78,7 @@ func needReplicaConnectionPoolerWorker(spec *acidv1.PostgresSpec) bool {
 | 
			
		|||
// have e.g. different `application` label, so that recreatePod operation will
 | 
			
		||||
// not interfere with it (it lists all the pods via labels, and if there would
 | 
			
		||||
// be no difference, it will recreate also pooler pods).
 | 
			
		||||
func (c *Cluster) connectionPoolerLabelsSelector(role PostgresRole, moreLabels bool) *metav1.LabelSelector {
 | 
			
		||||
func (c *Cluster) connectionPoolerLabels(role PostgresRole, moreLabels bool) *metav1.LabelSelector {
 | 
			
		||||
	connectionPoolerLabels := labels.Set(map[string]string{})
 | 
			
		||||
 | 
			
		||||
	var extraLabels map[string]string
 | 
			
		||||
| 
						 | 
				
			
			@ -293,7 +293,7 @@ func (c *Cluster) generateConnectionPoolerPodTemplate(role PostgresRole) (
 | 
			
		|||
 | 
			
		||||
	podTemplate := &v1.PodTemplateSpec{
 | 
			
		||||
		ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
			Labels:      c.connectionPoolerLabelsSelector(role, true).MatchLabels,
 | 
			
		||||
			Labels:      c.connectionPoolerLabels(role, true).MatchLabels,
 | 
			
		||||
			Namespace:   c.Namespace,
 | 
			
		||||
			Annotations: c.generatePodAnnotations(spec),
 | 
			
		||||
		},
 | 
			
		||||
| 
						 | 
				
			
			@ -347,7 +347,7 @@ func (c *Cluster) generateConnectionPoolerDeployment(connectionPooler *Connectio
 | 
			
		|||
		ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
			Name:        connectionPooler.Name,
 | 
			
		||||
			Namespace:   connectionPooler.Namespace,
 | 
			
		||||
			Labels:      c.connectionPoolerLabelsSelector(connectionPooler.Role, true).MatchLabels,
 | 
			
		||||
			Labels:      c.connectionPoolerLabels(connectionPooler.Role, true).MatchLabels,
 | 
			
		||||
			Annotations: map[string]string{},
 | 
			
		||||
			// make StatefulSet object its owner to represent the dependency.
 | 
			
		||||
			// By itself StatefulSet is being deleted with "Orphaned"
 | 
			
		||||
| 
						 | 
				
			
			@ -359,7 +359,7 @@ func (c *Cluster) generateConnectionPoolerDeployment(connectionPooler *Connectio
 | 
			
		|||
		},
 | 
			
		||||
		Spec: appsv1.DeploymentSpec{
 | 
			
		||||
			Replicas: numberOfInstances,
 | 
			
		||||
			Selector: c.connectionPoolerLabelsSelector(connectionPooler.Role, false),
 | 
			
		||||
			Selector: c.connectionPoolerLabels(connectionPooler.Role, false),
 | 
			
		||||
			Template: *podTemplate,
 | 
			
		||||
		},
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			@ -398,7 +398,7 @@ func (c *Cluster) generateConnectionPoolerService(connectionPooler *ConnectionPo
 | 
			
		|||
		ObjectMeta: metav1.ObjectMeta{
 | 
			
		||||
			Name:        connectionPooler.Name,
 | 
			
		||||
			Namespace:   connectionPooler.Namespace,
 | 
			
		||||
			Labels:      c.connectionPoolerLabelsSelector(connectionPooler.Role, true).MatchLabels,
 | 
			
		||||
			Labels:      c.connectionPoolerLabels(connectionPooler.Role, true).MatchLabels,
 | 
			
		||||
			Annotations: map[string]string{},
 | 
			
		||||
			// make StatefulSet object its owner to represent the dependency.
 | 
			
		||||
			// By itself StatefulSet is being deleted with "Orphaned"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -838,9 +838,9 @@ func testResources(cluster *Cluster, podSpec *v1.PodTemplateSpec, role PostgresR
 | 
			
		|||
func testLabels(cluster *Cluster, podSpec *v1.PodTemplateSpec, role PostgresRole) error {
 | 
			
		||||
	poolerLabels := podSpec.ObjectMeta.Labels["connection-pooler"]
 | 
			
		||||
 | 
			
		||||
	if poolerLabels != cluster.connectionPoolerLabelsSelector(role, true).MatchLabels["connection-pooler"] {
 | 
			
		||||
	if poolerLabels != cluster.connectionPoolerLabels(role, true).MatchLabels["connection-pooler"] {
 | 
			
		||||
		return fmt.Errorf("Pod labels do not match, got %+v, expected %+v",
 | 
			
		||||
			podSpec.ObjectMeta.Labels, cluster.connectionPoolerLabelsSelector(role, true).MatchLabels)
 | 
			
		||||
			podSpec.ObjectMeta.Labels, cluster.connectionPoolerLabels(role, true).MatchLabels)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
| 
						 | 
				
			
			@ -848,7 +848,7 @@ func testLabels(cluster *Cluster, podSpec *v1.PodTemplateSpec, role PostgresRole
 | 
			
		|||
 | 
			
		||||
func testSelector(cluster *Cluster, deployment *appsv1.Deployment) error {
 | 
			
		||||
	labels := deployment.Spec.Selector.MatchLabels
 | 
			
		||||
	expected := cluster.connectionPoolerLabelsSelector(Master, true).MatchLabels
 | 
			
		||||
	expected := cluster.connectionPoolerLabels(Master, true).MatchLabels
 | 
			
		||||
 | 
			
		||||
	if labels["connection-pooler"] != expected["connection-pooler"] {
 | 
			
		||||
		return fmt.Errorf("Labels are incorrect, got %+v, expected %+v",
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue