Skip to content

Commit

Permalink
Merge pull request #208 from microsoft/mahuber/incomplete_init
Browse files Browse the repository at this point in the history
samples: introduce incomplete_init category
  • Loading branch information
ms-mahuber authored Jul 12, 2024
2 parents cd7c5fa + 1590a72 commit cc23bdb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/tools/genpolicy/policy_samples.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
"kubernetes/fixtures/replication.yaml",
"kubernetes/fixtures2/rc-service.yaml",
"kubernetes/fixtures2/valid-pod.yaml",
"kubernetes/incomplete-init/cassandra-statefulset.yaml",
"kubernetes/incomplete-init/controller.yaml",
"kubernetes/incomplete-init/cockroachdb-statefulset.yaml",
"pod/pod-exec.yaml",
"pod/pod-lifecycle.yaml",
"pod/pod-one-container.yaml",
Expand All @@ -46,6 +43,11 @@
"stateful-set/web.yaml",
"stateful-set/web2.yaml"
],
"incomplete_init": [
"kubernetes/incomplete-init/cassandra-statefulset.yaml",
"kubernetes/incomplete-init/controller.yaml",
"kubernetes/incomplete-init/cockroachdb-statefulset.yaml"
],
"silently_ignored": [
"webhook/webhook-pod1.yaml",
"webhook/webhook-pod2.yaml",
Expand Down Expand Up @@ -77,4 +79,4 @@
"nginx:latest",
"ubuntu:latest"
]
}
}
5 changes: 3 additions & 2 deletions src/tools/genpolicy/update_policy_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
samples = json.load(f)

default_yamls = samples["default"]
incomplete_init = samples["incomplete_init"]
silently_ignored = samples["silently_ignored"]
no_policy = samples["no_policy"]
needs_containerd_pull = samples["needs_containerd_pull"]
Expand Down Expand Up @@ -42,7 +43,7 @@ def timeRunCmd(arg):
print("\n".join(log))

# check we can access all files we are about to update
for file in default_yamls + silently_ignored + no_policy:
for file in default_yamls + incomplete_init + silently_ignored + no_policy:
filepath = os.path.join(file_base_path, file)
if not os.path.exists(filepath):
sys.exit(f"filepath does not exists: {filepath}")
Expand All @@ -65,7 +66,7 @@ def timeRunCmd(arg):
with concurrent.futures.ThreadPoolExecutor(max_workers=os.cpu_count()) as executor:
futures = []

for file in default_yamls + no_policy + needs_containerd_pull:
for file in default_yamls + incomplete_init + no_policy + needs_containerd_pull:
rego_file = "/tmp/" + Path(os.path.basename(file)).stem + "-rego.txt"
cmd = f"{genpolicy_path} -r -d -u -y {os.path.join(file_base_path, file)} > {rego_file}"
futures.append(executor.submit(timeRunCmd, cmd))
Expand Down

0 comments on commit cc23bdb

Please sign in to comment.