Merge pull request #85 from mrunalp/pod_annotations
Add annotations for pods
This commit is contained in:
commit
e8405a4eec
1 changed files with 20 additions and 11 deletions
|
@ -20,6 +20,7 @@ type sandbox struct {
|
|||
name string
|
||||
logDir string
|
||||
labels map[string]string
|
||||
annotations map[string]string
|
||||
containers oci.Store
|
||||
}
|
||||
|
||||
|
@ -129,7 +130,15 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// add annotations
|
||||
annotations := req.GetConfig().GetAnnotations()
|
||||
annotationsJSON, err := json.Marshal(annotations)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
g.AddAnnotation("ocid/labels", string(labelsJSON))
|
||||
g.AddAnnotation("ocid/annotations", string(annotationsJSON))
|
||||
g.AddAnnotation("ocid/log_path", logDir)
|
||||
g.AddAnnotation("ocid/name", name)
|
||||
containerName := name + "-infra"
|
||||
|
@ -139,10 +148,10 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
|||
name: name,
|
||||
logDir: logDir,
|
||||
labels: labels,
|
||||
annotations: annotations,
|
||||
containers: oci.NewMemoryStore(),
|
||||
})
|
||||
|
||||
annotations := req.GetConfig().GetAnnotations()
|
||||
for k, v := range annotations {
|
||||
g.AddAnnotation(k, v)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue