Skip to content

Instantly share code, notes, and snippets.

View rssnyder's full-sized avatar
🥨
limitless servers in a serverless world

Riley Snyder rssnyder

🥨
limitless servers in a serverless world
View GitHub Profile
@rssnyder
rssnyder / 0.README.md
Last active February 22, 2024 14:38
create a k8s service account for use with a harness k8s connector

to get a connection into a k8s cluster without deploying a delegate, we need to create a service account with the correct permissions and generate a token for it.

first, we create the service account:

apiVersion: v1
kind: ServiceAccount
metadata:
  name: harness
  namespace: default
@rssnyder
rssnyder / stress1.service
Created January 26, 2024 23:44
stress systemd
[Unit]
Description=stress
[Service]
SyslogIdentifier=stress
StandardOutput=journal
StandardError=journal
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/bin/stress -c 1
Restart=always
@rssnyder
rssnyder / aws_stop_1.json
Created January 22, 2024 14:10
Since the AWS granular permissions are extended, it needs to be split into two policies because of AWS size limitations.
{
"Version": "2012-10-17",
"Statement":
[
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action":
[
"acm:ListCertificates",
@rssnyder
rssnyder / stale_flags.py
Created January 5, 2024 15:39
get all stale flags in a harness account
from os import getenv
from requests import get
headers = {
"Harness-Account": getenv("HARNESS_ACCOUNT_ID"),
"x-api-key": getenv("HARNESS_PLATFORM_API_KEY"),
}
# get all orgs
@rssnyder
rssnyder / main.tf
Created December 27, 2023 18:54
run a harness delegate in azure aci
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.0.0"
}
}
}
provider "azurerm" {
@rssnyder
rssnyder / readme.md
Last active December 13, 2023 00:45
scaling kubernetes delegates based on tasks

problem statement: scale a kubernetes delegate not based on cpu or memory, but on the number of tasks assigned to the delegates

what we need:

  1. validate that our prometheus metrics can be used by the cluster for scaling:
@rssnyder
rssnyder / main.tf
Last active February 2, 2024 15:53
harness scheduled autostopping via instance tags
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
harness = {
source = "harness/harness"
}
}
@rssnyder
rssnyder / main.tf
Created October 24, 2023 14:26
harness terraform provider example
terraform {
required_providers {
harness = {
source = "harness/harness"
}
}
}
provider "harness" {}
@rssnyder
rssnyder / main.py
Created October 23, 2023 13:44
create a perspective for a group of aws accounts using python
from os import getenv
from requests import post
HEADERS = {"x-api-key": getenv("HARNESS_PLATFORM_API_KEY")}
PARAMS = {
"routingId": getenv("HARNESS_ACCOUNT_ID"),
"accountIdentifier": getenv("HARNESS_ACCOUNT_ID"),
@rssnyder
rssnyder / README.md
Last active September 25, 2023 20:12
get a list of harness projects

get all harness projects using python

setup

set the following in your environment

HARNESS_ACCOUNT_ID: your harness account id

HARNESS_PLATFORM_API_KEY: a harness token with orgs and projects read