mirror of
https://github.com/cloudnative-pg/plugin-barman-cloud.git
synced 2026-01-11 21:23:12 +01:00
feat: finish development
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
This commit is contained in:
parent
94bd35e85b
commit
9442ed2038
@ -4,6 +4,7 @@ metadata:
|
||||
name: cluster-example
|
||||
spec:
|
||||
instances: 3
|
||||
imagePullPolicy: Always
|
||||
plugins:
|
||||
- name: barman-cloud.cloudnative-pg.io
|
||||
isWALArchiver: true
|
||||
|
||||
8
hack/minio/kustomization.yaml
Normal file
8
hack/minio/kustomization.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
resources:
|
||||
- minio-deployment.yaml
|
||||
- minio-pvc.yaml
|
||||
- minio-secret.yaml
|
||||
- minio-service.yaml
|
||||
- minio-certificate.yaml
|
||||
- selfsigned-issuer.yaml
|
||||
|
||||
21
hack/minio/minio-certificate.yaml
Normal file
21
hack/minio/minio-certificate.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: minio-server
|
||||
spec:
|
||||
secretName: minio-server-tls
|
||||
commonName: minio
|
||||
dnsNames:
|
||||
- minio
|
||||
|
||||
duration: 2160h # 90d
|
||||
renewBefore: 360h # 15d
|
||||
|
||||
isCA: false
|
||||
usages:
|
||||
- server auth
|
||||
|
||||
issuerRef:
|
||||
name: selfsigned-issuer
|
||||
kind: Issuer
|
||||
group: cert-manager.io
|
||||
1
hack/minio/minio-delete.sh
Normal file
1
hack/minio/minio-delete.sh
Normal file
@ -0,0 +1 @@
|
||||
kubectl exec -ti mc -- mc rm -r --force minio/backups
|
||||
@ -22,16 +22,20 @@ spec:
|
||||
volumeMounts:
|
||||
- mountPath: /data
|
||||
name: data
|
||||
- mountPath: /opt/minio/certs
|
||||
name: certs
|
||||
args:
|
||||
- server
|
||||
- --certs-dir
|
||||
- /opt/minio/certs
|
||||
- /data
|
||||
env:
|
||||
- name: MINIO_ACCESS_KEY
|
||||
- name: MINIO_ROOT_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio
|
||||
key: ACCESS_KEY_ID
|
||||
- name: MINIO_SECRET_KEY
|
||||
- name: MINIO_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: minio
|
||||
@ -40,3 +44,13 @@ spec:
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: minio
|
||||
- name: certs
|
||||
projected:
|
||||
sources:
|
||||
- secret:
|
||||
name: minio-server-tls
|
||||
items:
|
||||
- key: tls.crt
|
||||
path: public.crt
|
||||
- key: tls.key
|
||||
path: private.key
|
||||
|
||||
@ -9,3 +9,8 @@ spec:
|
||||
- protocol: TCP
|
||||
port: 9000
|
||||
targetPort: 9000
|
||||
name: api
|
||||
- protocol: TCP
|
||||
port: 36261
|
||||
targetPort: 36261
|
||||
name: webui
|
||||
|
||||
6
hack/minio/selfsigned-issuer.yaml
Normal file
6
hack/minio/selfsigned-issuer.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
apiVersion: cert-manager.io/v1
|
||||
kind: Issuer
|
||||
metadata:
|
||||
name: selfsigned-issuer
|
||||
spec:
|
||||
selfSigned: {}
|
||||
@ -44,6 +44,13 @@ func (i IdentityImplementation) GetPluginCapabilities(
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Type: &identity.PluginCapability_Service_{
|
||||
Service: &identity.PluginCapability_Service{
|
||||
Type: identity.PluginCapability_Service_TYPE_METRICS,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
@ -40,7 +40,7 @@ func (m metricsImpl) GetCapabilities(
|
||||
_ *metrics.MetricsCapabilitiesRequest,
|
||||
) (*metrics.MetricsCapabilitiesResult, error) {
|
||||
contextLogger := log.FromContext(ctx)
|
||||
contextLogger.Trace("metrics capabilities call received")
|
||||
contextLogger.Info("metrics capabilities call received")
|
||||
|
||||
return &metrics.MetricsCapabilitiesResult{
|
||||
Capabilities: []*metrics.MetricsCapability{
|
||||
@ -60,17 +60,10 @@ func (m metricsImpl) Define(
|
||||
_ *metrics.DefineMetricsRequest,
|
||||
) (*metrics.DefineMetricsResult, error) {
|
||||
contextLogger := log.FromContext(ctx)
|
||||
contextLogger.Trace("metrics define call received")
|
||||
contextLogger.Info("metrics define call received")
|
||||
|
||||
return &metrics.DefineMetricsResult{
|
||||
Metrics: []*metrics.Metric{
|
||||
{
|
||||
FqName: testMetricName,
|
||||
Help: "this is a test metric",
|
||||
VariableLabels: nil,
|
||||
ConstLabels: map[string]string{"test": "value"},
|
||||
ValueType: &metrics.MetricType{Type: metrics.MetricType_TYPE_GAUGE},
|
||||
},
|
||||
{
|
||||
FqName: firstRecoverabilityPointMetricName,
|
||||
Help: "The first point of recoverability for the cluster as a unix timestamp",
|
||||
@ -90,7 +83,7 @@ func (m metricsImpl) Collect(
|
||||
req *metrics.CollectMetricsRequest,
|
||||
) (*metrics.CollectMetricsResult, error) {
|
||||
contextLogger := log.FromContext(ctx)
|
||||
contextLogger.Trace("metrics collect call received")
|
||||
contextLogger.Info("metrics collect call received")
|
||||
|
||||
configuration, err := config.NewFromClusterJSON(req.ClusterDefinition)
|
||||
if err != nil {
|
||||
@ -106,7 +99,18 @@ func (m metricsImpl) Collect(
|
||||
|
||||
x, ok := objectStore.Status.ServerRecoveryWindow[configuration.ServerName]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("no recovery window found for server %s", configuration.ServerName)
|
||||
return &metrics.CollectMetricsResult{
|
||||
Metrics: []*metrics.CollectMetric{
|
||||
{
|
||||
FqName: firstRecoverabilityPointMetricName,
|
||||
Value: 0,
|
||||
},
|
||||
{
|
||||
FqName: lastAvailableBackupTimestampMetricName,
|
||||
Value: 0,
|
||||
},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
var firstRecoverabilityPoint float64
|
||||
@ -120,10 +124,6 @@ func (m metricsImpl) Collect(
|
||||
|
||||
return &metrics.CollectMetricsResult{
|
||||
Metrics: []*metrics.CollectMetric{
|
||||
{
|
||||
FqName: testMetricName,
|
||||
Value: 42.0,
|
||||
},
|
||||
{
|
||||
FqName: firstRecoverabilityPointMetricName,
|
||||
Value: firstRecoverabilityPoint,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user