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 \
| --- | |
| - name: Get pods, retrieve secret, and execute command with secret data in each pod | |
| hosts: localhost | |
| gather_facts: no | |
| vars: | |
| namespace: "your-namespace" | |
| label_selector: "app=myapp" # Adjust this label selector to match your pods | |
| command_to_run: "your-command" # Replace with the command you want to execute | |
| secret_name: "px-admin-token" # The name of the secret to retrieve | |
| secret_key: "auth-token" # The key in the secret data to use as the environment variable value |
| 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) |
| 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 os | |
| import requests | |
| import json | |
| import click | |
| import logging | |
| from time import sleep | |
| # Configure logging | |
| logging.basicConfig( | |
| filename="ansible_tower.log", |
| 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 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: |
| 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() |
| 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 |
| 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__) |