Skip to content

Commit 91b6dcb

Browse files
authored
OWLS 86406: WKO - scaling with webhook invoked from Prometheus not working (#2106)
* Update scalingAction.sh to use jq command line tool, if present * update jq usage and use openssl to create certificate for internal REST * refactor scalingAction.sh script * Add comments * Add comment about openssl for OL8-slim only * Update scalingAction.sh based on code review * revert default scripts values * Updated logging and verify scaling request against configured minimum replica count * return min replica count if greater than discovered value * remove unused vars from timestamp function
1 parent 741ef68 commit 91b6dcb

File tree

3 files changed

+399
-191
lines changed

3 files changed

+399
-191
lines changed

kubernetes/samples/scripts/domain-lifecycle/helper.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,6 @@ function timestamp() {
693693
local ymdhms="`echo $timestamp | awk '{ print $1 }'`"
694694
# convert nano to milli
695695
local milli="`echo $timestamp | awk '{ print $2 }' | sed 's/\(^...\).*/\1/'`"
696-
local secs_since_epoch="`echo $timestamp | awk '{ print $3 }'`"
697-
local millis_since_opoch="${secs_since_epoch}${milli}"
698696
local timezone="`echo $timestamp | awk '{ print $4 }'`"
699697
echo "${ymdhms}.${milli} ${timezone}"
700698
}

src/scripts/initialize-internal-operator-identity.sh

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -34,56 +34,24 @@ function generateInternalIdentity {
3434
host="internal-weblogic-operator-svc"
3535
SANS="DNS:${host},DNS:${host}.${NAMESPACE},DNS:${host}.${NAMESPACE}.svc,DNS:${host}.${NAMESPACE}.svc.cluster.local"
3636
DAYS_VALID="3650"
37-
TEMP_PW="temp_password"
3837
OP_PREFIX="weblogic-operator"
39-
OP_ALIAS="${OP_PREFIX}-alias"
40-
OP_JKS="${TEMP_DIR}/${OP_PREFIX}.jks"
41-
OP_PKCS12="${TEMP_DIR}/${OP_PREFIX}.p12"
42-
OP_CSR="${TEMP_DIR}/${OP_PREFIX}.csr"
4338
OP_CERT_PEM="${TEMP_DIR}/${OP_PREFIX}.cert.pem"
4439
OP_KEY_PEM="${TEMP_DIR}/${OP_PREFIX}.key.pem"
45-
KEYTOOL=${JAVA_HOME}/bin/keytool
46-
47-
# generate a keypair for the operator's internal service, putting it in a keystore
48-
$KEYTOOL \
49-
-genkey \
50-
-keystore ${OP_JKS} \
51-
-alias ${OP_ALIAS} \
52-
-storepass ${TEMP_PW} \
53-
-keypass ${TEMP_PW} \
54-
-keysize 2048 \
55-
-keyalg RSA \
56-
-validity ${DAYS_VALID} \
57-
-dname "CN=weblogic-operator" \
58-
-ext KU=digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment,keyAgreement \
59-
-ext SAN="${SANS}"
60-
61-
# extract the cert to a pem file
62-
$KEYTOOL \
63-
-exportcert \
64-
-keystore ${OP_JKS} \
65-
-storepass ${TEMP_PW} \
66-
-alias ${OP_ALIAS} \
67-
-rfc \
68-
> ${OP_CERT_PEM}
69-
70-
# convert the keystore to a pkcs12 file
71-
$KEYTOOL \
72-
-importkeystore \
73-
-srckeystore ${OP_JKS} \
74-
-srcstorepass ${TEMP_PW} \
75-
-destkeystore ${OP_PKCS12} \
76-
-deststorepass ${TEMP_PW} \
77-
-deststoretype PKCS12
78-
79-
# extract the private key from the pkcs12 file to a pem file
40+
41+
# generate a keypair for the operator's internal service
42+
# openssl v1.1.1 is the required minimum to use 'addext' option for
43+
# speciifying "Subject Alternative Names (SANS)" thus the following
44+
# configuration cannot be used on Oracle Linux 7-slim.
8045
openssl \
81-
pkcs12 \
82-
-in ${OP_PKCS12} \
83-
-passin pass:${TEMP_PW} \
46+
req \
47+
-newkey rsa:2048 \
8448
-nodes \
85-
-nocerts \
86-
-out ${OP_KEY_PEM}
49+
-keyout ${OP_KEY_PEM} \
50+
-x509 \
51+
-days ${DAYS_VALID} \
52+
-out ${OP_CERT_PEM} \
53+
-subj "/C=US/ST=CALIFORNIA/L=REDWOOD CITY/O=WebLogic/OU=Development/CN=weblogic-operator" \
54+
-addext "subjectAltName = ${SANS}"
8755

8856
# copy the certificate and key to the locations the operator runtime expects
8957
base64 -i ${OP_CERT_PEM} | tr -d '\n' > ${INTERNAL_CERT_BASE64_PEM}

0 commit comments

Comments
 (0)