Package: dok8s
dok8sdok8s: Output notes for a Kubernetes deployment.ContentsUse CaseConfigurationDevelopmentTestingVersioningDeploymentProductionUse CaseCollect and export information about a Kubernetes deployment (such as components, resources and docker images/tags) in a table format.
Input: Deployment files (collection of YAML definitions).Output: Pretty-print tabular data.RequirementsParse the following Kubernetes components:ConfigMap,Deployment,Ingress,PersistentVolumeClaim,Secret,Service,StatefulSet.Collect relevant information:kind,metadata name,data filenames,(init) containers,hosts / rules,storage name / size,ports,cpu/memory requests/limitsProduction-ready code.AssumptionsParsed Kubernetes components are included in theofficial python Kubernetes clientDesignThis project is based on a CLI interface.Example OutputInputYAML file:Cluster AutoscalerOutputComponentsComponentValueDetailsClusterRolecluster-autoscaler--ClusterRoleBindingcluster-autoscaler--Deploymentcluster-autoscalercluster-autoscalerRolecluster-autoscaler--RoleBindingcluster-autoscaler--ServiceAccountcluster-autoscaler--ResourcesPlatform/ServiceNameRequestLimit RequestNotescluster-autoscalercluster-autoscalerCPU:100m Memory:300MiCPU:100m Memory:300Mi--Docker imagesPlatform/ServiceNameImageVersioncluster-autoscalercluster-autoscalerk8s.gcr.io/cluster-autoscalerv1.14.7ConfigurationBehaviour of the application can be configured via Environment Variables.Environment VariableDescriptionTypeDefault ValueDOK8S_LOG_LEVELLevel of logging - overrides verbose/quiet flagstring-DOK8S_LOG_DIRDirectory to save logsstring-DOK8S_BIN_DIRDirectory to save any output (bin)stringbinDevelopmentConfigure your local developmentClonerepoon your local machineInstallcondaorminicondaCreate your local project environment (based onconda,poetry,pre-commit):$ make env(Optional) Update existing local project environment:$ make env-updateRun locallyOn a terminal, run the following (execute on project's root directory):Activate project environment:$ . ./scripts/helpers/environment.shRun the CLI usingpoetry:$ dok8sContribute[ Not Available ]Testing(part of CI/CD)[ Work in progress... ]To run the tests, open a terminal and run the following (execute on project's root directory):Activate project environment:$ . ./scripts/helpers/environment.shTo run pytest:$ make testTo check test coverage:$ make test-coverageVersioningIncrement the version number:$ poetry version {bump rule}where valid bump rules are:patchminormajorprepatchpreminorpremajorprereleaseChangelogUseCHANGELOG.mdto track the evolution of this package.The[UNRELEASED]tag at the top of the file should always be there to log the work until a release occurs.Work should be logged under one of the following subtitles:AddedChangedFixedRemovedOn a release, a version of the following format should be added to all the current unreleased changes in the file.## [major.minor.patch] - YYYY-MM-DDDeploymentPip packageOn a terminal, run the following (execute on project's root directory):Activate project environment:$ . ./scripts/helpers/environment.shTo build pip package:$ make build-packageTo publish pip package (requires credentials to PyPi):$ make publish-packageDocker imageOn a terminal, run the following (execute on project's root directory):Activate project environment:$ . ./scripts/helpers/environment.shTo build docker image:$ make build-dockerProductionFor production, a Docker image is used.
This image is published publicly ondocker hub.First pull image from docker hub:$ docker pull nichelia/dok8s:{version}Execute CLI via docker run:$ docker run --rm -it -v ~/dok8s_bin:/tmp/bin nichelia/dok8s:{version} {command} -d /tmp/bin -o {filename}This command mounts the application's bin (outcome) to user's root directory under dok8s_bin folder. The Kubernetes YAML files you want to parse, should be included in this directory.where version is the published application version