Skip to content

sourcegraph/deploy-k8s-helper

Repository files navigation

deploy-k8s-helper

A small helper program to aid in creating a test cluster for https://github.com/sourcegraph/deploy-sourcegraph.

Prerequisites

Configuration

See config.ts for more information, but you must set the following configuration values via pulumi config set <NAME> <VALUE>

Usage

Run yarn so that you install all the necessary dependencies.

  • yarn up: creates a new GKE cluster and fetches the necessary credentials
  • yarn destroy: deletes a GKE cluster that was previously created with yarn up
  • yarn auth: fetch the credentials so that kubectl can speak to the cluster
  • yarn deauth: remove the cluster's kubectl credentials
  • yarn web: opens the GCP page for your cluster in your webrowser

Troubleshooting

The zone '...' doesn't have enough resources to fulfill the request

Example:

Do you want to perform this update? yes
Updating (dev):

     Type                      Name                       Status                  Info
 +   pulumi:pulumi:Stack       sg-deploy-k8s-helper-dev   **creating failed**     1 error
 +   └─ gcp:container:Cluster  geoffrey-sourcegraph-test  **creating failed**     1 error

Diagnostics:
  pulumi:pulumi:Stack (sg-deploy-k8s-helper-dev):
    error: update failed

  gcp:container:Cluster (geoffrey-sourcegraph-test):
    error: Plan apply failed: Error waiting for creating GKE cluster: Deploy error: Not all instances running in IGM after 46.650887217s. Expect 4. Current errors: [ZONE_RESOURCE_POOL_EXHAUSTED_WITH_DETAILS]: Instance 'gke-geoffrey-sourcegraph-default-pool-7f493867-0bmt' creation failed: The zone 'projects/sourcegraph-server/zones/us-central1-a' does not have enough resources available to fulfill the request.  '(resource type:compute)'. - ; .

Solution: Pick another zone to use from https://cloud.google.com/compute/docs/regions-zones/#available. Set it in your stack configuration by running pulumi config set gcp:zone [NEW_ZONE]

(ingress-nginx) Cannot read property 'status' of undefined

This happens if you're trying to deploy a pre-3.x release of https://github.com/sourcegraph/deploy-sourcegraph/ (which didn't have nginx-ingress).

Example:

Diagnostics:
  pulumi:pulumi:Stack (sg-deploy-k8s-helper-dev):
    error: Running program '/Users/ggilmore/dev/go/src/github.com/sourcegraph/ds-k8s-helper' failed with an unhandled exception:
    TypeError: Cannot read property 'status' of undefined
        at exports.ingressIPs.ingressNginx.getResource.apply.svc (/Users/ggilmore/dev/go/src/github.com/sourcegraph/ds-k8s-helper/index.ts:49:23)
        at OutputImpl.<anonymous> (/Users/ggilmore/dev/go/src/github.com/sourcegraph/ds-k8s-helper/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output.js:102:47)
        at Generator.next (<anonymous>)
        at fulfilled (/Users/ggilmore/dev/go/src/github.com/sourcegraph/ds-k8s-helper/node_modules/@pulumi/kubernetes/node_modules/@pulumi/pulumi/output.js:17:58)

Solution: Comment out the const ingressNginx and export const ingressIPs variables in https://github.com/sourcegraph/deploy-k8s-helper/blob/master/index.ts :

const ingressNginx = new k8s.yaml.ConfigGroup(
'ingress-nginx',
{
files: `${path.posix.join(deploySourcegraphRoot, 'configure', 'ingress-nginx')}/**/*.yaml`,
},
{ providers: { kubernetes: k8sProvider }, dependsOn: clusterAdmin }
)
export const ingressIPs = ingressNginx
.getResource('v1/Service', 'ingress-nginx', 'ingress-nginx')
.apply(svc => svc.status.apply(status => status.loadBalancer.ingress.map(i => i.ip)))

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published