Skip to content

Initialize OpenBao Service #630

Open
norbertgruszka wants to merge 22 commits intodevelopfrom
feat/init-openabo-service
Open

Initialize OpenBao Service #630
norbertgruszka wants to merge 22 commits intodevelopfrom
feat/init-openabo-service

Conversation

@norbertgruszka
Copy link
Copy Markdown
Collaborator

@norbertgruszka norbertgruszka commented Mar 31, 2026

Summary

Initialize OpenBao Service. The goal is to provide users with an option to setup HA OpenBao Cluster using Appcat.

Initial implementation contains:

  • Auto generated Kubernetes API
  • Deployment step
  • HCL generator
  • Self-signed TLS certificates

The service is not yet ready for production use. Further development will follow.

How to test?

  1. Create kindev environment with at least 3 nodes. For now, the OpenBao Cluster starts in HA.
  2. Create newvshnopenbaos.vshn.appcat.vshn.io resource.
apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNOpenBao
metadata:
  name: openbao-test
spec:
  parameters:
    security:
      deletionProtection: false
  writeConnectionSecretToRef:
    name: "openbao-test"
  1. Search for newly created namespace with openbao name included. Use bao operator init -tls-skip-verify to initialize the cluster manually with kubectl exec command.
  2. The cluster should be operational.

Checklist

  • Update tests.
  • Link this PR to related issues.
  • Merge with /merge comment.

Component PR: vshn/component-appcat#1128

@norbertgruszka norbertgruszka mentioned this pull request Mar 31, 2026
3 tasks
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 31, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 1, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 2, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 2, 2026

@norbertgruszka norbertgruszka requested a review from ioboi April 2, 2026 13:09
@ioboi ioboi added the minor label Apr 10, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 13, 2026

@ioboi ioboi force-pushed the feat/init-openabo-service branch from 875b55d to 8285fe7 Compare April 13, 2026 14:31
@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

Copy link
Copy Markdown
Contributor

@Kidswiss Kidswiss left a comment

Choose a reason for hiding this comment

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

The code looks good. Just a few remarks.

I haven't tested it yet, but will do some tests later.

Search for newly created namespace with openbao name included. Use bao operator init -tls-skip-verify to initialize the cluster manually with kubectl exec command.

One idea: this should probably be a post-install hook in the helm chart, since it's still part of the provisioning.

Comment thread apis/vshn/v1/vshn_openbao.go Outdated
// VSHNOpenBaoServiceSpec contains OpenBao DBaaS specific properties
type VSHNOpenBaoServiceSpec struct {
// +kubebuilder:validation:Enum=<TBD>
// +kubebuilder:default=<TBD>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should probably be defined before release.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The Version field was just a placeholder. The version is set in Components Appcat.

Comment thread apis/vshn/v1/vshn_openbao.go Outdated
Version string `json:"version,omitempty"`

// Openbaosettings contains additional OpenBao settings.
Openbaosettings string `json:"openbaosettings,omitempty"`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this really just a string? Or only a placeholder? Usually settings are modelled with a map[string]any

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

That was a placeholder too, so I removed it for now. We'll add it back later probably with better defined type.

withIssuerOfTypeSelfSigned(),
},
}
selfSignedIssuer := createIssuer(ns, serviceName+tlsSelfSignedIssuerSuffix, selfSignedIssuerOpts)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess common.CreateCertificate() wasn't flexible enough to handle this?

I'm wondering if it would make sense to refactor it make it more flexible.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I didn't know common.CreateCertificate() exists. I think we were looking at Redis and certificates are created differently there.

I update the code, now it's using common.CreateCertificate()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, some older services might not use the common library because they were migrated from legacy crossplane compositions and are thus stuck in a kind of limbo.

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions
Copy link
Copy Markdown
Contributor

@lieneluksika lieneluksika requested a review from Kidswiss April 23, 2026 09:09
Copy link
Copy Markdown
Contributor

@Kidswiss Kidswiss left a comment

Choose a reason for hiding this comment

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

I tried to create an instance, but I struggle to get the cluster initialized properly.

My steps:

k -n vshn-openbao-openbao-test-v54vf exec -it openbao-test-v54vf-0 -- sh

bao operator init -tls-skip-verify
bao operator unseal -tls-skip-verify

k -n vshn-openbao-openbao-test-v54vf exec -it openbao-test-v54vf-1 -- sh

bao operator unseal -tls-skip-verify
Unseal Key (will be hidden):
Error unsealing: Error making API request.

URL: PUT https://127.0.0.1:8200/v1/sys/unseal
Code: 400. Errors:

* Vault is not initialized

The first pod looks fine, the others throw this error. According to the openbao docs bao operator init has to be run only once.

Checking the config within the pod I see this:

cat userconfig/openbao-hcl-config/config.hcl
ui           = true
log_level    = "info"
log_format   = "json"
cluster_name = "openbao-test-v54vf"
api_addr     = "https://openbao-test-v54vf:8200"
cluster_addr = "https://openbao-test-v54vf:8201"

listener "tcp" {
  address         = "[::]:8200"
  cluster_address = "[::]:8201"
  tls_disable     = false
  tls_cert_file   = "/openbao/userconfig/openbao-tls/tls.crt"
  tls_key_file    = "/openbao/userconfig/openbao-tls/tls.key"
}

storage "raft" {
  path = "/openbao/data"
}

Isn't there supposed to be something to tell the instance where its peers are?

Comment on lines +95 to +96
type VSHNOpenBaoSizeSpec struct {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This one seems unused. At least according to the linter.

// GetPDBLabels returns the labels to be used for the PodDisruptionBudget
// it should match one unique label od pod running in instanceNamespace
// without this, the PDB will match all pods
func (v *VSHNOpenBao) GetPDBLabels() map[string]string {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does the helm chart you're using already deploy PDBs? If not setting the labels to match the pods and then calling common.AddPDBSettings() will automagically deploy them. But I think the instances parameter needs to be set for them to work...

"server": map[string]any{
"ha": map[string]any{
"enabled": true,
"config": "# Config provided via external file\n",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm wondering why the config is provided via an external file?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants