Compare commits

..

186 Commits

Author SHA1 Message Date
de8451e12b Switched hiddenbar for ice
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-07 07:07:35 +01:00
3d836bc810 Added spotmenu
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-07 06:56:58 +01:00
066e482fd8 Added Gifski
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-07 06:47:16 +01:00
c6a9a90dde Cleaned up GS leftovers
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-07 06:36:53 +01:00
1d34f433ef Removed GS tools
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-07 06:34:18 +01:00
8be57f1430 Handle removing old tools
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-07 06:19:23 +01:00
92b9c9d927 Remove karabiner-elements
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-06 18:24:34 +01:00
9334e7adcc Added tailscale app
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-06 18:23:36 +01:00
17ad5b51fc Added 1password
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-06 18:15:42 +01:00
7c99a558f6 Fixed install of some apps and config 2025-09-06 17:14:17 +01:00
fca2d9530e Added kind-list-images
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-09-03 11:00:41 +01:00
Marcus Noble
3ad35f41c3 Update kind-create-cluster to v1.34 by default 2025-09-03 10:10:32 +01:00
d98212c757 Update FPATH
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-29 10:09:22 +01:00
c879e18a89 Fix green colour
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-27 08:02:43 +01:00
4fb6921469 Added green colour util
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-27 07:58:36 +01:00
f4e7952130 Added baobab to install list
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-10 14:55:14 +01:00
716004c46b Added gpg config
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-09 10:06:34 +01:00
e2fb52f896 Enable syntax in vim:
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-09 09:41:47 +01:00
851be03ffc Removed screen dummp dir
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-07 20:47:39 +01:00
f7259cf9af Added more apps
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-07 20:47:22 +01:00
6bb71f487c Fix k9s screen dump dir
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-07 16:47:12 +01:00
2ad80a9c67 Added some more Mac-specific apps / installs
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-06 13:01:39 +02:00
14bc3b3b7c Various updates
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-06-06 09:57:01 +02:00
3e48fec287 Update git aliases to include PR link on publish
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-05-28 08:13:19 +01:00
ce1a34246e Updated k9s config
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-05-08 09:41:14 +01:00
fe5e9d9c9b Handle opening grafana via teleport
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-04-10 11:41:56 +01:00
a8f0d8d043 Fixed kind
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-02-07 13:47:10 +00:00
21f3d27493 Updated default kind version to 1.32
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-02-07 11:32:40 +00:00
18732d84e9 Added new Krew plugins - explore and blame
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-01-16 07:33:26 +00:00
58cbef9432 Added git release alias
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-01-09 05:26:37 +00:00
e8ba500810 Set git to follow tags by default
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2025-01-09 05:17:55 +00:00
14750b0260 Install opentofu
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-12-24 07:58:54 +00:00
21b88d4ec6 Upgraded default kind version
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-11-03 08:46:34 +00:00
74888271aa Added a kube-empty-namespace helper
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-09-19 09:54:39 +01:00
aab2b2a52f Added flag to skip confirmation when force-deleting
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-09-17 12:28:58 +01:00
2d78ed73c9 Added gs-ssh
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-08-30 13:42:25 +01:00
c305a854eb Fix path order
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-08-20 20:03:24 +01:00
d501fc75d0 Added kpexec
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-07-26 07:00:45 +01:00
5eaee93d3e Dont use prerelease when upgrading talos
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-07-19 11:58:47 +01:00
1e6b1a9c92 Added script to handle upgrading talos
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-06-24 10:26:01 +01:00
79fd63ec78 Added autorise
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-06-13 08:30:31 +01:00
951bbcc7fd Handle non-namespaced resouces
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-06-07 13:18:56 +01:00
a1cd7f9eae Fix standup/teardown
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-05-03 15:32:59 +01:00
aae5d5791d Updated standup/teardown
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-05-03 15:17:43 +01:00
7a7ceaa3bd Fix repo creation
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-04-25 10:32:35 +01:00
b7ab28935b Added azure-cli
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-04-04 11:32:10 +01:00
b60bf05177 Support audit policy when creating kind cluster
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-03-04 15:17:22 +00:00
028487c55a Ensure teleport cache directory is symlink
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-21 15:48:00 +00:00
071195304d Remove kubectx
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-20 08:50:40 +00:00
329f4124ae Updated kube-shell to work in rerstricted clusters
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-15 12:23:54 +00:00
d7469d40ae Added an --all flag to flux-pause
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-13 12:44:24 +00:00
e1aad7b032 Fix typo
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-12 09:05:49 +00:00
9c67d15489 Fix standup and teardown scripts
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-12 08:00:25 +00:00
67a6f50ca7 Fix gs-login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-09 16:05:53 +00:00
6e93ae0969 Added gron
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-06 19:09:43 +00:00
6b44bf8ecc Added renovate-prs
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-02-06 19:09:29 +00:00
45c9d5afcb Stop brew updating everything all the time
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-01-21 18:26:04 +00:00
09a3059378 Added standup/teardown helpers
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-01-21 18:25:02 +00:00
625aa58ce9 Added support for Teleport to gs-login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2024-01-18 09:08:17 +00:00
4bd7292f23 Added kubectl-iam4sa
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-12-01 08:01:12 +00:00
d207414434 Added Civo CLI
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-10-04 09:51:42 +01:00
0f584fd297 Added talosctl
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-10-03 17:22:01 +01:00
a822f82708 Add correct python bin dir to PATH
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-09-22 15:32:19 +01:00
4c10b4fb94 Remove python install dir from PATH
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-09-22 15:26:26 +01:00
ce98d5da65 Added Python install dir to PATH
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-09-22 15:23:40 +01:00
6e64c9dd6a Update kind kubeconfig
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-09-01 17:26:01 +01:00
5650fc8fdb Added kind helpers
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-09-01 16:44:24 +01:00
80710a2ccf Install openssh
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-08-17 07:26:14 +01:00
34ba64ab24 Ensure local dnsmasq is used for wifi
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-08-14 06:57:56 +01:00
1bbe379a34 Set DOCKER_HOST env var
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-07-06 10:17:43 +01:00
a0a1834112 Prevent pushing branches to kubernetes repos directly
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-07-03 09:06:07 +01:00
c44a00fbcb Ensure git publish uses fork remote if found
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-06-20 08:50:31 +01:00
4b3373f76f Fix namespace on flux-pause
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-06-08 10:29:45 +01:00
80ee8996de Speed up zsh startup
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-06-01 11:35:50 +01:00
3d1da1e586 Added flux-pause
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-05-12 10:52:15 +01:00
7f795ef69a Added Crane
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-05-12 09:10:08 +01:00
3df7db747b Checkout repo after create
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-04-13 07:13:10 +01:00
1cd2abbcc4 Added jq and yq testers
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-04-04 08:39:24 +01:00
b0a62568e9 Added tkn tab completion
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-03-31 07:45:22 +01:00
b2487b3642 Updated gs-create-repo
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-03-24 10:49:51 +00:00
642f685a03 Added watch
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-02-17 11:20:40 +00:00
4338fae15f Updated flux-refresh
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-02-02 15:33:07 +00:00
6336e83371 Added flux-refresh-all
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-02-01 18:42:20 +00:00
c306923371 Added flux
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-01-27 08:55:13 +00:00
2b6ac7ee27 Fixed gs-create-repo
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-01-23 09:18:49 +00:00
3d41d240b0 Fixed kube-schedule-anywhere
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-01-16 12:22:13 +00:00
c57251d4d5 Updated fzf usage and updated kube-ssh to use kubectl debug
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-01-04 23:38:25 +00:00
2a59d2b677 Changed location of symlinked gnu tools
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2023-01-04 23:38:03 +00:00
08c0c58227 Added util to lookup ec2 type availability
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-12-16 15:11:27 +00:00
5d22f6edc9 Disable AWS CLI pager output
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-12-15 13:17:00 +00:00
9d4ee4e95b Added podman
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-11-21 13:45:20 +00:00
b65b3ee032 Added kube-schedule-anywhere
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-11-21 13:45:05 +00:00
8ac6aef897 Added flux utils
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-11-11 14:39:30 +00:00
cdbd89cf3f Added kubeseal
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-11-07 18:54:50 +00:00
5064c29cb4 Added pulumi
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-11-06 14:29:37 +00:00
8795465b80 Use gnu base64
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-10-28 15:54:44 +01:00
e15ca89f5b Fixed quotes
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-10-28 07:38:54 +01:00
64fe2474da Better gnu util handling
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-10-28 07:22:31 +01:00
0eb4663dab Added bashrc
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-10-28 07:04:39 +01:00
a1d663d0d6 Added gnu sed
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-10-28 07:03:26 +01:00
a6d474a93f Fixed force deleting core resources
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-10-25 09:51:33 +01:00
1127b5fc64 Remove keepingyouawake
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-24 11:59:53 +01:00
1aa3722c02 Added find-empty-dirs
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-18 11:25:31 +01:00
53f6c16cf3 Added more mac apps
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-18 11:18:44 +01:00
855c741b0b Better handling of installed git
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-10 19:44:22 +01:00
7dd94b20e5 Pull out mac specific brew apps
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-09 08:58:02 +01:00
6870e67472 Fix apt
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-09 08:40:27 +01:00
2ffd1172bf More linux improvements
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-09 07:31:06 +01:00
9271bddf7a Linux improvements
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-09 07:04:34 +01:00
6b4546694b Switched to doggo
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-09-08 17:56:38 +01:00
b5b6d450eb Added golangci-lint
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-08-24 14:39:18 +01:00
03b058f685 Updated gs-create-repo with all steps
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-08-17 15:17:02 +01:00
5d965ade68 Added gs-create-repo command
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-08-17 12:41:22 +01:00
31ec51f982 Update gs-create-cluster for CAPA clusters
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-08-17 11:51:20 +01:00
0e3be2cb83 Added dnsmasq
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-08-15 16:33:30 +01:00
5b3cbc4cbd Fix typo
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-08-11 09:35:57 +01:00
375ae575e5 Added ssh hostname to starship config
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-08-06 21:56:42 +01:00
88474c7831 Updated kube-ssh to use alpine
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-07-15 08:00:35 +01:00
c991af3e0f Added auto update and tab completion for GS utils
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-07-15 07:53:44 +01:00
f363cabe84 Ensure AWS_PROFILE is unset
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-07-15 07:51:06 +01:00
93134c7f30 Added HA CLI
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-07-11 05:55:11 +01:00
cbe4bdc0d7 Switch to main after gs-release
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-07-08 07:53:28 +01:00
35853c10c2 Update default GCP project used
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-07-08 06:04:09 +01:00
6009f16f95 Start ssh agent
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-07-08 06:03:40 +01:00
5a5fa09e70 Added Viddy
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-06-26 10:00:42 +01:00
c49f1f1fc6 Improved output
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-06-22 09:07:06 +01:00
10a9883a84 Updated gs-create-cluster
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-06-17 06:32:41 +01:00
6680689910 Added kube-count-events
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-04-29 16:22:55 +02:00
b25a5c4c8d Tweaked kube-force-delete
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-04-06 05:54:27 +01:00
c5233d41e7 Updated force delete to take a label selector
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-04-05 21:26:27 +01:00
6c7aee7b93 Added litractl for controlling Litra Glow
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-04-01 16:11:01 +01:00
1313900363 Updated GPG
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-04-01 16:10:41 +01:00
843e1c6d20 Added git co alias
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-28 10:51:53 +01:00
e918596757 Added kapp
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-23 06:57:36 +00:00
37817394c4 Added tz
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-23 06:54:21 +00:00
475b4d3b5f Silence output
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-18 07:37:01 +00:00
28b8a20ff9 Removed GS specific aliases
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-18 07:36:52 +00:00
15ae2e615a Fixed disable webhook script
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-15 09:29:05 +00:00
4528e35872 Disable/enable webhooks
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-11 18:38:47 +00:00
381adefe87 Make things pretty
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-11 18:38:32 +00:00
b9647b569d More style tweaks
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-04 15:03:28 +00:00
03ec3eea98 Made things pretty
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-04 14:05:47 +00:00
d0b7ffb63b Added kube-force-delete script
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-03 09:22:27 +00:00
37497ee10a Added gs-open command:
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-02 07:56:15 +00:00
a08cb76510 Removed GS specific completion setup
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-02 07:46:04 +00:00
495da19e85 Added script for handling AWS CLI login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-01 11:50:41 +00:00
dfba592831 Ensure new context used each login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-01 11:49:13 +00:00
0ab4e25456 Handle new repos with no tags
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-03-01 11:48:47 +00:00
758298694c Updated gs-login to remove old flags
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-02-22 10:16:24 +00:00
8dcba62bee Added script to update GS tools
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-02-22 08:42:51 +00:00
18bd3c0985 Updated gs-login to support new opsctl login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-02-21 14:17:10 +00:00
99a1ef4575 Added jless install
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-02-21 14:16:52 +00:00
4b006c5c43 Added kube-restarting
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-02-07 12:26:58 +00:00
ecb3beec8f Added lastpass CLI 2022-01-26 10:26:33 +00:00
693bb7a0e9 Added Vale
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-25 06:22:53 +00:00
9bb937fbe3 Fixed namespace
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-20 15:02:02 +00:00
f50d6136b9 Added kube-template and kube-trigger-cronjob
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-20 08:58:17 +00:00
6462c06743 Switch yq binary
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-20 08:57:46 +00:00
dc6bf17452 Added release notes to gs-release
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-19 11:18:11 +00:00
4265bf76ce Added tabby to install list
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-09 19:06:41 +00:00
ee191f8bd2 Added tabby
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-09 14:28:57 +00:00
f13e42df13 Added stats and stern install
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-07 08:03:52 +00:00
6e2ad466d7 Updated gs-login to support old orgs in default
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-05 06:16:01 +00:00
e8fd0e0be6 Added vault cli
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2022-01-04 11:46:34 +00:00
bca70e0e01 Fix install script
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-24 10:29:45 +00:00
e3dcb1da3d Fixed bash arrays in gs-release
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-17 07:25:45 +00:00
1568e5a56f Ensure default namespace is used
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-15 10:46:43 +00:00
fc58941ad1 Added more krew plugins
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-14 15:53:57 +00:00
1cfabac2f5 Fix login fallback
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-14 15:53:44 +00:00
d0556dc92f Cleaned up pre-flight checks
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-14 08:24:18 +00:00
d28d49cb04 Ensure MC context is updated each time gs-login is used
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-14 08:07:58 +00:00
3024bbd0cc Added lookup for MC if no args given to gs-login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-14 07:49:42 +00:00
586538f14f Catch errors rather than exit early
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-13 15:11:38 +00:00
56e07cfd24 Set kubeconfig file on login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-13 15:11:17 +00:00
f79c757168 Install yq
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-13 15:11:01 +00:00
83978cc429 Fix namespace selector
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-08 08:34:05 +00:00
1dfe84005b Fix bash substring for older bash
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-08 08:22:05 +00:00
927cf87bae MC login fallback if Dex down
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-07 13:04:19 +00:00
622b9b16a8 Fix gs-login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-07 12:44:20 +00:00
b1ca06ca1c Improved gs-login
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-07 10:08:44 +00:00
6ab3606e20 Fix defaul namespace if not in config
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-06 09:34:16 +00:00
8752ee0267 Ignore kube clusters
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-06 07:41:58 +00:00
fd2f36cab0 Added git push config
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-06 07:41:33 +00:00
21dc2e7a00 Update git take command
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-03 18:42:46 +00:00
0b43014820 Ignore kube files
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-03 18:23:52 +00:00
09248c19cd Fix exec perm
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-12-03 18:20:33 +00:00
68 changed files with 2470 additions and 598 deletions

