Skip to content

Instantly share code, notes, and snippets.

View salanisor's full-sized avatar

Saul Alanis salanisor

  • Linux Kernel
View GitHub Profile
@rcarrata
rcarrata / hcp-rosa.md
Last active April 16, 2024 21:14
Hosted Control Planes for ROSA HCP

HyperShift

  • Set environment variables
CLUSTER_NAME="rosa-hcp-rcs"
PREFIX_NAME="hcp-rcs"
REGION="us-east-1"
VERSION="4.14.9"
USER=rcarrata
@chmouel
chmouel / buildah-task.yaml
Last active February 23, 2023 20:20
Openshift Pipelines Buildah task rootless
---
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: buildah-userns
labels:
app.kubernetes.io/version: "0.1"
annotations:
tekton.dev/pipelines.minVersion: "0.12.1"
tekton.dev/tags: image-build
ARG BASE_IMG=registry.access.redhat.com/ubi8/ubi
FROM $BASE_IMG AS buildah-runner
RUN useradd buildah; echo buildah:10000:5000 > /etc/subuid; echo buildah:10000:5000 > /etc/subgid;
# https://github.com/containers/buildah/blob/main/docs/tutorials/05-openshift-rootless-build.md
# https://github.com/containers/buildah/blob/master/contrib/buildahimage/stable/Dockerfile
# https://github.com/containers/buildah/issues/1011
# https://github.com/containers/buildah/issues/3053
@chmouel
chmouel / prune-pipelinerun-objects.yaml
Last active February 23, 2023 20:27
cronjob for pruning pipelinerun objects by age
apiVersion: v1
kind: List
items:
- apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: pr-cleanup
namespace: ghe
spec:
concurrencyPolicy: Replace
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
apiServerAddress: "10.0.111.66"
apiServerPort: 8443
kubeadmConfigPatchesJSON6902:
- group: kubeadm.k8s.io
version: v1beta2
kind: ClusterConfiguration
patch: |
@tosin2013
tosin2013 / custom-machine-set
Last active September 6, 2024 21:53
Custom Machine Set for OpenShift
#!/bin/bash
set -xe
curl -OL https://github.com/openshift/openshift-cns-testdrive/raw/ocp4-dev/support/machineset-cli
curl -OL https://raw.githubusercontent.com/openshift/openshift-cns-testdrive/ocp4-dev/support/machineset-generator.sh
chmod +x machineset-generator.sh
chmod +x machineset-cli
bash /home/lab-user/machineset-generator.sh 1 infra 0 | oc create -f -
export MACHINESET=$(oc get machineset -n openshift-machine-api -l machine.openshift.io/cluster-api-machine-role=infra -o jsonpath='{.items[0].metadata.name}')
oc patch machineset $MACHINESET -n openshift-machine-api --type='json' -p='[{"op": "add", "path": "/spec/template/spec/metadata/labels", "value":{"node-role.kubernetes.io/worker":"", "node-role.kubernetes.io/infra":""} }]'
@dmc5179
dmc5179 / etcd-backup-cron.yaml
Created March 2, 2021 02:19
OpenShift Cron job to backup etcd database
---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: etcd-backup
spec:
schedule: "0 0 * * *"
jobTemplate:
spec:
template:
@ikurni
ikurni / force-mcp-ocp-update
Created October 5, 2020 14:43
How to force openshift MCP to update machine config
### Create file called machine-config-daemon-force in /run ###
ssh [email protected] sudo touch /run/machine-config-daemon-force
### Edit node annotations ###
oc edit node <node-name>
### Check Annotations, change like below sample ###
machineconfiguration.openshift.io/currentConfig: rendered-worker-ab4a1e7216bf3da2a5203f09c871b456
machineconfiguration.openshift.io/desiredConfig: rendered-worker-ab4a1e7216bf3da2a5203f09c871b456
machineconfiguration.openshift.io/reason: ""
@devops-school
devops-school / terraform-map-variable.tf
Last active June 9, 2023 22:35
Terraform variable Map Type Explained
Example 1
===============================
Maps are a way to create variables that are lookup tables. An example will show this best. Let's extract our AMIs into a map and add support for the us-west-2 region as well:
variable "amis" {
type = "map"
default = {
"us-east-1" = "ami-b374d5a5"
"us-west-2" = "ami-4b32be2b"
}
@brikis98
brikis98 / main.tf
Last active March 14, 2023 23:43
A hacky way to create a dynamic list of maps in Terraform
# The goal: create a list of maps of subnet mappings so we don't have to statically hard-code them in aws_lb
# https://www.terraform.io/docs/providers/aws/r/lb.html#subnet_mapping
locals {
# These represent dynamic data we fetch from somewhere, such as subnet IDs and EIPs from a VPC module
subnet_ids = ["subnet-1", "subnet-2", "subnet-3"]
eips = ["eip-1", "eip-2", "eip-3"]
}
# Here's the hack! The null_resource has a map called triggers that we can set to arbitrary values.
# We can also use count to create a list of null_resources. By accessing the triggers map inside of