Commit e35d7100 authored by João Lino's avatar João Lino

Upgrade docker image version and add some initialization scripts.

parent a4bae91e
#!/bin/sh #!/bin/sh
__is_pod_ready() { __is_pod_ready() {
POD_STATUS="False" POD_STATUS="False"
while [ "$POD_STATUS" != "True" ]; while [ "$POD_STATUS" != "True" ];
do do
echo "waiting for pod..." echo "waiting for pod..."
sleep 5 sleep 5
POD_STATUS=$(kubectl get pods --namespace demo-infra -l "app.kubernetes.io/component=jenkins-master" -l "app.kubernetes.io/instance=demo-infra-nexus" -o jsonpath='{..status.conditions[?(@.type=="Ready")].status}') POD_STATUS=$(kubectl get pods --namespace demo-infra -l "app=sonatype-nexus" -o jsonpath='{..status.conditions[?(@.type=="Ready")].status}')
done done
} }
# install nexus __expose_pod() {
helm install -f values.yaml --namespace demo-infra --kubeconfig ~/.kube/config demo-infra-nexus oteemo.github.io/charts/sonatype-nexus # kill any previous proxy
kill $(ps aux | grep '8280[:]8080' | awk '{print $2}')
kill $(ps aux | grep '8281[:]8081' | awk '{print $2}')
# print admin password
echo "HOST: http://192.168.1.194:8280 USERNAME: admin PASSWORD: admin123"
# expose
export POD_NAME=$(kubectl get pods --namespace demo-infra -l "app=sonatype-nexus" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace demo-infra port-forward $POD_NAME 8280:8080 --address 0.0.0.0 &
kubectl --namespace demo-infra port-forward $POD_NAME 8281:8081 --address 0.0.0.0 &
}
POD_STATUS=$(kubectl get pods --namespace demo-infra -l "app=sonatype-nexus" -o jsonpath='{..status.conditions[?(@.type=="Ready")].status}')
if [ "$POD_STATUS" = 'True' ]; then
echo "pod already installed, exposing it..."
# create proxy into the pod
__expose_pod
else
echo "pod missing, installing it..."
# install nexus
helm install -f values.yaml --namespace demo-infra --kubeconfig ~/.kube/config demo-infra-nexus ./
# wait for it to become ready # wait for it to become ready
__is_pod_ready __is_pod_ready
# print admin password # create proxy into the pod
#export JENKINS_PASS=$(kubectl get secret --namespace demo-infra demo-infra-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode) __expose_pod
echo "HOST: http://192.168.1.194:8180 USERNAME: admin PASSWORD: admin123"
# expose fi
export POD_NAME=$(kubectl get pods --namespace demo-infra -l "app.kubernetes.io/component=jenkins-master" -l "app.kubernetes.io/instance=demo-infra-jenkins" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace demo-infra port-forward $POD_NAME 8180:8080 --address 0.0.0.0 &
#!/bin/sh #!/bin/sh
# remove proxy
kill $(ps aux | grep '8280[:]8080' | awk '{print $2}')
kill $(ps aux | grep '8281[:]8081' | awk '{print $2}')
# use helm for uninstall # use helm for uninstall
helm uninstall --namespace demo-infra --kubeconfig ~/.kube/config demo-infra-jenkins helm uninstall --namespace demo-infra --kubeconfig ~/.kube/config demo-infra-nexus
...@@ -10,7 +10,7 @@ deploymentStrategy: {} ...@@ -10,7 +10,7 @@ deploymentStrategy: {}
nexus: nexus:
imageName: quay.io/travelaudience/docker-nexus imageName: quay.io/travelaudience/docker-nexus
imageTag: 3.21.2-03 imageTag: 3.22.0-02
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
# Uncomment this to scheduler pods on priority # Uncomment this to scheduler pods on priority
# priorityClassName: "high-priority" # priorityClassName: "high-priority"
...@@ -19,6 +19,8 @@ nexus: ...@@ -19,6 +19,8 @@ nexus:
value: "-Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" value: "-Xms1200M -Xmx1200M -XX:MaxDirectMemorySize=2G -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap"
- name: NEXUS_SECURITY_RANDOMPASSWORD - name: NEXUS_SECURITY_RANDOMPASSWORD
value: "false" value: "false"
- name: NEXUS_CONTEXT
value: "nexus"
# nodeSelector: # nodeSelector:
# cloud.google.com/gke-nodepool: default-pool # cloud.google.com/gke-nodepool: default-pool
resources: {} resources: {}
...@@ -59,13 +61,13 @@ nexus: ...@@ -59,13 +61,13 @@ nexus:
periodSeconds: 30 periodSeconds: 30
failureThreshold: 6 failureThreshold: 6
# timeoutSeconds: 10 # timeoutSeconds: 10
path: / path: /nexus
readinessProbe: readinessProbe:
initialDelaySeconds: 30 initialDelaySeconds: 30
periodSeconds: 30 periodSeconds: 30
failureThreshold: 6 failureThreshold: 6
# timeoutSeconds: 10 # timeoutSeconds: 10
path: / path: /nexus
# hostAliases allows the modification of the hosts file inside a container # hostAliases allows the modification of the hosts file inside a container
hostAliases: [] hostAliases: []
# - ip: "192.168.1.10" # - ip: "192.168.1.10"
...@@ -92,7 +94,7 @@ nexusProxy: ...@@ -92,7 +94,7 @@ nexusProxy:
# labels: {} # labels: {}
env: env:
nexusDockerHost: nexusDockerHost:
nexusHttpHost: nexusHttpHost: www.joaolino.com
enforceHttps: false enforceHttps: false
cloudIamAuthEnabled: false cloudIamAuthEnabled: false
## If cloudIamAuthEnabled is set to true uncomment the variables below and remove this line ## If cloudIamAuthEnabled is set to true uncomment the variables below and remove this line
...@@ -113,7 +115,7 @@ nexusProxy: ...@@ -113,7 +115,7 @@ nexusProxy:
# memory: 512Mi # memory: 512Mi
nexusProxyRoute: nexusProxyRoute:
enabled: true enabled: false
labels: labels:
annotations: annotations:
path: /nexus path: /nexus
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment