Skip to content

Commit

Permalink
[werft] Support observability with Installer
Browse files Browse the repository at this point in the history
  • Loading branch information
kylos101 committed Dec 3, 2021
1 parent dc78a19 commit 68819ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
23 changes: 7 additions & 16 deletions .werft/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,14 @@ interface DeploymentConfig {

/*
* Deploy a preview environment using the Installer
*
* TODO: add support for tracing, if needed, use with-helm for now
* TODO: add support for k3sWsCluster, if needed, use with-helm for now
*/
export async function deployToDevWithInstaller(deploymentConfig: DeploymentConfig, workspaceFeatureFlags: string[], dynamicCPULimits, storage) {
// to test this function, change files in your workspace, and sideload (-s) changed files into werft like so
// werft run github -f -j ./.werft/build.yaml -s ./.werft/post-process.sh -s ./.werft/build.ts -a with-clean-slate-deployment=true
// werft run github -f -j ./.werft/build.yaml -s ./.werft/util/kubectl.ts -a with-clean-slate-deployment=true

werft.phase(phases.DEPLOY, "deploying to dev")

const { version, destname, namespace, domain, monitoringDomain, url } = deploymentConfig;
const { version, destname, namespace, domain, monitoringDomain, url, withObservability } = deploymentConfig;

// find free ports
werft.log(installerSlices.FIND_FREE_HOST_PORTS, "Check for some free ports.");
Expand Down Expand Up @@ -432,8 +429,10 @@ export async function deployToDevWithInstaller(deploymentConfig: DeploymentConfi

// TODO: add analytics

// TODO: try adding honeycomb, if with-tracing is set
// exec(`yq w -i config.yaml jaegerOperator.inCluster ${false}`, {slice: installerSlices.INSTALLER_RENDER});
if (withObservability) {
const tracingEndpoint = exec(`yq r ./.werft/values.dev.yaml tracing.endpoint`,{slice: installerSlices.INSTALLER_RENDER}).stdout.trim();
exec(`yq w -i config.yaml observability.tracing.endpoint ${tracingEndpoint}`, {slice: installerSlices.INSTALLER_RENDER});
}

// TODO: Remove this after #6867 is done
werft.log("authProviders", "copy authProviders")
Expand Down Expand Up @@ -483,7 +482,7 @@ export async function deployToDevWithInstaller(deploymentConfig: DeploymentConfi
exec(`werft log result -d "dev installation" -c github-check-preview-env url ${url}/projects`);
}

// TODO: test sweeper is installed
// TODO: test sweeper is working (check on Monday)
werft.log('sweeper', 'installing Sweeper');
const sweeperVersion = deploymentConfig.sweeperImage.split(":")[1];
werft.log('sweeper', `Sweeper version: ${sweeperVersion}`);
Expand Down Expand Up @@ -515,17 +514,9 @@ export async function deployToDevWithInstaller(deploymentConfig: DeploymentConfi
| kubectl apply -f -`);
exec(`/usr/local/bin/helm3 upgrade --install --set image.version=${sweeperVersion} --set command="werft run github -a namespace=${namespace} --remote-job-path .werft/wipe-devstaging.yaml github.com/gitpod-io/gitpod:main" ${allArgsStr} sweeper ./dev/charts/sweeper`);

// TODO: Additional post processing needs
// adding a license (Simon created #6868) - ADD THIS IN VIA POST PROCESSING
// intergrating with charge bees (get feedback from meta team) - WON'T FIX NOW
// analytics (get feedback from meta team) - WILL TRY SETTING AS CONFIG
// Server feature flags (get feedback from meta team) - TRY ADDING IN AS POST PROCESSING
// disk paths are set for for ws-daemon and image builder (test and see if this works "as is")

werft.done(phases.DEPLOY);

async function cleanStateEnv(shellOpts: ExecOptions) {
// TODO: check to see if anything lingers after this point ... mysql, minio, jaeger, etc.
await wipeAndRecreateNamespace(helmInstallName, namespace, { ...shellOpts, slice: installerSlices.CLEAN_ENV_STATE });
// cleanup non-namespace objects
werft.log(installerSlices.CLEAN_ENV_STATE, "removing old unnamespaced objects - this might take a while");
Expand Down
6 changes: 3 additions & 3 deletions .werft/post-process.sh
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ while [ "$i" -le "$DOCS" ]; do
fi

# TODO: list
# honeycomb
# license
# server feature flags
# adding a license (Simon created #6868) - ADD THIS IN VIA POST PROCESSING
# intergrating with charge bees (get feedback from meta team) - WON'T FIX NOW
# Server feature flags (get feedback from meta team) - TRY ADDING IN AS POST PROCESSING

i=$((i + 1))
done
Expand Down

0 comments on commit 68819ae

Please sign in to comment.