sparse-intern-71089
01/18/2024, 3:53 PMsalmon-account-74572
01/18/2024, 4:26 PMstale-answer-34162
01/18/2024, 4:26 PMstale-answer-34162
01/18/2024, 4:26 PMimport * as k8s from '@pulumi/kubernetes'
import * as pulumi from '@pulumi/pulumi'
const _websocketNamespace = new k8s.core.v1.Namespace(
'websocket',
{ metadata: { name: 'websocket' } },
{ provider: k8sProvider },
)
export const websocketRelease = new k8s.helm.v3.Release(
'websocket',
{
chart: './charts/websocket',
name: 'websocket',
namespace: _websocketNamespace.metadata.name,
},
{ provider: k8sProvider, dependsOn: _websocketNamespace },
)stale-answer-34162
01/18/2024, 4:29 PMsalmon-account-74572
01/18/2024, 4:32 PMstale-answer-34162
01/18/2024, 4:33 PMstale-answer-34162
01/18/2024, 4:34 PM❯ pu
Previewing update (eks-dev-charts-app)
View in Browser (Ctrl+O): <https://app.pulumi.com/openphone/infra/eks-dev-charts-app/previews/2e0e6079-32c4-434f-a2c1-03019bfa8e6d>
Type Name Plan
pulumi:pulumi:Stack infra-eks-dev-charts-app
Resources:
1 unchangedstale-answer-34162
01/18/2024, 4:39 PMsalmon-account-74572
01/18/2024, 4:40 PMstale-answer-34162
01/18/2024, 4:42 PMkubernetes:<http://helm.sh/v3:Release|helm.sh/v3:Release> (command):
warning: Helm release "command" was created but has a failed status. Use the `helm` command to investigate the error, correct it, then retry. Reason: 1 error occurred:
* deployments.apps "command-worker" already exists
error: 1 error occurred:
* Helm release "command/command" was created, but failed to initialize completely. Use Helm CLI to investigate.: failed to become available within allocated timeout. Error: Helm Release command/command: 1 error occurred:
* deployments.apps "command-worker" already existsstale-answer-34162
01/18/2024, 4:43 PMsalmon-account-74572
01/18/2024, 4:44 PMpulumi refresh first, to reconcile the stack state with what is actually present/not present, then try pulumi up and see if you get the same error. I’m assuming you’ve verified (using kubectl or whatever tool you prefer) that the Deployment is indeed gone?stale-answer-34162
01/18/2024, 4:52 PMstale-answer-34162
01/18/2024, 5:13 PMkubernetes:<http://helm.sh/v3:Release|helm.sh/v3:Release> (admin):
error: cannot re-use a name that is still in usesalmon-account-74572
01/18/2024, 5:15 PMhelm CLI, using pulumi destroy, or by deleting the K8s resources directly? Does the helm CLI still show the release as being present?stale-answer-34162
01/18/2024, 5:16 PMstale-answer-34162
01/18/2024, 5:17 PMstale-answer-34162
01/18/2024, 5:18 PMstale-answer-34162
01/18/2024, 5:20 PMfunction createExtCredSecret(
namespace: pulumi.Output<string>,
provider: k8s.Provider,
dependsOn: pulumi.Input<pulumi.Resource>,
): pulumi.Output<k8s.yaml.ConfigFile> {
return namespace.apply(
(ns) =>
new k8s.yaml.ConfigFile(
`extcred-${ns}`,
{
file: 'extcred.yaml',
transformations: [
(obj: any) => {
if (obj.kind === 'Secret') {
obj.metadata.namespace = ns
}
},
],
},
),
)
}
const _accountNamespace = new k8s.core.v1.Namespace(
'account',
{ metadata: { name: 'account' } },
{ provider: k8sProvider },
)
const _extcredSecretAccount = createExtCredSecret(_accountNamespace.metadata.name, k8sProvider, _accountNamespace)
namespace is present but secret is notsalmon-account-74572
01/18/2024, 5:22 PMstale-answer-34162
01/18/2024, 6:15 PMstale-answer-34162
01/18/2024, 8:45 PMsalmon-account-74572
01/18/2024, 8:52 PMstale-answer-34162
01/18/2024, 9:16 PMsalmon-account-74572
01/18/2024, 9:19 PMstale-answer-34162
01/18/2024, 9:23 PMquiet-jackal-96812
01/18/2024, 10:29 PMkube-system namespace? Example kubectl command:
kubectl -n kube-system get secrets | grep helm
This might be why helm ls might not be showing a release, despite the error surfaced from helm CLI to Pulumi indicating otherwise.stale-answer-34162
01/18/2024, 10:32 PMquiet-jackal-96812
01/18/2024, 10:34 PMhelm.v3.Release resources, and not helm.v3.Chart? Are you also manipulating the helm installations externally/manually with the helm CLI? And can you clarify how you're uninstalling helm releases from the cluster as well. Thanks!stale-answer-34162
01/18/2024, 10:40 PMhelm.v3.Release, I had a really poor success rate with helm.v3.Chart due to many charts requiring hooks and much better success with Release. I was not typically manipulating helm installations with helm unless testing broken installs.
My intention was to use helm.v3.Release to overwrite existing releases when helm chart changes were detected and I have no other uninstall logic in my pulumi codebase.
When or if an overwrite would not work on a complex chart I would comment out the release code block and run pulumi up and then uncomment it and run pulumi up again.stale-answer-34162
01/18/2024, 10:41 PMstale-answer-34162
01/18/2024, 10:43 PMexport const _elasticSystemNamespace = new k8s.core.v1.Namespace(
'elastic-system',
{ metadata: { name: 'elastic-system' } },
{ provider: k8sProvider },
)
const _elasticValues = new pulumi.asset.FileAsset('charts/eck-operator/values.yaml')
const _elasticRelease = new helm.v3.Release(
'elastic-operator',
{
name: 'elastic-operator',
namespace: _elasticSystemNamespace.metadata.name,
chart: 'eck-operator',
repositoryOpts: { repo: '<https://helm.elastic.co>' },
valueYamlFiles: [_elasticValues],
version: '2.10.0',
},
{ provider: k8sProvider, dependsOn: [_elasticSystemNamespace] },
)stale-answer-34162
01/18/2024, 10:44 PMconst _notificationNamespace = new k8s.core.v1.Namespace(
'notification',
{ metadata: { name: 'notification' } },
{ provider: k8sProvider },
)
const _dockerSecretNotification = createDockerRegistrySecret(
"ghcr-k8s-notification", // Pulumi resource name
"ghcr-k8s", // Kubernetes secret name
_notificationNamespace.metadata.name,
{ provider: k8sProvider }
);
const _extcredSecretNotification = createExtCredSecret(_notificationNamespace.metadata.name, k8sProvider, _notificationNamespace)
export const notificationRelease = new k8s.helm.v3.Release(
'notification',
{
chart: './charts/notification',
name: 'notification',
namespace: _notificationNamespace.metadata.name,
values: {
image: {
pullSecrets: [{ name: _dockerSecretNotification }],
},
},
},
{ provider: k8sProvider, dependsOn: [_notificationNamespace, _dockerSecretNotification, _extcredSecretNotification] },
)stale-answer-34162
01/18/2024, 10:46 PMpulumi upquiet-jackal-96812
01/18/2024, 10:48 PMworried-knife-31967
01/21/2024, 3:08 PMhelm release list to see if the one that pulumi deployed actually errored.
Helm is an interesting beast and can error in weird and wonderful ways that are not related to pulumi.stale-answer-34162
01/23/2024, 2:45 PM