7
.gitignore vendored
View File

@@ -25,3 +25,10 @@
/os-specific/darwin/home/.gnupg/*
!/os-specific/darwin/home/.gnupg/gpg-agent.conf
/home/.kube/*
!/home/.kube/clusters/.gitkeep
!/home/.kube/switch-config.yaml
/home/.k9s/benchmarks
/home/.k9s/clusters
/home/.k9s/screen-dumps

2
home/.bashrc Normal file
View File

@@ -0,0 +1,2 @@
alias date='gdate'
alias sed='gsed'

55
home/.bin/.utils Normal file
View File

@@ -0,0 +1,55 @@
END_CHARS="\e[0m\n"
tput colors &>/dev/null
if [ $? -eq 0 ]; then
bold() {
printf "\e[1m$@${END_CHARS}"
}
italic() {
printf "\e[3m$@${END_CHARS}"
}
underline() {
printf "\e[4m$@${END_CHARS}"
}
orange() {
printf "\e[38;5;208m$@${END_CHARS}"
}
blue() {
printf "\e[38;5;75m$@${END_CHARS}"
}
green() {
printf "\e[32;5;75m$@${END_CHARS}"
}
else
bold() {
echo $@
}
italic() {
echo $@
}
underline() {
echo $@
}
orange() {
echo $@
}
blue() {
echo $@
}
green() {
echo $@
}
fi
_fzf() {
fzf --multi --ansi -i -1 --height=50% --reverse -0 --header-lines=1 --border --info=hidden
}

View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
source .utils
REGIONS=( $(aws ec2 describe-regions --region eu-west-1 | jq -r '.Regions[].RegionName') )
INSTANCE_TYPES=()
print_usage() {
orange "aws-instance-type-availability - check EC2 instance type availability in all regions"
echo " "
underline "Usage:"
echo "aws-instance-type-availability [instance type IDs]"
echo " "
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
INSTANCE_TYPES+=${1}
break
;;
esac
done
for INSTANCE in "${INSTANCE_TYPES[@]}"; do
blue "${INSTANCE} availability:"
for REGION in "${REGIONS[@]}"; do
aws ec2 describe-instance-type-offerings --filters Name=instance-type,Values=${INSTANCE} --region ${REGION} | jq -r '.InstanceTypeOfferings[0].Location | select( . != null )'
done
echo ""
done

68
home/.bin/flux-pause Executable file
View File

@@ -0,0 +1,68 @@
#!/usr/bin/env bash
source .utils
set -e
VERBOSE=""
ALL=""
TARGET_RESOURCE="kustomization"
NAMESPACES="-n flux-system"
print_usage() {
blue "flux-pause - Suspends Flux Kustomization resources"
echo " "
underline "Usage:"
echo "flux-pause [options] RESOURCE_NAME..."
echo " "
underline "Options:"
echo " --all pause all Kustomizations"
echo "-n, --namespace the namespace resources belong in. Default: flux-system"
echo "-v --verbose show full verbose output"
echo "-h, --help show this help text"
}
RESOURCES=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
-n|--namespace)
shift
NAMESPACES="-n $1"
shift
;;
-v|--verbose)
VERBOSE="true"
shift
;;
--all)
ALL="true"
shift
;;
*)
RESOURCES+=(${1})
shift
;;
esac
done
if [[ "${ALL}" == "true" ]]; then
RESOURCES=$(kubectl get kustomization ${NAMESPACES} -o json | jq -r '.items[] | "\( .metadata.name)"')
fi
for RESOURCE in ${RESOURCES[@]}
do
printf "Pausing '${RESOURCE}'..."
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux suspend kustomization ${NAMESPACES} ${RESOURCE} || true
else
flux suspend kustomization ${NAMESPACES} ${RESOURCE} &> /dev/null || true
printf " ✅"
fi
echo ""
done

129
home/.bin/flux-refresh Executable file
View File

@@ -0,0 +1,129 @@
#!/usr/bin/env bash
source .utils
set -e
VERBOSE=""
TARGET_RESOURCE="all"
NAMESPACES="-A"
print_usage() {
blue "flux-refresh - Refresh all flux resources"
echo " "
underline "Usage:"
echo "flux-refresh [options]"
echo " "
underline "Options:"
echo "-t, --type the resource type to target. Valid options: gitrepo, helmrepository, kustomization, helmrelease & all. Default: all"
echo "-n, --namespace the namespace resources belong in. Default: all namespaces"
echo " --verbose show full verbose output"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
-t|--type)
shift
TARGET_RESOURCE=$1
shift
;;
-n|--namespace)
shift
NAMESPACES="-n $1"
shift
;;
--verbose)
VERBOSE="true"
shift
;;
*)
shift
;;
esac
done
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "gitrepo" ]]; then
GITREPOS=$(kubectl get gitrepo ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
fi
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "helmrepository" ]]; then
HELMREPOS=$(kubectl get helmrepository ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
fi
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "kustomization" ]]; then
KUSTOMIZATIONS=$(kubectl get kustomization ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
fi
if [[ "${TARGET_RESOURCE}" == "all" || "${TARGET_RESOURCE}" == "helmrelease" ]]; then
HEALMRELEASES=$(kubectl get helmrelease ${NAMESPACES} -o json | jq -r '.items[] | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
fi
if [[ "${GITREPOS}" != "" ]]; then
blue "Refreshing GitRepositories"
for RESOURCE in ${GITREPOS}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
printf "${PARTS[0]}/${PARTS[2]}"
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux reconcile source git -n ${PARTS[0]} ${PARTS[2]} || true
else
flux reconcile source git -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
printf " ✅"
fi
echo ""
done
fi
if [[ "${HELMREPOS}" != "" ]]; then
blue "Refreshing HelmRepositories"
for RESOURCE in ${HELMREPOS}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
printf "${PARTS[0]}/${PARTS[2]}"
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux reconcile source helm -n ${PARTS[0]} ${PARTS[2]} || true
else
flux reconcile source helm -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
printf " ✅"
fi
echo ""
done
fi
if [[ "${KUSTOMIZATIONS}" != "" ]]; then
blue "Refreshing Kustomizations"
for RESOURCE in ${KUSTOMIZATIONS}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
printf "${PARTS[0]}/${PARTS[2]}"
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux reconcile kustomization -n ${PARTS[0]} ${PARTS[2]} || true
else
flux reconcile kustomization -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
printf " ✅"
fi
echo ""
done
fi
if [[ "${HEALMRELEASES}" != "" ]]; then
blue "Refreshing HelmReleases"
for RESOURCE in ${HEALMRELEASES}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
printf "${PARTS[0]}/${PARTS[2]}"
if [[ "${VERBOSE}" == "true" ]]; then
echo ""
flux reconcile helmrelease -n ${PARTS[0]} ${PARTS[2]} || true
else
flux reconcile helmrelease -n ${PARTS[0]} ${PARTS[2]} &> /dev/null || true
printf " ✅"
fi
echo ""
done
fi

43
home/.bin/flux-resume-all Executable file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env bash
source .utils
set -e
print_usage() {
blue "flux-resume-all - Resume all flux resources"
echo " "
underline "Usage:"
echo "flux-resume-all [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
KUSTOMIZATIONS=$(kubectl get kustomization -A -o json | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
GITREPOS=$(kubectl get gitrepo -A -o json | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .kind)/\( .metadata.name)"')
if [[ "${KUSTOMIZATIONS}" == "" ]] && [[ "${GITREPOS}" == "" ]]; then
italic "Nothing to resume"
fi
for RESOURCE in ${KUSTOMIZATIONS} ${GITREPOS}
do
PARTS=($(echo ${RESOURCE} | tr '[:upper:]' '[:lower:]' | tr "/" "\n"))
blue "Resuming ${PARTS[1]} - ${PARTS[0]}/${PARTS[2]}"
kubectl patch ${PARTS[1]} -n ${PARTS[0]} ${PARTS[2]} -p '{"spec":{"suspend":null}}' --type merge
done

37
home/.bin/flux-state Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
source .utils
set -e
print_usage() {
blue "flux-state - Check if any Flux resources are suspended"
echo " "
underline "Usage:"
echo "flux-state [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
blue "'kustomization' resources:"
KUSTOMIZATIONS=$(kubectl get kustomization -A -o json)
echo ${KUSTOMIZATIONS} | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .metadata.name) - ⚠Suspended"' | column -t
echo ${KUSTOMIZATIONS} | jq -r '.items[] | select(.spec.suspend!=true) | "\(.metadata.namespace)/\( .metadata.name) - ⚡Active"' | column -t
echo ""
blue "'gitrepo' resources:"
GITREPOS=$(kubectl get gitrepo -A -o json)
echo ${GITREPOS} | jq -r '.items[] | select(.spec.suspend==true) | "\(.metadata.namespace)/\( .metadata.name) - ⚠Suspended"' | column -t
echo ${GITREPOS} | jq -r '.items[] | select(.spec.suspend!=true) | "\(.metadata.namespace)/\( .metadata.name) - ⚡Active"' | column -t

View File

@@ -1,76 +0,0 @@
#!/usr/bin/env bash
set -e
NAMESPACE="org-giantswarm"
RELEASE="20.0.0-alpha1"
PROVIDER="aws"
AZS="eu-west-1a"
print_usage() {
echo "gs-create-cluster - create a Giant Swarm managed workload cluster"
echo " "
echo "gs-create-cluster [cluster-name]"
echo " "
echo " "
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the cluster is in (default: org-giantswarm)"
echo "-r, --release the namespace the cluster is in (default: 20.0.0-alpha1)"
echo "-p, --provider the cloud provider to use (default: aws)"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-r|--release)
shift
RELEASE=$1
shift
;;
-p|--provider)
shift
PROVIDER=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
# Positional args
NAME=${1:-wc001}
PREFIXED_NAMESPACE="org-$NAMESPACE"
case $NAMESPACE in org-*)
PREFIXED_NAMESPACE="$NAMESPACE"
NAMESPACE=${NAMESPACE#"org-"}
esac
echo "✨ Pre-flight checks"
gs-get-cluster --namespace ${PREFIXED_NAMESPACE} ${NAME} &>/dev/null
if [ $? -eq 0 ]; then
echo "Cluster named '${NAME}' already exists"
exit 1
else
echo "Cleaning up any old awsclusterroleidentities..."
kubectl get --namespace ${PREFIXED_NAMESPACE} awsclusterroleidentities ${NAME} >/dev/null && kubectl delete --namespace ${PREFIXED_NAMESPACE} awsclusterroleidentities ${NAME}
fi
echo "✨ Creating an ${PROVIDER} cluster called '${NAMESPACE}/${NAME}' with release '${RELEASE}'"
kubectl-gs template cluster --provider ${PROVIDER} --release ${RELEASE} --organization ${NAMESPACE} --name ${NAME} --description "$(whoami)'s test cluster" | kubectl apply -f -
echo "✨ Adding node pool to cluster"
kubectl-gs template nodepool --provider ${PROVIDER} --release ${RELEASE} --organization ${NAMESPACE} --cluster-name ${NAME} --description "$(whoami)'s test cluster" --availability-zones ${AZS} | kubectl apply -f -
echo "✨ Checking status..."
gs-get-cluster --namespace ${PREFIXED_NAMESPACE} ${NAME}

View File

@@ -1,35 +0,0 @@
#!/usr/bin/env bash
set -e
NAMESPACE="org-giantswarm"
print_usage() {
echo "gs-get-cluster - get a Giant Swarm managed workload cluster"
echo " "
echo "gs-get-cluster [cluster-name]"
echo " "
echo " "
echo "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the cluster is in (default: org-giantswarm)"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
kubectl-gs get cluster --namespace $NAMESPACE $@ 2>/dev/null || kubectl get cl --namespace $NAMESPACE $@

View File

@@ -1,59 +0,0 @@
#!/usr/bin/env bash
set -e
TTL="24h"
CERTIFICATE_GROUP="system:masters"
print_usage() {
echo "gs-login - login to Giant Swarm managed clusters"
echo " "
echo "gs-login [INSTALLATION] [WORKLOAD CLUSTER] [ORGANISATION]"
echo " "
echo "Examples:"
echo "> gs-login gauss"
echo "> gs-login gauss mywc1"
echo " "
echo "Options:"
echo "-h, --help show this help text"
echo "-t, --ttl the certificate ttl for the workload cluster login (default: 24h)"
echo "-g, --certificate-group the certificate group to login as on the workload cluster (default: system:masters)"
}
while test $# -gt 0; do
case "$1" in
-t|--ttl)
shift
TTL=$1
shift
;;
-g|--certificate-group)
shift
CERTIFICATE_GROUP=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
case $# in
1)
kubectl gs login $1 2>/dev/null || opsctl kgs login -i $1
;;
2)
kubectl gs login $1 --workload-cluster $2 --certificate-group system:masters --certificate-ttl 24h
;;
3)
kubectl gs login $1 --workload-cluster $2 --certificate-group system:masters --certificate-ttl 24h --organization $3
;;
*)
print_usage
exit 1
;;
esac

View File

@@ -1,103 +0,0 @@
#!/usr/bin/env bash
set -e
print_usage() {
echo "gs-release - create a new release of a Giant Swarm repo"
echo " "
echo "gs-release [SEMVER LEVEL]"
echo " "
echo " "
echo "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
SEMVER=$1
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
MAIN_BRANCH=$(git remote show origin 2>/dev/null|grep HEAD|sed 's/.* //')
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
if [ "$MAIN_BRANCH" != "$CURRENT_BRANCH" ]; then
echo "Not currently on main branch, please switch to ${MAIN_BRANCH} to perform a release"
exit 1
fi
VERSION_PARTS=($(echo $CURRENT_TAG | tr "." "\n"))
VERSION_MAJOR=${VERSION_PARTS[1]}
VERSION_MINOR=${VERSION_PARTS[2]}
VERSION_PATCH=${VERSION_PARTS[3]}
echo "The latest released version is ${CURRENT_TAG}"
echo ""
if [[ "$SEMVER" == "" ]]; then
printf "What semver release level? (patch, minor or major): "
read SEMVER
fi
case ${SEMVER} in
patch)
VERSION_PATCH=$((VERSION_PATCH+1))
;;
minor)
VERSION_MINOR=$((VERSION_MINOR+1))
VERSION_PATCH=0
;;
major)
if [[ ${VERSION_MAJOR:0:1} == "v" ]]; then
VERSION_MAJOR="v$((VERSION_MAJOR+1))"
else
VERSION_MAJOR=$((VERSION_MAJOR+1))
fi
VERSION_MINOR=0
VERSION_PATCH=0
;;
*)
echo "Unknown Semver level provided"
exit 1
;;
esac
NEW_VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
NEW_BRANCH="${MAIN_BRANCH}#release#${NEW_VERSION}"
echo ""
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
echo "Current version ${CURRENT_TAG}"
echo " New version ${NEW_VERSION}"
echo " Release branch ${NEW_BRANCH}"
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
echo ""
printf "Confirm? (y/n): "
read CONFIRM
if [ "${CONFIRM}" = "y" ]; then
echo "Publishing new release branch..."
git checkout -b "${NEW_BRANCH}"
git push -u origin "${NEW_BRANCH}"
ORG_NAME=$(git remote get-url origin | sed 's/.*github.com[:|\/]//' | sed 's/\.git$//' | tr '/' ' ' | awk '{print $1}')
REPO_NAME=$(git remote get-url origin | sed 's/.*github.com[:|\/]//' | sed 's/\.git$//' | tr '/' ' ' | awk '{print $2}')
echo "🚀 Keep an eye on https://github.com/${ORG_NAME}/${REPO_NAME}/pulls for the new release PR"
else
echo "Aborting..."
exit 1
fi

37
home/.bin/jq-test Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
source .utils
print_usage() {
orange "jq-test - interactively use JQ against a json file"
echo " "
underline "Usage:"
echo "jq-test [FILE]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
POS_ARGS+=$1
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -eq 0 ]
then
print_usage
exit 0
fi
echo '' | fzf --preview "jq {q} < ${POS_ARGS[@]}"

141
home/.bin/kind-create-cluster Executable file
View File

@@ -0,0 +1,141 @@
#!/usr/bin/env bash
source .utils
NAME=""
VERSION="1.34.0@sha256:7416a61b42b1662ca6ca89f02028ac133a309a2a30ba309614e8ec94d976dc5a"
NODES="2"
FEATURE_GATES="MutatingAdmissionPolicy"
RUNTIME_CONFIG="admissionregistration.k8s.io/v1alpha1"
AUDIT_POLICY=""
print_usage() {
orange "kind-create-cluster - create a Kind cluster"
echo " "
underline "Usage:"
echo "kind-create-cluster [cluster-name]"
echo " "
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-v, --version the version of kubernetes to use (default: ${VERSION})"
echo "-n, --nodes the number of worker nodes (default: ${NODES})"
echo "-f, --feature-gates a comma seperated list of feature-gates to enable (default: ${FEATURE_GATES})"
echo "-r, --runtime-config a comma seperated list of API versions to enable (default: ${RUNTIME_CONFIG})"
echo " --audit-policy a file containing the audit policy config"
}
while test $# -gt 0; do
case "$1" in
-n|--nodes)
shift
NODES=$1
shift
;;
-v|--version)
shift
VERSION=$1
shift
;;
-f|--feature-gates)
shift
FEATURE_GATES=$1
shift
;;
-r|--runtime-config)
shift
RUNTIME_CONFIG=$1
shift
;;
--audit-policy)
shift
AUDIT_POLICY=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
# Positional args
NAME=${1:-$(LC_ALL=C tr -dc a-z </dev/urandom | head -c 10)}
function node() {
TYPE=$1
COUNT=$2
for ((i = 1 ; i <= $COUNT ; i++)); do
echo "- role: ${TYPE}"
echo " image: kindest/node:${VERSION}"
if [[ "${AUDIT_POLICY}" != "" ]]; then
if [[ "${TYPE}" == "control-plane" ]]; then
echo " kubeadmConfigPatches:"
echo " - |"
echo " kind: ClusterConfiguration"
echo " apiServer:"
echo " extraArgs:"
echo " audit-log-path: /var/log/kubernetes/kube-apiserver-audit.log"
echo " audit-policy-file: /etc/kubernetes/policies/audit-policy.yaml"
echo " extraVolumes:"
echo " - name: audit-policies"
echo " hostPath: /etc/kubernetes/policies"
echo " mountPath: /etc/kubernetes/policies"
echo " readOnly: true"
echo " pathType: "DirectoryOrCreate""
echo " - name: "audit-logs""
echo " hostPath: "/var/log/kubernetes""
echo " mountPath: "/var/log/kubernetes""
echo " readOnly: false"
echo " pathType: DirectoryOrCreate"
echo " extraMounts:"
echo " - hostPath: ${AUDIT_POLICY}"
echo " containerPath: /etc/kubernetes/policies/audit-policy.yaml"
echo " readOnly: true"
fi
fi
done
}
function feature-gates() {
if [[ "${FEATURE_GATES}" != "" ]]; then
echo "featureGates:"
FEATURES=(${FEATURE_GATES//,/ })
for f in "${FEATURES[@]}"; do
echo " \"${f}\": true"
done
fi
}
function runtime-config() {
if [[ "${RUNTIME_CONFIG}" != "" ]]; then
echo "runtimeConfig:"
RUNTIME=(${RUNTIME_CONFIG//,/ })
for f in "${RUNTIME[@]}"; do
echo " \"${f}\": true"
done
fi
}
CONFIG="kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: ${NAME}
nodes:
$(node "control-plane" 1)
$(node "worker" $NODES)
$(feature-gates)
$(runtime-config)
"
CONFIG_FILE=`mktemp`
echo "${CONFIG}" > ${CONFIG_FILE}
cat ${CONFIG_FILE}
kind create cluster --config ${CONFIG_FILE}
kind get kubeconfig --name ${NAME} > ~/.kube/clusters/kind.yaml

22
home/.bin/kind-delete-cluster Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env bash
source .utils
CONTEXT_NAME=$(kubectl config current-context | sed -e "s/kind-//")
print_usage() {
orange "kind-delete-cluster - delete a Kind cluster"
echo " "
underline "Usage:"
echo "kind-delete-cluster [cluster-name]"
echo " "
echo "If no cluster-name is provided it will attempt to get it from the current kubectl context"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
# Positional args
NAME=${1:-${CONTEXT_NAME}}
kind delete cluster --name ${NAME}

53
home/.bin/kind-list-images Executable file
View File

@@ -0,0 +1,53 @@
#!/usr/bin/env zsh
source .utils
TAG_COUNT=5
MINOR_VERSION="v1."
print_usage() {
orange "kind-list-images - List latest images for use with Kind nodes"
echo " "
underline "Usage:"
echo "kind-list-images [minor-version]"
echo " "
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --last-n-minors return the last n minor versions (default: ${TAG_COUNT})"
}
while test $# -gt 0; do
case "$1" in
-n|--last-n-minors)
shift
TAG_COUNT=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
MINOR_VERSION=$1
shift
;;
esac
done
TAGS=( $(crane ls kindest/node | sort | grep 'v1.' | grep -vE 'alpha|beta' | grep ${MINOR_VERSION}) )
declare -A latestMinor
for TAG in "${TAGS[@]}"; do
MINOR="${TAG%.*}"
latestMinor[$MINOR]=$TAG
done
RETURN_TAGS=( $(echo $latestMinor | tr ' ' '\n' | sort -r | head -n ${TAG_COUNT}) )
for TAG in "${RETURN_TAGS[@]}"; do
echo " - kindest/node:$(blue $TAG)@$(crane digest kindest/node:$TAG)"
done

22
home/.bin/kube-all Normal file → Executable file
View File

@@ -1,17 +1,20 @@
#!/usr/bin/env bash
set -e
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
LABEL=""
ALL_NAMESPACES=false
print_usage() {
echo "kube-all - A better 'kubectl get all' - actually get all Kubernetes resources, including custom resources"
blue "kube-all - A better 'kubectl get all' - actually get all Kubernetes resources, including custom resources"
echo " "
underline "Usage:"
echo "kube-all [options]"
echo " "
echo "Options:"
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in"
echo "-l, --selector the label selector to match on"
@@ -44,14 +47,17 @@ while test $# -gt 0; do
esac
done
NAMESPACED="--namespaced"
if [[ "${LABEL}" != "" ]]; then
LABEL="-l ${LABEL}"
NAMESPACED=""
fi
NAMES="$(kubectl api-resources --namespaced --verbs list -o name | tr '\n' ,)"
NAMES="$(kubectl api-resources ${NAMESPACED} --verbs list -o name | tr '\n' ,)"
if [ $ALL_NAMESPACES ]; then
kubectl get "${NAMES:0:-1}" --show-kind --ignore-not-found ${LABEL} -A
if [[ "$ALL_NAMESPACES" == "true" ]]; then
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -A 2>/dev/null
else
kubectl get "${NAMES:0:-1}" --show-kind --ignore-not-found ${LABEL} -n ${NAMESPACE}
kubectl get "${NAMES::${#NAMES}-1}" --show-kind --ignore-not-found ${LABEL} -n ${NAMESPACE} 2>/dev/null
fi

11
home/.bin/kube-clean-replicasets Normal file → Executable file
View File

@@ -1,17 +1,20 @@
#!/usr/bin/env bash
set -e
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
LABEL=""
ALL_NAMESPACES=false
print_usage() {
echo "kube-clean-replicasets - Remove all olf ReplicaSets with 0 desired pods"
blue "kube-clean-replicasets - Remove all olf ReplicaSets with 0 desired pods"
echo " "
underline "Usage:"
echo "kube-clean-replicasets [options]"
echo " "
echo "Options:"
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in"
echo "-l, --selector the label selector to match on"

29
home/.bin/kube-count-events Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
source .utils
set -e
print_usage() {
blue "kube-count-events - Counts events by type"
echo " "
underline "Usage:"
echo "kube-count-events [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
kubectl get events -A | awk '{ print $4 }' | sort | uniq -c | sort -bgr

61
home/.bin/kube-disable-webhook Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/env bash
source .utils
set -e
WEBHOOK_TYPE="mutating"
print_usage() {
blue "kube-disable-webhook - Disabled a webhook by modifying the namespace selector"
echo " "
underline "Usage:"
echo "kube-disable-webhook [options] NAME"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-t, --type the type of webhook [mutating (default), validating]"
}
while test $# -gt 0; do
case "$1" in
-t|--type)
shift
WEBHOOK_TYPE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
NAME=${1}
FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","operator":"In","values":["webhook"]}]}'
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
printf "🚫 Disabling mutating webhook ${NAME}..."
kubectl annotate mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state="$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json)" &>/dev/null
HOOKS=$(kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
for HOOK in ${HOOKS}
do
kubectl patch mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -p '{"webhooks": [{"name": "'${HOOK}'", '${FAKE_SELECTOR}'}]}' 1>/dev/null
done
printf " ✅ Done"
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
printf "🚫 Disabling validating webhook ${NAME}..."
kubectl annotate validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} previous-state="$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o json)" &>/dev/null
HOOKS=$(kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o go-template='{{range .webhooks}}{{.name}}{{"\n"}}{{end}}')
for HOOK in ${HOOKS}
do
kubectl patch validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -p '{"webhooks": [{"name": "'${HOOK}'", '${FAKE_SELECTOR}'}]}' 1>/dev/null
done
printf " ✅ Done"
else
echo "Unknown webhook type"
exit 1
fi

94
home/.bin/kube-empty-namespace Executable file
View File

@@ -0,0 +1,94 @@
#!/usr/bin/env bash
source .utils
set -e
NAMESPACE=""
CONTEXT="$(kubectl config current-context)"
print_usage() {
blue "kube-empty-namespace - Force delete all resources in the provided namespace"
echo " "
underline "Usage:"
echo "kube-empty-namespace"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo " --context sets the context from the kubeconfig to use"
echo "-n, --namespace the namespace the resources are in (required)"
}
YOLO="0"
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
--context)
shift
CONTEXT="$1"
shift
;;
--yolo)
YOLO="1"
shift
;;
*)
POS_ARGS+=(`echo $1 | tr '/' ' '`)
shift
;;
esac
done
if [[ "${NAMESPACE}" == "" ]]; then
echo "Please provide the namespace to empty"
exit 1
fi
function deleteResource() {
RES="${1//.v1/}"
kubectl --context "${CONTEXT}" patch -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE} ${RES} 1>/dev/null || printf ""
kubectl --context "${CONTEXT}" delete -n ${NAMESPACE} ${RES} 2>/dev/null || printf ""
}
printf "⚠️ This could leave cloud resources undeleted if finalizers aren't honoured ⚠️\n\n"
RESOURCES=()
if [[ "${YOLO}" == 0 ]]; then
printf "Are you sure you want to force delete all resources in '${NAMESPACE}'? (y/n): "
read CONFIRM
else
echo ""
echo ""
orange "YOLO MODE!!! (What could go wrong?!)"
CONFIRM="y"
fi
if [ "${CONFIRM}" = "y" ]; then
echo ""
echo "💣 OK, I hope you know what you're doing..."
echo "Deleting all resources in namespace '${NAMESPACE}'"
echo ""
NAMES="$(kubectl --context "${CONTEXT}" api-resources --namespaced --verbs list -o name 2>/dev/null | tr '\n' ,)"
RESOURCES=$(kubectl --context "${CONTEXT}" get "${NAMES::${#NAMES}-1}" --ignore-not-found -n ${NAMESPACE} -o go-template='{{range.items}}{{.kind}}.{{.apiVersion}}/{{.metadata.name}}{{"\n"}}{{end}}' 2>/dev/null | tr '[:upper:]' '[:lower:]' | sed -r "s|/(v.+)/|/|g")
IFS='
'
for RESOURCE in ${RESOURCES}
do
deleteResource ${RESOURCE}
done
else
echo "Aborting..."
exit 1
fi

17
home/.bin/kube-exec Normal file → Executable file
View File

@@ -1,17 +1,20 @@
#!/usr/bin/env bash
set -e
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
POD=""
CMD="sh"
print_usage() {
echo "kube-exec - execute commands within a pod"
blue "kube-exec - execute commands within a pod"
echo " "
underline "Usage:"
echo "kube-exec [options]"
echo " "
echo "Options:"
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the pod is in"
echo "-p, --pod the name of the pod"
@@ -53,9 +56,9 @@ if [[ "$POD" == "" ]]; then
exit 1
)
pod=($(kubectl get pods --all-namespaces -owide | fzf | awk '{print $1, $2}'))
POD=$pod[1]
NAMESPACE=$pod[0]
pod=($(kubectl get pods --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
POD=${pod[1]}
NAMESPACE=${pod[0]}
fi
echo kubectl exec -it --namespace $NAMESPACE $POD $CMD

113
home/.bin/kube-force-delete Executable file
View File

@@ -0,0 +1,113 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
SELECTOR=""
CONTEXT="$(kubectl config current-context)"
print_usage() {
blue "kube-force-delete - Force delete resources, even those with finalizers"
echo " "
underline "Usage:"
echo "kube-force-delete [RESOURCE_TYPE] [RESOURCE_NAME]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo " --context sets the context from the kubeconfig to use"
echo "-n, --namespace the namespace the resource is in (default: current namespace)"
}
YOLO="0"
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-l|--selector)
shift
SELECTOR="$1"
shift
;;
-h|--help)
print_usage
exit 0
;;
--context)
shift
CONTEXT="$1"
shift
;;
--yolo)
YOLO="1"
shift
;;
/)
# We want to ignore slash seperators between resource types and names
shift
;;
*)
POS_ARGS+=(`echo $1 | tr '/' ' '`)
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -lt 2 ] && [[ "${SELECTOR}" == "" ]]; then
echo "Please provide the resource type and name to delete"
exit 1
fi
function deleteResource() {
RES="${1//.v1/}"
echo "Deleting ${RES}"
kubectl --context "${CONTEXT}" patch -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE} ${RES} 1>/dev/null|| printf ""
kubectl --context "${CONTEXT}" delete -n ${NAMESPACE} ${RES} 2>/dev/null || printf ""
}
printf "⚠️ This could leave cloud resources undeleted if finalizers aren't honoured ⚠️\n\n"
RESOURCES=()
if [[ "${SELECTOR}" == "" ]]; then
printf "Are you sure you want to delete ${POS_ARGS[0]}/${POS_ARGS[1]}? (y/n): "
RESOURCES=("${POS_ARGS[0]}/${POS_ARGS[1]}")
else
printf "Are you sure you want to delete all matching '${SELECTOR}'? (y/n): "
fi
if [[ "${YOLO}" == 0 ]]; then
read CONFIRM
else
echo ""
echo ""
orange "YOLO MODE!!! (What could go wrong?!)"
CONFIRM="y"
fi
if [ "${CONFIRM}" = "y" ]; then
echo ""
echo "💣 OK, I hope you know what you're doing..."
if [[ "${SELECTOR}" != "" ]]; then
SELECTOR="-l ${SELECTOR}"
NAMES="$(kubectl --context "${CONTEXT}" api-resources --verbs list -o name 2>/dev/null | tr '\n' ,)"
RESOURCES=$(kubectl --context "${CONTEXT}" get "${NAMES::${#NAMES}-1}" --ignore-not-found ${SELECTOR} -n ${NAMESPACE} -o go-template='{{range.items}}{{.kind}}.{{.apiVersion}}/{{.metadata.name}}{{"\n"}}{{end}}' 2>/dev/null | tr '[:upper:]' '[:lower:]' | sed -r "s|/(v.+)/|/|g")
fi
IFS='
'
for RESOURCE in ${RESOURCES}
do
deleteResource ${RESOURCE}
done
else
echo "Aborting..."
exit 1
fi

12
home/.bin/kube-forward-all Normal file → Executable file
View File

@@ -1,16 +1,20 @@
#!/usr/bin/env bash
set -e
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
HOST_PORT=10001
print_usage() {
echo "kube-forward-all - create port-forwards for all pods in the given namespace"
blue "kube-forward-all - create port-forwards for all pods in the given namespace"
echo " "
underline "Usage:"
echo "kube-forward-all [options]"
echo " "
echo "Options:"
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace to launch the pod in"
echo "-p, --port the port to start at (and increment from for each service) (default: 10001)"

17
home/.bin/kube-logs Normal file → Executable file
View File

@@ -1,17 +1,20 @@
#!/usr/bin/env bash
set -e
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
POD=""
ARGS=""
print_usage() {
echo "kube-logs - tail logs from a pod"
blue "kube-logs - tail logs from a pod"
echo " "
underline "Usage:"
echo "kube-logs [options]"
echo " "
echo "Options:"
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the pod is in"
echo "-p, --pod the name of the pod to get logs for"
@@ -53,9 +56,9 @@ if [[ "$POD" == "" ]]; then
exit 1
)
pod=($(kubectl get pods --all-namespaces -owide | fzf | awk '{print $1, $2}'))
POD=$pod[1]
NAMESPACE=$pod[0]
pod=($(kubectl get pods --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
POD=${pod[1]}
NAMESPACE=${pod[0]}
fi
echo kubectl logs -f $ARGS --namespace $NAMESPACE $POD

51
home/.bin/kube-reenable-webhook Executable file
View File

@@ -0,0 +1,51 @@
#!/usr/bin/env bash
source .utils
set -e
WEBHOOK_TYPE="mutating"
print_usage() {
blue "kube-reenable-webhook - Re-enable a previously disabled webhook"
echo " "
underline "Usage:"
echo "kube-reenable-webhook [options] NAME"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-t, --type the type of webhook [mutating (default), validating]"
}
while test $# -gt 0; do
case "$1" in
-t|--type)
shift
WEBHOOK_TYPE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
NAME=${1}
FAKE_SELECTOR='"namespaceSelector":{"matchExpressions":[{"key":"disabled","operator":"In","values":["webhook"]}]}'
if [[ "${WEBHOOK_TYPE}" == "mutating" ]]; then
printf "🔌 Re-enabling mutating webhook ${NAME}..."
kubectl get mutatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o custom-columns="prev:.metadata.annotations.previous-state" --no-headers | kubectl apply -f -
printf " ✅ Done"
elif [[ "${WEBHOOK_TYPE}" == "validating" ]]; then
printf "🔌 Re-enabling validating webhook ${NAME}..."
kubectl get validatingwebhookconfigurations.admissionregistration.k8s.io ${NAME} -o custom-columns="prev:.metadata.annotations.previous-state" --no-headers | kubectl apply -f -
printf " ✅ Done"
else
echo "Unknown webhook type"
exit 1
fi

38
home/.bin/kube-restarting Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
NAMESPACE="-A"
print_usage() {
blue "kube-restarting - Show all pods with restarts"
echo " "
underline "Usage:"
echo "kube-restarting [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in (searches all if not set)"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE="-n $1"
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
kubectl get pod ${NAMESPACE} -o json | jq --raw-output '.items[] | select([.status.containerStatuses[].restartCount] | add > 0) | "\( .metadata.namespace)/\( .metadata.name) \t \([.status.containerStatuses[].restartCount] | add)" ' | column -t

View File

@@ -0,0 +1,58 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
DEPLOYMENT=""
print_usage() {
blue "kube-schedule-anywhere - modify a deployment to schedule on any node"
echo " "
underline "Usage:"
echo "kube-schedule-anywhere [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the pod is in"
echo "-d, --deployment the name of the deployment to modify"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-d|--deployment)
shift
DEPLOYMENT=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
if [[ "$DEPLOYMENT" == "" ]]; then
which fzf &>/dev/null || (
echo "If no deployment provided, fzf is required to select deployments"
echo ""
print_usage
exit 1
)
deployment=($(kubectl get deployments --all-namespaces -o wide | _fzf | awk '{print $1, $2}'))
DEPLOYMENT=${deployment[1]}
NAMESPACE=${deployment[0]}
fi
kubectl patch deployment -n ${NAMESPACE} ${DEPLOYMENT} -p '{"spec": { "template": { "spec": { "tolerations": [ { "operator": "Exists" } ] } } } }' 1>/dev/null

33
home/.bin/kube-shell Normal file → Executable file
View File

@@ -1,22 +1,25 @@
#!/usr/bin/env bash
set -e
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
POD="shell"
IMAGE="bash"
CMD="sh"
IMAGE="digitalocean/doks-debug"
CMD="bash"
print_usage() {
echo "kube-shell - create a new pod and exec into it's shell"
blue "kube-shell - create a new pod and exec into it's shell"
echo " "
underline "Usage:"
echo "kube-shell [options]"
echo " "
echo "Options:"
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the pod should launch in"
echo "-p, --pod the name of the pod to get logs for (default: shell)"
echo "-i, --image the image to use for the shell container (default: bash)"
echo "-i, --image the image to use for the shell container (default: digitalocean/doks-debug)"
echo "-c, --command the initial command to execute in the container (default: sh)"
}
@@ -52,6 +55,18 @@ while test $# -gt 0; do
esac
done
NAMESPACE=${NAMESPACE:-default}
echo kubectl run -it --namespace $NAMESPACE $POD --image $IMAGE --restart Never --rm -- $CMD
kubectl run -it --namespace $NAMESPACE $POD --image $IMAGE --restart Never --rm -- $CMD
OVERRIDES='{
"spec": {
"securityContext": {"runAsGroup": 1000,"runAsNonRoot": true,"runAsUser": 1000,"seccompProfile": {"type": "RuntimeDefault"}},
"containers": [
{
"name":"'$POD'","image":"'$IMAGE'", "command": ["'$CMD'"],
"stdin": true,"stdinOnce": true,"tty": true,
"securityContext": {"allowPrivilegeEscalation": false,"capabilities": {"drop": ["ALL"]},"privileged": false,"runAsGroup": 1000,"runAsNonRoot": true,"runAsUser": 1000,"seccompProfile": {"type": "RuntimeDefault"}}
}
]
}
}'
kubectl run -it --namespace $NAMESPACE $POD --image $IMAGE --restart Never --overrides "${OVERRIDES}" --rm -- $CMD

61
home/.bin/kube-ssh Normal file → Executable file
View File

@@ -1,21 +1,25 @@
#!/usr/bin/env bash
set -e
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}')"
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
POD="kube-ssh"
NODE=""
IMAGE="alpine"
print_usage() {
echo "kube-ssh - gain access to a Kubernetes host node (ssh-like for when a host doesn't have ssh)"
blue "kube-ssh - gain access to a Kubernetes host node (ssh-like for when a host doesn't have ssh)"
echo " "
underline "Usage:"
echo "kube-ssh [options]"
echo " "
echo "Options:"
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace to launch the pod in"
echo "-p, --pod the name of the pod to launch (default: kube-ssh)"
echo "-N, --node the name of the node to access"
echo "-i, --image the image to launch for debugging (default: alpine)"
}
while test $# -gt 0; do
@@ -25,16 +29,16 @@ while test $# -gt 0; do
NAMESPACE=$1
shift
;;
-p|--pod)
shift
POD=$1
shift
;;
-N|--node)
shift
NODE=$1
shift
;;
-i|--image)
shift
IMAGE=$1
shift
;;
-h|--help)
print_usage
exit 0
@@ -46,9 +50,9 @@ while test $# -gt 0; do
done
if [[ "$NODE" == "" ]]; then
NODES=$(kubectl get nodes --no-headers -o custom-columns=name:.metadata.name)
if [ -z "$(which fzf)" ]; then
NODES=$(kubectl get nodes --no-headers -o custom-columns=name:.metadata.name)
i=0
while read -r node; do
echo "[$i] - $node"
@@ -59,33 +63,18 @@ if [[ "$NODE" == "" ]]; then
IFS=$'\n' NODES=($NODES)
NODE=${NODES[$REPLY]}
else
NODE=$(echo "$NODES" | fzf)
NODES=$(kubectl get nodes)
NODE=$(echo "$NODES" | _fzf | awk '{print $1}')
fi
fi
SERVER_VERSION=$(kubectl version --client=false -o json 2>/dev/null | jq -r '.serverVersion.minor')
NODE_NAME=$(kubectl get node $NODE -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}')
NODE_SELECTOR='"nodeSelector": { "kubernetes.io/hostname": "'${NODE_NAME}'" },'
if [ ${SERVER_VERSION} -ge 22 ]; then
kubectl debug node/${NODE} -it --image ${IMAGE}
else
NODE_NAME=$(kubectl get node $NODE -o template --template='{{index .metadata.labels "kubernetes.io/hostname"}}')
NODE_SELECTOR='"nodeSelector": { "kubernetes.io/hostname": "'${NODE_NAME}'" },'
kubectl run --namespace ${NAMESPACE} $POD --rm -it --image ${IMAGE} --privileged --overrides '{"spec":{'"${NODE_SELECTOR}"'"hostPID": true}}' --command nsenter -- --mount=/proc/1/ns/mnt -- /bin/bash
fi
kubectl run --namespace ${NAMESPACE} $POD --restart=Never -it --rm --image overriden --overrides '
{
"spec": {
"hostPID": true,
"hostNetwork": true,
'"${NODE_SELECTOR}"'
"tolerations": [{
"operator": "Exists"
}],
"containers": [
{
"name": "kube-ssh",
"image": "averagemarcus/kube-ssh:latest",
"stdin": true,
"tty": true,
"securityContext": {
"privileged": true
}
}
]
}
}' --attach

62
home/.bin/kube-template Executable file
View File

@@ -0,0 +1,62 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
print_usage() {
blue "kube-template - Quickly template up kubernetes resources"
echo " "
underline "Usage:"
echo "kube-template [options] RESOURCE_KIND NAME [extra arguments]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE="--namespace $1"
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
NAME=${2}
case "$1" in
deployment|dp)
kubectl create ${NAMESPACE} deployment ${NAME} --image=nginx:1.21 --dry-run=client -o yaml ${@:3}
;;
ingress|in)
kubectl create ${NAMESPACE} ingress ${NAME} --dry-run=client -o yaml --rule=example.com/=my-service:web ${@:3}
;;
service|svc)
kubectl create ${NAMESPACE} service clusterip ${NAME} --dry-run=client -o yaml ${@:3}
;;
configmap|cm)
kubectl create ${NAMESPACE} configmap ${NAME} --dry-run=client -o yaml ${@:3}
;;
secret|sec)
kubectl create ${NAMESPACE} secret generic ${NAME} --dry-run=client -o yaml ${@:3}
;;
cronjob|cj)
kubectl create ${NAMESPACE} cronjob ${NAME} --image=alpine:latest --schedule="1 * * * *" --dry-run=client -o yaml ${@:3}
;;
job|jo)
kubectl create ${NAMESPACE} job ${NAME} --image=alpine:latest --dry-run=client -o yaml ${@:3}
;;
esac

40
home/.bin/kube-trigger-cronjob Executable file
View File

@@ -0,0 +1,40 @@
#!/usr/bin/env bash
source .utils
NAMESPACE="$(kubectl config view --minify --output 'jsonpath={..namespace}' &>/dev/null)"
set -e
NAMESPACE=${NAMESPACE:-default}
print_usage() {
blue "kube-trigger-cronjob - Triggers a CronJob by creating a new job based on it"
echo " "
underline "Usage:"
echo "kube-trigger-cronjob [options] CRONJOB_NAME"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-n, --namespace the namespace the to search in"
}
while test $# -gt 0; do
case "$1" in
-n|--namespace)
shift
NAMESPACE=$1
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
NAME=${1}
kubectl create job --namespace ${NAMESPACE} ${NAME}-manual --from=cronjob/${NAME} ${@:3}

41
home/.bin/litractl Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bash
source .utils
set -e
if [ -z `which hidapitester` ]; then
bold "hidapitester command not found"
echo "Download from https://github.com/todbot/hidapitester"
exit 1
fi
print_usage() {
blue "litractl - Control Litra Glow"
echo " "
underline "Usage:"
echo "litractl [on / off]"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
POS_ARGS+=(`echo $1`)
shift
;;
esac
done
if [[ "${POS_ARGS[0]}" == "on" ]]; then
italic "Turning Litra Glow on... "
hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c,0x01 &>/dev/null
elif [[ "${POS_ARGS[0]}" == "off" ]]; then
italic "Turning Litra Glow off... "
hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c &>/dev/null
else
print_usage
fi

82
home/.bin/renovate-prs Executable file
View File

@@ -0,0 +1,82 @@
#!/usr/bin/env bash
source .utils
set -e
RENOVATE_USER="29139614"
MERGE=false
print_usage() {
blue "renovate-prs - List all Renovate PRs and batch approve"
echo " "
underline "Usage:"
echo "renovate-prs [options]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
echo "-m, --merge merge PRs after approving"
}
while test $# -gt 0; do
case "$1" in
-m|--merge)
shift
MERGE=true
shift
;;
-h|--help)
print_usage
exit 0
;;
*)
break
;;
esac
done
PULLS=$(curl --silent -L -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" -H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/search/issues?q=is%3Apr%20is%3Aopen%20archived%3Afalse%20sort%3Aupdated-desc%20review-requested%3AAverageMarcus%20renovate" \
| jq -r -c ".items[] | select(.user.id == ${RENOVATE_USER} and .draft == false) | @base64")
if [[ "${PULLS}" == "" ]]; then
blue "No Renovate PRs pending"
else
for PR in ${PULLS}; do
PR=$(echo ${PR} | base64 -d)
NUMBER=$(echo ${PR} | jq -r '.number')
TITLE=$(echo ${PR} | jq -r '.title')
URL=$(echo ${PR} | jq -r '.pull_request.html_url')
BODY=$(echo ${PR} | jq -r '.body')
PACKAGES=""
HEADER_FOUND=false
DIVIDER_FOUND=false
while IFS= read -r line; do
if [[ "${line}" == "" ]] && [[ "${HEADER_FOUND}" == "true" ]] && [[ "${DIVIDER_FOUND}" == "true" ]]; then
break
fi
if [[ "${HEADER_FOUND}" == "true" ]] && [[ "${DIVIDER_FOUND}" == "true" ]]; then
line=$(echo ${line} | sed -r 's/\((.+)\)//g' | sed -r 's/(\[|\]|`)//g')
parts=(${line//|/ })
PACKAGES+=" - ${parts[0]} - ${parts[${#parts[@]}-3]]} ➡ ${parts[${#parts[@]}-1]]}\n"
fi
if [[ "${line}" == "| Package | Type | Update | Change |" ]] || [[ "${line}" == "| Package | Update | Change |" ]]; then
HEADER_FOUND=true
fi
if [[ "${line}" == "|---|---|---|---|" ]] || [[ "${line}" == "|---|---|---|" ]]; then
DIVIDER_FOUND=true
fi
done <<< "$BODY"
bold "#${NUMBER} ${STATE} $(blue "${TITLE}")"
printf "🌐 $(underline ${URL})\n"
printf "${PACKAGES}"
echo ""
done
fi

71
home/.bin/talos-upgrade Executable file
View File

@@ -0,0 +1,71 @@
#!/usr/bin/env bash
source .utils
set -e
if [[ "${TALOSCONFIG}" == "" ]]; then
echo "You need to set TALOSCONFIG before running this"
exit 1
fi
LATEST_RELEASE=$(curl --silent https://api.github.com/repos/siderolabs/talos/releases | jq -r '[.[] | select(.prerelease == false)] | .[0]')
TALOS_VERSION="$(jq --argjson LATEST_RELEASE "$LATEST_RELEASE" -c -n -r '$LATEST_RELEASE.tag_name')"
KUBERNETES_VERSION="$(jq --argjson LATEST_RELEASE "$LATEST_RELEASE" -c -n -r '$LATEST_RELEASE.body | match("registry.k8s.io/kube-apiserver:v([0-9\\.]+)") | .captures[0].string')"
blue "TALOS_VERSION = ${TALOS_VERSION}"
blue "KUBERNETES_VERSION = ${KUBERNETES_VERSION}"
echo ""
blue "ISO URL: https://github.com/siderolabs/talos/releases/download/${TALOS_VERSION}/metal-amd64.iso"
echo ""
kubectl cluster-info
echo ""
printf "Continue? (y/n): "
read CONFIRM
if [[ "${CONFIRM}" != "y" ]]; then
exit 1
fi
echo ""
blue "Ensuring talosctl is up-to-date..."
brew upgrade siderolabs/tap/talosctl
CONTROL_PLANE="$(talosctl get nodetaintspec -o json | jq -r '.node')"
WORKERS=( $(talosctl get nodeips -o json | jq -r '.node | select(. != "'${CONTROL_PLANE}'")'))
echo ""
kubectl get no -o wide
echo ""
blue "Upgrading the control plane first..."
talosctl upgrade --image ghcr.io/siderolabs/installer:${TALOS_VERSION} --preserve=true --nodes ${CONTROL_PLANE}
echo ""
blue "Upgrading the worker nodes..."
SLEEP="10"
for NODE in "${WORKERS[@]}"
do
talosctl upgrade --image ghcr.io/siderolabs/installer:${TALOS_VERSION} --preserve=true --nodes ${NODE}
italic "Waiting for ${SLEEP} seconds to let pods settle..."
sleep ${SLEEP}
done
echo ""
kubectl get no -o wide
# Only the control plane requires the k8s version upgrading, the workers are done as part of the OS upgrade
echo ""
blue "Upgrading Kubernetes..."
talosctl upgrade-k8s --nodes ${CONTROL_PLANE} --to ${KUBERNETES_VERSION}
echo ""
kubectl get no -o wide
echo ""
orange "🎉 Upgrade Complete! 🎉"
echo ""
blue "ISO URL: https://github.com/siderolabs/talos/releases/download/${TALOS_VERSION}/metal-amd64.iso"

37
home/.bin/yq-test Executable file
View File

@@ -0,0 +1,37 @@
#!/usr/bin/env bash
source .utils
print_usage() {
orange "yq-test - interactively use YQ against a json file"
echo " "
underline "Usage:"
echo "yq-test [FILE]"
echo " "
underline "Options:"
echo "-h, --help show this help text"
}
POS_ARGS=()
while test $# -gt 0; do
case "$1" in
-h|--help)
print_usage
exit 0
;;
*)
POS_ARGS+=$1
shift
;;
esac
done
if [ ${#POS_ARGS[@]} -eq 0 ]
then
print_usage
exit 0
fi
echo '' | fzf --preview "yq {q} < ${POS_ARGS[@]}"

View File

@@ -3,7 +3,6 @@ export ZSH="$HOME/.oh-my-zsh"
plugins=(
zsh-syntax-highlighting
)
autoload -U compinit
# Use this setting if you want to disable marking untracked files under VCS as dirty.
# This makes repository status checks for large repositories much, much faster.
@@ -16,7 +15,6 @@ zstyle ':omz:update' mode reminder
source `brew --prefix switch`/switch.sh
# History
HISTFILE="$HOME/.zsh_history"
HISTIGNORE="&:exit:reset:clear:zh"
@@ -31,7 +29,6 @@ setopt HIST_REDUCE_BLANKS
setopt autocd
autoload -U add-zsh-hook
DISABLE_AUTO_TITLE="true"
# Override auto-title when static titles are desired ($ title My new title)
@@ -55,8 +52,6 @@ preexec() {
printf "\033]0;%s\a" "${1%% *} | $cwd" # Omit construct from $1 to show args
}
# Giant Swarm specific
which opsctl &>/dev/null && opsctl completion zsh > /usr/local/share/zsh/site-functions/_opsctl
which gsctl &>/dev/null && gsctl completion zsh --stdout > /usr/local/share/zsh/site-functions/_gsctl
which devctl &>/dev/null && devctl completion zsh > /usr/local/share/zsh/site-functions/_devctl
if [ $(/bin/ps -ef | /usr/bin/grep "ssh-agent" | /usr/bin/grep -v "grep" | wc -l) -eq 0 ]; then
eval "$(ssh-agent -s)" > /dev/null
fi

View File

@@ -2,7 +2,7 @@
alias _cat=`which cat`
alias _curl=`which curl`
alias _ls="/bin/ls"
alias _grep="/bin/grep"
alias _grep="/usr/bin/grep"
alias _diff="/usr/bin/diff"
alias _du=`which du`
alias _df=`which df`
@@ -10,28 +10,40 @@ alias _find=`which find`
alias _top=`which top`
alias _ps="/bin/ps"
alias _dig=`which dig`
alias _readlink='/usr/bin/readlink'
alias _sed='/usr/bin/sed'
alias _date='/bin/date'
alias _base64='/usr/bin/base64'
alias _git=`which git`
alias _readlink=`which readlink`
if command -v $(brew --prefix)/bin/git &>/dev/null; then
alias _git=$(brew --prefix)/bin/git
fi
# Aliases
alias cat='bat '
alias curl='curlie'
alias ls='exa --group-directories-first --icons --header --git --ignore-glob=.git'
alias ls='eza --group-directories-first --icons --header --git --ignore-glob=.git'
alias grep='rg'
alias diff='delta'
alias du='dust'
alias df='duf -hide special'
alias find='fd'
alias find-empty-dirs='fd --type empty --type directory'
alias bandwhich='sudo bandwhich'
alias top='btm'
alias ps='procs'
alias dig='dog'
alias dig='doggo'
alias kubectx='switch'
alias kctx='switch'
alias machine-info='macchina -t Boron --bar'
alias watch='watch '
alias tmp='cd $(mktemp -d)'
which greadlink &>/dev/null && alias readlink=`which greadlink`
# Ensure GNU version of tools are used by default (symlink so they are picked up in scripts also)
which greadlink &>/dev/null && ln -sfn `which greadlink` /usr/local/bin/readlink
which gsed &>/dev/null && ln -sfn `which gsed` /usr/local/bin/sed
which gdate &>/dev/null && ln -sfn `which gdate` /usr/local/bin/date
which gbase64 &>/dev/null && ln -sfn `which gbase64` /usr/local/bin/base64
lt() {
DEPTH=$(echo $1 | grep "^[0-9]*$")
@@ -45,21 +57,91 @@ lt() {
git() {
if [ "$1" = "take" ]; then # Git clone then cd into new directory
_git clone $2
cd $(basename $2 | sed 's/\.git$//')
if [ $# -gt 2 ]; then
_git clone ${@:2}
cd $3
else
ORG=$(echo $2 | sed -e 's|https://||' -e 's|/| |g' -e 's|:| |g' | cut -f 2 -d ' ')
REPO=$(echo $2 | sed -e 's|https://||' -e 's|/| |g' -e 's|:| |g' | cut -f 3 -d ' ' | xargs basename -s .git)
DST="${HOME}/Code/${ORG}/${REPO}"
mkdir -p ${DST}
_git clone $2 ${DST}
cd ${DST}
fi
elif [ "$1" = "commit" ]; then # Sign all commits
shift
_git commit -s $@
elif [ "$1" = "co" ]; then # Create a new branch
shift
_git checkout -b $@
elif [ "$1" = "push" ]; then # Guard against pushing to certain orgs
shift
if [ $# -eq 0 ]; then
remote_url=$(_git remote get-url $(git current-remote))
if [[ $remote_url == *"kubernetes/"* ]] || [[ $remote_url == *"kubernetes-sigs/"* ]]; then
echo "⚠️ Don't push directly to Kubernetes"
return 1
fi
fi
_git push $@
elif [ "$1" = "release" ]; then # Create a new tag
shift
SEMVER=$1
CURRENT_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
VERSION_PARTS=($(echo $CURRENT_TAG | tr "." "\n"))
VERSION_MAJOR=${VERSION_PARTS[1]}
VERSION_MINOR=${VERSION_PARTS[2]}
VERSION_PATCH=${VERSION_PARTS[3]}
case ${SEMVER} in
patch)
VERSION_PATCH=$((VERSION_PATCH+1))
;;
minor)
VERSION_MINOR=$((VERSION_MINOR+1))
VERSION_PATCH=0
;;
major)
if [[ ${VERSION_MAJOR:0:1} == "v" ]]; then
VERSION_MAJOR="v$((VERSION_MAJOR+1))"
else
VERSION_MAJOR=$((VERSION_MAJOR+1))
fi
VERSION_MINOR=0
VERSION_PATCH=0
;;
*)
echo "Unknown Semver level provided"
exit 1
;;
esac
NEW_VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
echo ""
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
echo "Current version ${CURRENT_TAG}"
echo " New version ${NEW_VERSION}"
echo "✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ ✨ "
echo ""
printf "Confirm? (y/n): "
read CONFIRM
if [ "${CONFIRM}" = "y" ]; then
git tag -a -m "${NEW_VERSION}" ${NEW_VERSION}
echo "New tag created, don't forget to push to remote"
else
echo "Aborting..."
exit 1
fi
else
_git $@
fi
}
# Giant Swarm specific
alias prom='opsctl open -a prometheus --sso -i'
alias happa='opsctl open -a happa --sso -i'
alias grafana='opsctl open -a grafana --sso -i'
alias argo='opsctl open -a argocd --sso -i'
alias cloud-provider='opsctl open -a cloudprovider -i'
alias get-cluster='gs-get-cluster'
alias create-cluster='gs-create-cluster'

View File

@@ -3,6 +3,7 @@ export VISUAL='code'
export GPG_TTY=$(tty)
# AWS
export AWS_PAGER=""
if [ -f ~/.aws/profile ]; then
export AWS_PROFILE=$(cat ~/.aws/profile)
export AWS_DEFAULT_REGION=eu-west-1
@@ -24,3 +25,15 @@ export STARSHIP_LOG=error
# Bat
export BAT_THEME="Monokai Extended Light"
export BAT_STYLE="grid,header"
# TZ
export TZ_LIST="Europe/Berlin;Europe/Sofia;UTC"
# Docker
export DOCKER_HOST=$(docker context inspect --format='{{.Endpoints.docker.Host}}')
# Brew - Prevent updating all packages when installing a new one
export HOMEBREW_NO_AUTO_UPDATE=1
# k9s
export K9S_CONFIG_DIR="$HOME/.k9s"

View File

@@ -0,0 +1,6 @@
# Giant Swarm utils
which opsctl &>/dev/null && screen -dm bash -c 'opsctl version update'
which devctl &>/dev/null && screen -dm bash -c 'devctl version update'
which kubectl-gs &>/dev/null && screen -dm bash -c 'kubectl-gs selfupdate'
which opsctl &>/dev/null && opsctl completion zsh > /usr/local/share/zsh/site-functions/_opsctl
which devctl &>/dev/null && devctl completion zsh > /usr/local/share/zsh/site-functions/_devctl

View File

@@ -7,6 +7,5 @@ alias fix-broken-replicasets='kube-clean-replicasets '
alias kube-forward='kube-forward-all '
source <(kubectl completion zsh)
# tkn currently doesn't work with Mac ARM chips
# source <(tkn completion zsh)
source <(tkn completion zsh)

2
home/.dotfiles/network Normal file
View File

@@ -0,0 +1,2 @@
# Ensure local dnsmasq is used for DNS
which networksetup &>/dev/null && networksetup -setdnsservers Wi-Fi 127.0.0.1

View File

@@ -19,8 +19,10 @@
[delta]
line-numbers = true
side-by-side = true
[push]
default = simple
followTags = true
[init]
defaultBranch = main
@@ -36,13 +38,15 @@
[alias]
basename = "!git remote -v | head -n1 | awk '{print $2}' | sed 's/.*\\///' | sed 's/\\.git//'"
remote-base-url = "!git remote get-url $(git fork-or-origin) | tr ':' '/' | sed 's|ssh///git@|https://|' | sed 's|git@|https://|' | sed 's|\\.git|/|'"
org-name = "!git remote -v | grep -m 1 -o ':.*/' | sed 's:^.\\(.*\\).$:\\1:'"
branch-name = "!git rev-parse --abbrev-ref HEAD"
changelog-changed = "!test $(git diff --name-only HEAD origin/$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') | grep CHANGELOG.md | wc -l | xargs) = 1"
main-branch = "!git remote show origin|grep HEAD|sed 's/.* //'"
main-branch = "!git remote show origin 2>/dev/null | grep HEAD | sed 's/.* //'"
fork-or-origin = "!func(){ $(git remote show fork &>/dev/null); if [[ $? == 0 ]]; then echo \"fork\" ; else echo \"origin\"; fi; }; func"
main = "!git remote set-head origin --auto && git checkout $(git main-branch) && git pull"
publish = "!func(){ if [[ $(git branch-name) != \"$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\" ]]; then git push -u origin $(git branch-name) && (git changelog-changed || echo '\n\n⚠ Dont forget to update changelog ⚠️ ') ; else echo "Wat?!"; fi; }; func"
pr-link = "!echo \"$(git remote-base-url)compare/$(git main-branch)...$(git branch-name)?expand=1\""
publish = "!func(){ if [[ $(git branch-name) != \"$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')\" ]]; then git push -u $(git fork-or-origin) $(git branch-name) && (git changelog-changed || echo '\n\n⚠ Dont forget to update changelog ⚠️ ') && (echo '\n\n'; git pr-link) ; else echo "Wat?!"; fi; }; func"
cleanup = "!git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done"
dont-change-file = "!git update-index --assume-unchanged"
ignore-file = "!git update-index --skip-worktree"
@@ -50,7 +54,7 @@
logg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
dif = "!git diff -w"
pop = "!git stash pop"
current-remote = "!func(){ REMOTE=$(git rev-parse --abbrev-ref @{u}) ; echo ${REMOTE%/*} ; }; func"
[help]
autocorrect = 1
@@ -59,3 +63,7 @@
[url "ssh://git@github.com"]
insteadOf = https://github.com
[pull]
rebase = false
[gpg]
program = /opt/homebrew/bin/gpg

