RD: Added sidecar MongoDB. Added related configuration in values.yaml
Change-Id: I9f1c1ecf560c5f3f153dcf9efea53f6e875de419
This commit is contained in:
parent
a465f2e6ce
commit
184b45e5f2
@ -33,6 +33,11 @@ spec:
|
|||||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
env:
|
||||||
|
{{- range .Values.env }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
value: {{ .value | quote }}
|
||||||
|
{{- end }}
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
containerPort: 8080
|
containerPort: 8080
|
||||||
@ -47,6 +52,22 @@ spec:
|
|||||||
port: http
|
port: http
|
||||||
resources:
|
resources:
|
||||||
{{- toYaml .Values.resources | nindent 12 }}
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
|
- name: {{ .Chart.Name }}-mongodb
|
||||||
|
securityContext:
|
||||||
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||||
|
image: "docker.io/library/mongo:7.0.2"
|
||||||
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||||
|
env:
|
||||||
|
{{- range .Values.env }}
|
||||||
|
- name: {{ .name }}
|
||||||
|
value: {{ .value | quote }}
|
||||||
|
{{- end }}
|
||||||
|
ports:
|
||||||
|
- name: mongo-port
|
||||||
|
containerPort: 27017
|
||||||
|
protocol: TCP
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.resources | nindent 12 }}
|
||||||
{{- with .Values.nodeSelector }}
|
{{- with .Values.nodeSelector }}
|
||||||
nodeSelector:
|
nodeSelector:
|
||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
|
@ -80,3 +80,19 @@ nodeSelector: {}
|
|||||||
tolerations: []
|
tolerations: []
|
||||||
|
|
||||||
affinity: {}
|
affinity: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
# ===== MongoDB configuration =====
|
||||||
|
- name: MONGO_INITDB_ROOT_USERNAME
|
||||||
|
value: 'root'
|
||||||
|
- name: MONGO_INITDB_ROOT_PASSWORD
|
||||||
|
value: 'example'
|
||||||
|
# ===== Resource Manager configuration =====
|
||||||
|
- name: SPRING_DATA_MONGODB_URI
|
||||||
|
value: 'mongodb://root:example@localhost:27017/admin'
|
||||||
|
- name: DISCOVERY_BROKER_USERNAME
|
||||||
|
value: 'aaa'
|
||||||
|
- name: DISCOVERY_BROKER_PASSWORD
|
||||||
|
value: '111'
|
||||||
|
- name: DISCOVERY_BROKERURL
|
||||||
|
value: 'tcp://nebulous-monitoring:61616?daemon=true&trace=false&useInactivityMonitor=false&connectionTimeout=0&keepAlive=true'
|
||||||
|
@ -5,7 +5,6 @@ ENV BASEDIR /app
|
|||||||
WORKDIR ${BASEDIR}
|
WORKDIR ${BASEDIR}
|
||||||
COPY src ${BASEDIR}/src
|
COPY src ${BASEDIR}/src
|
||||||
COPY pom.xml ${BASEDIR}/
|
COPY pom.xml ${BASEDIR}/
|
||||||
COPY run.sh ${BASEDIR}/
|
|
||||||
RUN mvn -f ${BASEDIR}/pom.xml -DskipTests clean install && \
|
RUN mvn -f ${BASEDIR}/pom.xml -DskipTests clean install && \
|
||||||
java -Djarmode=layertools -jar ${BASEDIR}/target/resource-discovery-*.jar extract
|
java -Djarmode=layertools -jar ${BASEDIR}/target/resource-discovery-*.jar extract
|
||||||
|
|
||||||
@ -22,11 +21,21 @@ RUN wget --progress=dot:giga -O /usr/local/bin/dumb-init \
|
|||||||
chmod +x /usr/local/bin/dumb-init
|
chmod +x /usr/local/bin/dumb-init
|
||||||
|
|
||||||
# Add RD user
|
# Add RD user
|
||||||
ARG RD_USER=rd
|
ARG RD_USER=root
|
||||||
RUN mkdir ${RD_HOME} && \
|
#ARG RD_USER=rd
|
||||||
addgroup ${RD_USER} && \
|
#RUN mkdir ${RD_HOME} && \
|
||||||
adduser --home ${RD_HOME} --no-create-home --ingroup ${RD_USER} --disabled-password ${RD_USER} && \
|
# addgroup ${RD_USER} && \
|
||||||
chown ${RD_USER}:${RD_USER} ${RD_HOME}
|
# adduser --home ${RD_HOME} --no-create-home --ingroup ${RD_USER} --disabled-password ${RD_USER} && \
|
||||||
|
# chown ${RD_USER}:${RD_USER} ${RD_HOME}
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install --no-install-recommends -y \
|
||||||
|
netcat=1.218-4ubuntu1 \
|
||||||
|
iputils-ping=3:20211215-1 \
|
||||||
|
telnet=0.17-44build1 \
|
||||||
|
vim=2:8.2.3995-1ubuntu2.16 \
|
||||||
|
net-tools=1.60+git20181103.0eebece-1ubuntu5 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Set User and Workdir
|
# Set User and Workdir
|
||||||
USER ${RD_USER}
|
USER ${RD_USER}
|
||||||
@ -37,8 +46,11 @@ COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/dependencies
|
|||||||
COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/spring-boot-loader ${BASEDIR}
|
COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/spring-boot-loader ${BASEDIR}
|
||||||
COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/snapshot-dependencies ${BASEDIR}
|
COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/snapshot-dependencies ${BASEDIR}
|
||||||
COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/application ${BASEDIR}
|
COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/application ${BASEDIR}
|
||||||
COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/run.sh ${BASEDIR}
|
#COPY --chown=${RD_USER}:${RD_USER} --from=rd-builder /app/run.sh ${BASEDIR}
|
||||||
RUN chmod +x run.sh
|
|
||||||
|
COPY --chown=${RD_USER}:${RD_USER} run.sh ${BASEDIR}
|
||||||
|
COPY --chown=${RD_USER}:${RD_USER} wait_for_mongodb.sh ${BASEDIR}
|
||||||
|
RUN chmod +x run.sh wait_for_mongodb.sh
|
||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
@ -5,6 +5,9 @@ PREVWORKDIR=`pwd`
|
|||||||
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||||
cd ${BASEDIR}
|
cd ${BASEDIR}
|
||||||
|
|
||||||
|
# Wait for MongoDB to start
|
||||||
|
./wait_for_mongodb.sh
|
||||||
|
|
||||||
# Read JASYPT password (decrypts encrypted configuration settings)
|
# Read JASYPT password (decrypts encrypted configuration settings)
|
||||||
#if [[ -z "$JASYPT_PASSWORD" ]]; then
|
#if [[ -z "$JASYPT_PASSWORD" ]]; then
|
||||||
# printf "Configuration Password: "
|
# printf "Configuration Password: "
|
||||||
|
18
resource-discovery/wait_for_mongodb.sh
Normal file
18
resource-discovery/wait_for_mongodb.sh
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Define MongoDB connection details
|
||||||
|
MONGODB_HOST="localhost"
|
||||||
|
MONGODB_PORT="27017"
|
||||||
|
|
||||||
|
# Function to check if MongoDB is ready
|
||||||
|
wait_for_mongodb() {
|
||||||
|
echo "Waiting for MongoDB to be ready..."
|
||||||
|
until nc -z $MONGODB_HOST $MONGODB_PORT
|
||||||
|
do
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
echo "MongoDB is up and running!"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Call the function to wait for MongoDB
|
||||||
|
wait_for_mongodb
|
Loading…
x
Reference in New Issue
Block a user