Skip to content

Instantly share code, notes, and snippets.

View gnunn1's full-sized avatar

Gerald Nunn gnunn1

View GitHub Profile
@gnunn1
gnunn1 / starship.toml
Last active February 14, 2024 23:13
Starship tuned for OpenShift contexts
# Color wheel Blue #208dc6, Orange #c65720, yellow #c6aa20, purple #8f20c6
format = """
[\uE0B6](fg:#9a3ac7)[$directory](bg:#9a3ac7)[\uE0B0](fg:#9a3ac7 bg:black)[\uE0B0](fg:black bg:#c7693a)[$kubernetes](bg:#c7693a fg:white)[\uE0B0](fg:#c7693a bg:black)[\uE0B0](fg:black bg:#9A8565)$git_branch[\uE0B0](fg:#9A8565 bg:#AE9D84)$git_status[\uE0B0](fg:#AE9D84 bg:black)[\uE0B0](fg:black bg:#208dc6)$time[\uE0B0](#208dc6 bg:none) $cmd_duration$character """
add_newline = true
[character] # The name of the module we are configuring is 'character'
success_symbol = '[➜](bold white)' # The 'success_symbol' segment is being set to '➜' with the color 'bold green'
@gnunn1
gnunn1 / lookup_cluster_values_openshift_gitops.md
Last active January 31, 2023 02:39
Lookup up cluster values in OpenShift GitOps

OpenShift GitOps currently does not support looking up values in the cluster either through Helm or Kustomize. You can do this through the use of the plugin however it should be noted that this isn’t recommended as a general practice since lookup values are not stored in git and subject to change.

An example use case where this may make sense is when dealing with ephemeral clusters that are created for a specific task and then torn down again once that task is completed. In this case it’s not possible to manage this through normal GitOps practices.

To accomplish this goal, you can use a ConfigurationManagementPlugin in Argo CD.

In my case I am using Red Hat Advanced Cluster Manager (RHACM) to deploy OpenShift GitOps via policy to various clusters. RHACM has the ability in it's template policies to lookup values so I am using this capability to populate enivronment variables on the repo server as follows:

repo:
@gnunn1
gnunn1 / openshift-cheatcheat
Last active July 21, 2021 22:17
OpenShift Cheat Sheet for Commands
Show all requuests and pods:
oc get po -o custom-columns="Name:metadata.name,CPU-request:spec.containers[*].resources.requests.cpu,CPU-limit:spec.containers[*].resources.limits.cpu,Mem-request:spec.containers[*].resources.requests.memory,Mem-limit:spec.containers[*].resources.limits.memory"
Approve all pending CSRs:
or i in `oc get csr --no-headers | grep -i pending | awk '{ print $1 }'`; do oc adm certificate approve $i; done
@gnunn1
gnunn1 / iscsi_config.txt
Created October 16, 2020 02:51
Server iSCSI Configuration
# To setup the drive
pvcreate /dev/sda
vgcreate vg-targetd /dev/sda
lvcreate -l 100%FREE -T iscsi/thin_pool
lvcreate -V 100G -T iscsi/thin_pool -n block0_100
lvcreate -V 100G -T iscsi/thin_pool -n block1_100
lvcreate -V 50G -T iscsi/thin_pool -n block2_50
lvcreate -V 50G -T iscsi/thin_pool -n block3_50