This commit is contained in:
Serge Logvinov
2021-11-21 08:58:17 +02:00
parent 07ee540e46
commit 24a2d10261
8 changed files with 94 additions and 7 deletions

3
hetzner/.gitignore vendored
View File

@@ -1,4 +1,5 @@
_cfgs/
controlplane-*.yaml
templates/controlplane.yaml
controlplane-*.yaml
worker-*.yaml
*.patch

View File

@@ -0,0 +1,46 @@
apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
name: overprovisioning
value: -1
globalDefault: false
description: "Priority class used by overprovisioning."
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: overprovisioning
namespace: default
spec:
replicas: 1
selector:
matchLabels:
run: overprovisioning
template:
metadata:
labels:
run: overprovisioning
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node.kubernetes.io/instance-type
operator: Exists
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: kubernetes.io/hostname
labelSelector:
matchExpressions:
- key: run
operator: In
values:
- overprovisioning
priorityClassName: overprovisioning
containers:
- name: reserve-resources
image: k8s.gcr.io/pause
resources:
requests:
cpu: "700m"

View File

@@ -0,0 +1,40 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: csi-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: hcloud-volumes
---
kind: Pod
apiVersion: v1
metadata:
name: csi-app
spec:
tolerations:
- effect: NoExecute
operator: Exists
- effect: NoSchedule
operator: Exists
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node.kubernetes.io/instance-type
operator: Exists
containers:
- name: my-frontend
image: alpine
volumeMounts:
- mountPath: "/data"
name: my-csi-volume
command: [ "sleep", "1000000" ]
volumes:
- name: my-csi-volume
persistentVolumeClaim:
claimName: csi-pvc

View File

@@ -43,7 +43,7 @@ data "openstack_networking_subnet_v2" "controlplane_public" {
}
resource "openstack_compute_instance_v2" "controlplane" {
count = 1
count = 0
name = "master-${count.index + 1}"
image_id = openstack_images_image_v2.talos[count.index].id
flavor_name = "s1-2"

View File

@@ -17,7 +17,7 @@ locals {
}
resource "openstack_compute_instance_v2" "worker" {
count = 1
count = 0
name = "worker-${count.index + 1}"
image_id = openstack_images_image_v2.talos[count.index].id
flavor_name = "s1-2"

View File

@@ -21,7 +21,7 @@ resource "openstack_networking_subnet_v2" "core" {
cidr = cidrsubnet(var.vpc_main_cidr, 8, count.index * 4)
no_gateway = true
allocation_pool {
start = cidrhost(cidrsubnet(var.vpc_main_cidr, 8, count.index * 4), 11)
start = cidrhost(cidrsubnet(var.vpc_main_cidr, 8, count.index * 4), 100)
end = cidrhost(cidrsubnet(var.vpc_main_cidr, 8, count.index * 4), -7)
}
ip_version = 4
@@ -35,7 +35,7 @@ resource "openstack_networking_subnet_v2" "private" {
network_id = data.openstack_networking_network_v2.main[count.index].id
cidr = cidrsubnet(var.vpc_main_cidr, 8, 1 + count.index * 4)
allocation_pool {
start = cidrhost(cidrsubnet(var.vpc_main_cidr, 8, 1 + count.index * 4), 11)
start = cidrhost(cidrsubnet(var.vpc_main_cidr, 8, 1 + count.index * 4), 100)
end = cidrhost(cidrsubnet(var.vpc_main_cidr, 8, 1 + count.index * 4), -7)
}
ip_version = 4

View File

@@ -14,7 +14,7 @@ resource "null_resource" "controlplane_machineconfig" {
type = "controlplane"
ipv4_local = "192.168.10.11"
ipv4_vip = "192.168.10.10"
nodeSubnets = "${var.vpc_main_cidr},!192.168.10.10/32"
nodeSubnets = "${var.vpc_main_cidr}"
})
)

View File

@@ -7,7 +7,7 @@ variable "hcloud_token" {
variable "talos_version" {
type = string
default = "v0.13.0"
default = "v0.13.2"
}
locals {