summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 07c25faf9..8a12c61e4 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -401,3 +401,19 @@ func WithPodName(name string) PodCreateOption {
return nil
}
}
+
+// WithPodLabels sets the labels of a pod
+func WithPodLabels(labels map[string]string) PodCreateOption {
+ return func(pod *Pod) error {
+ if pod.valid {
+ return ErrPodFinalized
+ }
+
+ pod.labels = make(map[string]string)
+ for key, value := range labels {
+ pod.labels[key] = value
+ }
+
+ return nil
+ }
+}