Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yaml.ConfigFile does not use provider via parent #812

Closed
gitfool opened this issue Sep 20, 2019 · 1 comment · Fixed by #2713
Closed

yaml.ConfigFile does not use provider via parent #812

gitfool opened this issue Sep 20, 2019 · 1 comment · Fixed by #2713
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec language/javascript mro2 Monica's list of 2st tier overlay related issues resolution/fixed This issue was fixed

Comments

@gitfool
Copy link

gitfool commented Sep 20, 2019

I'll try the lazy report first, where I'm leaving out how I set up various variables, and if you can't repro then I'll try to create a minimal repro.

...
const cluster = new eks.Cluster(name, {
    deployDashboard: false,
    publicSubnetIds: publicSubnetIds,
    privateSubnetIds: privateSubnetIds,
    instanceRole: instanceRole,
    roleMappings: iam.getRoleMappings(),
    userMappings: iam.getUserMappings(),
    skipDefaultNodeGroup: true,
    tags: {
        Environment: environment,
        EnvironmentType: environmentType,
        CostCenter: costCenter
    },
    version: k8sVersion,
    vpcId: vpc.outputs.Vpc
}, {
    customTimeouts: {
        create: "30m",
        update: "30m"
    }
});

export let kubeConfig = cluster.kubeconfig;

const nodeGroup = cluster.createNodeGroup(`${name}-nodeGroup`, {
    instanceType: instanceType,
    keyName: keyName,
    desiredCapacity: desiredCapacity,
    minSize: minSize,
    maxSize: maxSize,
    instanceProfile: instanceProfile,
    autoScalingGroupTags: { "k8s.io/cluster-autoscaler/enabled": "true" }
});
...
const fluentBit = new k8s.yaml.ConfigFile("fluent-bit.yml", {}, { parent: cluster });

Fails with:

Previewing update (org/dev):

     Type                                                 Name             Plan       Info
     pulumi:pulumi:Stack                                  k8s-infra-dev               
     ├─ eks:index:Cluster                                 Dev-Eks                     
 +   │  └─ kubernetes:yaml:ConfigFile                     fluent-bit.yml   create     
     └─ kubernetes:rbac.authorization.k8s.io:ClusterRole  fluent-bit-read             1 error
 
Diagnostics:
  kubernetes:rbac.authorization.k8s.io:ClusterRole (fluent-bit-read):
    error: unable to load Kubernetes client configuration from kubeconfig file: invalid configuration: no configuration has been provided

But succeeds if I change the fluentBit resource to specify the provider, which I'd expect to be deduced via the parent:

const fluentBit = new k8s.yaml.ConfigFile("fluent-bit.yml", {}, { parent: cluster, provider: cluster.provider });

fluent-bit.yml.txt

@sterlingdeng
Copy link

I encountered this issue as well. I needed to explicitly pass in the provider in the options. Thanks for raising this issue.

@metral metral assigned lblackstone and unassigned metral Feb 26, 2020
@mnlumi mnlumi added the mro2 Monica's list of 2st tier overlay related issues label Mar 28, 2023
@lblackstone lblackstone removed their assignment Jul 14, 2023
@lblackstone lblackstone added the kind/bug Some behavior is incorrect or out of spec label Jul 14, 2023
EronWright added a commit that referenced this issue Jan 3, 2024
<!--Thanks for your contribution. See [CONTRIBUTING](CONTRIBUTING.md)
    for Pulumi's contribution guidelines.

    Help us merge your changes more quickly by adding more details such
    as labels, milestones, and reviewers.-->

### Proposed changes
Epic: #2254
Fixes: #1938
Fixes: #2049
Fixes: #812

This PR standardizes the option propagation logic for the component
resources in the pulumi-kubernetes NodeJS SDK. The general approach is:
1. In the component resource constructor, compute the child options to
be propagated to any children. The child options consist of the
component as parent, and with `version` and `pluginDownloadURL` if
specified.
2. Compute the invoke options by copying the child options.

### Specification
The component resource is responsible for computing sub-options for
invokes and for child resource declarations. This table outlines the
expected behavior for each [resource
option](https://www.pulumi.com/docs/concepts/options/) when presented to
a component resource.

|  | Propagated | Remarks |
|---|---|---|
| `additionalSecretOutputs` | no | "does not apply to component
resources" |
| `aliases` | no | Inherited via parent-child relationship. |
| `customTimeouts` | no | "does not apply to component resources" |
| `deleteBeforeReplace` | no |  |
| `deletedWith` | no |  |
| `dependsOn` | no | The children implicitly wait for the dependency. |
| `ignoreChanges` | no | Nonsensical to apply directly to children (see
[discussion](pulumi/pulumi#8969)). |
| `import` | no |  |
| `parent` | **yes** | The component becomes the parent. |
| `protect` | no | Inherited. |
| `provider` | no | Combined into providers map, then inherited via
parent-child relationship. |
| `providers` | no | Inherited. |
| `replaceOnChanges` | no | "does not apply to component resources" |
| `retainOnDelete` | no | "does not apply to component resources" |
| `transformations` | no | Inherited. |
| `version` | **yes** | Influences default provider selection logic
during invokes.<br/>Should propagate when child resource is from the
same provider type. |
| `pluginDownloadURL` | **yes** | Influences default provider selection
logic during invokes.<br/>Should propagate when child resource is from
the same provider type. |

### Testing
A new test case is provided ([test
case](https://github.com/pulumi/pulumi-kubernetes/blob/e1ad541a9c86e8eb207bd1d8a276822862425109/tests/sdk/nodejs/nodejs_test.go#L2107),
[test
program](https://github.com/pulumi/pulumi-kubernetes/blob/e1ad541a9c86e8eb207bd1d8a276822862425109/tests/sdk/nodejs/options/index.ts))
that exercises option propagation across the component resources:
-
[kubernetes.helm.sh.v3.Chart](https://www.pulumi.com/registry/packages/kubernetes/api-docs/helm/v3/chart/)
-
[kubernetes.kustomize.Directory](https://www.pulumi.com/registry/packages/kubernetes/api-docs/kustomize/directory/)
-
[kubernetes.yaml.ConfigGroup](https://www.pulumi.com/registry/packages/kubernetes/api-docs/yaml/configgroup/)
-
[kubernetes.yaml.ConfigFile](https://www.pulumi.com/registry/packages/kubernetes/api-docs/yaml/configfile/)

Upgrade testing must be done manually, with an emphasis on avoiding
replacement due to reparenting.

### Related issues (optional)

The p/p NodeJS SDK doesn't propagate the `pluginDownloadURL` option to
the Invoke RPC.
pulumi/pulumi#14839
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec language/javascript mro2 Monica's list of 2st tier overlay related issues resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants