Skip to content

validatedpatterns/patternizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Patternizer

Version: 1.0.0 Quay Repository CI Pipeline

Patternizer is a command-line tool that bootstraps a Git repository containing Helm charts into a ready-to-use Validated Pattern. It automatically generates the necessary scaffolding, configuration files, and utility scripts, so you can get your pattern up and running in minutes. It can also be used to upgrade existing patterns as described in the Validated Pattern's blog.

Note: This repo was developed with AI tools including Cursor, Claude and Gemini.

Quick Start

Prerequisites:

  • Podman or Docker
  • A Git repository you want to convert into a pattern

Navigate to your repository's root directory and run the initialization command:

podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init

This single command will generate all the necessary files to turn your repository into a Validated Pattern.

Example Workflow

  1. Clone or create your pattern repository

    git clone https://github.com/your-org/your-pattern.git
    cd your-pattern
    git checkout -b initialize-pattern
  2. Initialize the pattern using Patternizer

    podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init
  3. Review, commit, and push the generated files

    git status
    git add .
    git commit -m 'initialize pattern using patternizer'
    git push -u origin initialize-pattern
  4. Login to an OpenShift cluster

    export KUBECONFIG=/path/to/cluster/kubeconfig
  5. Install the pattern

    ./pattern.sh make install

Usage Details

Container Usage (Recommended)

Using the prebuilt container is the easiest way to run Patternizer, as it requires no local installation.

Initialize without secrets:

podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init

Initialize with secrets support:

podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer init --with-secrets

Upgrade an existing pattern repository:

Use this to migrate or refresh an existing pattern repo to the latest common structure and scripts.

# Refresh common assets, keep your Makefile unless it lacks the include
podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer upgrade

# Replace your Makefile with the default from Patternizer
podman run --pull=newer -v "$PWD:$PWD:z" -w "$PWD" quay.io/validatedpatterns/patternizer upgrade --replace-makefile

What upgrade does:

  • Removes the common/ directory if it exists
  • Updates ansible.cfg, Makefile-common, and pattern.sh to the latest versions from the resources directory
  • Makefile handling:
    • If --replace-makefile is set: replaces an existing Makefile, if present, to Makefile from the resources directory
    • If not set:
      • If no Makefile exists: copies the default Makefile
      • If a Makefile exists and already contains include Makefile-common anywhere: leaves it unchanged
      • Otherwise: prepends include Makefile-common to the first line so your existing targets are preserved

Understanding Secrets Management

You can start simple and add secrets management later.

  • By default, patternizer init disables secret loading.
  • To add secrets scaffolding, run patternizer init --with-secrets at any time. This will update your configuration to enable secrets.
  • Important: This action is not easily reversible. We recommend committing your work to Git before adding secrets support.

For more details on how secrets work in the framework, see the Secrets Management Documentation.

Generated Files

Running patternizer init creates the following:

  • values-global.yaml: Global pattern configuration.
  • values-<cluster_group>.yaml: Cluster group-specific values.
  • pattern.sh: A utility script for common pattern operations (install, upgrade, etc.).
  • Makefile: A simple Makefile that includes Makefile-common.
  • Makefile-common: The core Makefile with all pattern-related targets.
  • ansible.cfg: Configuration for the ansible installation used when ./pattern.sh is called

Using the --with-secrets flag additionally creates:

  • values-secret.yaml.template: A template for defining your secrets.
  • It also updates values-global.yaml to set global.secretLoader.disabled: false and adds Vault and External Secrets Operator to the cluster group values.

Development & Contributing

This section is for developers who want to contribute to the Patternizer project itself.

Prerequisites

  • Go (see go.mod for version)
  • Podman or Docker
  • Git
  • Make

Local Development Workflow

# 1. Clone the repository
git clone https://github.com/validatedpatterns/patternizer.git
cd patternizer

# 2. Set up the development environment
make dev-setup

# 3. Make your changes...

# 4. Run the full CI suite locally before committing
make ci

How to Contribute

  1. Fork the repository.
  2. Create a feature branch for your changes.
  3. Make your changes and ensure they pass the local CI check (make ci).
  4. Submit a pull request.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors