Skip to content

Commit

Permalink
Merge pull request #210 from visulate/pgoldtho/backendConfig
Browse files Browse the repository at this point in the history
Pgoldtho/backend config
  • Loading branch information
pgoldtho authored Mar 10, 2021
2 parents a261265 + 9ccf2fb commit 8fb923b
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 99 deletions.
6 changes: 5 additions & 1 deletion google-marketplace/apptest/tester/tester.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright 2018 Google LLC
# Copyright 2021 Visulate LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -28,6 +28,10 @@ do
sleep 3
done

# Wait 2 minutes after the ingress reports it is healthy before starting the tests
# to avoid 502 errors
sleep 120

EXTERNAL_IP="$(kubectl get ingress/${APP_INSTANCE_NAME}-igs \
--namespace ${NAMESPACE} \
--output jsonpath='{.status.loadBalancer.ingress[0].ip}')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,6 @@ spec:
- group: extensions/v1beta1
kind: Ingress
- group: batch/v1
kind: Job
kind: Job
# - group: cloud.google.com/v1
# kind: BackendConfig
Original file line number Diff line number Diff line change
@@ -1,82 +1,22 @@
---
#####################################
# Secrets and ConfigMaps
#####################################
# apiVersion: cloud.google.com/v1
# kind: BackendConfig
# metadata:
# name: {{ .Release.Name }}-{{ .Chart.Name }}-{{ .Values.sql.label }}-conf
# namespace: {{ .Release.Namespace }}
# spec:
# timeoutSec: {{ .Values.sql.timeout }}
# ---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-ubbagent-config
data:
config.yaml: |
# The identity section contains authentication information used
# by the agent.
identities:
- name: gcp
gcp:
# This parameter accepts a base64-encoded JSON service
# account key. The value comes from the reporting secret.
encodedServiceAccountKey: $AGENT_ENCODED_KEY
# The metrics section defines the metric that will be reported.
# Metric names should match verbatim the identifiers created
# during pricing setup.
metrics:
- name: database_connections
type: int
metric_kind: DELTA
value_type: INT64
unit: h
# The endpoints section of a metric defines which endpoints the
# metric data is sent to.
endpoints:
- name: on_disk
- name: servicecontrol
passthrough: {}
- name: time
type: int
metric_kind: DELTA
value_type: INT64
unit: h
endpoints:
- name: on_disk
- name: servicecontrol
# The passthrough marker indicates that no aggregation should
# occur for this metric. Reports received are immediately sent
# to the reporting endpoint. We use passthrough for the
# instance_time metric since reports are generated
# automatically by a heartbeat source defined in a later
# section.
passthrough: {}
# The endpoints section defines where metering data is ultimately
# sent. Currently supported endpoints include:
# * disk - some directory on the local filesystem
# * servicecontrol - Google Service Control
endpoints:
- name: on_disk
# The disk endpoint is useful for debugging, but its inclusion
# is not necessary in a production deployment.
disk:
reportDir: /var/lib/ubbagent/reports
expireSeconds: 36000
- name: servicecontrol
servicecontrol:
identity: gcp
# The service name is unique to your application and will be
# provided during onboarding.
serviceName: visulate-for-oracle.mp-visulate-llc-public.appspot.com
consumerId: $AGENT_CONSUMER_ID # From the reporting secret.
# The sources section lists metric data sources run by the agent
# itself. The currently-supported source is 'heartbeat', which
# sends a defined value to a metric at a defined interval.
sources:
- name: instance_time_heartbeat
heartbeat:
metric: time
intervalSeconds: 3600
value:
int64Value: 1
config.yaml: |-
{{ .Files.Get "ubbagent-config.yaml" | indent 4 }}
---
apiVersion: v1
kind: Secret
Expand All @@ -97,6 +37,23 @@ stringData:
{{ .Files.Get "endpoints.json" | indent 4 }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-tls
labels:
app.kubernetes.io/name: "{{ .Release.Name }}"
app.kubernetes.io/component: visulate-for-oracle
data:
tls.key: |
{{ .Values.tls.base64EncodedPrivateKey | indent 4 }}
tls.crt: |
{{ .Values.tls.base64EncodedCertificate | indent 4 }}
type: kubernetes.io/tls
---
#####################################
# API Server
#####################################
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-{{ .Values.apiServer.label }}-svc
Expand Down Expand Up @@ -211,20 +168,9 @@ spec:
configMap:
name: {{ .Release.Name }}-ubbagent-config
---
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-tls
labels:
app.kubernetes.io/name: "{{ .Release.Name }}"
app.kubernetes.io/component: visulate-for-oracle
data:
tls.key: |
{{ .Values.tls.base64EncodedPrivateKey | indent 4 }}
tls.crt: |
{{ .Values.tls.base64EncodedCertificate | indent 4 }}
type: kubernetes.io/tls
---
#####################################
# UI
#####################################
apiVersion: v1
kind: Service
metadata:
Expand Down Expand Up @@ -293,19 +239,15 @@ spec:
- name: logfiles
emptyDir: {}
---
apiVersion: cloud.google.com/v1beta1
kind: BackendConfig
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-{{ .Values.sql.label }}-conf
spec:
timeoutSec: {{ .Values.sql.timeout }}
---
#####################################
# Query Engine
#####################################
apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/backend-config:
'{"ports": {"{{ .Values.sql.port }}":"{{ .Release.Name }}-{{ .Chart.Name }}-{{ .Values.sql.label }}-conf"}}'
# annotations:
# cloud.google.com/backend-config:
# '{"default": "{{ .Release.Name }}-{{ .Chart.Name }}-{{ .Values.sql.label }}-conf"}'
name: {{ .Release.Name }}-{{ .Chart.Name }}-{{ .Values.sql.label }}-svc
labels:
app: {{ .Chart.Name }}
Expand Down Expand Up @@ -364,6 +306,9 @@ spec:
secret:
secretName: {{ .Release.Name }}-empty-endpoints
---
#####################################
# Ingress
#####################################
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
Expand Down
72 changes: 72 additions & 0 deletions google-marketplace/chart/visulate-for-oracle/ubbagent-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# The identity section contains authentication information used
# by the agent.
identities:
- name: gcp
gcp:
# This parameter accepts a base64-encoded JSON service
# account key. The value comes from the reporting secret.
encodedServiceAccountKey: $AGENT_ENCODED_KEY

# The metrics section defines the metric that will be reported.
# Metric names should match verbatim the identifiers created
# during pricing setup.
metrics:
- name: database_connections
type: int
metric_kind: DELTA
value_type: INT64
unit: h

# The endpoints section of a metric defines which endpoints the
# metric data is sent to.
endpoints:
- name: on_disk
- name: servicecontrol
passthrough: {}

- name: time
type: int
metric_kind: DELTA
value_type: INT64
unit: h
endpoints:
- name: on_disk
- name: servicecontrol

# The passthrough marker indicates that no aggregation should
# occur for this metric. Reports received are immediately sent
# to the reporting endpoint. We use passthrough for the
# instance_time metric since reports are generated
# automatically by a heartbeat source defined in a later
# section.
passthrough: {}

# The endpoints section defines where metering data is ultimately
# sent. Currently supported endpoints include:
# * disk - some directory on the local filesystem
# * servicecontrol - Google Service Control
endpoints:
- name: on_disk
# The disk endpoint is useful for debugging, but its inclusion
# is not necessary in a production deployment.
disk:
reportDir: /var/lib/ubbagent/reports
expireSeconds: 36000
- name: servicecontrol
servicecontrol:
identity: gcp
# The service name is unique to your application and will be
# provided during onboarding.
serviceName: visulate-for-oracle.mp-visulate-llc-public.appspot.com
consumerId: $AGENT_CONSUMER_ID # From the reporting secret.

# The sources section lists metric data sources run by the agent
# itself. The currently-supported source is 'heartbeat', which
# sends a defined value to a metric at a defined interval.
sources:
- name: instance_time_heartbeat
heartbeat:
metric: time
intervalSeconds: 3600
value:
int64Value: 1
1 change: 1 addition & 0 deletions google-marketplace/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ x-google-marketplace:
v1.1.17 Display recent history on search screen
v1.1.19 Bump highlight.js from 9.18.1 to 10.4.1 in /ui
v1.1.20 Improve database connection performance and updates to support BMS migrations
v1.1.21 Fix for orphaned BackendConfig bug
images:
'':
properties:
Expand Down

0 comments on commit 8fb923b

Please sign in to comment.