-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Patryk Strusiewicz-Surmacki <[email protected]>
- Loading branch information
1 parent
95d5b65
commit 854ef91
Showing
18 changed files
with
865 additions
and
2 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 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
244 changes: 244 additions & 0 deletions
244
...e-metal3/bases/clusterclass-centos-kubeadm-config/clusterclass-centos-kubeadm-config.yaml
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,244 @@ | ||
--- | ||
apiVersion: controlplane.cluster.x-k8s.io/${CAPI_VERSION} | ||
kind: KubeadmControlPlaneTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME} | ||
namespace: ${NAMESPACE} | ||
spec: | ||
template: | ||
spec: | ||
kubeadmConfigSpec: | ||
clusterConfiguration: {} | ||
users: | ||
- name: ${IMAGE_USERNAME} | ||
sshAuthorizedKeys: | ||
- ${SSH_PUB_KEY_CONTENT} | ||
sudo: ALL=(ALL) NOPASSWD:ALL | ||
files: | ||
- content: | | ||
#!/bin/bash | ||
set -e | ||
url="$1" | ||
dst="$2" | ||
filename="$(basename $url)" | ||
tmpfile="/tmp/$filename" | ||
curl -sSL -w "%{http_code}" "$url" | sed "s:/usr/bin:/usr/local/bin:g" > /tmp/"$filename" | ||
http_status=$(cat "$tmpfile" | tail -n 1) | ||
if [ "$http_status" != "200" ]; then | ||
echo "Error: unable to retrieve $filename file"; | ||
exit 1; | ||
else | ||
cat "$tmpfile"| sed '$d' > "$dst"; | ||
fi | ||
owner: root:root | ||
path: /usr/local/bin/retrieve.configuration.files.sh | ||
permissions: "0755" | ||
- path: /etc/keepalived/keepalived.conf | ||
content: | | ||
! Configuration File for keepalived | ||
global_defs { | ||
notification_email { | ||
[email protected] | ||
[email protected] | ||
} | ||
notification_email_from [email protected] | ||
smtp_server localhost | ||
smtp_connect_timeout 30 | ||
} | ||
vrrp_script k8s_api_check { | ||
script "curl -sk https://127.0.0.1:6443/healthz" | ||
interval 5 | ||
timeout 5 | ||
rise 3 | ||
fall 3 | ||
} | ||
vrrp_instance VI_1 { | ||
state MASTER | ||
interface eth1 | ||
virtual_router_id 1 | ||
priority 101 | ||
advert_int 1 | ||
virtual_ipaddress { | ||
${CLUSTER_APIENDPOINT_HOST} | ||
} | ||
track_script { | ||
k8s_api_check | ||
} | ||
} | ||
- path: /etc/NetworkManager/system-connections/eth0.nmconnection | ||
owner: root:root | ||
permissions: '0600' | ||
content: | | ||
[connection] | ||
id=eth0 | ||
type=ethernet | ||
interface-name=eth0 | ||
master=ironicendpoint | ||
slave-type=bridge | ||
- content: | | ||
[connection] | ||
id=ironicendpoint | ||
type=bridge | ||
interface-name=ironicendpoint | ||
autoconnect=yes | ||
autoconnect-priority=1 | ||
[bridge] | ||
stp=false | ||
interface-name=ironicendpoint | ||
[ipv4] | ||
address1={{ ds.meta_data.provisioningIP }}/{{ ds.meta_data.provisioningCIDR }} | ||
method=manual | ||
[ipv6] | ||
addr-gen-mode=eui64 | ||
method=ignore | ||
path: /etc/NetworkManager/system-connections/ironicendpoint.nmconnection | ||
owner: root:root | ||
permissions: '0600' | ||
- content: | | ||
[kubernetes] | ||
name=Kubernetes | ||
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 | ||
enabled=1 | ||
gpgcheck=1 | ||
repo_gpgcheck=0 | ||
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg | ||
owner: root:root | ||
path: /etc/yum.repos.d/kubernetes.repo | ||
permissions: '0644' | ||
- content: | | ||
[registries.search] | ||
registries = ['docker.io'] | ||
[registries.insecure] | ||
registries = ['${REGISTRY}'] | ||
path: /etc/containers/registries.conf | ||
initConfiguration: | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cgroup-driver: systemd | ||
container-runtime-endpoint: unix:///var/run/crio/crio.sock | ||
feature-gates: AllAlpha=false | ||
node-labels: metal3.io/uuid={{ ds.meta_data.uuid }} | ||
provider-id: ${PROVIDER_ID_FORMAT} | ||
runtime-request-timeout: 5m | ||
name: '{{ ds.meta_data.name }}' | ||
joinConfiguration: | ||
controlPlane: {} | ||
nodeRegistration: | ||
kubeletExtraArgs: | ||
cgroup-driver: systemd | ||
container-runtime-endpoint: unix:///var/run/crio/crio.sock | ||
feature-gates: AllAlpha=false | ||
node-labels: metal3.io/uuid={{ ds.meta_data.uuid }} | ||
provider-id: ${PROVIDER_ID_FORMAT} | ||
runtime-request-timeout: 5m | ||
name: '{{ ds.meta_data.name }}' | ||
preKubeadmCommands: | ||
- rm /etc/cni/net.d/* | ||
- systemctl restart NetworkManager.service | ||
- nmcli connection load /etc/NetworkManager/system-connections/ironicendpoint.nmconnection | ||
- nmcli connection up ironicendpoint | ||
- nmcli connection load /etc/NetworkManager/system-connections/eth0.nmconnection | ||
- nmcli connection up eth0 | ||
- systemctl enable --now keepalived | ||
- sleep 60 | ||
- systemctl enable --now crio kubelet | ||
postKubeadmCommands: | ||
- mkdir -p /home/${IMAGE_USERNAME}/.kube | ||
- chown ${IMAGE_USERNAME}:${IMAGE_USERNAME} /home/${IMAGE_USERNAME}/.kube | ||
- cp /etc/kubernetes/admin.conf /home/${IMAGE_USERNAME}/.kube/config | ||
- chown ${IMAGE_USERNAME}:${IMAGE_USERNAME} /home/${IMAGE_USERNAME}/.kube/config | ||
|
||
--- | ||
apiVersion: bootstrap.cluster.x-k8s.io/${CAPI_VERSION} | ||
kind: KubeadmConfigTemplate | ||
metadata: | ||
name: ${CLUSTER_NAME}-workers | ||
namespace: ${NAMESPACE} | ||
spec: | ||
template: | ||
spec: | ||
files: | ||
- content: | | ||
#!/bin/bash | ||
set -e | ||
url="$1" | ||
dst="$2" | ||
filename="$(basename $url)" | ||
tmpfile="/tmp/$filename" | ||
curl -sSL -w "%{http_code}" "$url" | sed "s:/usr/bin:/usr/local/bin:g" > /tmp/"$filename" | ||
http_status=$(cat "$tmpfile" | tail -n 1) | ||
if [ "$http_status" != "200" ]; then | ||
echo "Error: unable to retrieve $filename file"; | ||
exit 1; | ||
else | ||
cat "$tmpfile"| sed '$d' > "$dst"; | ||
fi | ||
owner: root:root | ||
path: /usr/local/bin/retrieve.configuration.files.sh | ||
permissions: "0755" | ||
- content: | | ||
[connection] | ||
id=eth0 | ||
type=ethernet | ||
interface-name=eth0 | ||
master=ironicendpoint | ||
slave-type=bridge | ||
autoconnect=yes | ||
autoconnect-priority=999 | ||
path: /etc/NetworkManager/system-connections/eth0.nmconnection | ||
owner: root:root | ||
permissions: '0600' | ||
- path: /etc/NetworkManager/system-connections/ironicendpoint.nmconnection | ||
owner: root:root | ||
permissions: '0600' | ||
content: | | ||
[connection] | ||
id=ironicendpoint | ||
type=bridge | ||
interface-name=ironicendpoint | ||
[bridge] | ||
stp=false | ||
[ipv4] | ||
address1={{ ds.meta_data.provisioningIP }}/{{ ds.meta_data.provisioningCIDR }} | ||
method=manual | ||
[ipv6] | ||
addr-gen-mode=eui64 | ||
method=ignore | ||
- path: /etc/yum.repos.d/kubernetes.repo | ||
owner: root:root | ||
permissions: '0644' | ||
content: | | ||
[kubernetes] | ||
name=Kubernetes | ||
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 | ||
enabled=1 | ||
gpgcheck=1 | ||
repo_gpgcheck=0 | ||
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg | ||
- path : /etc/containers/registries.conf | ||
owner: root:root | ||
permissions: '0644' | ||
content: | | ||
[registries.search] | ||
registries = ['docker.io'] | ||
[registries.insecure] | ||
registries = ['${REGISTRY}'] | ||
preKubeadmCommands: | ||
- rm /etc/cni/net.d/* | ||
- systemctl restart NetworkManager.service | ||
- nmcli connection load /etc/NetworkManager/system-connections/ironicendpoint.nmconnection | ||
- nmcli connection up ironicendpoint | ||
- nmcli connection load /etc/NetworkManager/system-connections/eth0.nmconnection | ||
- nmcli connection up eth0 | ||
- systemctl enable --now crio kubelet | ||
- sleep 120 |
4 changes: 4 additions & 0 deletions
4
...2e/data/infrastructure-metal3/bases/clusterclass-centos-kubeadm-config/kustomization.yaml
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,4 @@ | ||
resources: | ||
- ../clusterclass-cluster | ||
patchesStrategicMerge: | ||
- clusterclass-centos-kubeadm-config.yaml |
Oops, something went wrong.