-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from pabrahamsson/ubi_prune_image
Use UBI for project prune image
- Loading branch information
Showing
5 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Images | ||
|
||
This directory contains a collection of utility images for Openshift tasks. | ||
|
||
### Prune Openshift projects | ||
|
||
The [prune-ocp-projects](prune-ocp-projects) declaratively prunes projects based on creation date. Projects can beexcluded from being pruned by annotating the project or by excluding it based on name. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Prune OCP projects | ||
|
||
Use this image to prune Openshift projects | ||
|
||
- Based on UBI 8 | ||
- Uses oc client 4.4 | ||
|
||
## Build image | ||
|
||
### Dockerfile | ||
``` | ||
docker build -t prune-ocp-projects . | ||
``` | ||
|
||
### Buildah | ||
``` | ||
./buildah.sh | ||
``` | ||
or | ||
``` | ||
buildah build -t prune-ocp-projects . | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
|
||
# Create the container | ||
container=$(buildah from registry.access.redhat.com/ubi8/ubi) | ||
buildah config --label io.k8s.description="OCP Project Pruner" --label io.k8s.display-name="OCP Project Pruner" --env PATH='$PATH:/usr/local/bin' $container | ||
buildah add $container include/prune-ocp-projects.sh /usr/local/bin/ | ||
buildah run $container -- curl -Lo /tmp/oc.tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/oc/4.4/linux/oc.tar.gz | ||
buildah run $container -- tar -C /usr/local/bin/ -xzf /tmp/oc.tar.gz | ||
buildah run $container -- rm /tmp/oc.tar.gz | ||
buildah config --cmd /usr/local/bin/prune-ocp-projects.sh $container | ||
|
||
buildah commit $container prune-ocp-projects:latest |