You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

kubernetes.go 774 B

123456789101112131415161718192021222324252627282930
  1. package utils
  2. import (
  3. "bytes"
  4. "io"
  5. "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
  6. "k8s.io/apimachinery/pkg/runtime"
  7. syaml "k8s.io/apimachinery/pkg/runtime/serializer/yaml"
  8. "k8s.io/apimachinery/pkg/util/yaml"
  9. )
  10. func StrToInfo(val string) *unstructured.Unstructured {
  11. d := yaml.NewYAMLOrJSONDecoder(bytes.NewBufferString(val), 4096)
  12. var err error
  13. var rawObj runtime.RawExtension
  14. err = d.Decode(&rawObj)
  15. if err == io.EOF {
  16. }
  17. if err != nil {
  18. }
  19. obj := &unstructured.Unstructured{}
  20. syaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme).Decode(rawObj.Raw, nil, obj)
  21. unstructuredMap, _ := runtime.DefaultUnstructuredConverter.ToUnstructured(obj)
  22. unStructureObj := &unstructured.Unstructured{Object: unstructuredMap}
  23. return unStructureObj
  24. }

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.