Skip to content

Commit

Permalink
Fix potential NPE (#587)
Browse files Browse the repository at this point in the history
Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
  • Loading branch information
mmorhun authored Dec 18, 2020
1 parent fd9edb1 commit cdb613a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion local-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ echo "WATCH_NAMESPACE='${CHE_NAMESPACE}'" >> ${ENV_FILE}

echo "[WARN] Make sure that your CR contains valid ingress domain!"

operator-sdk run --local --watch-namespace=${CHE_NAMESPACE} --enable-delve &
operator-sdk run --local --namespace ${CHE_NAMESPACE} --enable-delve &
OPERATOR_SDK_PID=$!

wait ${OPERATOR_SDK_PID}
9 changes: 9 additions & 0 deletions pkg/deploy/server/che_configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,15 @@ func GetCheConfigMapData(deployContext *deploy.DeployContext) (cheEnv map[string
if err != nil {
return nil, err
}
if cheTLSSecret == nil {
return nil, fmt.Errorf("%s secret not found", deployContext.CheCluster.Spec.K8s.TlsSecretName)
}
if _, exists := cheTLSSecret.Data["tls.key"]; !exists {
return nil, fmt.Errorf("%s secret has no 'tls.key' key in data", deployContext.CheCluster.Spec.K8s.TlsSecretName)
}
if _, exists := cheTLSSecret.Data["tls.crt"]; !exists {
return nil, fmt.Errorf("%s secret has no 'tls.crt' key in data", deployContext.CheCluster.Spec.K8s.TlsSecretName)
}
k8sCheEnv["CHE_INFRA_KUBERNETES_TLS__KEY"] = string(cheTLSSecret.Data["tls.key"])
k8sCheEnv["CHE_INFRA_KUBERNETES_TLS__CERT"] = string(cheTLSSecret.Data["tls.crt"])
}
Expand Down

0 comments on commit cdb613a

Please sign in to comment.