Skip to content

Commit

Permalink
Pass io.microsoft.container.privileged annotation when creating conti…
Browse files Browse the repository at this point in the history
…aners for Windows privileged contianer POC
  • Loading branch information
marosset committed Jan 25, 2021
1 parent c4d7527 commit 7abbd21
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/kubelet/kuberuntime/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ func newContainerAnnotations(container *v1.Container, pod *v1.Pod, restartCount
annotations[a.Name] = a.Value
}

windowsPrivilegedAnnotation := "io.microsoft.container.privileged"

klog.Infof("Checking if pod annotations exist")
if pod.Annotations != nil {
klog.Infof("Checking if pod annotaions contains %s", windowsPrivilegedAnnotation)
if value, ok := pod.Annotations[windowsPrivilegedAnnotation]; ok {
klog.Infof("Pod annotations contains %s, value %s", windowsPrivilegedAnnotation, value)
annotations[windowsPrivilegedAnnotation] = value
} else {
klog.Infof("Pod annotations did not contian %s", windowsPrivilegedAnnotation)
}
}

annotations[containerHashLabel] = strconv.FormatUint(kubecontainer.HashContainer(container), 16)
annotations[containerRestartCountLabel] = strconv.Itoa(restartCount)
annotations[containerTerminationMessagePathLabel] = container.TerminationMessagePath
Expand Down

0 comments on commit 7abbd21

Please sign in to comment.