Skip to content

Commit

Permalink
Merge pull request #558 from yuvipanda/carbonplan-eksctl
Browse files Browse the repository at this point in the history
Move carbonplan hub to eksctl
  • Loading branch information
yuvipanda authored Jul 30, 2021
2 parents 151faa8 + 71842ce commit cc71cbd
Show file tree
Hide file tree
Showing 14 changed files with 205 additions and 199 deletions.
2 changes: 2 additions & 0 deletions .sops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ creation_rules:
gcp_kms: projects/two-eye-two-see/locations/global/keyRings/sops-keys/cryptoKeys/similar-hubs
- path_regex: .*/kops/ssh-keys/.*
gcp_kms: projects/two-eye-two-see/locations/global/keyRings/sops-keys/cryptoKeys/similar-hubs
- path_regex: .*/eksctl/ssh-keys/.*
gcp_kms: projects/two-eye-two-see/locations/global/keyRings/sops-keys/cryptoKeys/similar-hubs
- path_regex: config/secrets.yaml$
gcp_kms: projects/two-eye-two-see/locations/global/keyRings/sops-keys/cryptoKeys/similar-hubs
- path_regex: support/secrets.yaml$
Expand Down
5 changes: 5 additions & 0 deletions config/hubs/carbonplan.cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ support:
limits:
cpu: 4
memory: 8Gi
cluster-autoscaler:
enabled: true
autoDiscovery:
clusterName: carbonplanhub
awsRegion: us-west-2
grafana:
ingress:
hosts:
Expand Down
87 changes: 87 additions & 0 deletions eksctl/carbonplan.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// Exports an eksctl config file for carbonplan cluster
local cluster = import "./libsonnet/cluster.jsonnet";
local ng = import "./libsonnet/nodegroup.jsonnet";

// place all cluster nodes here
local clusterRegion = "us-west-2";
local masterAzs = ["us-west-2a", "us-west-2b", "us-west-2c"];
local nodeAz = "us-west-2a";

// Node definitions for use with dask and notebook nodes
// These are merged in with the defaults for either node type,
// and so can contain any overrides.
local nodes = [
{ instanceType: "r5.large" },
{ instanceType: "r5.xlarge" },
{ instanceType: "r5.2xlarge" },
{ instanceType: "r5.8xlarge" },
{ instanceType: "x1.16xlarge" },
{ instanceType: "x1.32xlarge" }
];

cluster {
metadata+: {
name: "carbonplanhub",
region: clusterRegion
},
availabilityZones: masterAzs,
nodeGroups: [
ng {
name: 'core-a',
availabilityZones: [nodeAz],
ssh: {
publicKeyPath: 'ssh-keys/carbonplan.key.pub'
},
instanceType: "m5.xlarge",
minSize: 1,
maxSize: 6,
labels+: {
"hub.jupyter.org/node-purpose": "core",
"k8s.dask.org/node-purpose": "core"
},
},
] + [
ng {
// NodeGroup names can't have a '.' in them, while
// instanceTypes always have a .
name: "nb-%s" % std.strReplace(self.instanceType, ".", "-"),
availabilityZones: [nodeAz],
minSize: 0,
maxSize: 500,
ssh: {
publicKeyPath: 'ssh-keys/carbonplan.key.pub'
},
labels+: {
"hub.jupyter.org/node-purpose": "user",
"k8s.dask.org/node-purpose": "scheduler"
},
taints+: {
"hub.jupyter.org_dedicated": "user:NoSchedule",
"hub.jupyter.org/dedicated": "user:NoSchedule"
},

} + n for n in nodes
] + [
ng {
// NodeGroup names can't have a '.' in them, while
// instanceTypes always have a .
name: "dask-%s" % std.strReplace(self.instanceType, ".", "-"),
availabilityZones: [nodeAz],
minSize: 0,
maxSize: 500,
ssh: {
publicKeyPath: 'ssh-keys/carbonplan.key.pub'
},
labels+: {
"k8s.dask.org/node-purpose": "worker"
},
taints+: {
"k8s.dask.org_dedicated" : "worker:NoSchedule",
"k8s.dask.org/dedicated" : "worker:NoSchedule"
},

} + n for n in nodes
]


}
19 changes: 19 additions & 0 deletions eksctl/libsonnet/cluster.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Exports a customizable eksctl cluster object
// https://eksctl.io/usage/schema/ lists the config
//
// The default configuration is pretty bare, and only
// sets the default k8s version. Everything else must
// be merged in by the jsonnet file for each cluster
{
apiVersion: 'eksctl.io/v1alpha5',
kind: 'ClusterConfig',
metadata: {
name: '',
region: '',
version: '1.19',
},
availabilityZones: [],
iam: {
withOIDC: true,
},
}
32 changes: 32 additions & 0 deletions eksctl/libsonnet/nodegroup.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Make ASG tags for given set of k8s labels
local makeCloudLabels(labels) = {
['k8s.io/cluster-autoscaler/node-template/label/%s' % key]: labels[key]
for key in std.objectFields(labels)
};

