Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create hockeypuck rock and update charm files #3

Merged
merged 18 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ header:
- '.github/**'
- '**/*.json'
- '**/*.md'
- '**/*.conf'
- '**/*.txt'
- '**/*.sh'
swetha1654 marked this conversation as resolved.
Show resolved Hide resolved
- '.jujuignore'
- '.gitignore'
- '.licenserc.yaml'
- '.trivyignore'
- '.woke.yaml'
- '.woke.yml'
- 'CODEOWNERS'
- 'LICENSE'
- 'trivy.yaml'
Expand Down
3 changes: 3 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GHSA-9763-4f94-gfch

Check notice on line 1 in .trivyignore

View workflow job for this annotation

GitHub Actions / integration-tests / Scan Image (ghcr.io-canonical-hockeypuck-b0566df4bbcb02e6ad92b00ded9e1f57b6f778ac-_0.1_amd64.tar)

GHSA-9763-4f94-gfch not present anymore, can be safely removed.
CVE-2024-45337

Check notice on line 2 in .trivyignore

View workflow job for this annotation

GitHub Actions / integration-tests / Scan Image (ghcr.io-canonical-hockeypuck-b0566df4bbcb02e6ad92b00ded9e1f57b6f778ac-_0.1_amd64.tar)

CVE-2024-45337 not present anymore, can be safely removed.
CVE-2024-45338
swetha1654 marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 3 additions & 0 deletions .woke.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rules:
swetha1654 marked this conversation as resolved.
Show resolved Hide resolved
# Ignore "blacklist" - since the hockeypuck binaries look for this configuation option
- name: blacklist
53 changes: 46 additions & 7 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,49 @@
# See LICENSE file for licensing details.

type: charm
bases:
- build-on:
- name: ubuntu
channel: "22.04"
run-on:
- name: ubuntu
channel: "22.04"
name: hockeypuck-k8s
title: Hockeypuck K8S Charm
summary: Hockeypuck OpenPGP public keyserver
links:
documentation: https://github.com/canonical/hockeypuck-k8s-operator/blob/main/README.md
swetha1654 marked this conversation as resolved.
Show resolved Hide resolved
issues: https://github.com/canonical/hockeypuck-k8s-operator/issues
source: https://github.com/canonical/hockeypuck-k8s-operator
contact: https://launchpad.net/~canonical-is-devops

description: |
A [Juju](https://juju.is/) [charm](https://juju.is/docs/olm/charmed-operators)
for deploying and managing [Hockeypuck](https://hockeypuck.io/) on Kubernetes. Hockeypuck is an
OpenPGP public keyserver tool used to manage public key infrastructure for PGP
(Pretty Good Privacy). PGP is a system for securing communication through encryption and
digital signatures.

The server provides interfaces to add, look up, replace and delete public keys from the
keyserver. Hockeypuck can synchronize public key material with SKS (Synchronizing Key Server)
and other Hockeypuck servers. It implements the HTTP Keyserver Protocol and the SKS database
reconciliation protocol.

For DevOps and SRE teams, this charm will make operating Hockeypuck simple and straightforward
through Juju's clean interface.

assumes:
- juju >= 3.1
- k8s-api

containers:
hockeypuck:
resource: hockeypuck-image

resources:
hockeypuck-image:
type: oci-image
description: OCI image for Hockeypuck

requires:
database:
interface: postgresql_client
limit: 1

base: [email protected]
build-base: [email protected]
platforms:
amd64:
4 changes: 2 additions & 2 deletions hockeypuck_rock/hockeypuck.conf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ blacklist=[

[hockeypuck.openpgp.db]
driver="postgres-jsonb"
dsn="database=hkp host=${POSTGRES_HOST} user=${POSTGRES_USER} password=${POSTGRES_PASSWORD} port=${POSTGRES_PORT} sslmode=disable"
dsn="database=hockeypuck host=${POSTGRES_HOST} user=${POSTGRES_USER} password=${POSTGRES_PASSWORD} port=${POSTGRES_PORT} sslmode=disable"
swetha1654 marked this conversation as resolved.
Show resolved Hide resolved

[hockeypuck.conflux.recon]
allowCIDRs=["127.0.0.1/8"]
Expand All @@ -41,4 +41,4 @@ path="/hockeypuck/data/ptree"
# Gossip peers
#[hockeypuck.conflux.recon.partner.keyserver_example_com]
#httpAddr="keyserver.example.com:11371"
#reconAddr="keyserver.example.com:11370"
#reconAddr="keyserver.example.com:11370"
7 changes: 2 additions & 5 deletions hockeypuck_rock/hockeypuck_wrapper.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

#!/bin/bash

swetha1654 marked this conversation as resolved.
Show resolved Hide resolved
TEMPLATE_FILE="/hockeypuck/etc/hockeypuck.conf.tmpl"
OUTPUT_FILE="/hockeypuck/etc/hockeypuck.conf"

if [[ ! -f $TEMPLATE_FILE ]]; then
echo "Template file $TEMPLATE_FILE not found."
echo "Template file $TEMPLATE_FILE not found." >&2
exit 1
fi

envsubst < "$TEMP_FILE" > "$OUTPUT_FILE"

echo "Substitution complete. Output written to $OUTPUT_FILE."

exec /hockeypuck/bin/hockeypuck -config $OUTPUT_FILE
exec /hockeypuck/bin/hockeypuck -config $OUTPUT_FILE
9 changes: 4 additions & 5 deletions hockeypuck_rock/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ base: [email protected]
version: 0.1
summary: Hockeypuck is an OpenPGP public keyserver.
description: |
Hockeypuck is an openPGP public keyserver or a software tool
used to manage public key infrastructure for PGP (Pretty Good Privacy),
which is a system for securing communication through encryption and
digital signatures.
Hockeypuck is an OpenPGP public keyserver tool used to manage public key
infrastructure for PGP (Pretty Good Privacy). PGP is a system for securing
communication through encryption and digital signatures.
platforms:
amd64:
build-on:
Expand Down Expand Up @@ -40,4 +39,4 @@ parts:
hockeypuck.conf.tmpl: hockeypuck/etc/hockeypuck.conf.tmpl
hockeypuck_wrapper.sh: hockeypuck/bin/hockeypuck_wrapper.sh
prime:
- hockeypuck/*
- hockeypuck/*
39 changes: 0 additions & 39 deletions metadata.yaml

This file was deleted.

12 changes: 9 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Copyright 2025 Canonical Ltd.
# See LICENSE file for licensing details.

"""Fixtures for charm tests."""
"""Fixtures for hockeypuck-k8s tests."""

import pytest

def pytest_addoption(parser):

def pytest_addoption(parser: pytest.Parser):
"""Parse additional pytest options.

Args:
parser: Pytest parser.
"""
parser.addoption("--charm-file", action="store")
# The prebuilt charm file.
parser.addoption("--charm-file", action="append", default=[])
swetha1654 marked this conversation as resolved.
Show resolved Hide resolved
# The Hockeypuck image name:tag.
parser.addoption("--hockeypuck-image", action="store", default="")
# The path to kubernetes config.
Loading