Skip to content

Commit

Permalink
Rename kapitan to razeedeploy (razee-io#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkingit authored and alewitt2 committed Oct 10, 2019
1 parent ff09b44 commit 1fe88ef
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/routes/install/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
---
{{{REMOTE_RESOURCE}}}
---
{{{KAPITAN}}}
{{{RAZEEDEPLOY}}}
---
apiVersion: v1
kind: ConfigMap
Expand All @@ -24,7 +24,7 @@ metadata:
data:
RAZEEDASH_ORG_KEY: "{{{RAZEEDASH_ORG_KEY}}}"
---
apiVersion: "kapitan.razee.io/v1alpha1"
apiVersion: "deploy.razee.io/v1alpha1"
kind: RemoteResource
metadata:
name: watch-keeper-rr
Expand Down
48 changes: 43 additions & 5 deletions app/routes/install/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,45 @@ router.get('/inventory', asyncHandler(async(req, res, next) => {
}
}));

// Delete once we fully sunset the kapitan name
router.get('/kapitan', asyncHandler(async (req, res, next) => {
const orgKey = req.orgKey;
var razeeapiUrl = `${req.protocol}://${req.get('host')}/api/v2`;
const wk_url = 'https://github.com/razee-io/watch-keeper/releases/latest/download/resource.yaml';
const kptn_url = 'https://github.com/razee-io/kapitan-delta/releases/latest/download/resource.yaml';
const kptn_url = 'https://github.com/razee-io/razeedeploy-delta/releases/latest/download/resource.yaml';
try {
const inventory = await readFile(`${__dirname}/kapitan.yaml`, 'utf8');
const inventory = await readFile(`${__dirname}/razeedeploy.yaml`, 'utf8');
const wk = await request.get(wk_url);
const kptn = await request.get(kptn_url);
const view = {
RAZEEDASH_URL: razeeapiUrl,
RAZEEDASH_ORG_KEY: Buffer.from(orgKey).toString('base64'),
WATCH_KEEPER: wk,
KAPITAN: kptn
RAZEEDEPLOY: kptn
};
const configYaml = Mustache.render(inventory, view);
res.setHeader('content-type', 'application/yaml');
return res.status(200).send(configYaml);
} catch (e) {
req.log.error(e);
next(e);
}
}));

router.get('/razeedeploy', asyncHandler(async (req, res, next) => {
const orgKey = req.orgKey;
var razeeapiUrl = `${req.protocol}://${req.get('host')}/api/v2`;
const wk_url = 'https://github.com/razee-io/watch-keeper/releases/latest/download/resource.yaml';
const kptn_url = 'https://github.com/razee-io/razeedeploy-delta/releases/latest/download/resource.yaml';
try {
const inventory = await readFile(`${__dirname}/razeedeploy.yaml`, 'utf8');
const wk = await request.get(wk_url);
const kptn = await request.get(kptn_url);
const view = {
RAZEEDASH_URL: razeeapiUrl,
RAZEEDASH_ORG_KEY: Buffer.from(orgKey).toString('base64'),
WATCH_KEEPER: wk,
RAZEEDEPLOY: kptn
};
const configYaml = Mustache.render(inventory, view);
res.setHeader('content-type', 'application/yaml');
Expand All @@ -73,7 +98,7 @@ router.get('/kapitan', asyncHandler(async (req, res, next) => {
router.get('/cluster', asyncHandler(async (req, res, next) => {
const orgKey = req.orgKey;
var razeeapiUrl = `${req.protocol}://${req.get('host')}/api/v2`;
const kptn_url = 'https://github.com/razee-io/kapitan-delta/releases/latest/download/resource.yaml';
const kptn_url = 'https://github.com/razee-io/razeedeploy-delta/releases/latest/download/resource.yaml';
const remoteResource_url = 'https://github.com/razee-io/RemoteResource/releases/latest/download/resource.yaml';
try {
const inventory = await readFile(`${__dirname}/cluster.yaml`, 'utf8');
Expand All @@ -83,7 +108,7 @@ router.get('/cluster', asyncHandler(async (req, res, next) => {
RAZEEDASH_URL: razeeapiUrl,
RAZEEDASH_ORG_KEY: Buffer.from(orgKey).toString('base64'),
REMOTE_RESOURCE: rr,
KAPITAN: kptn
RAZEEDEPLOY: kptn
};
const configYaml = Mustache.render(inventory, view);
res.setHeader('content-type', 'application/yaml');
Expand All @@ -94,6 +119,7 @@ router.get('/cluster', asyncHandler(async (req, res, next) => {
}
}));

//Remove once we fully sunset the kapitan name
router.get('/kapitan/:component', asyncHandler(async (req, res, next) => {
const kptn_url = `https://github.com/razee-io/${req.params.component}/releases/latest/download/resource.yaml`;
try {
Expand All @@ -106,5 +132,17 @@ router.get('/kapitan/:component', asyncHandler(async (req, res, next) => {
}
}));

router.get('/razeedeploy/:component', asyncHandler(async (req, res, next) => {
const kptn_url = `https://github.com/razee-io/${req.params.component}/releases/latest/download/resource.yaml`;
try {
const kptn = await request.get(kptn_url);
res.setHeader('content-type', 'application/yaml');
return res.status(200).send(kptn);
} catch (e) {
req.log.error(e);
next(e);
}
}));


module.exports = router;
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ data:
---
{{{WATCH_KEEPER}}}
---
{{{KAPITAN}}}
{{{RAZEEDEPLOY}}}

0 comments on commit 1fe88ef

Please sign in to comment.