Setup some variables first
export PROJECT_ID=$(gcloud config get-value project)
export REGION=europe-west3 # should be the same as your mig
export MIG_NAME=service-x-mig # or whatever you already have
VAULT_TOKEN=<your token> |
import os | |
import shutil | |
import gitlab | |
from git import Repo | |
import time | |
# Configuration | |
GITLAB_URL = "https://git.acme.dk" | |
GITLAB_TOKEN = "..." |
This is confirmed working with Harbor v2.0.0 | |
# Parameters ------------------------ | |
HARBOR_URL="https://reg.registry.dk" | |
HARBOR_USER="username" | |
HARBOR_PASSWORD="secret" | |
PROJECT="project" | |
REPOSITORY="repository" | |
TAG="0.0.1" |
# Step 1: Use the kasten UI to create a role (<role>) | |
# Create service account for those who needs access | |
kubectl create serviceaccount <user> --namespace kasten-io | |
# For the namespace that the user needs access to: | |
kubectl create rolebinding backup_manager1 --namespace <namespace> \ | |
--clusterrole=<role> \ | |
--serviceaccount=kasten-io:<user> | |
# THIS IS A VERY HACKY AD-HOC SOLUTION TO BALANCE NODES BASED ON MEMORY USAGE ACROSS THE CLUSTER | |
import subprocess | |
import json | |
import time | |
def execute_kubectl_command(command): | |
"""Executes a kubectl command and returns the output.""" | |
full_command = ["kubectl"] + command.split() | |
result = subprocess.run(full_command, capture_output=True, text=True) |
#!/bin/bash | |
fix_rgb() { | |
fixes=0 | |
dryrun=false | |
if [ ! -t 0 ]; then | |
read -p "Do you want to proceed with fixing? (y/n): " answer | |
if [ "$answer" = "n" ]; then | |
dryrun=true |
{ | |
init: function(elevators, floors) { | |
// helper function to check if a floor is already queued | |
function isFloorQueued(elevator, floorNum) { | |
return elevator.destinationQueue.indexOf(floorNum) > -1; | |
} | |
function isFloorQueuedForAnyElevator(floorNum) { | |
for (let e = 0; e < elevators.length; e++) { |
WITH p AS ( | |
WITH q AS ( | |
WITH y AS ( | |
WITH x as ( | |
SELECT | |
sm.entity_id, | |
s.state, | |
s.last_updated_ts, | |
COALESCE(LAG(s.state) OVER (partition by sm.entity_id ORDER BY last_updated_ts ASC), s.state) as last_state | |
FROM states s |
# BEGIN: 8f7d6h3j4k5l | |
import unittest | |
import requests | |
import jwt | |
import time | |
class TestAPI(unittest.TestCase): | |
token = None | |
api_basepath = "https://api-test.xl-byg.dk" |