@otwld/nx-helm 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## Unreleased
2
+
3
+ ### Breaking Changes
4
+
5
+ - Build chart dependencies from the committed lockfile without refreshing Helm
6
+ repositories.
7
+
1
8
  ## 0.0.5 (2026-08-12)
2
9
 
3
10
  ### Breaking Changes
package/README.md CHANGED
@@ -32,10 +32,10 @@ pnpm exec nx g @otwld/nx-helm:stack public \
32
32
  --dependencies='[{"name":"public-app","version":"0.1.0","repository":"file://../../apps/public/chart","condition":"public-app.enabled"}]'
33
33
  ```
34
34
 
35
- The generator creates `charts/public/Chart.yaml`, `values.yaml`, a generic
36
- resources template, and the `helm-public` Nx project marker. Run `helm dependency
37
- update charts/public` after adding dependencies so the generated `Chart.lock` is
38
- committed; validation and packaging then use `helm dependency build`.
35
+ The generator creates `charts/public/Chart.yaml`, `values.yaml`, a chart template,
36
+ and the `helm-public` Nx project marker. Run `helm dependency update charts/public`
37
+ after adding dependencies so the generated `Chart.lock` is committed; validation
38
+ and packaging then use `helm dependency build --skip-refresh`.
39
39
 
40
40
  ## Inferred Targets
41
41
 
@@ -51,6 +51,7 @@ Each inferred validate and package target is cacheable, declares its direct
51
51
  output where applicable, and includes the installed Helm version as a runtime
52
52
  input. Local dependency directories are also inputs, and the dependency-build
53
53
  target declares Helm's generated `charts` directory and `Chart.lock` as outputs.
54
+ Dependency builds use the committed lockfile without refreshing Helm repositories.
54
55
  Charts without local dependencies keep the original target graph.
55
56
 
56
57
  ## Configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otwld/nx-helm",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -23,7 +23,8 @@ async function stackGenerator(tree, options) {
23
23
  ...(dependencies.length ? { dependencies } : {}),
24
24
  }, { lineWidth: 0 }));
25
25
  tree.write((0, devkit_1.joinPathFragments)(projectRoot, 'values.yaml'), (0, yaml_1.stringify)(createValues(dependencies), { lineWidth: 0 }));
26
- tree.write((0, devkit_1.joinPathFragments)(projectRoot, 'templates/resources.yaml'), '{{/* Render stack-owned namespaced resources. */}}\n{{- range .Values.resources }}\n---\n{{ tpl (toYaml .) $ }}\n{{- end }}\n');
26
+ tree.write((0, devkit_1.joinPathFragments)(projectRoot, 'templates/mongodb-password.yaml'), createMongoPasswordTemplate());
27
+ tree.write((0, devkit_1.joinPathFragments)(projectRoot, 'templates/mongodb.yaml'), createMongoTemplate());
27
28
  (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(projectRoot, 'project.json'), {
28
29
  name: projectName,
29
30
  root: projectRoot,
@@ -35,7 +36,7 @@ async function stackGenerator(tree, options) {
35
36
  await (0, devkit_1.formatFiles)(tree);
36
37
  }
37
38
  }
38
- /** Builds the minimal generic values contract for dependency toggles. */
39
+ /** Builds the opinionated stack values contract for dependency toggles and MongoDB. */
39
40
  function createValues(dependencies) {
40
41
  const values = {
41
42
  global: {
@@ -46,13 +47,136 @@ function createValues(dependencies) {
46
47
  previewDomain: '',
47
48
  sourceRevision: '',
48
49
  },
49
- resources: [],
50
+ mongodb: {
51
+ enabled: false,
52
+ namespace: '',
53
+ version: '7.0.5',
54
+ storage: '8Gi',
55
+ secret: {
56
+ mode: 'generated',
57
+ encryptedData: { password: '' },
58
+ },
59
+ },
50
60
  };
51
61
  for (const dependency of dependencies) {
52
62
  values[dependency.name] = { enabled: false };
53
63
  }
54
64
  return values;
55
65
  }
66
+ /** Renders the generated or sealed MongoDB password contract. */
67
+ function createMongoPasswordTemplate() {
68
+ return `{{/* Render the stack's explicit MongoDB credential contract. */}}
69
+ {{- if .Values.mongodb.enabled }}
70
+ {{- $mode := default "generated" .Values.mongodb.secret.mode }}
71
+ {{- if eq $mode "sealed" }}
72
+ apiVersion: bitnami.com/v1alpha1
73
+ kind: SealedSecret
74
+ metadata:
75
+ name: mongodb-app-password
76
+ {{ with .Values.mongodb.namespace }}
77
+ namespace: {{ . | quote }}
78
+ {{ end }}
79
+ annotations:
80
+ {{ with .Values.mongodb.namespace }}
81
+ argocd.argoproj.io/tracking-id: {{ printf "%s:/Secret:%s/mongodb-app-password" . . | quote }}
82
+ {{ end }}
83
+ argocd.argoproj.io/sync-wave: '-10'
84
+ spec:
85
+ encryptedData:
86
+ password: {{ required "mongodb.secret.encryptedData.password is required for sealed credentials" (dig "encryptedData" "password" "" .Values.mongodb.secret) | quote }}
87
+ template:
88
+ metadata:
89
+ name: mongodb-app-password
90
+ {{ with .Values.mongodb.namespace }}
91
+ namespace: {{ . | quote }}
92
+ {{ end }}
93
+ annotations:
94
+ sealedsecrets.bitnami.com/managed: 'true'
95
+ type: Opaque
96
+ {{- else if eq $mode "generated" }}
97
+ apiVersion: v1
98
+ kind: Secret
99
+ metadata:
100
+ name: mongodb-app-password
101
+ {{ with .Values.mongodb.namespace }}
102
+ namespace: {{ . | quote }}
103
+ {{ end }}
104
+ annotations:
105
+ argocd.argoproj.io/sync-wave: '-10'
106
+ delivery.otwld.com/generated-secret: random
107
+ type: Opaque
108
+ data:
109
+ password: {{ randAlphaNum 32 | b64enc | quote }}
110
+ {{- else }}
111
+ {{- fail (printf "mongodb.secret.mode must be sealed or generated, got %q" $mode) }}
112
+ {{- end }}
113
+ {{- end }}
114
+ `;
115
+ }
116
+ /** Renders the opinionated MongoDBCommunity application contract. */
117
+ function createMongoTemplate() {
118
+ return `{{/* Render the opinionated MongoDBCommunity application contract. */}}
119
+ {{- if .Values.mongodb.enabled }}
120
+ apiVersion: mongodbcommunity.mongodb.com/v1
121
+ kind: MongoDBCommunity
122
+ metadata:
123
+ name: mongodb
124
+ {{ with .Values.mongodb.namespace }}
125
+ namespace: {{ . | quote }}
126
+ {{ end }}
127
+ spec:
128
+ members: 1
129
+ type: ReplicaSet
130
+ version: {{ .Values.mongodb.version | quote }}
131
+ security:
132
+ authentication:
133
+ modes:
134
+ - SCRAM
135
+ users:
136
+ - name: app
137
+ db: app
138
+ passwordSecretRef:
139
+ name: mongodb-app-password
140
+ key: password
141
+ roles:
142
+ - name: dbOwner
143
+ db: app
144
+ scramCredentialsSecretName: mongodb-app-scram
145
+ connectionStringSecretName: mongodb-app-connection
146
+ statefulSet:
147
+ spec:
148
+ template:
149
+ spec:
150
+ containers:
151
+ - name: mongod
152
+ resources:
153
+ limits: {}
154
+ requests: {}
155
+ - name: mongodb-agent
156
+ resources:
157
+ limits: {}
158
+ requests: {}
159
+ initContainers:
160
+ - name: mongod-posthook
161
+ resources:
162
+ limits: {}
163
+ requests: {}
164
+ - name: mongodb-agent-readinessprobe
165
+ resources:
166
+ limits: {}
167
+ requests: {}
168
+ volumeClaimTemplates:
169
+ - metadata:
170
+ name: data-volume
171
+ spec:
172
+ accessModes:
173
+ - ReadWriteOnce
174
+ resources:
175
+ requests:
176
+ storage: {{ .Values.mongodb.storage | quote }}
177
+ {{- end }}
178
+ `;
179
+ }
56
180
  /** Normalizes dependency values while preserving Helm repository URLs. */
57
181
  function normalizeDependencies(dependencies) {
58
182
  if (!dependencies)
@@ -84,7 +84,7 @@ function createNodesInternal(chartFilePath, options, context) {
84
84
  inputs: dependencyInputs,
85
85
  outputs: ['{projectRoot}/charts', '{projectRoot}/Chart.lock'],
86
86
  options: {
87
- command: 'helm dependency build .',
87
+ command: 'helm dependency build --skip-refresh .',
88
88
  cwd: chartRoot.projectRoot,
89
89
  },
90
90
  metadata: {