Skip to content

Instantly share code, notes, and snippets.

View arianvp's full-sized avatar
🎱
Focusing

Arian van Putten arianvp

🎱
Focusing
View GitHub Profile
@arianvp
arianvp / flake.nix
Created February 22, 2022 19:18
A flake to deploy app to kubernetes
{
description = "A flake that builds a go app and deploys to kubernetes";
inputs = {
utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs, utils }: utils.lib.eachDefaultSystem (system:
let
{
"cniversion":"1.0.0",
"name":"kube",
"plugins": [
{
"type": "ptp",
"ipam": {
"type": "host-local",
"routes": [ { "dst": "::/0" } ],
"ranges": [ { "subnet": "2001:19f0:6c01:1f10::/80" } ]
@arianvp
arianvp / boot.ipxe
Last active August 31, 2021 16:17
ipxe boot config
#!ipxe
set STREAM stable
set VERSION 34.20210725.3.0
set BASEURL https://builds.coreos.fedoraproject.org/prod/streams/${STREAM}/builds/${VERSION}/x86_64
set NETWORK # ip=bond0:dhcp bond=bond0:enp0s20f0,enp0s20f1:mode=balance-tlb,downdelay=200,updelay=200,miimon=100 nameserver=8.8.8.8
kernel ${BASEURL}/fedora-coreos-${VERSION}-live-kernel-x86_64 initrd=main ignition.platform.id=metal coreos.inst.install_dev=/dev/sda coreos.live.rootfs_url=${BASEURL}/fedora-coreos-${VERSION}-live-rootfs.x86_64.img ignition.firstboot coreos.inst.platform_id=packet console=ttyS1,115200n8 ${NETWORK}
use anyhow::{anyhow, Result};
use futures::TryStreamExt;
use k8s_openapi::api::core::v1::{PersistentVolumeClaim, Pod};
use kube::api::{Api, DeleteParams, ListParams, Patch, PatchParams};
use kube::Client;
use kube::CustomResource;
use kube_runtime::utils::try_flatten_applied;
use kube_runtime::watcher;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@arianvp
arianvp / eksctl.yaml
Last active June 14, 2021 19:36
EKS managed node group k8ssandra
apiVersion: eksctl.io/v1alpha5
kind: ClusterConfig
metadata:
name: arian-playground-staging
region: eu-central-1
version: "1.19"
managedNodeGroups:
# Used for other workloads
- name: compute
minSize: 1
{ pkgs, lib, config, ... }:
let
cfg = config.webshop;
in
{
options.webshop = {
website = lib.mkOption {
type = lib.types.package;
description = "The static content to serve";
};
@arianvp
arianvp / README.md
Created August 6, 2020 21:01
Nix bug

nix-shell --pure repro.nix succeeds:

$ nix-shell --pure repro.nix
[nix-shell]$ out=final.img
[nix-shell]$ genericBuild
90792
Checking that no-one is using this disk right now ... OK

Disk out.img: 44.3 MiB, 46485504 bytes, 90792 sectors
Units: sectors of 1 * 512 = 512 bytes
@arianvp
arianvp / review.md
Last active July 7, 2020 11:51
publiccode review
  • Code in the open - Development is done on a closed platform (Azure) that is periodically synced with GitHub. Some teams do work primarily on GitHub.
  • Bundle policy and source code - No. there are some requirement documents; but they're not in editable form, and are not the policy itself
  • Create reusable and portable code - Impossible due to dependence on GAEN which violates the "The codebase MUST be independent from any secret, undisclosed, proprietary or non-open licensed code or services for execution and understanding." requirement
  • Welcome contributions
  • Maintain version control
  • Require review of contributions
  • Document your objectives - . There is a requirements document but it's uneditable
  • Document your code. Partially. there are architecture documentation, but no code docs.
  • Use plain English
[nix-shell:~/Projects/nixos-stuff]$ ./result/bin/deploy switch ryzen.local
Enter PIN for 'arian':
[139 copied (1633.8 MiB)]
[sudo] password for arian:
Shared connection to ryzen.local closed.
[sudo] password for arian:
stopping the following units: accounts-daemon.service, nscd.service, systemd-modules-load.service
NOT restarting the following changed units: systemd-fsck@dev-sdc1.service
activating the configuration...
setting up /etc...
@arianvp
arianvp / example.sh
Last active March 5, 2023 10:34
Declaratively manage packages without NixOS or home-manager
# add your package set to your existing environment (together with the things you installed imperatively)
$ nix-env -i -f ./packages.nix
# More declarative: _replace_ your environment with _exactly_ what is in ./packages.nix
$ nix-env --set -f ./packages.nix
# Show previous versions
$ nix-env --list-generations
# Rollback
$ nix-env --rollback