# Make asg tags for given set of k8s taints
local makeCloudTaints(taints) = {
['k8s.io/cluster-autoscaler/node-template/taint/%s' % key]: taints[key]
for key in std.objectFields(taints)
};

{
name: '',
availabilityZones: [],
minSize: 0,
desiredCapacity: self.minSize,
instanceType: '',
volumeSize: 80,
labels+: {
// Add instance type as label to nodegroups, so they
// can be picked up by the autoscaler
'node.kubernetes.io/instance-type': $.instanceType,
},
taints+: {},
tags: makeCloudLabels(self.labels) + makeCloudTaints(self.taints),
iam: {
withAddonPolicies: {
autoScaler: true,
},
},
}
21 changes: 21 additions & 0 deletions eksctl/ssh-keys/carbonplan.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"data": "ENC[AES256_GCM,data:BZazQGKXm86j1Pb/RRhmGdJGSoUUed7GY6Fo6xrZEh73qyNS13IJop9eGmeMI7UsuOCwPungwW++pJX7MDQ5wa4ol9E4m/+1FoO56paLwGnCexsx0no9s+3y9UZVN4TCXkd3ISaq92FdUc2FKuLkUiKMOC78uYtaSDyIOWOpba0MxbLdScITbSBGwmP+nEoWt52wGokqrPMGKre9WMpRaUycPSB+rL0A13rnH/nwYdQhRHEWmCIulPAMNe5aeYUQ/NMPJaoxGhL7A7TmeFcX7nWedymRn/WGTS3AIo8iPXQkBe7lurPQrS1pzP5lG6IX6pNJ3STbHYRkWl+xTaoBjH29r5+VPuHsBfMr1jwW8j3dCqOB/oODbz0cSW7qlb0sLNgJ+JuCyCBFJNzie6pBHORLjhhv1ifhMCuLXs0Fk5TJVnh7ODwWaRUuD1DgGz2XnOOiWOW1hIb2hqt0dojEbgSC2iPuUi1bCu5UnNZ8XgD27A5xKwRasYtCJuRJjJ+WGiQnzSNSTW4A/qJ6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N8IcLQFFxOxXK0rQuK8EsEzk57UGW2s8mKwmUClpq6rxOQ+VokDzDm2MeDuD9ZA+u7rv7d+QJu59NGvfDHOx21HSZS4r8UsEO45LBy27saQgFY1b100Q8j4G641xAip1uTY98hi2fIyQi79p1NZ6hVB/ia65xb728uOzI2VvBjiOphbGTawVQBSqDtpbOjc4Fo8Xrw2xlqaQPsRDnn6baMWCXfFt4+lgMI8D75lQtQ/stV7ZRZOM+qUI7Qf/k5gjIKT0LcjGGFLRRrbg4GiTbnGR8H10PiYTFyTAfYhaQFN9VKfVY50ulCJlI2QC8uJy5o40R3Ye6jJFYu7mjOWNJF7eY51FkexiTmvVt9SerR4UqqcM7qE++IpI+xu2qCmY8TA08SiZ0qfKBT/VrcBlRC3gYQvaEVSX+GZlKUfzXn++pY/SeSReOpf2TRy01/vZwlOe+9yDBX8GSw7KKxCW5qGFUSWUSBM8D1mjsTM74kWw7LAlLJnpIRXxns7GmwRiGyhSo5R8gyZg0tiNDuegazCW0JOLUJRX4bL4HDOdTCMvjK1dPe0oCqG0AG25v9TWWfp1Vnm5EDcdUVFQAyIu+w5wy68NPt5RIsKQPGK2gcP46btKR/janEwmPvh+Bzwm/onPOLFAMhqiPU0kD7tvOW7tpZgo1kbaZzz3n6X5mPevhffHIj9QMor66Kb0x24+6h9KdwHDvJ9aAsS9VO8qnUVJWuPoA2eHWS+4rxaHFSCVDlOGLqmdhzd4nt5btHB/DcBzOJssQJHqVV+jyHa6TGouONaDVPTFSFfq6D,iv:6L89V9Nycfneb4bU0nCvA0i+qxy9JMqwRIr/H5T3PQ4=,tag:yCmxcl0ZwMLQ0zU0CmZ6FA==,type:str]",
"sops": {
"kms": null,
"gcp_kms": [
{
"resource_id": "projects/two-eye-two-see/locations/global/keyRings/sops-keys/cryptoKeys/similar-hubs",
"created_at": "2021-07-27T12:23:33Z",
"enc": "CiQA4OM7eICUZva/D+yx43fQXwFmI54mOdn4+aT3TdnTqIWaI9USSQB6TpsYaJh4GNAW1aI3J+N9fokpWYybO8SUIQRebDpmNUpeMh+xqQG2lRnpjnGt/2D2JGnMzUn076Nd/0CIUSlVoq5/W57jsk8="
}
],
"azure_kv": null,
"hc_vault": null,
"age": null,
"lastmodified": "2021-07-27T12:23:34Z",
"mac": "ENC[AES256_GCM,data:8KbxNB7+PYDE79iHXrw7aLvt3DE07MMRhAqhrbdNeKAVE+iMpQyxk4twjG/hEJSYXq3Q17VjIJNqDtFF4EE+/cveOH4A9yNtXlne0mEacFuRD2Av4GHUt7i1EjFNyXiPhirUovu1RiG9pcIKu5zkOhMOMk2lYv6l4i2GVmxDjLQ=,iv:WMM/f3kGv6gdoxwiPMPs2/8VHYDfkmZSp8hgZ+hnOzo=,tag:KfQa2YWEzDRJPHc9oqXyIA==,type:str]",
"pgp": null,
"unencrypted_suffix": "_unencrypted",
"version": "3.7.1"
}
}
1 change: 1 addition & 0 deletions eksctl/ssh-keys/carbonplan.key.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDaDc3nWE5ndKpmeIg1vbYnCmG4UZ/ZYMKXAdKaVy/p0EHec99o2WqqoqIjgJzeZBGSC/v57igWWbxjlvtnAMbd1M7JXvz1RTjzsw2ankBCq96UOklQoOR341ekxt/Zomp8TC+J7neXYHdSzQ280HNHQpX0MhwxsHLTs49kYOmauiW4uiXuTgRL5nvCeHzeIXFvhLuC9QmeQpaFoPgJrHS5AGER5C7fcRdybyMVfm/EDvc27c9S6NYZ98fcjyR9fmIeOB+krNWlB3UIQG1IwxR1Yhy9f/c8R2RCg63aWFMgGbF70MHGi9m3ntFkq9HMPoEHzLDB20vd/9Om+vIqq9nykBYiS1tjzGKv/jbvr7d6c81POv6UgMaVcDZYnAx/AHv4zzS0KDtnNLd/OAk2r1Ov9v104J7U17WjNBJjNMxtMe8skj/JqXPJJ/6FDI3/7S+zKX1tszMqi+XD/jUAisiZh/VvarJGzkyI09JyC6M6w507/HBjzuMePFtroeCf270= [email protected]
160 changes: 0 additions & 160 deletions kops/carbonplan.jsonnet

This file was deleted.

1 change: 1 addition & 0 deletions kops/libsonnet/cluster.jsonnet
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

// Exports a customizable kops Cluster object.
// https://kops.sigs.k8s.io/cluster_spec/ lists available properties.
//
Expand Down
21 changes: 0 additions & 21 deletions kops/ssh-keys/carbonplan.key

This file was deleted.

Loading

0 comments on commit cc71cbd

Please sign in to comment.