Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for GetTemplateLabels (0.1 sec)

  1. istioctl/pkg/validate/validate.go

    			fmt.Sprintf("%s/%s:", un.GetName(), un.GetNamespace()), objLabels)
    	}
    	return nil
    }
    
    // GetTemplateLabels returns spec.template.metadata.labels from Deployment
    func GetTemplateLabels(u *unstructured.Unstructured) (map[string]string, error) {
    	if spec, ok := u.Object["spec"].(map[string]any); ok {
    		if template, ok := spec["template"].(map[string]any); ok {
    Registered: Wed Nov 06 22:53:10 UTC 2024
    - Last Modified: Thu Aug 15 22:27:47 UTC 2024
    - 14.3K bytes
    - Viewed (0)
  2. istioctl/pkg/validate/validate_test.go

    					strings.Join(c.args, " "), output, c.expectedRegexp)
    			}
    		})
    	}
    }
    
    func TestGetTemplateLabels(t *testing.T) {
    	un := fromYAML(validDeployment)
    
    	labels, err := GetTemplateLabels(un)
    	if err != nil {
    		t.Fatal(err)
    	}
    	assert.Equal(t, labels, map[string]string{
    		"app":     "helloworld",
    		"version": "v1",
    	})
    Registered: Wed Nov 06 22:53:10 UTC 2024
    - Last Modified: Fri Aug 02 16:18:14 UTC 2024
    - 21.4K bytes
    - Viewed (0)
Back to top