Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Generalizes sed and fixes dry-run cmd #363

Merged
merged 2 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,16 +325,17 @@ if [[ $enable_self_signed_ca == "true" ]]; then
# comment out vars
configMapGeneratorStartLine=$(grep -n configMapGenerator ./default/kustomization.yaml |cut -d':' -f1)
configMapGeneratorBeforeLine=$((configMapGeneratorStartLine-1))
sed "1,${configMapGeneratorBeforeLine}s/^/#/g" -i default/kustomization.yaml
sed -i.bak "1,${configMapGeneratorBeforeLine}s/^/#/g" default/kustomization.yaml

# remove webhookcainjection_patch.yaml
sed 's+- webhookcainjection_patch.yaml++g' -i default/kustomization.yaml
sed -i.bak '/webhookcainjection_patch.yaml/d' default/kustomization.yaml

# create dummy secret 'modelmesh-webhook-server-cert'
secretExist=$(kubectl get secret modelmesh-webhook-server-cert --ignore-not-found|wc -l)
if [[ $secretExist == 0 ]]; then
if [[ $secretExist -eq 0 ]]; then
kubectl create secret generic modelmesh-webhook-server-cert
fi
rm default/kustomization.yaml.bak
rafvasq marked this conversation as resolved.
Show resolved Hide resolved
fi

kustomize build default | kubectl apply -f -
Expand Down Expand Up @@ -365,10 +366,9 @@ if [[ $enable_self_signed_ca == "true" ]]; then
info "Enabled Self Signed CA: Generate certificates and restart controller"

# Delete dummy secret for webhook server
kubectl delete secret modelmesh-webhook-server-cert
kubectl delete secret modelmesh-webhook-server-cert

../scripts/self-signed-ca.sh --namespace $namespace

fi

info "Waiting for ModelMesh Serving controller pod to be up..."
Expand Down
4 changes: 2 additions & 2 deletions scripts/self-signed-ca.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ openssl x509 -extensions v3_req -req -days 365 -in ${tmpdir}/server.csr -CA ${tm
kubectl create secret generic ${secret} \
--from-file=tls.key=${tmpdir}/server.key \
--from-file=tls.crt=${tmpdir}/server.crt \
--dry-run -o yaml |
--dry-run=server -o yaml |
kubectl -n ${namespace} apply -f -
# Webhook pod needs to be restarted so that the service reload the secret
# http://github.com/kueflow/kubeflow/issues/3227
# http://github.com/kubeflow/kubeflow/issues/3227
webhookPod=$(kubectl get pods -n ${namespace} |grep ${webhookDeploymentName} |awk '{print $1;}')
# ignore error if webhook pod does not exist
kubectl delete pod ${webhookPod} -n ${namespace} 2>/dev/null || true
Expand Down