Fixing meta
This commit is contained in:
12
virt/multus/common.tf
Normal file
12
virt/multus/common.tf
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
locals {
|
||||
common-labels = {
|
||||
"vynil.solidite.fr/owner-name" = var.instance
|
||||
"vynil.solidite.fr/owner-namespace" = var.namespace
|
||||
"vynil.solidite.fr/owner-category" = var.category
|
||||
"vynil.solidite.fr/owner-component" = var.component
|
||||
"app.kubernetes.io/managed-by" = "vynil"
|
||||
"app.kubernetes.io/name" = var.component
|
||||
"app.kubernetes.io/instance" = var.instance
|
||||
}
|
||||
}
|
||||
78
virt/multus/index.yaml
Normal file
78
virt/multus/index.yaml
Normal file
@@ -0,0 +1,78 @@
|
||||
---
|
||||
apiVersion: vinyl.solidite.fr/v1beta1
|
||||
kind: Component
|
||||
category: virt
|
||||
metadata:
|
||||
name: multus
|
||||
description: a CNI plugin capable of allocating several networks to pods
|
||||
options:
|
||||
cni:
|
||||
default:
|
||||
bin_dir: /opt/cni/bin
|
||||
conf_dir: /etc/cni/net.d
|
||||
examples:
|
||||
- bin_dir: /opt/cni/bin
|
||||
conf_dir: /etc/cni/net.d
|
||||
properties:
|
||||
bin_dir:
|
||||
default: /opt/cni/bin
|
||||
description: use /var/lib/rancher/k3s/data/current/bin for k3s
|
||||
type: string
|
||||
conf_dir:
|
||||
default: /etc/cni/net.d
|
||||
description: use /var/lib/rancher/k3s/agent/etc/cni/net.d for k3s
|
||||
type: string
|
||||
type: object
|
||||
images:
|
||||
default:
|
||||
operator:
|
||||
pull_policy: IfNotPresent
|
||||
registry: ghcr.io
|
||||
repository: k8snetworkplumbingwg/multus-cni
|
||||
tag: v3.9.3
|
||||
examples:
|
||||
- operator:
|
||||
pull_policy: IfNotPresent
|
||||
registry: ghcr.io
|
||||
repository: k8snetworkplumbingwg/multus-cni
|
||||
tag: v3.9.3
|
||||
properties:
|
||||
operator:
|
||||
default:
|
||||
pull_policy: IfNotPresent
|
||||
registry: ghcr.io
|
||||
repository: k8snetworkplumbingwg/multus-cni
|
||||
tag: v3.9.3
|
||||
properties:
|
||||
pull_policy:
|
||||
default: IfNotPresent
|
||||
enum:
|
||||
- Always
|
||||
- Never
|
||||
- IfNotPresent
|
||||
type: string
|
||||
registry:
|
||||
default: ghcr.io
|
||||
type: string
|
||||
repository:
|
||||
default: k8snetworkplumbingwg/multus-cni
|
||||
type: string
|
||||
tag:
|
||||
default: v3.9.3
|
||||
type: string
|
||||
type: object
|
||||
type: object
|
||||
dependencies:
|
||||
- dist: null
|
||||
category: crd
|
||||
component: multus
|
||||
providers:
|
||||
kubernetes: true
|
||||
authentik: null
|
||||
kubectl: true
|
||||
postgresql: null
|
||||
mysql: null
|
||||
restapi: null
|
||||
http: null
|
||||
gitea: null
|
||||
tfaddtype: null
|
||||
44
virt/multus/multus_ConfigMap.tf
Normal file
44
virt/multus/multus_ConfigMap.tf
Normal file
@@ -0,0 +1,44 @@
|
||||
resource "kubectl_manifest" "ConfigMap_multus-cni-config" {
|
||||
yaml_body = <<-EOF
|
||||
kind: ConfigMap
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: multus-cni-config
|
||||
namespace: ${var.namespace}
|
||||
labels: ${jsonencode(local.common-labels)}
|
||||
ownerReferences: ${jsonencode(var.install_owner)}
|
||||
data:
|
||||
cni-conf.json: |-
|
||||
{
|
||||
"name": "multus-cni-network",
|
||||
"type": "multus",
|
||||
"capabilities": {
|
||||
"portMappings": true
|
||||
},
|
||||
"delegates": [
|
||||
{
|
||||
"cniVersion": "0.3.1",
|
||||
"name": "default-cni-network",
|
||||
"plugins": [
|
||||
{
|
||||
"type": "flannel",
|
||||
"name": "flannel.1",
|
||||
"delegate": {
|
||||
"isDefaultGateway": true,
|
||||
"hairpinMode": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "portmap",
|
||||
"capabilities": {
|
||||
"portMappings": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"kubeconfig": "${var.cni.conf_dir}/multus.d/multus.kubeconfig"
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
66
virt/multus/multus_rbac.tf
Normal file
66
virt/multus/multus_rbac.tf
Normal file
@@ -0,0 +1,66 @@
|
||||
resource "kubectl_manifest" "ClusterRole_multus" {
|
||||
yaml_body = <<-EOF
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: multus
|
||||
ownerReferences: ${jsonencode(var.install_owner)}
|
||||
labels: ${jsonencode(local.common-labels)}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- k8s.cni.cncf.io
|
||||
resources:
|
||||
- '*'
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- pods
|
||||
- pods/status
|
||||
verbs:
|
||||
- get
|
||||
- update
|
||||
- apiGroups:
|
||||
- ''
|
||||
- events.k8s.io
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- update
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "ClusterRoleBinding_multus" {
|
||||
yaml_body = <<-EOF
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: multus
|
||||
ownerReferences: ${jsonencode(var.install_owner)}
|
||||
labels: ${jsonencode(local.common-labels)}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: multus
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: multus
|
||||
namespace: ${var.namespace}
|
||||
EOF
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "ServiceAccount_multus" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: multus
|
||||
namespace: ${var.namespace}
|
||||
ownerReferences: ${jsonencode(var.install_owner)}
|
||||
labels: ${jsonencode(local.common-labels)}
|
||||
EOF
|
||||
}
|
||||
|
||||
89
virt/multus/multus_workload.tf
Normal file
89
virt/multus/multus_workload.tf
Normal file
@@ -0,0 +1,89 @@
|
||||
resource "kubectl_manifest" "DaemonSet_kube-multus-ds" {
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: kube-multus-ds
|
||||
namespace: ${var.namespace}
|
||||
labels: ${jsonencode(local.common-labels)}
|
||||
ownerReferences: ${jsonencode(var.install_owner)}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
name: multus
|
||||
updateStrategy:
|
||||
type: RollingUpdate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
tier: node
|
||||
app: multus
|
||||
name: multus
|
||||
spec:
|
||||
hostNetwork: true
|
||||
tolerations:
|
||||
- operator: Exists
|
||||
effect: NoSchedule
|
||||
- operator: Exists
|
||||
effect: NoExecute
|
||||
serviceAccountName: multus
|
||||
containers:
|
||||
- name: kube-multus
|
||||
image: ${var.images.operator.registry}/${var.images.operator.repository}:${var.images.operator.tag}
|
||||
imagePullPolicy: ${var.images.operator.pull_policy}
|
||||
command:
|
||||
- /entrypoint.sh
|
||||
args:
|
||||
- --multus-conf-file=auto
|
||||
- --cni-version=0.3.1
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 50Mi
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 50Mi
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: cni
|
||||
mountPath: /host/etc/cni/net.d
|
||||
- name: cnibin
|
||||
mountPath: /host/opt/cni/bin
|
||||
- name: multus-cfg
|
||||
mountPath: /tmp/multus-conf
|
||||
initContainers:
|
||||
- name: install-multus-binary
|
||||
image: ${var.images.operator.registry}/${var.images.operator.repository}:${var.images.operator.tag}
|
||||
imagePullPolicy: ${var.images.operator.pull_policy}
|
||||
command:
|
||||
- cp
|
||||
- /usr/src/multus-cni/bin/multus
|
||||
- /host/opt/cni/bin/multus
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 15Mi
|
||||
securityContext:
|
||||
privileged: true
|
||||
volumeMounts:
|
||||
- name: cnibin
|
||||
mountPath: /host/opt/cni/bin
|
||||
mountPropagation: Bidirectional
|
||||
terminationGracePeriodSeconds: 10
|
||||
volumes:
|
||||
- name: cni
|
||||
hostPath:
|
||||
path: ${var.cni.conf_dir}
|
||||
- name: cnibin
|
||||
hostPath:
|
||||
path: ${var.cni.bin_dir}
|
||||
- name: multus-cfg
|
||||
configMap:
|
||||
name: multus-cni-config
|
||||
items:
|
||||
- key: cni-conf.json
|
||||
path: 70-multus.conf
|
||||
EOF
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user