AiaP - Develop a method to support caching on a remote node
- Adds PV for local caching. This allows us to also use PV in other clusters like AKS. - Moves artifacts and caching files into /opt/aiap-files/artifacts and /opt/aiap-files/caching so we only have one PV Relates-To: #645 Change-Id: I84172778df66bee8a833b13d5b740a6cf45220c2
This commit is contained in:
parent
bc704b736d
commit
61c18d9359
|
@ -163,14 +163,15 @@ Airship-in-a-pod produces the following outputs:
|
||||||
* A tarball containing the generated ephemeral ISO, as well as the
|
* A tarball containing the generated ephemeral ISO, as well as the
|
||||||
configuration used during generation.
|
configuration used during generation.
|
||||||
|
|
||||||
These artifacts are placed at `ARTIFACTS_DIR` (defaults to `/opt/aiap-artifacts`).
|
These artifacts are placed at `ARTIFACTS_DIR` (defaults to `/opt/aiap-files/artifacts`).
|
||||||
|
|
||||||
## Caching
|
## Caching
|
||||||
|
#TODO: Need to review this.
|
||||||
|
|
||||||
As it can be cumbersome and time-consuming to build and rebuild binaries and
|
As it can be cumbersome and time-consuming to build and rebuild binaries and
|
||||||
images, some options are made available for caching. A developer may re-use
|
images, some options are made available for caching. A developer may re-use
|
||||||
artifacts from previous runs (or provide their own) by placing them in
|
artifacts from previous runs (or provide their own) by placing them in
|
||||||
`CACHE_DIR` (defaults to `/opt/aiap-cache`). Special care is needed for the
|
`CACHE_DIR` (defaults to `/opt/aiap-files/cache`). Special care is needed for the
|
||||||
caching:
|
caching:
|
||||||
|
|
||||||
* If using a cached `airshipctl`, the `airshipctl` binary must be stored in the
|
* If using a cached `airshipctl`, the `airshipctl` binary must be stored in the
|
||||||
|
|
|
@ -4,10 +4,10 @@ FROM ${BASE_IMAGE}
|
||||||
SHELL ["bash", "-exc"]
|
SHELL ["bash", "-exc"]
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
ARG CACHE_DIR=/opt/aiap-cache
|
ARG CACHE_DIR=/opt/aiap-files/cache
|
||||||
ENV CACHE_DIR=$CACHE_DIR
|
ENV CACHE_DIR=$CACHE_DIR
|
||||||
|
|
||||||
ARG ARTIFACTS_DIR=/opt/aiap-artifacts
|
ARG ARTIFACTS_DIR=/opt/aiap-files/artifacts
|
||||||
ENV ARTIFACTS_DIR=$ARTIFACTS_DIR
|
ENV ARTIFACTS_DIR=$ARTIFACTS_DIR
|
||||||
|
|
||||||
# Update distro and install common reqs
|
# Update distro and install common reqs
|
||||||
|
|
|
@ -15,6 +15,9 @@ kind: Kustomization
|
||||||
bases:
|
bases:
|
||||||
- ../base
|
- ../base
|
||||||
|
|
||||||
|
resources:
|
||||||
|
- pv.yaml
|
||||||
|
|
||||||
patchesJson6902:
|
patchesJson6902:
|
||||||
- target:
|
- target:
|
||||||
version: v1 # apiVersion
|
version: v1 # apiVersion
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolume
|
||||||
|
metadata:
|
||||||
|
name: aiap-pv-files-volume
|
||||||
|
spec:
|
||||||
|
capacity:
|
||||||
|
storage: 100Gi
|
||||||
|
volumeMode: Filesystem
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
persistentVolumeReclaimPolicy: Delete
|
||||||
|
storageClassName: standard
|
||||||
|
local:
|
||||||
|
path: /var/local-path-provisioner
|
||||||
|
nodeAffinity:
|
||||||
|
required:
|
||||||
|
nodeSelectorTerms:
|
||||||
|
- matchExpressions:
|
||||||
|
- key: kubernetes.io/hostname
|
||||||
|
operator: In
|
||||||
|
values:
|
||||||
|
- kind-control-plane
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: aiap-pv-files-claim
|
||||||
|
spec:
|
||||||
|
storageClassName: standard
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 100Gi
|
|
@ -61,28 +61,29 @@
|
||||||
# that it should be the same across containers
|
# that it should be the same across containers
|
||||||
- op: replace
|
- op: replace
|
||||||
path: "/spec/containers/4/env/2/value"
|
path: "/spec/containers/4/env/2/value"
|
||||||
value: /opt/aiap-artifacts
|
value: /opt/aiap-files/artifacts
|
||||||
- op: replace
|
- op: replace
|
||||||
path: "/spec/containers/5/env/1/value"
|
path: "/spec/containers/5/env/1/value"
|
||||||
value: /opt/aiap-artifacts
|
value: /opt/aiap-files/artifacts
|
||||||
- op: replace
|
- op: replace
|
||||||
path: "/spec/containers/6/env/1/value"
|
path: "/spec/containers/6/env/1/value"
|
||||||
value: /opt/aiap-artifacts
|
value: /opt/aiap-files/artifacts
|
||||||
|
|
||||||
# This is the location on the host machine of the cache directory. Note that it
|
# This is the location on the host machine of the cache directory. Note that it
|
||||||
# should be the same across containers
|
# should be the same across containers
|
||||||
- op: replace
|
- op: replace
|
||||||
path: "/spec/containers/4/env/0/value"
|
path: "/spec/containers/4/env/0/value"
|
||||||
value: /opt/aiap-cache
|
value: /opt/aiap-files/cache
|
||||||
- op: replace
|
- op: replace
|
||||||
path: "/spec/containers/5/env/0/value"
|
path: "/spec/containers/5/env/0/value"
|
||||||
value: /opt/aiap-cache
|
value: /opt/aiap-files/cache
|
||||||
- op: replace
|
- op: replace
|
||||||
path: "/spec/containers/6/env/0/value"
|
path: "/spec/containers/6/env/0/value"
|
||||||
value: /opt/aiap-cache
|
value: /opt/aiap-files/cache
|
||||||
# Set true to use a cached airshipctl binary
|
# Set true to use a cached airshipctl binary
|
||||||
- op: replace
|
- op: replace
|
||||||
path: "/spec/containers/4/env/1/value"
|
path: "/spec/containers/4/env/1/value"
|
||||||
|
# value: $(USE_CACHED_AIRSHIPCTL)
|
||||||
value: "false"
|
value: "false"
|
||||||
# Set true to use a cached ephemeral iso
|
# Set true to use a cached ephemeral iso
|
||||||
- op: replace
|
- op: replace
|
||||||
|
|
|
@ -223,11 +223,11 @@ spec:
|
||||||
- /entrypoint.sh
|
- /entrypoint.sh
|
||||||
env:
|
env:
|
||||||
- name: CACHE_DIR
|
- name: CACHE_DIR
|
||||||
value: /opt/aiap-cache
|
value: /opt/aiap-files/cache
|
||||||
- name: USE_CACHED_AIRSHIPCTL
|
- name: USE_CACHED_AIRSHIPCTL
|
||||||
value: "false"
|
value: "false"
|
||||||
- name: ARTIFACTS_DIR
|
- name: ARTIFACTS_DIR
|
||||||
value: /opt/aiap-artifacts
|
value: /opt/aiap-files/artifacts
|
||||||
- name: AIRSHIPCTL_REPO_URL
|
- name: AIRSHIPCTL_REPO_URL
|
||||||
value: https://opendev.org/airship/airshipctl
|
value: https://opendev.org/airship/airshipctl
|
||||||
- name: AIRSHIPCTL_REPO_REF
|
- name: AIRSHIPCTL_REPO_REF
|
||||||
|
@ -245,10 +245,8 @@ spec:
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: tmp
|
- name: tmp
|
||||||
mountPath: /tmp
|
mountPath: /tmp
|
||||||
- name: cache
|
- name: aiap-files
|
||||||
mountPath: /opt/aiap-cache
|
mountPath: /opt/aiap-files
|
||||||
- name: artifacts
|
|
||||||
mountPath: /opt/aiap-artifacts
|
|
||||||
- name: status
|
- name: status
|
||||||
mountPath: /tmp/status
|
mountPath: /tmp/status
|
||||||
- name: var-run-docker
|
- name: var-run-docker
|
||||||
|
@ -269,9 +267,9 @@ spec:
|
||||||
- /entrypoint.sh
|
- /entrypoint.sh
|
||||||
env:
|
env:
|
||||||
- name: CACHE_DIR
|
- name: CACHE_DIR
|
||||||
value: /opt/aiap-cache
|
value: /opt/aiap-files/cache
|
||||||
- name: ARTIFACTS_DIR
|
- name: ARTIFACTS_DIR
|
||||||
value: /opt/aiap-artifacts
|
value: /opt/aiap-files/artifacts
|
||||||
- name: USE_PROXY
|
- name: USE_PROXY
|
||||||
value:
|
value:
|
||||||
- name: no_proxy
|
- name: no_proxy
|
||||||
|
@ -281,10 +279,8 @@ spec:
|
||||||
- name: https_proxy
|
- name: https_proxy
|
||||||
value:
|
value:
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: cache
|
- name: aiap-files
|
||||||
mountPath: /opt/aiap-cache
|
mountPath: /opt/aiap-files
|
||||||
- name: artifacts
|
|
||||||
mountPath: /opt/aiap-artifacts
|
|
||||||
- name: status
|
- name: status
|
||||||
mountPath: /tmp/status
|
mountPath: /tmp/status
|
||||||
- name: tmp
|
- name: tmp
|
||||||
|
@ -311,9 +307,9 @@ spec:
|
||||||
- /entrypoint.sh
|
- /entrypoint.sh
|
||||||
env:
|
env:
|
||||||
- name: CACHE_DIR
|
- name: CACHE_DIR
|
||||||
value: /opt/aiap-cache
|
value: /opt/aiap-files/cache
|
||||||
- name: ARTIFACTS_DIR
|
- name: ARTIFACTS_DIR
|
||||||
value: /opt/aiap-artifacts
|
value: /opt/aiap-files/artifacts
|
||||||
- name: USE_CACHED_ISO
|
- name: USE_CACHED_ISO
|
||||||
value: "false"
|
value: "false"
|
||||||
- name: AIRSHIP_CONFIG_PHASE_REPO_URL
|
- name: AIRSHIP_CONFIG_PHASE_REPO_URL
|
||||||
|
@ -336,10 +332,8 @@ spec:
|
||||||
value:
|
value:
|
||||||
|
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: cache
|
- name: aiap-files
|
||||||
mountPath: /opt/aiap-cache
|
mountPath: /opt/aiap-files
|
||||||
- name: artifacts
|
|
||||||
mountPath: /opt/aiap-artifacts
|
|
||||||
- name: status
|
- name: status
|
||||||
mountPath: /tmp/status
|
mountPath: /tmp/status
|
||||||
- name: tmp
|
- name: tmp
|
||||||
|
@ -367,13 +361,23 @@ spec:
|
||||||
- name: status
|
- name: status
|
||||||
mountPath: /tmp/status
|
mountPath: /tmp/status
|
||||||
|
|
||||||
|
initContainers:
|
||||||
|
- name: init-aiap-files
|
||||||
|
image: ubuntu:20.04
|
||||||
|
command:
|
||||||
|
- bash
|
||||||
|
- -cex
|
||||||
|
- |
|
||||||
|
mkdir -p /opt/aiap-files/artifacts
|
||||||
|
mkdir -p /opt/aiap-files/cache
|
||||||
|
volumeMounts:
|
||||||
|
- name: aiap-files
|
||||||
|
mountPath: /opt/aiap-files
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: cache
|
- name: aiap-files
|
||||||
hostPath:
|
persistentVolumeClaim:
|
||||||
path: /opt/aiap-cache
|
claimName: aiap-pv-files-claim
|
||||||
- name: artifacts
|
|
||||||
hostPath:
|
|
||||||
path: /opt/aiap-artifacts
|
|
||||||
- name: status
|
- name: status
|
||||||
emptyDir: {}
|
emptyDir: {}
|
||||||
- name: dev
|
- name: dev
|
||||||
|
|
Loading…
Reference in New Issue