This repository contains the Docker image definition for the cray-product-catalog-update image. This image provides a script that uploads the contents of a yaml file to a product catalog entry, which serves as a kubernetes config map.
At minimum, the catalog_update.py
script takes a PRODUCT
and
PRODUCT_VERSION
and applies the content of a file denoted by YAML_CONTENT
file as follows:
{PRODUCT}:
{PRODUCT_VERSION}:
{content of yaml file (in YAML_CONTENT)}
The product catalog is a lightweight software inventory of sorts, and allows for system users to view a product and its associated versions and version metadata that have been installed on the system.
The cray-product-catalog-update image is assumed to be running in the CSM Kubernetes cluster by an actor that has permissions to read and update config maps in the namespace that is configured.
Additionally, this repository provides the cray-product-catalog
config map,
which is managed by the cray-product-catalog Helm chart.
The main use case for cray-product-catalog is for a product to add install-time information and metadata to the cray-product-catalog config map located in the services namespace via a Kubernetes job as part of a Helm chart. The image could also be used via podman on an NCN, but this has not been tested.
Two seminal examples of using cray-product-catalog are the cray-import-config
and cray-import-kiwi-recipe-image
base charts. Review the values files and
Kubernetes job template to see cray-product-catalog in action.
To create an entry in the config map for an "example" product with version
1.2.3, you can use podman on a Kubernetes worker/master node. Be sure to mount
the Kubernetes config file into the running container as well as the
YAML_CONTENT
.
ncn-w001:~/ # podman run --rm --name example-cpc --network podman-cni-config \
-e PRODUCT=example \
-e PRODUCT_VERSION=1.2.3 \
-e YAML_CONTENT=/results/example.yaml \
-e KUBECONFIG=/.kube/admin.conf \
-v /etc/kubernetes:/.kube:ro \
-v ${PWD}:/results:ro \
artifactory.algol60.net/csm-docker/stable/cray-product-catalog-update:1.2.57
Updating config_map=cray-product-catalog in namespace=services for product/version=example/1.2.3
Retrieving content from /results/example.yaml
Resting 3s before reading ConfigMap
Product=example does not exist; will update
ConfigMap update attempt=1
Resting 2s before reading ConfigMap
ConfigMap data updates exist; Exiting.
View the results in a nice format:
ncn-w001:~/ # kubectl get cm -n services cray-product-catalog -o json | jq .data.example | ./yq r -
1.2.3:
this:
is: some
yaml: stuff
All configuration options are provided as environment variables.
PRODUCT
= (no default)
The name of the Cray/Shasta product that is being cataloged.
PRODUCT_VERSION
= (no default)
The SemVer version of the Cray/Shasta product that is being imported, e.g.
1.2.3
.
YAML_CONTENT
= (no default)
The filesystem location of the YAML that will be added to the config map.
CONFIG_MAP
=cray-product-catalog
The name of the config map to add the
YAML_CONTENT
to.
CONFIG_MAP_NAMESPACE
=services
The Kubernetes namespace of the
CONFIG_MAP
.
Versions are calculated automatically using gitversion
. The full SemVer
output is governed by the GitVersion.yml
file in the root of this repo.
Run gitversion -output json
to see the current version based on the checked
out commit.
Create a release by triggering the Draft New Release workflow with the version that will be released.
Releases are automatically published when pull requests to the master branch are merged.
This repo uses Git Flow. CMS-core-product-support team members shouuld make a branch. Others, make a fork.
- Alpine Linux
- Python 3
- Python Requests
- Kubernetes Python Client
- Docker
- Git Flow
- Gitversion
- Good intentions
See the CHANGELOG for changes.
This project is copyrighted by Hewlett Packard Enterprise Development LP and is under the MIT license. See the LICENSE file for details.