Skip to content

Commit

Permalink
feat:🐶 K9s full config and Transparent skin.
Browse files Browse the repository at this point in the history
  • Loading branch information
TechDufus committed Sep 16, 2024
1 parent e7b4db1 commit 7006738
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 141 deletions.
61 changes: 61 additions & 0 deletions roles/k9s/files/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# $XDG_CONFIG_HOME/k9s/config.yaml
k9s:
# Enable periodic refresh of resource browser windows. Default false
liveViewAutoRefresh: false
# The path to screen dump. Default: '%temp_dir%/k9s-screens-%username%' (k9s info)
screenDumpDir: /tmp/dumps
# Represents ui poll intervals. Default 2secs
refreshRate: 2
# Number of retries once the connection to the api-server is lost. Default 15.
maxConnRetry: 5
# Indicates whether modification commands like delete/kill/edit are disabled. Default is false
readOnly: false
# Toggles whether k9s should exit when CTRL-C is pressed. When set to true, you will need to exist k9s via the :quit command. Default is false.
noExitOnCtrlC: false
#UI settings
ui:
# Enable mouse support. Default false
enableMouse: true
# Set to true to hide K9s header. Default false
headless: false
# Set to true to hide the K9S logo Default false
logoless: false
# Set to true to hide K9s crumbs. Default false
crumbsless: false
noIcons: false
# Toggles reactive UI. This option provide for watching on disk artifacts changes and update the UI live Defaults to false.
reactive: false
# By default all contexts wil use the dracula skin unless explicitly overridden in the context config file.
skin: skin # => assumes the file skins/dracula.yaml is present in the $XDG_DATA_HOME/k9s/skins directory
# Allows to set certain views default fullscreen mode. (yaml, helm history, describe, value_extender, details, logs) Default false
defaultsToFullScreen: false
# Toggles icons display as not all terminal support these chars.
noIcons: false
# Toggles whether k9s should check for the latest revision from the Github repository releases. Default is false.
skipLatestRevCheck: false
# When altering kubeconfig or using multiple kube configs, k9s will clean up clusters configurations that are no longer in use. Setting this flag to true will keep k9s from cleaning up inactive cluster configs. Defaults to false.
keepMissingClusters: false
# Logs configuration
logger:
# Defines the number of lines to return. Default 100
tail: 200
# Defines the total number of log lines to allow in the view. Default 1000
buffer: 500
# Represents how far to go back in the log timeline in seconds. Setting to -1 will tail logs. Default is -1.
sinceSeconds: 300 # => tail the last 5 mins.
# Toggles log line wrap. Default false
textWrap: false
# Toggles log line timestamp info. Default false
showTime: false
# Provide shell pod customization when nodeShell feature gate is enabled!
shellPod:
# The shell pod image to use.
image: killerAdmin
# The namespace to launch to shell pod into.
namespace: default
# The resource limit to set on the shell pod.
limits:
cpu: 100m
memory: 100Mi
# Enable TTY
tty: true
44 changes: 44 additions & 0 deletions roles/k9s/files/skin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Styles..# -----------------------------------------------------------------------------
# Transparent skin
# Preserve your terminal session background color
# -----------------------------------------------------------------------------

# Skin...
k9s:
body:
bgColor: default
prompt:
bgColor: default
info:
sectionColor: default
dialog:
bgColor: default
labelFgColor: default
fieldFgColor: default
frame:
crumbs:
bgColor: default
title:
bgColor: default
counterColor: default
menu:
fgColor: default
views:
charts:
bgColor: default
table:
bgColor: default
header:
fgColor: default
bgColor: default
xray:
bgColor: default
logs:
bgColor: default
indicator:
bgColor: default
toggleOnColor: default
toggleOffColor: default
yaml:
colonColor: default
valueColor: default *purple
111 changes: 0 additions & 111 deletions roles/k9s/files/skin.yml

This file was deleted.

13 changes: 13 additions & 0 deletions roles/k9s/tasks/MacOSX.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,16 @@
community.general.homebrew:
name: k9s
state: present

#~/Library/Application Support/k9s
# - name: "k9s | Ensure k9s config directory exists"
# ansible.builtin.file:
# path: "{{ ansible_user_dir }}/.config/k9s"
# state: directory
# mode: "0755"
#
# - name: "k9s | Copy skin config"
# ansible.builtin.copy:
# dest: "{{ ansible_user_dir }}/.config/k9s/skin.yml"
# src: "skin.yml"
# mode: "0644"
58 changes: 41 additions & 17 deletions roles/k9s/tasks/Ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,108 @@
---
- name: "k9s | Download Latest Version JSON"
- name: "K9s | Download Latest Version JSON"
ansible.builtin.uri:
url: https://api.github.com/repos/derailed/k9s/releases/latest
register: k9s_latest_version_json
changed_when: false

