Skip to content

Commit

Permalink
added content jobs and tenant operation to defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhprasad-sap committed May 7, 2024
1 parent d625f32 commit 1cdd0b9
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 150 deletions.
16 changes: 0 additions & 16 deletions files/server.yaml.hbs

This file was deleted.

56 changes: 56 additions & 0 deletions files/workloads.yaml.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
workloads:
server:
name: server
labels:
sme.sap.com/app-type: {{appName}}
consumedBTPServices:
{{#hasXsuaa}}
- {{appName}}-uaa-bind
{{/hasXsuaa}}
{{#hasMultitenancy}}
- {{appName}}-saas-registry-bind
- {{appName}}-service-manager-bind
{{/hasMultitenancy}}
deploymentDefinition:
env:
- name: CDS_CONFIG
value:
type: CAP
image:

content-deploy:
name: content-deploy
labels:
sme.sap.com/app-type: {{appName}}
consumedBTPServices:
{{#hasXsuaa}}
- {{appName}}-uaa-bind
{{/hasXsuaa}}
{{#hasMultitenancy}}
- {{appName}}-saas-registry-bind
{{/hasMultitenancy}}
{{#hasHtml5Repo}}
- {{appName}}-html5-repo-host-bind
{{/hasHtml5Repo}}
deploymentDefinition:
type: Content
image:

tenant-job:
name: tenant-job
labels:
sme.sap.com/app-type: {{appName}}
consumedBTPServices:
{{#hasXsuaa}}
- {{appName}}-uaa-bind
{{/hasXsuaa}}
{{#hasMultitenancy}}
- {{appName}}-saas-registry-bind
- {{appName}}-service-manager-bind
{{/hasMultitenancy}}
deploymentDefinition:
env:
- name: CDS_CONFIG
value:
type: TenantOperation
image:
4 changes: 2 additions & 2 deletions lib/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ module.exports = class CapOperatorAddPlugin extends cds.add.Plugin {
await cds.add.merge(serviceManagerYaml).into(valuesYaml)
}

const serverYaml = yaml.parse(Mustache.render( await read(join(__dirname, '../files/server.yaml.hbs')), project))
await cds.add.merge(serverYaml).into(valuesYaml)
const workloadsYaml = yaml.parse(Mustache.render( await read(join(__dirname, '../files/workloads.yaml.hbs')), project))
await cds.add.merge(workloadsYaml).into(valuesYaml)

await write(yaml.stringify(valuesYaml)).to(join(cds.root, 'chart/values.yaml'))
}
Expand Down
13 changes: 1 addition & 12 deletions test/add.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('cds add cap-operator', () => {
await tempUtil.cleanUp()
temp = await tempUtil.mkTempFolder()
bookshop = join(temp, 'bookshop')
execSync(`cds init bookshop --add multitenancy,approuter,xsuaa`, { cwd: temp })
execSync(`cds init bookshop --add multitenancy,approuter,xsuaa,html5-repo`, { cwd: temp })
updateDependency(bookshop)
execSync(`npm install`, { cwd: bookshop })
setupHack(bookshop)
Expand Down Expand Up @@ -107,15 +107,4 @@ describe('cds add cap-operator', () => {
expect(getFileHash(join(__dirname,'files/expectedChart/valuesWithDestination.yaml'))).to.equal(getFileHash(join(bookshop, 'chart/values.yaml')))
})

it('Add xsuaa, approuter and destination. Then add cap-operator chart', async () => {
execSync(`cds add xsuaa`, { cwd: bookshop })
execSync(`cds add approuter`, { cwd: bookshop })
execSync(`cds add destination`, { cwd: bookshop })
execSync(`cds add cap-operator --force`, { cwd: bookshop })


expect(getFileHash(join(__dirname,'files/expectedChart/Chart.yaml'))).to.equal(getFileHash(join(bookshop, 'chart/Chart.yaml')))
expect(getFileHash(join(__dirname,'files/expectedChart/values.schema.json'))).to.equal(getFileHash(join(bookshop, 'chart/values.schema.json')))
expect(getFileHash(join(__dirname,'files/expectedChart/valuesWithXsuaaDestinationRouter.yaml'))).to.equal(getFileHash(join(bookshop, 'chart/values.yaml')))
})
})
2 changes: 1 addition & 1 deletion test/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('cds build', () => {
await tempUtil.cleanUp()
temp = await tempUtil.mkTempFolder()
bookshop = join(temp, 'bookshop')
execSync(`cds init bookshop --add multitenancy,approuter,xsuaa`, { cwd: temp })
execSync(`cds init bookshop --add multitenancy,approuter,xsuaa,html5-repo`, { cwd: temp })
updateDependency(bookshop)
execSync(`npm install`, { cwd: bookshop })
setupHack(bookshop)
Expand Down
64 changes: 64 additions & 0 deletions test/files/expectedChart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
serviceInstances:
destination:
name: bookshop-destination
serviceOfferingName: destination
servicePlanName: lite
parameters:
HTML5Runtime_enabled: true
html5RepoRuntime:
name: bookshop-html5-repo-runtime
serviceOfferingName: html5-apps-repo
servicePlanName: app-runtime
parameters: {}
html5RepoHost:
name: bookshop-html5-repo-host
serviceOfferingName: html5-apps-repo
servicePlanName: app-host
parameters: {}
xsuaa:
name: bookshop-uaa
serviceOfferingName: xsuaa
Expand Down Expand Up @@ -31,6 +47,24 @@ serviceInstances:
servicePlanName: container
parameters: {}
serviceBindings:
destination:
name: bookshop-destination-bind
serviceInstanceName: bookshop-destination
secretName: bookshop-destination-bind-secret
secretKey: credentials
parameters: {}
html5RepoRuntime:
name: bookshop-html5-repo-runtime-bind
serviceInstanceName: bookshop-html5-repo-runtime
secretName: bookshop-html5-repo-runtime-bind-secret
secretKey: credentials
parameters: {}
html5RepoHost:
name: bookshop-html5-repo-host-bind
serviceInstanceName: bookshop-html5-repo-host
secretName: bookshop-html5-repo-host-bind-secret
secretKey: credentials
parameters: {}
xsuaa:
name: bookshop-uaa-bind
serviceInstanceName: bookshop-uaa
Expand Down Expand Up @@ -69,6 +103,8 @@ workloads:
sme.sap.com/app-type: bookshop
consumedBTPServices:
- bookshop-uaa-bind
- bookshop-destination-bind
- bookshop-html5-repo-runtime-bind
- bookshop-saas-registry-bind
deploymentDefinition:
type: Router
Expand All @@ -85,8 +121,36 @@ workloads:
- bookshop-saas-registry-bind
- bookshop-service-manager-bind
deploymentDefinition:
env:
- name: CDS_CONFIG
value: null
type: CAP
image: null
content-deploy:
name: content-deploy
labels:
sme.sap.com/app-type: bookshop
consumedBTPServices:
- bookshop-uaa-bind
- bookshop-saas-registry-bind
- bookshop-html5-repo-host-bind
deploymentDefinition:
type: Content
image: null
tenant-job:
name: tenant-job
labels:
sme.sap.com/app-type: bookshop
consumedBTPServices:
- bookshop-uaa-bind
- bookshop-saas-registry-bind
- bookshop-service-manager-bind
deploymentDefinition:
env:
- name: CDS_CONFIG
value: null
type: TenantOperation
image: null
tenantOperations:
provisioning: []
upgrade: []
Expand Down
75 changes: 63 additions & 12 deletions test/files/expectedChart/valuesWithDestination.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
serviceInstances:
destination:
name: bookshop-destination
serviceOfferingName: destination
servicePlanName: lite
parameters:
HTML5Runtime_enabled: true
html5RepoRuntime:
name: bookshop-html5-repo-runtime
serviceOfferingName: html5-apps-repo
servicePlanName: app-runtime
parameters: {}
html5RepoHost:
name: bookshop-html5-repo-host
serviceOfferingName: html5-apps-repo
servicePlanName: app-host
parameters: {}
xsuaa:
name: bookshop-uaa
serviceOfferingName: xsuaa
Expand Down Expand Up @@ -30,13 +46,25 @@ serviceInstances:
serviceOfferingName: service-manager
servicePlanName: container
parameters: {}
destination:
name: bookshop-destination
serviceOfferingName: destination
servicePlanName: lite
parameters:
HTML5Runtime_enabled: true
serviceBindings:
destination:
name: bookshop-destination-bind
serviceInstanceName: bookshop-destination
secretName: bookshop-destination-bind-secret
secretKey: credentials
parameters: {}
html5RepoRuntime:
name: bookshop-html5-repo-runtime-bind
serviceInstanceName: bookshop-html5-repo-runtime
secretName: bookshop-html5-repo-runtime-bind-secret
secretKey: credentials
parameters: {}
html5RepoHost:
name: bookshop-html5-repo-host-bind
serviceInstanceName: bookshop-html5-repo-host
secretName: bookshop-html5-repo-host-bind-secret
secretKey: credentials
parameters: {}
xsuaa:
name: bookshop-uaa-bind
serviceInstanceName: bookshop-uaa
Expand All @@ -55,12 +83,6 @@ serviceBindings:
secretName: bookshop-service-manager-bind-secret
secretKey: credentials
parameters: {}
destination:
name: bookshop-destination-bind
serviceInstanceName: bookshop-destination
secretName: bookshop-destination-bind-secret
secretKey: credentials
parameters: {}
app:
domains:
primary: null
Expand All @@ -82,6 +104,7 @@ workloads:
consumedBTPServices:
- bookshop-uaa-bind
- bookshop-destination-bind
- bookshop-html5-repo-runtime-bind
- bookshop-saas-registry-bind
deploymentDefinition:
type: Router
Expand All @@ -98,8 +121,36 @@ workloads:
- bookshop-saas-registry-bind
- bookshop-service-manager-bind
deploymentDefinition:
env:
- name: CDS_CONFIG
value: null
type: CAP
image: null
content-deploy:
name: content-deploy
labels:
sme.sap.com/app-type: bookshop
consumedBTPServices:
- bookshop-uaa-bind
- bookshop-saas-registry-bind
- bookshop-html5-repo-host-bind
deploymentDefinition:
type: Content
image: null
tenant-job:
name: tenant-job
labels:
sme.sap.com/app-type: bookshop
consumedBTPServices:
- bookshop-uaa-bind
- bookshop-saas-registry-bind
- bookshop-service-manager-bind
deploymentDefinition:
env:
- name: CDS_CONFIG
value: null
type: TenantOperation
image: null
tenantOperations:
provisioning: []
upgrade: []
Expand Down
Loading

0 comments on commit 1cdd0b9

Please sign in to comment.