4 SCRIPTDIR="$(readlink -f $(dirname ${BASH_SOURCE[0]}))"
5 LIBDIR="$(dirname $(dirname ${SCRIPTDIR}))/env/lib"
7 source $LIBDIR/logging.sh
8 source $LIBDIR/common.sh
11 ENABLE_DHCP="${IRONIC_ENABLE_DHCP:-yes}"
15 kubectl get all -n ${NAMEPREFIX}-system
18 # This may be used to update the in-place Ironic YAML files from the
19 # upstream project. We cannot use the upstream sources directly as
20 # they require an envsubst step before kustomize build.
21 function build_source {
22 clone_baremetal_operator_repository
24 KUSTOMIZATION_FILES=$(find ${BMOPATH}/ironic-deployment/{default,ironic} -type f)
25 for src in ${KUSTOMIZATION_FILES}; do
26 dst=${src/${BMOPATH}\/ironic-deployment/${SCRIPTDIR}\/base}
27 mkdir -p $(dirname ${dst})
28 envsubst <${src} >${dst}
30 sed -i -e '/name: quay.io\/metal3-io\/ironic/{n;s/newTag:.*/newTag: '"${BMO_VERSION}"'/;}' ${SCRIPTDIR}/icn/kustomization.yaml
35 local layer="${SCRIPTDIR}/icn"
36 if [[ ${ENABLE_DHCP} != "yes" ]]; then
37 layer="${SCRIPTDIR}/icn-no-dhcp"
39 kustomize build ${layer} | kubectl apply -f -
40 kubectl wait --for=condition=Available --timeout=600s deployment/${NAMEPREFIX}-ironic -n ${NAMEPREFIX}-system
44 kustomize build ${SCRIPTDIR}/icn | kubectl delete -f -
48 "build-source") build_source ;;
52 Usage: $(basename $0) COMMAND
55 build-source - Rebuild the in-tree Ironic YAML files
57 deploy - Deploy Ironic