prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  CKV_K8S_31 failure with RuntimeDefault configured for workloads
  **Describe the bug**
  Please see #710
  
  **To Reproduce**
  Please see #710
  
  **Expected behavior**
  Please see #710
  
  **Additional context**
  The bug reported in #710 needs to be fixed for workloads in https://github.com/bridgecrewio/checkov/blob/master/checkov/kubernetes/checks/Seccomp.py#L44:L48 as well.
  
  ```yaml
  apiVersion: apps/v1
  kind: Deployment
  metadata:
  ....
  spec:
  ...
  ...
    template:
    ...
    ...
      spec:
      ....
      ....
        securityContext:
          allowPrivilegeEscalation: false
          seccompProfile:
            type: RuntimeDefault
  ```
  
  **Related PRs**
  #711 
  
  
  </issue>
  <code>
  [start of checkov/kubernetes/checks/Seccomp.py]
  1 import dpath
  2 
  3 from checkov.common.models.enums import CheckCategories, CheckResult
  4 from checkov.kubernetes.base_spec_check import BaseK8Check
  5 
  6 
  7 class Seccomp(BaseK8Check):
  8 
  9     def __init__(self):
  10         # CIS-1.5 5.7.2
  11         name = "Ensure that the seccomp profile is set to docker/default or runtime/default"
  12         id = "CKV_K8S_31"
  13         # Location: Pod.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
  14         # Location: CronJob.spec.jobTemplate.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
  15         # Location: *.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod
  16         # Location: *.spec.securityContext.seccompProfile.type
  17         supported_kind = ['Pod', 'Deployment', 'DaemonSet', 'StatefulSet', 'ReplicaSet', 'ReplicationController', 'Job', 'CronJob']
  18         categories = [CheckCategories.KUBERNETES]
  19         super().__init__(name=name, id=id, categories=categories, supported_entities=supported_kind)
  20 
  21     def get_resource_id(self, conf):
  22         if "namespace" in conf["metadata"]:
  23             return "{}.{}.{}".format(conf["kind"], conf["metadata"]["name"], conf["metadata"]["namespace"])
  24         else:
  25             return "{}.{}.default".format(conf["kind"], conf["metadata"]["name"])
  26 
  27     def scan_spec_conf(self, conf):
  28         metadata = {}
  29 
  30         if conf['kind'] == 'Pod':
  31             security_profile = dpath.search(conf, 'spec/securityContext/seccompProfile/type')
  32             if security_profile:
  33                 security_profile = dpath.get(conf, 'spec/securityContext/seccompProfile/type')
  34                 return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED
  35             if "metadata" in conf:
  36                 metadata = conf["metadata"]
  37         elif conf['kind'] == 'CronJob':
  38             if "spec" in conf:
  39                 if "jobTemplate" in conf["spec"]:
  40                     if "spec" in conf["spec"]["jobTemplate"]:
  41                         if "template" in conf["spec"]["jobTemplate"]["spec"]:
  42                             if "metadata" in conf["spec"]["jobTemplate"]["spec"]["template"]:
  43                                 metadata = conf["spec"]["jobTemplate"]["spec"]["template"]["metadata"]
  44         else:
  45             if "spec" in conf:
  46                 if "template" in conf["spec"]:
  47                     if "metadata" in conf["spec"]["template"]:
  48                         metadata = conf["spec"]["template"]["metadata"]
  49 
  50         if metadata:
  51             if "annotations" in metadata and isinstance(metadata['annotations'], dict):
  52                 if "seccomp.security.alpha.kubernetes.io/pod" in metadata["annotations"]:
  53                     if ("docker/default" in metadata["annotations"]["seccomp.security.alpha.kubernetes.io/pod"] or
  54                             "runtime/default" in metadata["annotations"]["seccomp.security.alpha.kubernetes.io/pod"]):
  55                         return CheckResult.PASSED
  56         return CheckResult.FAILED
  57 
  58 
  59 check = Seccomp()
  60
  [end of checkov/kubernetes/checks/Seccomp.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/checkov/kubernetes/checks/Seccomp.py b/checkov/kubernetes/checks/Seccomp.py
  --- a/checkov/kubernetes/checks/Seccomp.py
  +++ b/checkov/kubernetes/checks/Seccomp.py
  @@ -34,6 +34,20 @@
                   return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED
               if "metadata" in conf:
                   metadata = conf["metadata"]
  +        if conf['kind'] == 'Deployment':
  +            security_profile = dpath.search(conf, 'spec/template/spec/securityContext/seccompProfile/type')
  +            if security_profile:
  +                security_profile = dpath.get(conf, 'spec/template/spec/securityContext/seccompProfile/type')
  +                return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED
  +            if "metadata" in conf:
  +                metadata = conf["metadata"]
  +        if conf['kind'] == 'StatefulSet':
  +            security_profile = dpath.search(conf, 'spec/template/spec/securityContext/seccompProfile/type')
  +            if security_profile:
  +                security_profile = dpath.get(conf, 'spec/template/spec/securityContext/seccompProfile/type')
  +                return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED
  +            if "metadata" in conf:
  +                metadata = conf["metadata"]            
           elif conf['kind'] == 'CronJob':
               if "spec" in conf:
                   if "jobTemplate" in conf["spec"]:
  
verification_info: {"golden_diff": "diff --git a/checkov/kubernetes/checks/Seccomp.py b/checkov/kubernetes/checks/Seccomp.py\n--- a/checkov/kubernetes/checks/Seccomp.py\n+++ b/checkov/kubernetes/checks/Seccomp.py\n@@ -34,6 +34,20 @@\n                 return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED\n             if \"metadata\" in conf:\n                 metadata = conf[\"metadata\"]\n+        if conf['kind'] == 'Deployment':\n+            security_profile = dpath.search(conf, 'spec/template/spec/securityContext/seccompProfile/type')\n+            if security_profile:\n+                security_profile = dpath.get(conf, 'spec/template/spec/securityContext/seccompProfile/type')\n+                return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED\n+            if \"metadata\" in conf:\n+                metadata = conf[\"metadata\"]\n+        if conf['kind'] == 'StatefulSet':\n+            security_profile = dpath.search(conf, 'spec/template/spec/securityContext/seccompProfile/type')\n+            if security_profile:\n+                security_profile = dpath.get(conf, 'spec/template/spec/securityContext/seccompProfile/type')\n+                return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED\n+            if \"metadata\" in conf:\n+                metadata = conf[\"metadata\"]            \n         elif conf['kind'] == 'CronJob':\n             if \"spec\" in conf:\n                 if \"jobTemplate\" in conf[\"spec\"]:\n", "issue": "CKV_K8S_31 failure with RuntimeDefault configured for workloads\n**Describe the bug**\r\nPlease see #710\r\n\r\n**To Reproduce**\r\nPlease see #710\r\n\r\n**Expected behavior**\r\nPlease see #710\r\n\r\n**Additional context**\r\nThe bug reported in #710 needs to be fixed for workloads in https://github.com/bridgecrewio/checkov/blob/master/checkov/kubernetes/checks/Seccomp.py#L44:L48 as well.\r\n\r\n```yaml\r\napiVersion: apps/v1\r\nkind: Deployment\r\nmetadata:\r\n....\r\nspec:\r\n...\r\n...\r\n  template:\r\n  ...\r\n  ...\r\n    spec:\r\n    ....\r\n    ....\r\n      securityContext:\r\n        allowPrivilegeEscalation: false\r\n        seccompProfile:\r\n          type: RuntimeDefault\r\n```\r\n\r\n**Related PRs**\r\n#711 \r\n\n", "before_files": [{"content": "import dpath\n\nfrom checkov.common.models.enums import CheckCategories, CheckResult\nfrom checkov.kubernetes.base_spec_check import BaseK8Check\n\n\nclass Seccomp(BaseK8Check):\n\n    def __init__(self):\n        # CIS-1.5 5.7.2\n        name = \"Ensure that the seccomp profile is set to docker/default or runtime/default\"\n        id = \"CKV_K8S_31\"\n        # Location: Pod.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        # Location: CronJob.spec.jobTemplate.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        # Location: *.spec.template.metadata.annotations.seccomp.security.alpha.kubernetes.io/pod\n        # Location: *.spec.securityContext.seccompProfile.type\n        supported_kind = ['Pod', 'Deployment', 'DaemonSet', 'StatefulSet', 'ReplicaSet', 'ReplicationController', 'Job', 'CronJob']\n        categories = [CheckCategories.KUBERNETES]\n        super().__init__(name=name, id=id, categories=categories, supported_entities=supported_kind)\n\n    def get_resource_id(self, conf):\n        if \"namespace\" in conf[\"metadata\"]:\n            return \"{}.{}.{}\".format(conf[\"kind\"], conf[\"metadata\"][\"name\"], conf[\"metadata\"][\"namespace\"])\n        else:\n            return \"{}.{}.default\".format(conf[\"kind\"], conf[\"metadata\"][\"name\"])\n\n    def scan_spec_conf(self, conf):\n        metadata = {}\n\n        if conf['kind'] == 'Pod':\n            security_profile = dpath.search(conf, 'spec/securityContext/seccompProfile/type')\n            if security_profile:\n                security_profile = dpath.get(conf, 'spec/securityContext/seccompProfile/type')\n                return CheckResult.PASSED if security_profile == 'RuntimeDefault' else CheckResult.FAILED\n            if \"metadata\" in conf:\n                metadata = conf[\"metadata\"]\n        elif conf['kind'] == 'CronJob':\n            if \"spec\" in conf:\n                if \"jobTemplate\" in conf[\"spec\"]:\n                    if \"spec\" in conf[\"spec\"][\"jobTemplate\"]:\n                        if \"template\" in conf[\"spec\"][\"jobTemplate\"][\"spec\"]:\n                            if \"metadata\" in conf[\"spec\"][\"jobTemplate\"][\"spec\"][\"template\"]:\n                                metadata = conf[\"spec\"][\"jobTemplate\"][\"spec\"][\"template\"][\"metadata\"]\n        else:\n            if \"spec\" in conf:\n                if \"template\" in conf[\"spec\"]:\n                    if \"metadata\" in conf[\"spec\"][\"template\"]:\n                        metadata = conf[\"spec\"][\"template\"][\"metadata\"]\n\n        if metadata:\n            if \"annotations\" in metadata and isinstance(metadata['annotations'], dict):\n                if \"seccomp.security.alpha.kubernetes.io/pod\" in metadata[\"annotations\"]:\n                    if (\"docker/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"] or\n                            \"runtime/default\" in metadata[\"annotations\"][\"seccomp.security.alpha.kubernetes.io/pod\"]):\n                        return CheckResult.PASSED\n        return CheckResult.FAILED\n\n\ncheck = Seccomp()\n", "path": "checkov/kubernetes/checks/Seccomp.py"}]}