Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for CloneAndRemoveLabel (0.23 sec)

  1. pkg/util/labels/labels.go

    	for key, value := range labels {
    		newLabels[key] = value
    	}
    	newLabels[labelKey] = labelValue
    	return newLabels
    }
    
    // CloneAndRemoveLabel clones the given map and returns a new map with the given key removed.
    // Returns the given map, if labelKey is empty.
    func CloneAndRemoveLabel(labels map[string]string, labelKey string) map[string]string {
    	if labelKey == "" {
    		// Don't need to add a label.
    		return labels
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 11 17:34:12 UTC 2017
    - 3.7K bytes
    - Viewed (0)
  2. pkg/util/labels/labels_test.go

    		got := CloneAndAddLabel(tc.labels, tc.labelKey, tc.labelValue)
    		if !reflect.DeepEqual(got, tc.want) {
    			t.Errorf("[Add] got %v, want %v", got, tc.want)
    		}
    		// now test the inverse.
    		got_rm := CloneAndRemoveLabel(got, tc.labelKey)
    		if !reflect.DeepEqual(got_rm, tc.labels) {
    			t.Errorf("[RM] got %v, want %v", got_rm, tc.labels)
    		}
    	}
    }
    
    func TestAddLabel(t *testing.T) {
    	labels := map[string]string{
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jan 11 17:34:12 UTC 2017
    - 4.1K bytes
    - Viewed (0)
  3. pkg/controller/endpoint/endpoints_controller.go

    	// But first check if it has that label to avoid expensive copies.
    	compareLabels := currentEndpoints.Labels
    	if _, ok := currentEndpoints.Labels[v1.IsHeadlessService]; ok {
    		compareLabels = utillabels.CloneAndRemoveLabel(currentEndpoints.Labels, v1.IsHeadlessService)
    	}
    	// When comparing the subsets, we ignore the difference in ResourceVersion of Pod to avoid unnecessary Endpoints
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat May 04 18:33:12 UTC 2024
    - 26.3K bytes
    - Viewed (0)
  4. pkg/controller/deployment/util/deployment_util.go

    	deployment.Spec.Template.ObjectMeta = template.ObjectMeta
    	deployment.Spec.Template.Spec = template.Spec
    	deployment.Spec.Template.ObjectMeta.Labels = labelsutil.CloneAndRemoveLabel(
    		deployment.Spec.Template.ObjectMeta.Labels,
    		apps.DefaultDeploymentUniqueLabelKey)
    	return deployment
    }
    
    // GetReplicaCountForReplicaSets returns the sum of Replicas of the given replica sets.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Dec 15 07:09:11 UTC 2023
    - 39.3K bytes
    - Viewed (0)
Back to top