Skip to content

Conversation

@shafi-elastisys
Copy link
Contributor

Warning

This is a public repository, ensure not to disclose:

  • personal data beyond what is necessary for interacting with this pull request, nor
  • business confidential information, such as customer names.

What kind of PR is this?

Required: Mark one of the following that is applicable:

  • kind/feature
  • kind/improvement
  • kind/deprecation
  • kind/documentation
  • kind/clean-up
  • kind/bug
  • kind/other

Optional: Mark one or more of the following that are applicable:

Important

Breaking changes should be marked kind/admin-change or kind/dev-change depending on type
Critical security fixes should be marked with kind/security

  • kind/admin-change
  • kind/dev-change
  • kind/security
  • [kind/adr](set-me)

What does this PR do / why do we need this PR?

This PR introduces script to which helps to setup a temporary GPG for local testing.

  • Added bin/setup-local-gpg which generaes a GPG Key non-interactively and exports necessary environment variables for SOPS to use.
  • Updated bats.lib.bash added helper functions. This allows test to invoke the script during the setup phase.

Information to reviewers

Checklist

  • Proper commit message prefix on all commits
  • Change checks:
    • The change is transparent
    • The change is disruptive
    • The change requires no migration steps
    • The change requires migration steps
    • The change updates CRDs
    • The change updates the config and the schema
  • Documentation checks:
  • Metrics checks:
    • The metrics are still exposed and present in Grafana after the change
    • The metrics names didn't change (Grafana dashboards and Prometheus alerts required no updates)
    • The metrics names did change (Grafana dashboards and Prometheus alerts required an update)
  • Logs checks:
    • The logs do not show any errors after the change
  • PodSecurityPolicy checks:
    • Any changed Pod is covered by Kubernetes Pod Security Standards
    • Any changed Pod is covered by Gatekeeper Pod Security Policies
    • The change does not cause any Pods to be blocked by Pod Security Standards or Policies
  • NetworkPolicy checks:
    • Any changed Pod is covered by Network Policies
    • The change does not cause any dropped packets in the NetworkPolicy Dashboard
  • Audit checks:
    • The change does not cause any unnecessary Kubernetes audit events
    • The change requires changes to Kubernetes audit policy
  • Falco checks:
    • The change does not cause any alerts to be generated by Falco
  • Bug checks:
    • The bug fix is covered by regression tests

@shafi-elastisys shafi-elastisys requested review from a team as code owners December 9, 2025 09:47
@shafi-elastisys shafi-elastisys added the kind/feature New feature or request label Dec 9, 2025
Copy link
Contributor

@simonklb simonklb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't you use the existing setup?

@simonklb simonklb dismissed their stale review December 9, 2025 12:32

Sorry I see now this is for the quickstart and not just testing.

if [[ -z "${CK8S_CONFIG_PATH:-}" ]]; then
log.fatal "CK8S_CONFIG_PATH is unset"
config_path_was_unset=true
export CK8S_CONFIG_PATH="${HOME}/welkin-quick-start"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not pollute the home directory 😆

Suggested change
export CK8S_CONFIG_PATH="${HOME}/welkin-quick-start"
export CK8S_CONFIG_PATH="${HOME}/.ck8s/welkin-quick-start"

Copy link
Contributor

@aarnq aarnq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit concerned why the local-clusters script is becoming quick-start, I was under the impression that it should basically a command in the bin scripts, just like ./bin/ck8s quick-start or something.

pgp_key_was_unset=true
if [[ -x "${ROOT}/bin/setup-local-gpg" ]]; then
eval "$("${ROOT}/bin/setup-local-gpg")"
log.info "CK8S_PGP_FP is unset. Using temp gpgkey: ${CK8S_PGP_FP}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.info "CK8S_PGP_FP is unset. Using temp gpgkey: ${CK8S_PGP_FP}"
log.info "CK8S_PGP_FP is unset. Using temporary GPP key: ${CK8S_PGP_FP}"

if [[ -x "${ROOT}/bin/setup-local-gpg" ]]; then
eval "$("${ROOT}/bin/setup-local-gpg")"
log.info "CK8S_PGP_FP is unset. Using temp gpgkey: ${CK8S_PGP_FP}"
log.info "Using temp GNUPGHOME: ${GNUPGHOME}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.info "Using temp GNUPGHOME: ${GNUPGHOME}"
log.info "Using temp GNUPGHOME: ${GNUPGHOME}"
log.warn "Once this is cleared you will loose the ability to decrypt the secrets for this config path."

Comment on lines +165 to +180
# sets up a temporary GPG home and key for local testing
# usage: with_temporary_gpg
with_temporary_gpg() {
if ! command -v setup-local-gpg &>/dev/null; then
log.fatal "setup-local-gpg script not found in path"
fi

eval "$(setup-local-gpg)"

if [[ -z "${CK8S_PGP_FP:-}" ]]; then
fail "Failed to generate temporary GPG key"
fi

log.trace "Temporary GPG initialized. Fingerprint: $CK8S_PGP_FP"
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? We already have a function for it already in common/bats/gpg.sh that also takes care of an edge case in which the GPG agent isn't available in the first tries.

@shafi-elastisys
Copy link
Contributor Author

Right, I understood. My understanding was to simplify the script usage so that the README instructions could be kept minimal. However, if the plan is to have separate bin script then I can remove the default directory setup and keep the temp gpg key creation. Does that sounds good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[2] Update documentation on GPG and create a temp solution for quick start

4 participants