Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for SplitYamlByKind (0.14 sec)

  1. pkg/test/util/yml/parts.go

    // accidentally splitting in cases where yaml resources contain nested yaml (which
    // is indented).
    var splitRegex = regexp.MustCompile(`(^|\n)---`)
    
    // SplitYamlByKind splits the given YAML into parts indexed by kind.
    func SplitYamlByKind(content string) map[string]string {
    	cfgs := SplitString(content)
    	result := map[string]string{}
    	for _, cfg := range cfgs {
    		var typeMeta metav1.TypeMeta
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Nov 03 08:41:32 UTC 2022
    - 2.6K bytes
    - Viewed (0)
  2. pkg/test/util/yml/file.go

    	if err != nil {
    		return
    	}
    	defer f.Close()
    	filename = f.Name()
    
    	_, err = f.WriteString(contents)
    	return
    }
    
    func yamlToFilename(contents string) string {
    	spl := SplitYamlByKind(contents)
    	delete(spl, "")
    	types := []string{}
    	for k := range spl {
    		types = append(types, k)
    	}
    	switch len(types) {
    	case 0:
    		return "empty"
    	case 1:
    		m := GetMetadata(contents)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Sep 07 14:33:54 UTC 2023
    - 4.2K bytes
    - Viewed (0)
Back to top