-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
86 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
# Import this instead of <nixpkgs> to get the repo-specific version of nixpkgs. | ||
builtins.fetchTarball { | ||
name = "nixos-unstable-2018-09-12"; | ||
url = https://github.com/johanot/nixpkgs/archive/b3905f0d224bc5c2da3572f7017f05a27df742cd.tar.gz; | ||
sha256 = "05jxiyagfgl7s061vz2xmalrrbaz95ymcxdv89j3s700hicyd8pf"; | ||
} | ||
|
||
import ((import <nixpkgs> {}).fetchzip (import ./nixpkgs-version.nix)) | ||
# How to push a cache to arm.nixos.org | ||
# ./manage c export | jq '.[].configsPath' -r | ( read conf ; nix-store -qR $conf | while read line; do echo `nix-store -q --size $line` $line ; done | sort -nr | head -n10 | cut -d' ' -f2 | grep -E 'linux|icu4c|glibc|systemd|glib|coreutils|initrd|util-linux' | cachix push arm ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
{ targetEnv ? "virtualbox" } : | ||
let | ||
region = "us-gov-west-1"; | ||
zone = "us-gov-west-1a"; | ||
accessKeyId = "default"; | ||
machine = | ||
{ config, pkgs, resources, ... }:{ | ||
imports = | ||
(if targetEnv == "ec2" then | ||
[<nixpkgs/nixos/modules/virtualisation/amazon-image.nix>] else []) ++ | ||
[ <nixpkgs/nixos/modules/profiles/minimal.nix> ]; | ||
deployment.targetEnv = targetEnv; | ||
deployment.ec2 = { | ||
keyPair = resources.ec2KeyPairs.my-key-pair; | ||
ebsInitialRootDiskSize = 30; | ||
ebsOptimized = true; | ||
associatePublicIpAddress = true; | ||
ami = "ami-bb7618da"; | ||
inherit region zone accessKeyId; | ||
instanceType = "t3.large"; | ||
}; | ||
ec2.hvm = true; | ||
boot.initrd.postDeviceCommands= '' | ||
${pkgs.e2fsprogs}/sbin/e2fsck -fp /dev/disk/by-label/nixos | ||
${pkgs.e2fsprogs}/sbin/resize2fs /dev/disk/by-label/nixos | ||
''; | ||
|
||
deployment.virtualbox.memorySize = 4096; # megabytes | ||
deployment.virtualbox.vcpu = 2; # number of cpus | ||
deployment.virtualbox.headless = true; | ||
|
||
networking.extraHosts = "${config.networking.privateIPv4} api.kube"; | ||
services.kubernetes = { | ||
easyCerts = true; | ||
addons.dashboard.enable = true; | ||
roles = ["master" "node"]; | ||
apiserver = { | ||
securePort = 443; | ||
advertiseAddress = config.networking.privateIPv4; | ||
}; | ||
masterAddress = "api.kube"; | ||
}; | ||
services.dockerRegistry.enable = true; | ||
environment.systemPackages = with pkgs; [ | ||
kompose kubectl | ||
vim e2fsprogs | ||
]; | ||
networking.firewall.allowedTCPPorts = [22 443 ]; | ||
users.users.root.openssh.authorizedKeys = { | ||
keyFiles = [ ]; | ||
}; | ||
}; | ||
in { | ||
kubemaster = machine; | ||
|
||
network.description = "kubenixops"; | ||
network.enableRollback = true; | ||
resources = if targetEnv == "ec2" then { | ||
ec2KeyPairs.my-key-pair = { inherit region accessKeyId; }; | ||
}else {}; | ||
|
||
} |