-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from vshn/feature/minio
Add composition minio
- Loading branch information
Showing
75 changed files
with
1,942 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
local com = import 'lib/commodore.libjsonnet'; | ||
local kap = import 'lib/kapitan.libjsonnet'; | ||
local kube = import 'lib/kube.libjsonnet'; | ||
|
||
local comp = import 'lib/appcat-compositions.libsonnet'; | ||
local crossplane = import 'lib/crossplane.libsonnet'; | ||
|
||
local common = import 'common.libsonnet'; | ||
local xrds = import 'xrds.libsonnet'; | ||
|
||
local inv = kap.inventory(); | ||
local params = inv.parameters.appcat; | ||
local minioParams = params.services.vshn.minio; | ||
|
||
local serviceNameLabelKey = 'appcat.vshn.io/servicename'; | ||
local serviceNamespaceLabelKey = 'appcat.vshn.io/claim-namespace'; | ||
|
||
local connectionSecretKeys = [ | ||
'MINIO_URL', | ||
'MINIO_USERNAME', | ||
'MINIO_PASSWORD', | ||
]; | ||
|
||
local minioPlans = common.FilterDisabledParams(minioParams.plans); | ||
|
||
local xrd = xrds.XRDFromCRD( | ||
'xvshnminios.vshn.appcat.vshn.io', | ||
xrds.LoadCRD('vshn.appcat.vshn.io_vshnminios.yaml', params.images.appcat.tag), | ||
defaultComposition='vshnminio.vshn.appcat.vshn.io', | ||
connectionSecretKeys=connectionSecretKeys, | ||
) + xrds.WithPlanDefaults(minioPlans, minioParams.defaultPlan); | ||
|
||
local composition = | ||
kube._Object('apiextensions.crossplane.io/v1', 'Composition', 'vshnminio.vshn.appcat.vshn.io') + | ||
common.SyncOptions + | ||
common.VshnMetaVshn('Minio', 'distributed', 'true', minioPlans) + | ||
{ | ||
spec: { | ||
compositeTypeRef: comp.CompositeRef(xrd), | ||
writeConnectionSecretsToNamespace: minioParams.secretNamespace, | ||
functions: | ||
[ | ||
{ | ||
name: 'minio-func', | ||
type: 'Container', | ||
config: kube.ConfigMap('xfn-config') + { | ||
metadata: { | ||
labels: { | ||
name: 'xfn-config', | ||
}, | ||
name: 'xfn-config', | ||
}, | ||
data: { | ||
imageTag: common.GetAppCatImageTag(), | ||
minioChartRepository: params.charts.minio.source, | ||
minioChartVersion: params.charts.minio.version, | ||
plans: std.toString(minioPlans), | ||
defaultPlan: minioParams.defaultPlan, | ||
}, | ||
}, | ||
container: { | ||
image: 'minio', | ||
imagePullPolicy: 'IfNotPresent', | ||
timeout: '20s', | ||
runner: { | ||
endpoint: minioParams.grpcEndpoint, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
if params.services.vshn.enabled && minioParams.enabled then { | ||
'20_xrd_vshn_minio': xrd, | ||
'20_rbac_vshn_minio': xrds.CompositeClusterRoles(xrd), | ||
'21_composition_vshn_minio': composition, | ||
} else {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: syn-appcat | ||
openshift.io/cluster-monitoring: 'true' | ||
name: syn-appcat |
85 changes: 85 additions & 0 deletions
85
tests/golden/minio/appcat/appcat/10_appcat_recording_rule.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
apiVersion: monitoring.coreos.com/v1 | ||
kind: PrometheusRule | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: appcat-billing | ||
name: appcat-billing | ||
namespace: syn-appcat | ||
spec: | ||
groups: | ||
- name: appcat-billing | ||
rules: | ||
- expr: | | ||
sum by (label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( | ||
# Sum values over one hour and get mean | ||
sum_over_time( | ||
# Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture | ||
label_join( | ||
# Add label category: $provider:$claim_namespace | ||
label_join( | ||
# Add label architecture: $SLA, where $SLA is the content of label appcat.vshn.io/sla | ||
label_replace( | ||
# Add label provider: vshn | ||
label_replace( | ||
# Add label product: postgres | ||
label_replace( | ||
# Default appcat.vshn.io/sla to besteffort if it is not set | ||
label_replace( | ||
# Copy label appcat.vshn.io/namespace to label claim_namespace | ||
label_replace( | ||
# Populate tenant_id | ||
label_replace( | ||
# Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+" | ||
kube_namespace_labels{ label_appuio_io_billing_name=~"appcat-.+"} * | ||
on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name) | ||
kube_pod_info{created_by_kind!="Job"}, | ||
"tenant_id", | ||
"t-silent-test-1234", | ||
"", | ||
"" | ||
), | ||
"claim_namespace", | ||
"$1", | ||
"label_appcat_vshn_io_claim_namespace", | ||
"(.*)" | ||
), | ||
"label_appcat_vshn_io_sla", | ||
"besteffort", | ||
"label_appcat_vshn_io_sla", | ||
"^$" | ||
), | ||
"product", | ||
"appcat_$1", | ||
"label_appuio_io_billing_name", | ||
"appcat-(.+)" | ||
), | ||
"provider", | ||
"vshn", | ||
"", | ||
"" | ||
), | ||
"sla", | ||
"$1", | ||
"label_appcat_vshn_io_sla", | ||
"(.*)" | ||
), | ||
"category", | ||
":", | ||
"provider", | ||
"claim_namespace" | ||
), | ||
"product", | ||
":", | ||
"product", | ||
"provider", | ||
"tenant_id", | ||
"claim_namespace", | ||
"sla" | ||
# other billing queries have [59m:1m] here. This is due to some | ||
# obscure discrepancies between how the cloud-reporting evaluates the query | ||
# and how the GUI/recording rules evaluate the query. | ||
)[60m:1m] | ||
)/60 ) | ||
record: appcat:billing |
Oops, something went wrong.