Skip to content

Commit

Permalink
add freebsd as default
Browse files Browse the repository at this point in the history
  • Loading branch information
danpaul81 committed Feb 1, 2024
1 parent c2b9067 commit de106b7
Show file tree
Hide file tree
Showing 5 changed files with 201 additions and 2 deletions.
189 changes: 189 additions & 0 deletions assets/kubevirt/ocp/pxbbq-freebsd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
apiVersion: v1
kind: Service
metadata:
name: mongo
labels:
app.kubernetes.io/name: mongo
app.kubernetes.io/component: backend
namespace: pxbbq
spec:
ports:
- port: 27017
targetPort: 27017
type: ClusterIP
selector:
vm.kubevirt.io/name: freebsd-mongodb
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: pxbbq-web
namespace: pxbbq
spec:
replicas: 3
selector:
matchLabels:
app: pxbbq-web
template:
metadata:
labels:
app: pxbbq-web
spec:
containers:
- name: pxbbq-web
image: eshanks16/pxbbq:v3.3.1
env:
- name: MONGO_INIT_USER
value: "porxie" #Mongo User with permissions to create additional databases and users. Typically "porxie" or "pds"
- name: MONGO_INIT_PASS
value: "porxie" #Required to connect the init user to the database. If using the mongodb yaml supplied, use "porxie"
- name: MONGO_NODES
value: "mongo" #COMMA SEPARATED LIST OF MONGO ENDPOINTS. Example: mongo1.dns.name,mongo2.dns.name
- name: MONGO_PORT
value: "27017"
- name: MONGO_USER
value: porxie #Mongo DB User that will be created by using the Init_User
- name: MONGO_PASS
value: "porxie" #Mongo DB Password for User that will be created by using the Init User
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: pxbbq-svc
namespace: pxbbq
labels:
app: pxbbq-web
spec:
ports:
- port: 80
targetPort: 8080
type: ClusterIP
selector:
app: pxbbq-web
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: pxbbq
namespace: pxbbq
labels:
app: pxbbq-web
px-dr: 'false'
spec:
to:
kind: Service
name: pxbbq-svc
weight: 100
port:
targetPort: 8080
wildcardPolicy: None
---
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: freebsd-mongodb
annotations:
description: FreeBSD MongoDB
labels:
name: mongo
app: backend
os.template.kubevirt.io/freebsd: 'true'
namespace: pxbbq
spec:
running: true
template:
metadata:
annotations:
vm.kubevirt.io/flavor: small
vm.kubevirt.io/os: freebsd
vm.kubevirt.io/workload: server
labels:
kubevirt.io/domain: freebsd
kubevirt.io/size: small
spec:
domain:
cpu:
cores: 2
sockets: 1
threads: 1
devices:
disks:
- disk:
bus: virtio
name: rootdisk
bootOrder: 1
- disk:
bus: virtio
name: cloudinitdisk
bootOrder: 2
interfaces:
- masquerade: {}
model: virtio
name: default
networkInterfaceMultiqueue: true
rng: {}
features:
acpi: {}
smm:
enabled: true
firmware:
bootloader:
bios: {}
machine:
type: q35
resources:
requests:
memory: 2Gi
hostname: freebsd-mongodb
networks:
- name: default
pod: {}
terminationGracePeriodSeconds: 180
volumes:
- name: rootdisk
dataVolume:
name: 'freebsd-mongodb-rootdisk'
- cloudInitNoCloud:
userData: |
#cloud-config
hostname: mongodb
users:
- name: kubevirt
sudo: ALL=(ALL) NOPASSWD:ALL
passwd: $6$Q1dGl.LfuMeS8RPP$b4xynn.Z3n2/h.YqOV90H7GzoAfjLKPMAKP1rzCeeBxiYNhROkxOXAC4rmQNbQf3oZ.Om8/Q7W8XmTgHsdoLw.
shell: /bin/sh
home: /home/kubevirt
lock_passwd: false
write_files:
- content: |
from pymongo import MongoClient
client = MongoClient('localhost:27017')
foo = client["admin"]
foo.command("createUser", "porxie", pwd="porxie", roles=[{ 'role':'root', 'db':'admin'}])
path: /tmp/init-mongo.py
permissions: '0600'
runcmd:
- pkg install -y qemu-tools mongodb70
- sed -i '' 's/bindIp:\ 127.0.0.1/bindIp:\ 0.0.0.0/' /usr/local/etc/mongodb.conf
- echo 'mongod_enable="YES"' >>/etc/rc.conf
- service mongod start
- pkg install -y py39-pymongo
- python3 /tmp/init-mongo.py
name: cloudinitdisk
dataVolumeTemplates:
- metadata:
name: 'freebsd-mongodb-rootdisk'
spec:
storage:
resources:
requests:
storage: 5Gi
storageClassName: px-csi-db
preallocation: false
source:
pvc:
name: freebsd-image
namespace: pxbbq
2 changes: 1 addition & 1 deletion assets/kubevirt/ocp/pxbbq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec:
value: porxie #Mongo DB User that will be created by using the Init_User
- name: MONGO_PASS
value: "porxie" #Mongo DB Password for User that will be created by using the Init User
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
---
Expand Down
2 changes: 2 additions & 0 deletions scripts/ocp-kubevirt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ spec:
channel: "stable"
EOF

curl -Lo /usr/bin/virtctl https://github.com/kubevirt/kubevirt/releases/download/v1.1.1/virtctl-v1.1.1-linux-amd64
chmod 755 /usr/bin/virtctl

echo "waiting for kubevirt-hyperconverged operator readiness"
while ! kubectl wait clusterserviceversions.operators.coreos.com $OPVERSION -n openshift-cnv --timeout=300s --for=jsonpath='{.status.phase}'='Succeeded'; do
Expand Down
8 changes: 8 additions & 0 deletions scripts/ocp-kubevirt-apps-freebsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
kubectl create ns pxbbq
kubectl label ns pxbbq app=pxbbq
kubectl label ns pxbbq backup=true

curl -O https://object-storage.public.mtl1.vexxhost.net/swift/v1/1dbafeefbd4f4c80864414a441e72dd2/bsd-cloud-image.org/images/freebsd/13.2/2023-04-21/zfs/freebsd-13.2-zfs-2023-04-21.qcow2
virtctl image-upload pvc freebsd-image -n pxbbq --size 5Gi --insecure --storage-class px-csi-db --image-path=./freebsd-13.2-zfs-2023-04-21.qcow2

kubectl apply -f /assets/kubevirt/ocp/pxbbq-freebsd.yml
2 changes: 1 addition & 1 deletion templates/ocp-kubevirt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cloud: "aws"
clusters: 2
cluster:
- id: 1
scripts: [ "ocp-kubevirt-apps", "helm-backup", "helm-backup-ocp4-kubevirt"]
scripts: [ "ocp-kubevirt-apps-freebsd", "helm-backup", "helm-backup-ocp4-kubevirt"]
- id: 2
scripts: ["clusterpair-dr"]
env:
Expand Down

0 comments on commit de106b7

Please sign in to comment.