View File

@@ -1,156 +0,0 @@
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
scrollback: 10000000,
// default font size in pixels for all tabs
fontSize: 13,
// font family with optional fallbacks
fontFamily: '"OpenDyslexicMono Nerd Font", "Fira Code", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
// default font weight: 'normal' or 'bold'
fontWeight: 'normal',
// font weight for bold characters: 'normal' or 'bold'
fontWeightBold: 'bold',
// line height as a relative unit
lineHeight: 1,
// letter spacing as a relative unit
letterSpacing: 0,
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: 'rgba(248,28,229,0.8)',
// terminal text color under BLOCK cursor
cursorAccentColor: '#000',
// `'BEAM'` for |, `'UNDERLINE'` for _, `'BLOCK'` for █
cursorShape: 'BEAM',
// set to `true` (without backticks and without quotes) for blinking cursor
cursorBlink: true,
// color of the text
foregroundColor: '#fff',
// terminal background color
// opacity is only supported on macOS
backgroundColor: '#000',
// terminal selection color
selectionColor: 'rgba(248,28,229,0.3)',
// border color (window, tabs)
borderColor: '#333',
// custom CSS to embed in the main window
css: `.line {
color: #999;
stroke: #999;
}`,
// custom CSS to embed in the terminal window
termCSS: '',
// if you're using a Linux setup which show native menus, set to false
// default: `true` on Linux, `true` on Windows, ignored on macOS
showHamburgerMenu: '',
// set to `false` (without backticks and without quotes) if you want to hide the minimize, maximize and close buttons
// additionally, set to `'left'` if you want them on the left, like in Ubuntu
// default: `true` (without backticks and without quotes) on Windows and Linux, ignored on macOS
showWindowControls: '',
// custom padding (CSS format, i.e.: `top right bottom left`)
padding: '12px 14px',
// the full list. if you're going to provide the full color palette,
// including the 6 x 6 color cubes and the grayscale map, just provide
// an array here instead of a color map object
colors: {
black: '#000000',
red: '#C51E14',
green: '#1DC121',
yellow: '#C7C329',
blue: '#0A2FC4',
magenta: '#C839C5',
cyan: '#20C5C6',
white: '#C7C7C7',
lightBlack: '#686868',
lightRed: '#FD6F6B',
lightGreen: '#67F86F',
lightYellow: '#FFFA72',
lightBlue: '#6A76FB',
lightMagenta: '#FD7CFC',
lightCyan: '#68FDFE',
lightWhite: '#FFFFFF',
},
// the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
// if left empty, your system's login shell will be used by default
//
// Windows
// - Make sure to use a full path if the binary name doesn't work
// - Remove `--login` in shellArgs
//
// Bash on Windows
// - Example: `C:\\Windows\\System32\\bash.exe`
//
// PowerShell on Windows
// - Example: `C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`
shell: '',
// for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)
// by default `['--login']` will be used
shellArgs: ['--login'],
// for environment variables
env: {},
// set to `false` for no bell
bell: `false`,
// if `true` (without backticks and without quotes), selected text will automatically be copied to the clipboard
copyOnSelect: false,
// if `true` (without backticks and without quotes), hyper will be set as the default protocol client for SSH
defaultSSHApp: true,
// if `true` (without backticks and without quotes), on right click selected text will be copied or pasted if no
// selection is present (`true` by default on Windows and disables the context menu feature)
// quickEdit: true,
// URL to custom bell
// bellSoundURL: 'http://example.com/bell.mp3',
// for advanced config flags please refer to https://hyper.is/#cfg
},
// a list of plugins to fetch and install from npm
// format: [@org/]project[#version]
// examples:
// `hyperpower`
// `@company/project`
// `project#1.0.1`
plugins: ["hyper-search", "hyperterm-paste", "hyper-tabs-enhanced", "hyper-chesterish", "hyper-quit"],
// in development, you can create a directory under
// `~/.hyper_plugins/local/` and include it here
// to load it and avoid it being `npm install`ed
localPlugins: [],
keymaps: {
// Example
// 'window:devtools': 'cmd+alt+o',
},
};

