MCPcopy
hub / github.com/NVIDIA/aistore / ParsePodSpec

Function ParsePodSpec

etl/podspec.go:40–52  ·  view source on GitHub ↗
(errCtx *cmn.ETLErrorContext, spec []byte)

Source from the content-addressed store, hash-verified

38}
39
40func ParsePodSpec(errCtx *cmn.ETLErrorContext, spec []byte) (*corev1.Pod, error) {
41 obj, _, err := scheme.Codecs.UniversalDeserializer().Decode(spec, nil, nil)
42 if err != nil {
43 return nil, cmn.NewErrETL(errCtx, "failed to parse pod spec: %v", err)
44 }
45
46 pod, ok := obj.(*corev1.Pod)
47 if !ok {
48 kind := obj.GetObjectKind().GroupVersionKind().Kind
49 return nil, cmn.NewErrETL(errCtx, "expected pod spec, got: %s", kind)
50 }
51 return pod, nil
52}
53
54func (b *etlBootstraper) preparePodSpec() (err error) {
55 // Override the name (add target's daemon ID and node ID to its name).

Callers 3

SpecToInitMsgFunction · 0.92
ValidateMethod · 0.85
createPodSpecMethod · 0.85

Calls 1

NewErrETLFunction · 0.92

Tested by

no test coverage detected