diff options
| author | 2023-08-13 20:01:42 +0100 | |
|---|---|---|
| committer | 2023-08-14 11:44:03 +0100 | |
| commit | 661f49409e69f5cfafbef4cd41411a72ebc5418d (patch) | |
| tree | 9ddd7f2a2ab09cadc5b716be00628e19d839ad4d /kubernetes/scripts | |
| parent | Allow multiple documents within yaml files (diff) | |
Copy all files from kubernetes repo into this one
This commit is a like-for-like copy of the [kubernetes repo](https://github.com/python-discord/kubernetes) check that repo for comit history prioir to this commit.
Co-authored-by: Amrou Bellalouna <[email protected]>
Co-authored-by: Bradley Reynolds <[email protected]>
Co-authored-by: Chris <[email protected]>
Co-authored-by: Chris Lovering <[email protected]>
Co-authored-by: ChrisJL <[email protected]>
Co-authored-by: Den4200 <[email protected]>
Co-authored-by: GDWR <[email protected]>
Co-authored-by: Hassan Abouelela <[email protected]>
Co-authored-by: Hassan Abouelela <[email protected]>
Co-authored-by: jchristgit <[email protected]>
Co-authored-by: Joe Banks <[email protected]>
Co-authored-by: Joe Banks <[email protected]>
Co-authored-by: Joe Banks <[email protected]>
Co-authored-by: Johannes Christ <[email protected]>
Co-authored-by: Kieran Siek <[email protected]>
Co-authored-by: kosayoda <[email protected]>
Co-authored-by: ks129 <[email protected]>
Co-authored-by: Leon Sand├©y <[email protected]>
Co-authored-by: Leon Sand├©y <[email protected]>
Co-authored-by: MarkKoz <[email protected]>
Co-authored-by: Matteo Bertucci <[email protected]>
Co-authored-by: Sebastiaan Zeeff <[email protected]>
Co-authored-by: Sebastiaan Zeeff <[email protected]>
Co-authored-by: vcokltfre <[email protected]>
Diffstat (limited to '')
| -rw-r--r-- | kubernetes/scripts/__init__.py | 0 | ||||
| -rw-r--r-- | kubernetes/scripts/lint_manifests.py | 28 | 
2 files changed, 28 insertions, 0 deletions
| diff --git a/kubernetes/scripts/__init__.py b/kubernetes/scripts/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/kubernetes/scripts/__init__.py diff --git a/kubernetes/scripts/lint_manifests.py b/kubernetes/scripts/lint_manifests.py new file mode 100644 index 0000000..8660608 --- /dev/null +++ b/kubernetes/scripts/lint_manifests.py @@ -0,0 +1,28 @@ +import os +import sys +from pathlib import Path + + +def get_all_manifests() -> list[str]: +    """Return a list of file paths that look like k8s manifests.""" +    likely_manifests = [] +    for file in Path.cwd().glob("**/*.yaml"): +        if file.name in ("secrets.yaml", "ghcr-pull-secrets.yaml"): +            # Don't lint secret files as they're git-crypted +            continue +        if file.stem.startswith("_"): +            # Ignore manifests that start with _ +            continue +        if "apiVersion:" not in file.read_text(): +            # Probably not a manifest +            continue +        likely_manifests.append(str(file)) +    return likely_manifests + + +if __name__ == "__main__": +    if sys.argv[1] == "diff": +        arg = " -f ".join([""] + get_all_manifests()) +        os.system("kubectl diff" + arg)  # noqa: S605 +    elif sys.argv[1] == "find": +        print("\n".join(get_all_manifests()))  # noqa: T201 | 
