Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
fix: compile to tf-aws failed
Browse files Browse the repository at this point in the history
  • Loading branch information
eladb committed Nov 7, 2023
1 parent 462dd1c commit dc97167
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
18 changes: 15 additions & 3 deletions helm.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
const cdk8s = require('cdk8s');
const fs = require('fs');
const path = require('path');
const wingsdk = require('@winglang/sdk');
const crypto = require('crypto');

function findWorkdir(scope) {
if (typeof(scope.workdir) == "string") {
return scope.workdir;
}

const parent = scope.node.scope;
if (!parent) {
throw new Error("cannot determine workdir");
}
return findWorkdir(parent);
}

exports.toHelmChart = function(chart) {
const app = cdk8s.App.of(chart);
const wingdir = wingsdk.core.App.of(chart).workdir;
const wingdir = findWorkdir(chart);

app.resolvers = [new cdk8s.LazyResolver(), new cdk8s.ImplicitTokenResolver(), new cdk8s.NumberStringUnionResolver()];
const docs = cdk8s.App._synthChart(chart);
Expand All @@ -29,7 +40,8 @@ exports.toHelmChart = function(chart) {
appVersion: hash,
};

fs.writeFileSync(path.join(workdir, "Chart.yaml"), cdk8s.Yaml.stringify(manifest));
const chartyaml = path.join(workdir, "Chart.yaml");
fs.writeFileSync(chartyaml, cdk8s.Yaml.stringify(manifest));

return path.join("./", ".wing", reldir);
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/containers",
"version": "0.0.8",
"version": "0.0.9",
"description": "Wing container support",
"publishConfig": {
"access": "public",
Expand Down
4 changes: 2 additions & 2 deletions workload.tfaws.w
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub class Workload_tfaws impl api.IWorkload {

let chart = new _Chart(props);

let helm = new helm.release.Release(
let release = new helm.release.Release(
provider: cluster.helmProvider(),
dependsOn: deps.copy(),
name: props.name,
Expand All @@ -137,7 +137,7 @@ pub class Workload_tfaws impl api.IWorkload {
if props.public ?? false {
let ingress = new k8s.dataKubernetesIngressV1.DataKubernetesIngressV1(
provider: cluster.kubernetesProvider(),
dependsOn: [helm],
dependsOn: [release],
metadata: {
name: props.name
}
Expand Down

0 comments on commit dc97167

Please sign in to comment.