From f18ad3216b523caa2ba0c0eb632dd1f6aa1f3ae2 Mon Sep 17 00:00:00 2001 From: phantomjinx Date: Thu, 2 Nov 2023 16:42:30 +0000 Subject: [PATCH] fix: Modifies install procedures * oauthclient.yml * Corrects apiVersion as current causes error * package.json * kube-apply.sh * Since the patches directory has been introduced in the deploy directory, the kustomize install falls foul of the restricted root limit. By scripting the kube apply, the kustomize call can be relaxed with the load-restrictor switch. This is already used in the deploy directory Makefile --- oauthclient.yml | 2 +- package.json | 8 ++++---- scripts/kube-apply.sh | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100755 scripts/kube-apply.sh diff --git a/oauthclient.yml b/oauthclient.yml index 10235df0..c6358ab4 100644 --- a/oauthclient.yml +++ b/oauthclient.yml @@ -1,4 +1,4 @@ -apiVersion: v1 +apiVersion: oauth.openshift.io/v1 kind: OAuthClient metadata: name: hawtio-online-dev diff --git a/package.json b/package.json index b6e4f00d..945d942d 100644 --- a/package.json +++ b/package.json @@ -41,10 +41,10 @@ "test": "yarn test:docker && yarn test:nginx", "test:docker": "jasmine docker/*.spec.js", "test:nginx": "cd docker/ && HAWTIO_ONLINE_RBAC_ACL= njs test.js", - "deploy:k8s:namespace": "kubectl apply --kustomize deploy/k8s/namespace/", - "deploy:k8s:cluster": "kubectl apply --kustomize deploy/k8s/cluster/", - "deploy:openshift:namespace": "oc apply --kustomize deploy/openshift/namespace/", - "deploy:openshift:cluster": "oc apply --kustomize deploy/openshift/cluster/ && ./deploy/openshift/cluster/oauthclient.sh $ROUTE_HOSTNAME", + "deploy:k8s:namespace": "./scripts/kube-apply.sh deploy/k8s/namespace/", + "deploy:k8s:cluster": "./scripts/kube-apply.sh deploy/k8s/cluster/", + "deploy:openshift:namespace": "./scripts/kube-apply.sh deploy/openshift/namespace/", + "deploy:openshift:cluster": "./scripts/kube-apply.sh deploy/openshift/cluster/ && ./deploy/openshift/cluster/oauthclient.sh $ROUTE_HOSTNAME", "kustomize:image": "cd deploy/base && kustomize edit set image hawtio/online=docker.io/${ORG:-hawtio}/${PROJECT:-online}:${TAG:-latest}" }, "devDependencies": { diff --git a/scripts/kube-apply.sh b/scripts/kube-apply.sh new file mode 100755 index 00000000..af554931 --- /dev/null +++ b/scripts/kube-apply.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e -o pipefail + +if [ -z "${1}" ]; then + echo "Error: no directory specified" + exit 1 +fi + +if [ ! -d "${1}" ]; then + echo "Error: directory does not exist" + exit 1 +fi + +kubectl \ + kustomize --load-restrictor LoadRestrictionsNone "${1}" | \ + kubectl apply -f -