Skip to content

Commit e7cb154

Browse files
added as alternative pasing method
1 parent 5b17b70 commit e7cb154

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cf-deploy-kubernetes.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,14 @@ $(dirname $0)/template.sh "$deployment_file" > "$DEPLOYMENT_FILE" || fatal "Fail
7474

7575
echo "---> Kubernetes objects to deploy in $deployment_file :"
7676
KUBECTL_OBJECTS=/tmp/deployment.objects
77-
objects $DEPLOYMENT_FILE | tee $KUBECTL_OBJECTS
77+
kubectl convert -f "$DEPLOYMENT_FILE" --local=true --no-headers=true -o=custom-columns="KIND:{.kind},NAME:{.metadata.name}" > >(tee $KUBECTL_OBJECTS) 2>${KUBECTL_OBJECTS}.errors
78+
if [ $? != 0 ]; then
79+
cat ${KUBECTL_OBJECTS}.errors
80+
echo "Failed to parse $deployment_file with kubectl... "
81+
echo "Using alternative parsing method... "
82+
truncate -s 0 $KUBECTL_OBJECTS
83+
objects $DEPLOYMENT_FILE | tee $KUBECTL_OBJECTS
84+
fi
7885

7986
DEPLOYMENT_NAME=$(awk '/^Deployment /{a=$2}END{print a}' $KUBECTL_OBJECTS)
8087

0 commit comments

Comments
 (0)