From 5d7cfc8dc5973dba7f7c3c44c20ab31456944b55 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Tue, 31 Mar 2020 15:55:41 -0500 Subject: [PATCH] Ironic: Move to use sqllite rather than mariadb This PS makes the ironic deployment a bit simpler by removing mariadb and using sqllite instead. It also fixes the path of the ironic inspector db to get it to persist pod restarts. Change-Id: I522774597ff921449e86e2742131e5a51d60d559 Signed-off-by: Pete Birley --- .../config-file/configure-mysql.sql | 7 ------- .../config-file/inspector.conf | 2 +- .../config-file/ironic.conf | 2 +- .../config-file/kustomization.yaml | 2 -- .../baremetal-operator/config-file/my.cnf | 19 ------------------- .../entrypoint/kustomization.yaml | 1 - .../entrypoint/mariadb-entrypoint | 18 ------------------ .../baremetal-operator/ironic-vars.yaml | 1 - .../function/baremetal-operator/ironic.yaml | 15 --------------- 9 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 manifests/function/baremetal-operator/config-file/configure-mysql.sql delete mode 100644 manifests/function/baremetal-operator/config-file/my.cnf delete mode 100644 manifests/function/baremetal-operator/entrypoint/mariadb-entrypoint diff --git a/manifests/function/baremetal-operator/config-file/configure-mysql.sql b/manifests/function/baremetal-operator/config-file/configure-mysql.sql deleted file mode 100644 index e931f8f1f..000000000 --- a/manifests/function/baremetal-operator/config-file/configure-mysql.sql +++ /dev/null @@ -1,7 +0,0 @@ -DELETE FROM mysql.user ; -CREATE USER 'ironic'@'localhost' identified by '$(MARIADB_PASSWORD)' ; -GRANT ALL on *.* TO 'ironic'@'localhost' WITH GRANT OPTION ; -DROP DATABASE IF EXISTS test ; -CREATE DATABASE IF NOT EXISTS ironic ; -FLUSH PRIVILEGES ; - diff --git a/manifests/function/baremetal-operator/config-file/inspector.conf b/manifests/function/baremetal-operator/config-file/inspector.conf index 16981a35f..0a807fb56 100644 --- a/manifests/function/baremetal-operator/config-file/inspector.conf +++ b/manifests/function/baremetal-operator/config-file/inspector.conf @@ -5,7 +5,7 @@ transport_url = fake:// use_stderr = true listen_address = :: [database] -connection = sqlite:///var/lib/ironic-inspector/ironic-inspector.db +connection = sqlite:///shared/ironic-inspector.db [discovery] enroll_node_driver = ipmi [ironic] diff --git a/manifests/function/baremetal-operator/config-file/ironic.conf b/manifests/function/baremetal-operator/config-file/ironic.conf index 4c6680950..846fc0835 100644 --- a/manifests/function/baremetal-operator/config-file/ironic.conf +++ b/manifests/function/baremetal-operator/config-file/ironic.conf @@ -29,7 +29,7 @@ send_sensor_data_interval = 160 api_url = http://$(PROVISIONING_IP):6385 bootloader = http://$(PROVISIONING_IP):80/uefi_esp.img [database] -connection = mysql+pymysql://ironic:$(MARIADB_PASSWORD)@localhost/ironic?charset=utf8 +connection = sqlite:///shared/ironic.db [deploy] default_boot_option = local erase_devices_metadata_priority = 10 diff --git a/manifests/function/baremetal-operator/config-file/kustomization.yaml b/manifests/function/baremetal-operator/config-file/kustomization.yaml index 007da90cd..212a9f0e2 100644 --- a/manifests/function/baremetal-operator/config-file/kustomization.yaml +++ b/manifests/function/baremetal-operator/config-file/kustomization.yaml @@ -10,5 +10,3 @@ configMapGenerator: - inspector.conf - inspector.ipxe - ironic.conf - - my.cnf - - configure-mysql.sql diff --git a/manifests/function/baremetal-operator/config-file/my.cnf b/manifests/function/baremetal-operator/config-file/my.cnf deleted file mode 100644 index ad6064900..000000000 --- a/manifests/function/baremetal-operator/config-file/my.cnf +++ /dev/null @@ -1,19 +0,0 @@ -[server] - -[mysqld] -datadir=/var/lib/mysql -socket=/var/lib/mysql/mysql.sock -log-error=/var/log/mariadb/mariadb.log -pid-file=/run/mariadb/mariadb.pid -max_connections = 64 -max_heap_table_size = 1M -innodb_buffer_pool_size = 5M -innodb_log_buffer_size = 512K - -[galera] - -[embedded] - -[mariadb] - -[mariadb-10.3] diff --git a/manifests/function/baremetal-operator/entrypoint/kustomization.yaml b/manifests/function/baremetal-operator/entrypoint/kustomization.yaml index f6c84e6c5..ee51456c4 100644 --- a/manifests/function/baremetal-operator/entrypoint/kustomization.yaml +++ b/manifests/function/baremetal-operator/entrypoint/kustomization.yaml @@ -9,4 +9,3 @@ configMapGenerator: - init-bootstrap - inspector-entrypoint - ironic-entrypoint - - mariadb-entrypoint diff --git a/manifests/function/baremetal-operator/entrypoint/mariadb-entrypoint b/manifests/function/baremetal-operator/entrypoint/mariadb-entrypoint deleted file mode 100644 index 63b0d67f3..000000000 --- a/manifests/function/baremetal-operator/entrypoint/mariadb-entrypoint +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/bash -PATH=$PATH:/usr/sbin/ -DATADIR="/var/lib/mysql" -MARIADB_CONF_FILE="/etc/my.cnf.d/mariadb-server.cnf" - -ln -sf /proc/self/fd/1 /var/log/mariadb/mariadb.log - -if [ ! -d "${DATADIR}/mysql" ]; then - cp -f /shared/my.cnf $MARIADB_CONF_FILE - mysql_install_db --datadir="$DATADIR" - chown -R mysql "$DATADIR" - - # mysqld_safe closes stdout/stderr if no bash options are set ($- == '') - # turn on tracing to prevent this - exec bash -x /usr/bin/mysqld_safe --init-file /shared/configure-mysql.sql -else - exec bash -x /usr/bin/mysqld_safe -fi diff --git a/manifests/function/baremetal-operator/ironic-vars.yaml b/manifests/function/baremetal-operator/ironic-vars.yaml index df67b81ac..2987e2b55 100644 --- a/manifests/function/baremetal-operator/ironic-vars.yaml +++ b/manifests/function/baremetal-operator/ironic-vars.yaml @@ -5,7 +5,6 @@ metadata: labels: name: ironic-vars data: - MARIADB_PASSWORD: "e8ca990d79d351eacda0" PROVISIONING_IP: "192.168.10.100" DHCP_RANGE: "192.168.10.200,192.168.10.250" PROVISIONING_INTERFACE: "pxe0" diff --git a/manifests/function/baremetal-operator/ironic.yaml b/manifests/function/baremetal-operator/ironic.yaml index 0bf3b95ab..37a4af8f8 100644 --- a/manifests/function/baremetal-operator/ironic.yaml +++ b/manifests/function/baremetal-operator/ironic.yaml @@ -72,21 +72,6 @@ spec: - name: ironic-entrypoints mountPath: /bin/runhttpd subPath: httpd-entrypoint - - name: mariadb - image: "quay.io/metal3-io/ironic:latest" - imagePullPolicy: Always - command: ["/bin/runmariadb"] - securityContext: - privileged: true - volumeMounts: - - mountPath: "/shared" - name: ironic-storage - - mountPath: "/var/lib/mysql" - name: ironic-storage - subPath: mysql - - name: ironic-entrypoints - mountPath: /bin/runmariadb - subPath: mariadb-entrypoint - name: ironic image: "quay.io/metal3-io/ironic:latest" imagePullPolicy: Always