9
home/.k9s/aliases.yaml Normal file
View File

@@ -0,0 +1,9 @@
aliases:
dp: deployments
sec: v1/secrets
jo: jobs
cr: clusterroles
crb: clusterrolebindings
ro: roles
rb: rolebindings
np: networkpolicies

42
home/.k9s/config.yaml Normal file
View File

@@ -0,0 +1,42 @@
k9s:
liveViewAutoRefresh: false
refreshRate: 2
maxConnRetry: 5
readOnly: false
noExitOnCtrlC: false
ui:
enableMouse: false
headless: false
logoless: true
crumbsless: false
reactive: true
noIcons: false
skin: default
skipLatestRevCheck: false
disablePodCounting: false
shellPod:
image: busybox:1.35.0
namespace: default
limits:
cpu: 100m
memory: 100Mi
tty: true
imageScans:
enable: false
exclusions:
namespaces: []
labels: {}
logger:
tail: 5000
buffer: 50000
sinceSeconds: 0
fullScreen: false
textWrap: false
showTime: false
thresholds:
cpu:
critical: 90
warn: 80
memory:
critical: 90
warn: 80

View File

@@ -1,26 +0,0 @@
k9s:
refreshRate: 2
maxConnRetry: 5
enableMouse: false
headless: false
logoless: true
crumbsless: false
readOnly: false
noIcons: false
logger:
tail: 5000
buffer: 50000
sinceSeconds: 0
fullScreenLogs: false
textWrap: false
showTime: false
currentContext:
currentCluster:
clusters: []
thresholds:
cpu:
critical: 90
warn: 80
memory:
critical: 90
warn: 80

