From 7006738b8189ad166721075e8a41dba96030cb5d Mon Sep 17 00:00:00 2001 From: TechDufus Date: Mon, 16 Sep 2024 09:34:55 -0500 Subject: [PATCH] =?UTF-8?q?feat:=F0=9F=90=B6=20K9s=20full=20config=20and?= =?UTF-8?q?=20Transparent=20skin.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/k9s/files/config.yaml | 61 ++++++++++++++++++++ roles/k9s/files/skin.yaml | 44 ++++++++++++++ roles/k9s/files/skin.yml | 111 ------------------------------------ roles/k9s/tasks/MacOSX.yml | 13 +++++ roles/k9s/tasks/Ubuntu.yml | 58 +++++++++++++------ roles/k9s/tasks/main.yml | 13 ----- 6 files changed, 159 insertions(+), 141 deletions(-) create mode 100644 roles/k9s/files/config.yaml create mode 100644 roles/k9s/files/skin.yaml delete mode 100644 roles/k9s/files/skin.yml diff --git a/roles/k9s/files/config.yaml b/roles/k9s/files/config.yaml new file mode 100644 index 00000000..76481aa4 --- /dev/null +++ b/roles/k9s/files/config.yaml @@ -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 diff --git a/roles/k9s/files/skin.yaml b/roles/k9s/files/skin.yaml new file mode 100644 index 00000000..cf9737a9 --- /dev/null +++ b/roles/k9s/files/skin.yaml @@ -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 diff --git a/roles/k9s/files/skin.yml b/roles/k9s/files/skin.yml deleted file mode 100644 index 15907cb8..00000000 --- a/roles/k9s/files/skin.yml +++ /dev/null @@ -1,111 +0,0 @@ -# Styles... -foreground: &foreground "#f8f8f2" -background: &background "default" -current_line: ¤t_line "#44475a" -selection: &selection "#44475a" -comment: &comment "#6272a4" -cyan: &cyan "#8be9fd" -green: &green "#50fa7b" -orange: &orange "#ffb86c" -pink: &pink "#ff79c6" -purple: &purple "#bd93f9" -red: &red "#ff5555" -yellow: &yellow "#f1fa8c" - -# Skin... -k9s: - # General K9s styles - body: - fgColor: *foreground - bgColor: *background - logoColor: *purple - # Command prompt styles - prompt: - fgColor: *foreground - bgColor: *background - suggestColor: *purple - # ClusterInfoView styles. - info: - fgColor: *pink - sectionColor: *foreground - # Dialog styles. - dialog: - fgColor: *foreground - bgColor: *background - buttonFgColor: *foreground - buttonBgColor: *purple - buttonFocusFgColor: *yellow - buttonFocusBgColor: *pink - labelFgColor: *orange - fieldFgColor: *foreground - frame: - # Borders styles. - border: - fgColor: *selection - focusColor: *current_line - menu: - fgColor: *foreground - keyColor: *pink - # Used for favorite namespaces - numKeyColor: *pink - # CrumbView attributes for history navigation. - crumbs: - fgColor: *foreground - bgColor: *current_line - activeColor: *current_line - # Resource status and update styles - status: - newColor: *cyan - modifyColor: *purple - addColor: *green - errorColor: *red - highlightcolor: *orange - killColor: *comment - completedColor: *comment - # Border title styles. - title: - fgColor: *foreground - bgColor: *current_line - highlightColor: *orange - counterColor: *purple - filterColor: *pink - views: - # Charts skins... - charts: - bgColor: default - defaultDialColors: - - *purple - - *red - defaultChartColors: - - *purple - - *red - # TableView attributes. - table: - fgColor: *foreground - bgColor: *background - cursorFgColor: *foreground - cursorBgColor: *current_line - # Header row styles. - header: - fgColor: *foreground - bgColor: *background - sorterColor: *cyan - # Xray view attributes. - xray: - fgColor: *foreground - bgColor: *background - cursorColor: *current_line - graphicColor: *purple - showIcons: false - # YAML info styles. - yaml: - keyColor: *pink - colonColor: *purple - valueColor: *foreground - # Logs styles. - logs: - fgColor: *foreground - bgColor: *background - indicator: - fgColor: *foreground - bgColor: *purple diff --git a/roles/k9s/tasks/MacOSX.yml b/roles/k9s/tasks/MacOSX.yml index 6d85b94f..bc8b4453 100644 --- a/roles/k9s/tasks/MacOSX.yml +++ b/roles/k9s/tasks/MacOSX.yml @@ -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" diff --git a/roles/k9s/tasks/Ubuntu.yml b/roles/k9s/tasks/Ubuntu.yml index 2f1c61b3..975a1560 100644 --- a/roles/k9s/tasks/Ubuntu.yml +++ b/roles/k9s/tasks/Ubuntu.yml @@ -1,19 +1,19 @@ --- -- 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]*' @@ -21,53 +21,53 @@ 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 @@ -75,10 +75,34 @@ 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" diff --git a/roles/k9s/tasks/main.yml b/roles/k9s/tasks/main.yml index e7c208c0..4e1c9095 100644 --- a/roles/k9s/tasks/main.yml +++ b/roles/k9s/tasks/main.yml @@ -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" -