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

Missing docs, and suspected bug #11

Open
devantler opened this issue Sep 29, 2023 · 2 comments
Open

Missing docs, and suspected bug #11

devantler opened this issue Sep 29, 2023 · 2 comments

Comments

@devantler
Copy link

File: themes/default/content/registry/packages/flux/_index.md

I am trying to configure a flux provider in C# to bootstrap my existing Flux files, but I am encountering a weird behaviour that might be a bug.

string githubOwner = "xxx";
string repoName = "xxx";
string branch = config.Require("flux_branch");
string path = $"k8s/clusters/{Deployment.Instance.StackName}";

// Read the private key from the local filesystems home directory.
string sshPrivateKey = File.ReadAllText(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".ssh", "id_rsa"));

var fluxProvider = new Provider("flux", new ProviderArgs
{
    Kubernetes = new ProviderKubernetesArgs
    {
        ConfigPath = "~/.kube/config",
        ConfigContextCluster = "k3d-cluster-local"
    },
    Git = new ProviderGitArgs
    {
        Url = $"ssh://github.com/{githubOwner}/{repoName}",
        Branch = branch,
        // This throws an error for either the PrivateKey or the Password. It differs
        Ssh = new ProviderGitSshArgs()
        {
            Username = "git",
            PrivateKey = new StringAsset(sshPrivateKey).ToString(),
            Password = "xxxx"
        }
    }
});

_ = new FluxBootstrapGit("flux",
    new FluxBootstrapGitArgs
    {
        Path = path
    },
    new CustomResourceOptions
    {
        Provider = fluxProvider,
    }
);

The code throws the following error:

error: cannot encode provider configuration to call ConfigureProvider: objectEncoder failed on property "git": objectEncoder failed on property "ssh": objectEncoder failed on property "password": Expected a string, got: {map[4dabf18193072939515e22adb298388d:{1b47061264138c4ac30d75fd1eb44270} value:{xxxx}]}

Would it be possible to add an example of configuring Flux with SSH and check if some misconfiguration has happened? I am wondering why the setter parsed my string values into maps.

@oun
Copy link
Owner

oun commented Sep 30, 2023

Could you refer to nodejs example in https://github.com/oun/pulumi-flux/blob/main/examples/nodejs/flux-bootstrap-git/index.ts ?
Are you passing the right password for the ssh private key?

@devantler
Copy link
Author

Sorry I newer answerered - I moved on from this and has since been using OCI as a source. This looks correct to me, and I am sure that I was passing the right password back then. Given the error I guess it might be mapping related to the C# provider . I have experienced this on other plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants