Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sourcegraph/deploy-k8s-helper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: sourcegraph/deploy-k8s-helper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: lang-test
Choose a head ref

There isn’t anything to compare.

master and lang-test are entirely different commit histories.

Showing with 65 additions and 2 deletions.
  1. +4 −0 config.ts
  2. +61 −2 index.ts
4 changes: 4 additions & 0 deletions config.ts
Original file line number Diff line number Diff line change
@@ -48,3 +48,7 @@ export const gcloudConfig = {
* Example: /Users/ggilmore/dev/go/src/github.com/sourcegraph/deploy-sourcegraph
*/
export const deploySourcegraphRoot = config.require('deploySourcegraphRoot')

export const certificate = config.require('certificate')
export const key = config.require('key')
export const htpassword = config.require('htpassword')
63 changes: 61 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import * as path from 'path'
import * as k8s from '@pulumi/kubernetes'

import { k8sProvider } from './cluster'
import { deploySourcegraphRoot, gcloudConfig } from './config'
import { certificate, deploySourcegraphRoot, gcloudConfig, htpassword, key } from './config'

const clusterAdmin = new k8s.rbac.v1.ClusterRoleBinding(
'cluster-admin-role-binding',
@@ -47,14 +47,47 @@ const storageClass = new k8s.storage.v1.StorageClass(
{ provider: k8sProvider }
)

const tls = new k8s.core.v1.Secret(
'sourcegraph-tls',
{
metadata: {
name: 'sourcegraph-tls',
},

data: {
'tls.crt': Buffer.from(certificate).toString('base64'),
'tls.key': Buffer.from(key).toString('base64'),
},

type: 'kubernetes.io/tls',
},
{ provider: k8sProvider }
)

const langserverAuth = new k8s.core.v1.Secret(
'langserver-auth',
{
metadata: {
name: 'langserver-auth',
},

data: {
auth: Buffer.from(htpassword).toString('base64'),
},

type: 'Opaque',
},
{ provider: k8sProvider }
)

const baseDeployment = new k8s.yaml.ConfigGroup(
'base',
{
files: `${path.posix.join(deploySourcegraphRoot, 'base')}/**/*.yaml`,
},
{
providers: { kubernetes: k8sProvider },
dependsOn: [clusterAdmin, storageClass],
dependsOn: [clusterAdmin, storageClass, tls],
}
)

@@ -66,6 +99,32 @@ const ingressNginx = new k8s.yaml.ConfigGroup(
{ providers: { kubernetes: k8sProvider }, dependsOn: clusterAdmin }
)

const langGo = new k8s.yaml.ConfigGroup(
'lang-go',
{
files: `${path.posix.join(deploySourcegraphRoot, 'configure', 'lang', 'go')}/**/*.yaml`,
},
{
providers: {
kubernetes: k8sProvider,
},
dependsOn: [langserverAuth],
}
)

const langTypescript = new k8s.yaml.ConfigGroup(
'lang-typescript',
{
files: `${path.posix.join(deploySourcegraphRoot, 'configure', 'lang', 'typescript')}/**/*.yaml`,
},
{
providers: {
kubernetes: k8sProvider,
},
dependsOn: [langserverAuth],
}
)

export const ingressIPs = ingressNginx
.getResource('v1/Service', 'ingress-nginx', 'ingress-nginx')
.apply(svc => svc.status.apply(status => status.loadBalancer.ingress.map(i => i.ip)))