-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yin Da <[email protected]>
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.yaml | ||
cert/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
SVC_NAME="${SVC_NAME:-kubevela-cluster-gateway}" | ||
SVC_NAMESPACE="${SVC_NAMESPACE:-vela-system}" | ||
OUTPUT_DIR=${OUTPUT_DIR:-./cert} | ||
|
||
rm -r $OUTPUT_DIR; | ||
mkdir -p $OUTPUT_DIR; | ||
cd $OUTPUT_DIR; | ||
echo "authorityKeyIdentifier=keyid,issuer | ||
basicConstraints=CA:FALSE | ||
subjectAltName = @alt_names | ||
[alt_names] | ||
DNS.1 = $SVC_NAME | ||
DNS.2 = $SVC_NAME.$SVC_NAMESPACE.svc" > domain.ext | ||
openssl req -x509 -sha256 -days 3650 -newkey rsa:2048 -keyout ca.key -out ca -nodes -subj '/O=kubevela' \ | ||
&& openssl ecparam -name prime256v1 -genkey -noout -out apiserver.key \ | ||
&& openssl req -new -key apiserver.key -out apiserver.csr -subj '/O='$SVC_NAME \ | ||
&& openssl x509 -req -in apiserver.csr -CA ca -CAkey ca.key -CAcreateserial -extfile domain.ext -out apiserver.crt -days 3650 -sha256 | ||
|
||
kubectl create secret generic $SVC_NAME -n $SVC_NAMESPACE \ | ||
--from-file=ca=ca \ | ||
--from-file=apiserver.key=apiserver.key \ | ||
--from-file=apiserver.crt=apiserver.crt \ | ||
--dry-run=client -oyaml > $SVC_NAME.yaml | ||
|
||
cd .. | ||
mv ./cert/$SVC_NAME.yaml ./ |