Skip to content

Instantly share code, notes, and snippets.

View jkeam's full-sized avatar
🍻

Jon Keam jkeam

🍻
View GitHub Profile
@jkeam
jkeam / deploy-vista-ocp.sh
Created April 25, 2023 04:40
Deploy vista on OCP
#!/bin/bash
# create namespace
oc new-project vista
# sa
# can use default, this is convenient but not best practice
# oc adm policy add-scc-to-user anyuid -z default
oc create sa root
oc adm policy add-scc-to-user privileged -z root
@jkeam
jkeam / update-openshift-certs.sh
Last active April 24, 2023 19:56
Update certs in OpenShift
#!/bin/bash
# delete config map
oc delete configmap custom-ca -n openshift-config
# re-create it
oc create configmap custom-ca --from-file=ca-bundle.crt=</path/to/example-ca.crt> -n openshift-config
# make sure config map is being used
oc patch proxy/cluster --type=merge --patch='{"spec":{"trustedCA":{"name":"custom-ca"}}}'
@jkeam
jkeam / add_users_to_openshift.sh
Last active October 7, 2024 01:51
Add users to OpenShift via htpasswd
#!/bin/bash
# create admin and user1 with password `openshift`
# -c for file, -n just for console
# -B for bcrypt
# -b for allowing password in command
htpasswd -c -B -b ./openshift.htpasswd admin openshift
htpasswd -B -b ./openshift.htpasswd user1 openshift
# add secret with username/passwords
@jkeam
jkeam / rootful-priv.yaml
Created March 3, 2023 02:17
Privileged Podman Pod
apiVersion: v1
kind: Pod
metadata:
name: podman-priv
spec:
containers:
- name: priv
image: quay.io/podman/stable:v4.4.1
args:
- sleep
@jkeam
jkeam / setup-gitlab-with-rancher-and-ocp.md
Last active March 3, 2023 02:20
Setup for Demo for GitLab with Rancher and OpenShift runners

Setup for Demo for GitLab with Rancher and OpenShift runners

Git Repo

The code for this project is here [email protected]:jkeam/spring-petclinic-pac.git and the file we should be using is .gitlab-ci-kube.yml so in the repo that's in GitLab, make sure to blow away the original .gitlab-ci.yml and rename .gitlab-ci-kube.yml to .gitlab-ci.yml.

GitLab Variables

Something like below:

@jkeam
jkeam / gitlab-with-rancher-and-ocp.md
Last active March 3, 2023 02:01
Demo for GitLab with Rancher and OpenShift runners

Demo for GitLab with Rancher and OpenShift runners

Pre Demo

  1. Generate new KUBE_CONFIG with fresh OCP token

Demo

@jkeam
jkeam / psa.txt
Created February 7, 2023 21:55
Pod Security Admission Demo Script
# Pod Security Admission Demo
## Part 1 - What is this
1. New Project:
oc new-project psa-test
2. Create deployment
oc create -f https://raw.githubusercontent.com/radikaled/psa/main/deploy/psa-test-deployment.yaml
@jkeam
jkeam / openshift-project-request-template.md
Created January 31, 2023 03:16
OpenShift Project Request Template - EgressNetworkPolicy

OpenShift Project Request Template

Automatically create an EgressNetworkPolicy (note this is for OpenShiftSDN, for OVNKubernetes use EgressFirewall)

Before

oc new-project before
oc get EgressNetworkPolicy  # notice nothing is returned
@jkeam
jkeam / podman_share_dir.sh
Last active March 17, 2025 14:43
Podman share directory
#!/bin/bash
# create dir for container
mkdir -p /tmp/work
# give permissions to container user
podman unshare chown -R 1001:1001 /tmp/work
# relabel
sudo semanage fcontext -a -t container_file_t '/tmp/work(/.*)?'