- name: "k9s | Registering k9s Latest Release"
- name: "K9s | Registering k9s Latest Release"
ansible.builtin.set_fact:
k9s_latest_release: "{{ k9s_latest_version_json.json.tag_name }}"

- name: "k9s | Registering k9s Latest Version"
- name: "K9s | Registering k9s Latest Version"
ansible.builtin.set_fact:
k9s_latest_version: "{{ k9s_latest_release.stdout|default('') }}"

- name: "k9s | Getting version information"
- name: "K9s | Getting version information"
ansible.builtin.shell:
cmd: |
/usr/local/bin/k9s version -s | grep -o 'v[0-9]*\.[0-9]*\.[0-9]*'
register: current_k9s_version
changed_when: false
failed_when: false

- name: "k9s | Show current_k9s_version debug"
- name: "K9s | Show current_k9s_version debug"
ansible.builtin.debug:
var: current_k9s_version.stdout

- name: "k9s | Show k9s_latest_release debug"
- name: "K9s | Show k9s_latest_release debug"
ansible.builtin.debug:
var: k9s_latest_release

- name: "k9s | Install"
- name: "K9s | Install"
block:
- name: "k9s | Define k9s_file"
- name: "K9s | Define k9s_file"
ansible.builtin.set_fact:
k9s_file: "k9s_Linux_amd64"
k9s_file: "K9s_Linux_amd64"

- name: "k9s | Ensure clean download destination"
- name: "K9s | Ensure clean download destination"
ansible.builtin.file:
path: "/tmp/{{ k9s_file }}.tar.gz"
state: absent
become: true

- name: "k9s | Downloading k9s Release"
- name: "K9s | Downloading k9s Release"
ansible.builtin.get_url:
url: "https://github.com/derailed/k9s/releases/download/{{ k9s_latest_release }}/{{ k9s_file }}.tar.gz"
dest: /tmp/
mode: 0644
mode: "0644"
force: true
notify:
- Cleanup k9s downloaded tar

- name: "k9s | Ensure clean extraction destination"
- name: "K9s | Ensure clean extraction destination"
ansible.builtin.file:
path: "/tmp/k9s"
state: absent
become: true

- name: "k9s | Extract k9s tar file"
- name: "K9s | Extract k9s tar file"
ansible.builtin.unarchive:
src: "/tmp/{{ k9s_file }}.tar.gz"
dest: /tmp

- name: "k9s | Remove any current k9s installations"
- name: "K9s | Remove any current k9s installations"
ansible.builtin.file:
path: /usr/local/bin/k9s
state: absent
become: true

- name: "k9s | Install k9s"
- name: "K9s | Install k9s"
ansible.builtin.copy:
remote_src: true
src: /tmp/k9s
dest: /usr/local/bin/
owner: "{{ host_user }}"
group: "{{ host_user }}"
force: true
mode: 0755
mode: "0755"
become: true
notify:
- Remove extracted k9s directory

when: k9s_latest_release not in current_k9s_version.stdout|default('')

- name: "K9s | Ensure k9s config directory exists"
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.config/k9s"
state: directory
mode: "0755"

# skins directory
- name: "K9s | Ensure k9s skins directory exists"
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.config/k9s/skins"
state: directory
mode: "0755"

- name: "K9s | Copy skin config"
ansible.builtin.copy:
dest: "{{ ansible_user_dir }}/.config/k9s/skins/skin.yaml"
src: "skin.yaml"
mode: "0644"

- name: "K9s | Copy config"
ansible.builtin.copy:
dest: "{{ ansible_user_dir }}/.config/k9s/config.yaml"
src: "config.yaml"
mode: "0644"
13 changes: 0 additions & 13 deletions roles/k9s/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,3 @@
- name: "{{ role_name }} | Run Tasks: {{ ansible_distribution }}"
ansible.builtin.include_tasks: "{{ ansible_distribution }}.yml"
when: distribution_config.stat.exists

- name: "k9s | Ensure k9s config directory exists"
ansible.builtin.file:
path: "{{ ansible_user_dir }}/.config/k9s"
state: directory
mode: "0755"

- name: "k9s | Copy skin config"
ansible.builtin.copy:
dest: "{{ ansible_user_dir }}/.config/k9s/skin.yml"
src: "skin.yml"
mode: "0644"

0 comments on commit 7006738

Please sign in to comment.