Skip to content

Commit

Permalink
fix type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
ydkn committed Feb 22, 2024
1 parent 2b2bcfe commit fa21985
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ yarn.lock
ci-scripts
/nuget/
provider/**/schema-embed.json
go.work.sum
2 changes: 1 addition & 1 deletion examples/dotnet/provider-k0s.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Pulumi" Version="3.*" />
<PackageReference Include="Pulumi.K0s" Version="0.2.0" />
<PackageReference Include="Pulumi.K0s" Version="0.2.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion examples/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"dependencies": {
"typescript": "^4.0.0",
"@pulumi/pulumi": "^3.0.0",
"@pulumi/k0s": "0.2.0"
"@pulumi/k0s": "0.2.1"
}
}
2 changes: 1 addition & 1 deletion examples/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pulumi>=3.0.0,<4.0.0
pulumi-k0s==0.2.0
pulumi-k0s==0.2.1
7 changes: 7 additions & 0 deletions go.work
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
go 1.21

use (
./provider
./tests
./sdk
)
22 changes: 22 additions & 0 deletions provider/internal/k0sctl/cluster.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package k0sctl

import (
"encoding/json"
"fmt"

"github.com/k0sproject/k0sctl/pkg/apis/k0sctl.k0sproject.io/v1beta1"
"gopkg.in/yaml.v3"
)

type Cluster v1beta1.Cluster
Expand Down Expand Up @@ -47,3 +49,23 @@ func (c *Cluster) APIAddress() string {

return fmt.Sprintf("https://%s:%d", address, port)
}

// Fix problematic YAML handling with dig
func (c *Cluster) MarshalYAML() ([]byte, error) {
j, err := json.Marshal(c) //nolint:staticcheck
if err != nil {
return nil, err
}

var iface interface{}

if err := json.Unmarshal(j, &iface); err != nil {
return nil, err
}

return yaml.Marshal(iface)
}

func (c *Cluster) UnmarshalYAML(b []byte) error {
return yaml.Unmarshal(b, c)
}
2 changes: 1 addition & 1 deletion sdk/dotnet/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.2.1

0 comments on commit fa21985

Please sign in to comment.