Top
Enterprise Postgres 18 for Kubernetes User's Guide

4.11.4 Define Endpoint for Uploading Report

Web server url

Both http and https are supported.

Example)

    pgBadger:
      endpoint:
        url: 'https://webserver-svc:4443/cgi-bin/upload.php'

Web Server authentication

Only basic auth is supported

To configure web server authentication:

Create a base64 encoded text from username:password

Example)

$ echo -ne "myuser:mypass" | base64
amFzb253Omphc29udw==

Wrap the output with base64 for creating a secret

Example)

$ echo -ne "amFzb253Omphc29udw==" | base64
YW1GemIyNTNPbXBoYzI5dWR3PT0=

Ceate a secret by using the wrapped text. The key must be 'basic_auth'.

Example)

kind: Secret
apiVersion: v1
metadata:
  name: pgbadger-endpoint-auth
  namespace: fep-container-ct
data:
  basic_auth: YW1GemIyNTNPbXBoYzI5dWR3PT0=
type: Opaque

Add the secret name in the endpoint definition.

Example)

    pgBadger:
      endpoint:
        authentication: pgbadger-endpoint-auth

Web Server certificates

When certificate files are required by the web server, FEP cluster provides customCertificate CR to mount the certificates files in container.

To use certificates for web server.

Create a secret based on the cert and key files.

Example)

oc create secret tls  webserver-cert --cert=webserver.pem --key=webserver.key

The webserver.pem and webserver.key are certificate files for accessing web server


Create a configmap based on the CA cert.

Example)

oc create configmap webserver-cacert --from-file=ca.crt=webca.pem

The webca.pem is the CA certificate file for accessing web server.


Define custom certificates in FEPCluster CR.

Example)

spec:
  fepChildCrVal:
    customCertificates:
      - userName: pgbadger-custom
       certificateName: webserver-cert
       caName: webserver-cacert

The userName is a reference in the pgBadger enpoint.

The certificateName is the secret created above.

The caName is the configmap created above.


Refer the custom certificate name in pgbadger endpoint.

Example)

    pgBadger:
      endpoint:
        customCertificateName: pgbadger-custom

Insecure access to web server

The pgbadger CR provides an option to the web server endpoint when secure connection is not required:

Example)

    pgBadger:
      endpoint:
        insecure: true

File upload parameter

This parameter specify the request parameter for uploading a file to a web server. The value of this parameter is depended on the web server implementation.

Example)

    pgBadger:
      endpoint:
        fileUploadParameter: uploadfile

curl command and parameters

FEP cluster uses curl command to upload the generated report to a web server endpoint. The CR in enpoint section will be converted to curl command parameters. The following table shows the mapping:

curl command parameter

User configuration

[URL]

Endpoint url

--cert

webserver.pem

included in the secret referred in customCertificateName

--key

webserver.key

included in the secret referred in customCertificateName

--cacert

webca.pem

included in the configmap referred in customCertificateName

--form "uploadfile=@/path/to/report"

Endpoint fileUploadParameter

--header "Authorization: Basic passxxx"

Endpoint authentication configmap

--insecure

When endpoint.insecure is set to true