154
home/.k9s/plugins.yaml Normal file
View File

@@ -0,0 +1,154 @@
plugins:
# kubectl-blame by knight42
# Annotate each line in the given resource's YAML with information from the managedFields to show who last modified the field.
# Source: https://github.com/knight42/kubectl-blame
# Install via:
# krew: `kubectl krew install blame`
# go: `go install github.com/knight42/kubectl-blame@latest`
blame:
shortCut: b
confirm: false
description: "Blame"
scopes:
- all
command: sh
background: false
args:
- -c
- "kubectl-blame $RESOURCE_NAME $NAME -n $NAMESPACE --context $CONTEXT | less"
# Suspends/Resumes a cronjob
toggleCronjob:
shortCut: Shift-S
confirm: true
scopes:
- cj
description: Toggle to suspend or resume a running cronjob
command: kubectl
background: true
args:
- patch
- cronjobs
- $NAME
- -n
- $NAMESPACE
- --context
- $CONTEXT
- -p
- '{"spec" : {"suspend" : $!COL-SUSPEND }}'
# Flux
reconcile-git:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- gitrepositories
command: bash
background: false
args:
- -c
- >-
flux
reconcile source git
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-hr:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- helmreleases
command: bash
background: false
args:
- -c
- >-
flux
reconcile helmrelease
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-helm-repo:
shortCut: Shift-R
description: Flux reconcile
scopes:
- helmrepositories
command: bash
background: false
confirm: false
args:
- -c
- >-
flux
reconcile source helm
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-oci-repo:
shortCut: Shift-R
description: Flux reconcile
scopes:
- ocirepositories
command: bash
background: false
confirm: false
args:
- -c
- >-
flux
reconcile source oci
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
reconcile-ks:
shortCut: Shift-R
confirm: false
description: Flux reconcile
scopes:
- kustomizations
command: bash
background: false
args:
- -c
- >-
flux
reconcile kustomization
--context $CONTEXT
-n $NAMESPACE $NAME
| less -K
remove_finalizers:
shortCut: Ctrl-F
confirm: true
scopes:
- all
description: |
Removes all finalizers
command: kubectl
background: true
args:
- patch
- --context
- $CONTEXT
- --namespace
- $NAMESPACE
- $RESOURCE_NAME.$RESOURCE_GROUP
- $NAME
- -p
- '{"metadata":{"finalizers":null}}'
- --type
- merge
watch-events:
shortCut: Shift-E
confirm: false
description: Watch Events
scopes:
- all
command: sh
background: false
args:
- -c
- "kubectl events --context $CONTEXT --namespace $NAMESPACE --for $RESOURCE_NAME.$RESOURCE_GROUP/$NAME --watch"

View File

@@ -0,0 +1,4 @@
long_uptime = true
long_shell = true
physical_cores = true
show = [ "Host", "Machine", "OperatingSystem", "Terminal", "Shell", "Uptime" ]

44
home/.macchina/theme.toml Normal file
View File

@@ -0,0 +1,44 @@
hide_ascii = true
spacing = 1
padding = 0
separator = ""
key_color = "Cyan"
separator_color = "LightMagenta"
[bar]
glyph = "⭘"
symbol_open = ""
symbol_close = ""
visible = true
[box]
title = " Info "
border = "double"
visible = true
[box.inner_margin]
x = 1
y = 0
[randomize]
key_color = false
separator_color = false
[keys]
host = "Host"
kernel = "Kernel"
battery = "Battery"
os = "OS"
distro = "Distro"
terminal = "Terminal"
shell = "Shell"
packages = "Packages"
uptime = "Uptime"
memory = "Memory"
machine = "Machine"
local_ip = "IP"
backlight = "Brightness"
resolution = "Resolution"
cpu_load = "CPU Load"
cpu = "CPU"

View File

@@ -1,7 +1,7 @@
format = """\
$status\
$cmd_duration\
$line_break\
$hostname\
$directory\
$git_branch\
$git_commit\
@@ -14,32 +14,51 @@ format = """\
$terraform\
$package\
$custom\
$time\
$line_break\
$jobs\
$time\
$character\
"""
command_timeout = 1000
add_newline = true
[character]
success_symbol = "[✨](yellow)"
error_symbol = "[✗](red)"
[hostname]
ssh_only = true
format = "🌐 [$hostname](bold dimmed blue) \n"
disabled = false
[aws]
symbol = " "
format = "[$symbol$profile]($style) "
[directory]
format = "┏  [$path]($style)[$read_only]($read_only_style) "
[character]
success_symbol = "┗ [✨](yellow)"
error_symbol = "┗ [✗](fg:204)"
[git_branch]
format = "⎮ [$symbol$branch]($style) "
symbol = "🌱 "
[git_commit]
only_detached = true
[git_status]
format = '\($all_status$ahead_behind\) '
up_to_date = "[✓](green)"
modified = "[!](bold fg:208)"
untracked = "[?](bold fg:75)"
staged = '[++\($count\)](green)'
[aws]
symbol = " "
format = "⎮ [$symbol$profile]($style) "
[golang]
symbol = " "
format = "[$symbol$version]($style) "
format = "[$symbol$version](fg:45) "
[kubernetes]
format = '[$symbol$context \($namespace\)]($style) '
format = '[$symbol$context (\($namespace\))]($style) '
symbol = "ﴱ "
style = "bold blue"
disabled = false
@@ -47,25 +66,28 @@ disabled = false
"gs-(?P<cluster>.+)" = "$cluster [MC]"
[terraform]
format = "[$symbol$version]($style) "
format = "[$symbol$version]($style) "
[nodejs]
symbol = " "
[status]
style = "red"
symbol = "✗"
format = '[↪ \[$symbol $common_meaning$signal_name$maybe_int\]]($style)'
format = "[↪ $symbol $common_meaning$signal_name$maybe_int](fg:204)\n"
map_symbol = true
disabled = false
[helm]
format = "[$symbol$version]($style) "
format = "[$symbol$version]($style) "
symbol = " "
[cmd_duration]
format = " took [$duration]($style) "
format = " took [$duration]($style) \n"
[package]
symbol = "📦"
format = "[$symbol$version]($style) "
format = "[$symbol$version]($style) "
[jobs]
number_threshold = 1
format = "┣ [$symbol $number background jobs\n]($style)"

View File

@@ -3,3 +3,4 @@ set paste
set number
set linespace=3
set cursorline
syntax on

View File

@@ -1,3 +1,5 @@
DISABLE_AUTO_UPDATE="true"
PATH_DIRS=(
"${HOME}/.bin"
"${KREW_ROOT:-${HOME}/.krew}/bin"
@@ -5,6 +7,7 @@ PATH_DIRS=(
"${HOME}/.cargo/bin"
"/home/linuxbrew/.linuxbrew/bin"
"/opt/homebrew/bin/"
"${HOME}/Library/Python/3.11/bin"
"/usr/local/bin"
"/usr/bin"
"/bin"
@@ -13,6 +16,7 @@ PATH_DIRS=(
"${PATH}"
)
export PATH=${"${PATH_DIRS[*]}"// /:}
export FPATH="$FPATH:/opt/homebrew/share/zsh/site-functions"
if [ ! -z ~/.additional_dotfiles/credentials ]; then
source ~/.additional_dotfiles/credentials
@@ -29,3 +33,5 @@ done
rm -f ~/.zcompdump; compinit
eval "$(starship init zsh)"
macchina --config ~/.macchina/config.toml --theme ~/.macchina/theme

171
install.sh Normal file → Executable file
View File

@@ -2,63 +2,118 @@
export PATH="/home/linuxbrew/.linuxbrew/bin:/opt/homebrew/bin/:$PATH"
GITEMAIL=$(git config --get user.email)
[ -d ~/.additional_dotfiles ] || (mkdir -p ~/.additional_dotfiles && touch ~/.additional_dotfiles/credentials)
[ -d /usr/local/share/zsh/site-functions ] || (sudo mkdir -p /usr/local/share/zsh/site-functions && sudo chmod 777 /usr/local/share/zsh/site-functions)
# Install homebrew
echo ""
echo "🔵 Installing homebrew"
which brew >/dev/null || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo "🔵 Setting up zsh"
echo "✅"
# Install oh-my-zsh
echo ""
echo "🔵 Setting up zsh"
printf "Cloning oh-my-zsh..."
[ -d ${HOME}/.oh-my-zsh ] || sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
printf " ✅\n"
# Install ZSH plugins
printf "Cloning zsh plugins..."
[ -d ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions ] || git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
[ -d ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting ] || git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
printf " ✅\n"
# Set correct permissions on compinit dir
sudo chmod -R 755 /usr/local/share/zsh/site-functions
# Install tools
BREW_TOOLS=(
argocd bandwhich bat danielfoehrkn/switch/switch derailed/k9s/k9s dive dog duf dust exa fd fzf
git-delta git-delta go helm homebrew/cask-fonts/font-open-dyslexic-nerd-font htop jq kind krew
kubectl kubectx kustomize node procs progress ripgrep rs/tap/curlie rust starship
tektoncd/tools/tektoncd-cli tldr tailscale
git argocd bandwhich bat danielfoehrkn/switch/switch derailed/k9s/k9s
dive doggo duf dust eza fd fzf git-delta go helm htop jq kind krew curl
kubectl kustomize node procs progress ripgrep rs/tap/curlie rust starship
tektoncd/tools/tektoncd-cli tldr tailscale yq tabby vale jless macchina tz viddy
homeassistant-cli act dnsmasq gh kubebuilder golangci-lint gnu-sed s3cmd
pulumi/tap/pulumi kubeseal fluxcd/tap/flux ical-buddy baobab
watch crane openssh siderolabs/talos/talosctl civo/tools/civo raspberry-pi-imager
gron ssup2/tap/kpexec opentofu visual-studio-code 1password-cli scw smartmontools
firefox signal slack ffmpeg openscad tsh colima docker docker-buildx nordvpn
1password tailscale-app
)
CARGO_TOOLS=( macchina bottom )
# Brew tools only available / needed on Mac
MAC_BREW_TOOLS=(
pinentry-mac gpg gawk coreutils wget stats font-open-dyslexic-nerd-font
dimentium/autoraise/autoraiseapp the-unarchiver rar mas capcut
mqtt-explorer raycast bettertouchtool calibre kdenlive royal-tsx tableplus
homebrew/cask/todoist ultimaker-cura webtorrent pika pearcleaner spotmenu
jordanbaird-ice
)
CARGO_TOOLS=( bottom )
NODE_TOOLS=( git-split-diffs )
KREW_TOOLS=( gs )
KREW_TOOLS=( outdated tree stern explore blame access-matrix cert-manager rbac-tool resource-capacity view-secret )
APT_TOOLS=( zsh gcc )
MAS_TOOLS=(
1263070803 # Lungo
1470584107 # Dato
1351639930 # Gifski
)
# Tools removed to be cleaned up
REMOVED_BREW_TOOLS=(
exa karabiner-elements kubectx hiddenbar
)
REMOVED_KREW_TOOLS=( gs )
echo ""
echo "🔵 Installing / updating tools"
# Install Debian/Ubuntu specific packages if apt exists
if command -v apt &>/dev/null; then
echo "'apt' found on system, assuming Ubuntu/Debian and installing pre-requisites..."
sudo apt install -y ${APT_TOOLS}
fi
# Homebrew
echo ""
echo "🔵 Homebrew tools"
export HOMEBREW_NO_INSTALL_CLEANUP=true
for tool in "${BREW_TOOLS[@]}"
do
printf "${tool}..."
brew upgrade ${tool} &>/dev/null || brew install ${tool} &>/dev/null
printf " ✅\n"
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done
# Cargo
echo ""
echo "🔵 Cargo tools"
for tool in "${CARGO_TOOLS[@]}"
do
printf "${tool}..."
cargo install ${tool} &>/dev/null
printf " ✅\n"
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done
# Krew
echo ""
echo "🔵 Krew tools"
kubectl-krew update &>/dev/null
for tool in "${KREW_TOOLS[@]}"
do
printf "${tool}..."
kubectl-krew upgrade ${tool} &>/dev/null || kubectl-krew install ${tool} &>/dev/null
printf " ✅\n"
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done
fulllink() {
@@ -70,6 +125,7 @@ fulllink() {
fi
}
echo ""
echo "🔵 OS Specific setup"
echo "Detected OS type: ${OSTYPE}"
@@ -79,16 +135,36 @@ case "${OSTYPE}" in
;;
*darwin*)
# Mac specific setup
MAC_BREW_TOOLS=( pinentry-mac gpg gawk coreutils )
echo ""
echo "Instaling Mac-specific Brew tools..."
for tool in "${MAC_BREW_TOOLS[@]}"
do
printf "${tool}..."
brew upgrade ${tool} &>/dev/null || brew install ${tool} &>/dev/null
printf " ✅\n"
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done
# Mac App Store
echo ""
echo "Instaling Mac-specific App Store tools..."
for tool in "${MAS_TOOLS[@]}"
do
printf "MAS ID: ${tool}..."
mas install ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done
FILES=$(find ./os-specific/darwin/home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
echo ""
echo "Setting up config files"
FILES=$(/usr/bin/find ./os-specific/darwin/home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
for file in $FILES
do
f=$(fulllink "${file}")
@@ -106,16 +182,73 @@ case "${OSTYPE}" in
echo "⚠️ You'll need to create a new GPG key ⚠️"
echo "⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️"
fi
# Handle other files outside of the user's home directory
echo ""
echo "🔵 Handiling non-standard files:"
# 1. Tabby config
mkdir -p "/Users/${USER}/Library/Application Support/tabby"
f=$(fulllink "./other-files/tabby/config.yaml")
dst="/Users/${USER}/Library/Application Support/tabby/config.yaml"
printf "Linking ${f}=>${dst}"
ln -sfn "${f}" "${dst}"
printf " ✅\n"
# 2. dnsmasq
f=$(fulllink "./other-files/dnsmasq/dnsmasq.conf")
dst="$(brew --prefix)/etc/dnsmasq.conf"
printf "Copying ${f}=>${dst}"
cp ${f} ${dst}
printf " ✅\n"
printf "Setting DNS server for 'Wi-Fi' interface to use dnsmasq"
sudo networksetup -setdnsservers "Wi-Fi" 127.0.0.1
printf " ✅\n"
;;
esac
echo ""
echo "🔵 Adding configuration"
FILES=$(find ./home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
FILES=$(/usr/bin/find ./home -maxdepth 1 -mindepth 1 | tr '\n' ' ')
for file in $FILES
do
f=$(fulllink "${file}")
dst="${HOME}/$(basename "./home/${file}")"
printf "Linking ${f}=>${dst}"
printf "Linking ${f} => ${dst}"
ln -sfn ${f} ${dst}
printf " ✅\n"
done
echo ""
echo "🔵 Updating installed tools..."
brew upgrade
mas upgrade
echo ""
echo "🔵 Removing old Homebrew tools"
export HOMEBREW_NO_INSTALL_CLEANUP=true
for tool in "${REMOVED_BREW_TOOLS[@]}"
do
printf "${tool}..."
brew uninstall ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done
echo ""
echo "🔵 Removing old Krew tools"
for tool in "${REMOVED_KREW_TOOLS[@]}"
do
printf "${tool}..."
kubectl-krew uninstall ${tool} &>/dev/null
if [ $? -eq 0 ]; then
printf " ✅\n"
else
printf " ❌\n"
fi
done

View File

@@ -1 +1,5 @@
pinentry-program /usr/local/bin/pinentry-mac
pinentry-program /opt/homebrew/bin//pinentry-mac
default-cache-ttl 0
max-cache-ttl 600
default-cache-ttl-ssh 0
max-cache-ttl-ssh 0

View File

@@ -0,0 +1 @@
pinentry-mode loopback

View File

@@ -0,0 +1,12 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Brand
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
open 'smb://nas._smb._tcp.local/Nextcloud/Pictures/Brand'

View File

@@ -0,0 +1,16 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Litra Glow Off
# @raycast.mode silent
# Optional parameters:
# @raycast.icon ⚫️
# Documentation:
# @raycast.description Turn off Litra Glow light
cd ~/.bin/
./litractl off

View File

@@ -0,0 +1,15 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Litra Glow On
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 💡
# Documentation:
# @raycast.description Turn on Litra Glow light
cd ~/.bin/
./litractl on

View File

@@ -0,0 +1,12 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Nextcloud
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
open 'smb://nas._smb._tcp.local/Nextcloud'

View File

@@ -0,0 +1,11 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Reaction Gifs
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
open 'smb://nas._smb._tcp.local/Nextcloud/Pictures/ReactionGifs'

View File

@@ -0,0 +1,15 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Restart BusyCal Menu
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
# Documentation:
# @raycast.description Kills the BusyCal process
pkill busycal-setapp.alarm
open /Applications/Setapp/BusyCal.app

View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Restart Logi daemon
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
# Documentation:
# @raycast.description Kills the LogiMgr process to allow a new one to spawn
pkill LogiMgr

View File

@@ -0,0 +1,12 @@
#!/bin/bash
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Things
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🤖
open 'smb://nas._smb._tcp.local/Things'

View File

@@ -0,0 +1,34 @@
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Toggle Microphone
# @raycast.mode silent
# @raycast.packageName System
# Optional parameters:
# @raycast.icon 🎙
# Documentation:
# @raycast.author Matthew Morek
# @raycast.authorURL https://github.com/matthewmorek
# @raycast.description Toggles microphone.
on getMicrophoneVolume()
input volume of (get volume settings)
end getMicrophoneVolume
on disableMicrophone()
set volume input volume 0
log "Microphone turned off 🔴"
end disableMicrophone
on enableMicrophone()
set volume input volume 100
log "Microphone turned on 🟢"
end enableMicrophone
if getMicrophoneVolume() is greater than 0 then
disableMicrophone()
else
enableMicrophone()
end if

View File

@@ -0,0 +1,11 @@
server=/cluster.local/192.168.1.3
server=192.168.1.3
server=192.168.1.4
server=192.168.1.5
server=1.1.1.1
port=53
listen-address=127.0.0.1
bogus-priv
no-resolv
bind-interfaces
auth-ttl=0

View File

@@ -0,0 +1,218 @@
version: 7
profiles: []
hotkeys:
copy-current-path: []
ctrl-c:
- Ctrl-C
copy:
- ⌘-C
paste:
- ⌘-V
clear:
- ⌘-K
select-all:
- ⌘-A
zoom-in:
- ⌘-=
- ⌘-Shift-=
zoom-out:
- ⌘--
- ⌘-Shift--
reset-zoom:
- ⌘-0
home:
- ⌘-Left
- Home
end:
- ⌘-Right
- End
previous-word:
- ⌥-Left
next-word:
- ⌥-Right
delete-previous-word:
- ⌥-Backspace
delete-next-word:
- ⌥-Delete
search:
- ⌘-F
pane-focus-all:
- ⌘-Shift-I
restart-telnet-session: []
restart-ssh-session: []
launch-winscp: []
settings:
- ⌘-,
serial:
- Alt-K
restart-serial-session: []
new-window:
- ⌘-N
new-tab:
- ⌘-T
profile: {}
profile-selectors: {}
toggle-fullscreen:
- Ctrl+⌘+F
close-tab:
- ⌘-W
reopen-tab:
- ⌘-Shift-T
toggle-last-tab: []
rename-tab:
- ⌘-R
next-tab:
- Ctrl-Tab
previous-tab:
- Ctrl-Shift-Tab
move-tab-left:
- ⌘-Shift-Left
move-tab-right:
- ⌘-Shift-Right
rearrange-panes:
- ⌘-Shift
tab-1:
- ⌘-1
tab-2:
- ⌘-2
tab-3:
- ⌘-3
tab-4:
- ⌘-4
tab-5:
- ⌘-5
tab-6:
- ⌘-6
tab-7:
- ⌘-7
tab-8:
- ⌘-8
tab-9:
- ⌘-9
tab-10:
- ⌘-0
duplicate-tab: []
tab-11: []
tab-12: []
tab-13: []
tab-14: []
tab-15: []
tab-16: []
tab-17: []
tab-18: []
tab-19: []
tab-20: []
split-right:
- ⌘-Shift-D
split-bottom:
- ⌘-D
split-left: []
split-top: []
pane-nav-right:
- ⌘-⌥-Right
pane-nav-down:
- ⌘-⌥-Down
pane-nav-up:
- ⌘-⌥-Up
pane-nav-left:
- ⌘-⌥-Left
pane-nav-previous:
- ⌘-⌥-[
pane-nav-next:
- ⌘-⌥-]
pane-maximize:
- ⌘-⌥-Enter
close-pane:
- ⌘-Shift-W
profile-selector:
- ⌘-E
switch-profile:
- ⌘-Shift-E
toggle-window: []
scroll-to-bottom: []
delete-line:
- ⌘-Backspace
settings-tab: {}
explode-tab:
- ⌘-Shift-.
combine-tabs:
- ⌘-Shift-,
pane-nav-1: []
pane-nav-2: []
pane-nav-3: []
pane-nav-4: []
pane-nav-5: []
pane-nav-6: []
pane-nav-7: []
pane-nav-8: []
pane-nav-9: []
pane-increase-vertical: []
pane-decrease-vertical: []
pane-increase-horizontal: []
pane-decrease-horizontal: []
focus-all-tabs:
- ⌘-⌥-Shift-I
scroll-to-top:
- Shift-PageUp
scroll-up:
- ⌥-PageUp
scroll-down:
- ⌥-PageDown
restart-tab: []
reconnect-tab: []
disconnect-tab: []
command-selector:
- ⌘-Shift-P
terminal:
searchOptions: {}
colorScheme:
name: hyper-chesterish
foreground: '#CDD2E9'
background: '#293340'
cursor: '#2C85F7'
colors:
- '#293340'
- '#E17E85'
- '#61BA86'
- '#FFEC8E'
- '#4CB2FF'
- '#BE86E3'
- '#2DCED0'
- '#CDD2E9'
- '#546386'
- '#E17E85'
- '#61BA86'
- '#FFB68E'
- '#4CB2FF'
- '#BE86E3'
- '#2DCED0'
- '#CDD2E9'
font: OpenDyslexicMono Nerd Font
ligatures: true
cursor: beam
pasteOnMiddleClick: false
customColorSchemes: []
background: colorScheme
autoOpen: true
ssh: {}
configSync:
parts: {}
clickableLinks:
modifier: metaKey
appearance:
dockFill: 0.23
css: ''
pluginBlacklist: []
enableAnalytics: false
enableWelcomeTab: false
profileDefaults: {}
recoverTabs: false
electronFlags:
- - force_discrete_gpu
- '0'
accessibility: {}
hacks: {}
groups: []
providerBlacklist: []
commandBlacklist: []
profileBlacklist: []