-
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.
- Loading branch information
Showing
2 changed files
with
138 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
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/appcat-crossplane.libsonnet'; | ||
|
||
local common = import 'common.libsonnet'; | ||
local vars = import 'config/vars.jsonnet'; | ||
local prom = import 'prometheus.libsonnet'; | ||
local slos = import 'slos.libsonnet'; | ||
local opsgenieRules = import 'vshn_alerting.jsonnet'; | ||
local xrds = import 'xrds.libsonnet'; | ||
|
||
local inv = kap.inventory(); | ||
local params = inv.parameters.appcat; | ||
local codeyParams = params.services.vshn.codey; | ||
local appuioManaged = inv.parameters.appcat.appuioManaged; | ||
|
||
local defaultUser = 'default'; | ||
local defaultPort = '6379'; | ||
|
||
local caCertificateSecretName = 'tls-ca-certificate'; | ||
local serverCertificateSecretName = 'tls-server-certificate'; | ||
local clientCertificateSecretName = 'tls-client-certificate'; | ||
|
||
local serviceNameLabelKey = 'appcat.vshn.io/servicename'; | ||
local serviceNamespaceLabelKey = 'appcat.vshn.io/claim-namespace'; | ||
local serviceCLaimNameLabelKey = 'appcat.vshn.io/claim-name'; | ||
|
||
local connectionSecretKeys = [ | ||
'CODEY_USERNAME', | ||
'CODEY_PASSWORD', | ||
'CODEY_URL', | ||
]; | ||
|
||
local isOpenshift = std.startsWith(inv.parameters.facts.distribution, 'openshift') || inv.parameters.facts.distribution == 'oke'; | ||
|
||
local securityContext = if isOpenshift then false else true; | ||
|
||
local codeyPlans = common.FilterDisabledParams(codeyParams.plans); | ||
|
||
local xrd = xrds.XRDFromCRD( | ||
'xvshncodey.vshn.appcat.vshn.io', | ||
xrds.LoadCRD('vshn.appcat.vshn.io_vshncodey.yaml', params.images.appcat.tag), | ||
defaultComposition='vshncodey.vshn.appcat.vshn.io', | ||
connectionSecretKeys=connectionSecretKeys, | ||
) + xrds.WithPlanDefaults(codeyPlans, codeyParams.defaultPlan); | ||
|
||
local composition = | ||
local selfSignedIssuer = comp.KubeObject('cert-manager.io/v1', 'Issuer') + | ||
{ | ||
spec+: { | ||
forProvider+: { | ||
manifest+: { | ||
metadata: { | ||
name: '', | ||
namespace: '', | ||
}, | ||
spec: { | ||
selfSigned: { | ||
crlDistributionPoints: [], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
|
||
kube._Object('apiextensions.crossplane.io/v1', 'Composition', 'vshncodey.vshn.appcat.vshn.io') + | ||
common.SyncOptions + | ||
common.vshnMetaVshnDBaas('codey', 'standalone', 'true', codeyPlans) + | ||
{ | ||
spec: { | ||
compositeTypeRef: comp.CompositeRef(xrd), | ||
writeConnectionSecretsToNamespace: codeyParams.secretNamespace, | ||
mode: 'Pipeline', | ||
pipeline: | ||
[ | ||
{ | ||
step: 'patch-and-transform', | ||
functionRef: { | ||
name: 'function-patch-and-transform', | ||
}, | ||
input: { | ||
apiVersion: 'pt.fn.crossplane.io/v1beta1', | ||
kind: 'Resources', | ||
resources: [ selfSignedIssuer ], | ||
}, | ||
}, | ||
{ | ||
step: 'codey-func', | ||
functionRef: { | ||
name: 'function-appcat', | ||
}, | ||
input: kube.ConfigMap('xfn-config') + { | ||
metadata: { | ||
labels: { | ||
name: 'xfn-config', | ||
}, | ||
name: 'xfn-config', | ||
}, | ||
data: { | ||
serviceName: 'codey', | ||
controlNamespace: params.services.controlNamespace, | ||
quotasEnabled: std.toString(params.services.vshn.quotasEnabled), | ||
ownerKind: xrd.spec.names.kind, | ||
ownerGroup: xrd.spec.group, | ||
ownerVersion: xrd.spec.versions[0].name, | ||
sliNamespace: params.slos.namespace, | ||
crossplaneNamespace: params.crossplane.namespace, | ||
ignoreNamespaceForBilling: params.billing.ignoreNamespace, | ||
}, | ||
}, | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
local plansCM = kube.ConfigMap('vshncodeyplans') + { | ||
metadata+: { | ||
namespace: params.namespace, | ||
}, | ||
data: { | ||
plans: std.toString(codeyPlans), | ||
}, | ||
}; | ||
|
||
if params.services.vshn.enabled && codeyParams.enabled && vars.isSingleOrControlPlaneCluster then { | ||
'26_xrd_vshn_codey': xrd, | ||
// '20_rbac_vshn_codey': xrds.CompositeClusterRoles(xrd), | ||
// '20_role_vshn_codeyrestore': [ restoreRole, restoreServiceAccount, restoreClusterRoleBinding ], | ||
'20_plans_vshn_codey': plansCM, | ||
// '21_composition_vshn_codey': 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