This Dockerfile includes etcdctl for interacting with etcd and the AWS CLI for uploading backups to S3. Dockerfile
FROM alpine:3.18
RUN apk add --no-cache
etcd
aws-cli
bash \
| import os | |
| import logging | |
| import hvac | |
| from argparse import ArgumentParser | |
| def setup_logging(): | |
| """Set up the logging configuration.""" | |
| logging.basicConfig( | |
| level=logging.INFO, |
| import logging | |
| import os | |
| import click | |
| from kubernetes import client, config | |
| from kubernetes.client.exceptions import ApiException | |
| import yaml | |
| # Setup logging | |
| logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') | |
| logger = logging.getLogger(__name__) |
| from kubernetes import client, config | |
| from concurrent.futures import ThreadPoolExecutor, as_completed | |
| def count_ns_resources_for_ns(ns, c_core, c_apps, c_batch, c_custom): | |
| """ | |
| Helper function to count resources for a single namespace. | |
| :param ns: Namespace to query | |
| :param c_core: CoreV1Api client | |
| :param c_apps: AppsV1Api client |
| from kubernetes import client, config | |
| def count_resources_by_namespace(): | |
| """ | |
| Count all standard resources and custom resources (CRDs) grouped by namespace. | |
| :return: A dictionary with namespaces as keys and resource counts as values. | |
| """ | |
| # Load kubeconfig | |
| config.load_kube_config() |
| import click | |
| import os | |
| import re | |
| import random | |
| from kubernetes import client, config, utils | |
| from kubernetes.client.rest import ApiException | |
| # Function to load Kubernetes config from the environment or kubeconfig file | |
| def load_k8s_config(kubeconfig_path=None): | |
| if kubeconfig_path: |
| import tkinter as tk | |
| from tkinter import filedialog, messagebox, ttk, simpledialog | |
| from cryptography import x509 | |
| from cryptography.hazmat.backends import default_backend | |
| import os | |
| import ssl | |
| import socket | |
| class X509CertViewer: | |
| def __init__(self, root): |
| import os | |
| import requests | |
| import json | |
| import click | |
| import logging | |
| from time import sleep | |
| # Configure logging | |
| logging.basicConfig( | |
| filename="ansible_tower.log", |
| import click | |
| import logging | |
| import ssl | |
| import queue | |
| from kubernetes import client, config | |
| from pyVim.connect import SmartConnect, Disconnect | |
| from pyVmomi import vim | |
| from concurrent.futures import ThreadPoolExecutor, as_completed | |
| import sys |
| import click | |
| import logging | |
| import ssl | |
| from kubernetes import client, config | |
| from pyVim.connect import SmartConnect, SmartConnectNoSSL, Disconnect | |
| from pyVmomi import vim | |
| # Set up logging | |
| logger = logging.getLogger(__name__) | |
| logger.setLevel(logging.DEBUG) |