Răsfoiți Sursa

Fixed maybe

Fred Damstra (k8s1) 2 ani în urmă
părinte
comite
0d0728dd36
4 a modificat fișierele cu 15 adăugiri și 16 ștergeri
  1. 4 3
      Dockerfile
  2. 5 8
      k8s.update-route53.yaml
  3. 1 0
      kaniko-update-route53.yaml
  4. 5 5
      update-route53.sh

+ 4 - 3
Dockerfile

@@ -6,10 +6,11 @@ LABEL description="Docker image that updates a route53 zone record with the curr
 # Never prompt
 ARG DEBIAN_FRONTEND=noninteractive
 
-RUN apt update \
-  && apt install -y curl awscli \
+RUN apt-get update \
+  && apt-get upgrade -y \
+  && apt-get install -y curl awscli \
   && rm -rf /var/lib/apt/lists/* \
-  && apt clean
+  && apt-get clean
 
 COPY . /opt/update-route53
 RUN chmod 755 /opt/update-route53/update-route53.sh \

+ 5 - 8
k8s.update-route53.yaml

@@ -57,8 +57,8 @@ spec:
           - secretRef:
               name: update-route53
         volumeMounts:
-        - name: docker-config
-          mountPath: /kaniko/.docker/
+        - name: update-route53
+          mountPath: /scratch/
       dnsPolicy: "None"
       dnsConfig:
         nameservers:
@@ -75,9 +75,6 @@ spec:
           - name: trust-ad
       restartPolicy: Never
       volumes:
-      - name: docker-config
-        secret:
-          secretName: docker-regcred
-          items:
-              - key: .dockerconfigjson
-                path: config.json
+      - name: update-route53
+        persistentVolumeClaim:
+          claimName: update-route53

+ 1 - 0
kaniko-update-route53.yaml

@@ -29,6 +29,7 @@ spec:
         - "--dockerfile=./Dockerfile"
         - "--context=git://git.monkeybox.org/Containers/update-route53#refs/heads/master"
         - "--destination=fdamstra/update-route53:latest"
+        - "--cache=true"
         env:
           - name: GIT_TOKEN
             valueFrom:

+ 5 - 5
update-route53.sh

@@ -33,7 +33,7 @@ LOGFILE="$DIR/update-route53.log"
 IPFILE="$DIR/update-route53.ip"
  
 if ! valid_ip $IP; then
-    echo "Invalid IP address: $IP" >> "$LOGFILE"
+    echo "Invalid IP address: $IP" | tee -a "$LOGFILE"
     exit 1
 fi
  
@@ -45,10 +45,10 @@ fi
  
 if grep -Fxq "$IP" "$IPFILE"; then
     # code if found
-    echo "IP is still $IP. Exiting" >> "$LOGFILE"
+    echo "IP is still $IP. Exiting" | tee -a "$LOGFILE"
     exit 0
 else
-    echo "IP has changed to $IP" >> "$LOGFILE"
+    echo "IP has changed to $IP" | tee -a "$LOGFILE"
     # Fill a temp file with valid JSON
     TMPFILE=$(mktemp /tmp/temporary-file.XXXXXXXX)
     cat > ${TMPFILE} << EOF
@@ -75,8 +75,8 @@ EOF
     # Update the Hosted Zone record
     aws route53 change-resource-record-sets \
         --hosted-zone-id $ZONEID \
-        --change-batch file://"$TMPFILE" >> "$LOGFILE"
-    echo "" >> "$LOGFILE"
+        --change-batch file://"$TMPFILE" | tee -a "$LOGFILE"
+    echo "" | tee -a "$LOGFILE"
  
     # Clean up
     rm $TMPFILE