Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for NewYAMLOrJSONDecoder (0.27 sec)

  1. staging/src/k8s.io/apimachinery/pkg/util/yaml/decoder_test.go

    		t.Fatalf("expected YamlSyntaxError, got nil instead")
    	}
    	if _, ok := err.(YAMLSyntaxError); !ok {
    		t.Fatalf("unexpected error: %v", err)
    	}
    }
    
    func TestDecodeBrokenYAML(t *testing.T) {
    	s := NewYAMLOrJSONDecoder(bytes.NewReader([]byte(`---
    stuff: 1
    		test-foo: 1
    
    ---
      `)), 100)
    	obj := generic{}
    	err := s.Decode(&obj)
    	if err == nil {
    		t.Fatal("expected error with yaml: violate, got no error")
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 10 07:29:34 UTC 2023
    - 12.4K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apimachinery/pkg/util/yaml/decoder.go

    	return e.err.Error()
    }
    
    // NewYAMLOrJSONDecoder returns a decoder that will process YAML documents
    // or JSON documents from the given reader as a stream. bufferSize determines
    // how far into the stream the decoder will look to figure out whether this
    // is a JSON stream (has whitespace followed by an open brace).
    func NewYAMLOrJSONDecoder(r io.Reader, bufferSize int) *YAMLOrJSONDecoder {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 19 21:24:36 UTC 2021
    - 10.2K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/cel/common/equality_test.go

    func mustSchema(source string) *openapi.Schema {
    	d := yaml.NewYAMLOrJSONDecoder(strings.NewReader(source), 4096)
    	res := &spec.Schema{}
    	if err := d.Decode(res); err != nil {
    		panic(err)
    	}
    	return &openapi.Schema{Schema: res}
    }
    
    // Creates an *unstructured by decoding the given YAML. Panics on error
    func mustUnstructured(source string) interface{} {
    	d := yaml.NewYAMLOrJSONDecoder(strings.NewReader(source), 4096)
    	var res interface{}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Oct 13 21:36:46 UTC 2023
    - 21.1K bytes
    - Viewed (0)
  4. pilot/pkg/config/kube/crd/conversion.go

    	var others []IstioKind
    	reader := bytes.NewReader([]byte(inputs))
    	empty := IstioKind{}
    
    	// We store configs as a YaML stream; there may be more than one decoder.
    	yamlDecoder := kubeyaml.NewYAMLOrJSONDecoder(reader, 512*1024)
    	for {
    		obj := IstioKind{}
    		err := yamlDecoder.Decode(&obj)
    		if err == io.EOF {
    			break
    		}
    		if err != nil {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Apr 25 18:26:16 UTC 2024
    - 6.3K bytes
    - Viewed (0)
  5. plugin/pkg/admission/imagepolicy/admission.go

    	if configFile == nil {
    		return nil, fmt.Errorf("no config specified")
    	}
    
    	// TODO: move this to a versioned configuration file format
    	var config AdmissionConfig
    	d := yaml.NewYAMLOrJSONDecoder(configFile, 4096)
    	err := d.Decode(&config)
    	if err != nil {
    		return nil, err
    	}
    
    	whConfig := config.ImagePolicyWebhook
    	if err := normalizeWebhookConfig(&whConfig); err != nil {
    		return nil, err
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Jun 02 06:05:06 UTC 2023
    - 9.8K bytes
    - Viewed (0)
  6. pkg/config/crd/validator.go

    		data, err := os.Open(file)
    		if err != nil {
    			return nil, fmt.Errorf("failed to read input yaml file: %v", err)
    		}
    		closers = append(closers, data)
    
    		yamlDecoder := kubeyaml.NewYAMLOrJSONDecoder(data, 512*1024)
    		for {
    			un := &unstructured.Unstructured{}
    			err = yamlDecoder.Decode(&un)
    			if err == io.EOF {
    				break
    			}
    			if err != nil {
    				return nil, err
    			}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Oct 17 15:38:40 UTC 2023
    - 8.3K bytes
    - Viewed (0)
  7. plugin/pkg/admission/podnodeselector/admission.go

    //	namespace2: <node-selectors-labels>
    func readConfig(config io.Reader) *pluginConfig {
    	defaultConfig := &pluginConfig{}
    	if config == nil || reflect.ValueOf(config).IsNil() {
    		return defaultConfig
    	}
    	d := yaml.NewYAMLOrJSONDecoder(config, 4096)
    	for {
    		if err := d.Decode(defaultConfig); err != nil {
    			if err != io.EOF {
    				continue
    			}
    		}
    		break
    	}
    	return defaultConfig
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jul 26 17:14:05 UTC 2022
    - 8.3K bytes
    - Viewed (0)
  8. pkg/kube/inject/webhook_test.go

    		for _, object := range strings.Split(mlist, yamlSeparator) {
    			if len(object) == 0 {
    				continue
    			}
    			r := bytes.NewReader([]byte(object))
    			decoder := k8syaml.NewYAMLOrJSONDecoder(r, 1024)
    
    			out := &unstructured.Unstructured{}
    			err := decoder.Decode(out)
    			if err != nil {
    				t.Fatalf("error decoding object %q: %v", object, err)
    			}
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Mon Jul 17 20:25:52 UTC 2023
    - 39K bytes
    - Viewed (1)
  9. staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go

    	patch := &unstructured.Unstructured{}
    	if obj, ok := a.patch.(map[string]interface{}); ok {
    		patch.Object = obj
    	} else if str, ok := a.patch.(string); ok {
    		str = FixTabsOrDie(str)
    		if err := utilyaml.NewYAMLOrJSONDecoder(strings.NewReader(str), len(str)).Decode(&patch.Object); err != nil {
    			return err
    		}
    	} else {
    		return fmt.Errorf("invalid patch type: %T", a.patch)
    	}
    
    	patch.SetKind(kind)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue May 28 08:48:22 UTC 2024
    - 59.5K bytes
    - Viewed (0)
  10. staging/src/k8s.io/cli-runtime/pkg/resource/visitor.go

    		Schema: schema,
    	}
    }
    
    // Visit implements Visitor over a stream. StreamVisitor is able to distinct multiple resources in one stream.
    func (v *StreamVisitor) Visit(fn VisitorFunc) error {
    	d := yaml.NewYAMLOrJSONDecoder(v.Reader, 4096)
    	for {
    		ext := runtime.RawExtension{}
    		if err := d.Decode(&ext); err != nil {
    			if err == io.EOF {
    				return nil
    			}
    			return fmt.Errorf("error parsing %s: %v", v.Source, err)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jul 03 10:17:56 UTC 2023
    - 21.3K bytes
    - Viewed (0)
Back to top