Skip to content

Commit

Permalink
Add Flux to development cluster (#1096)
Browse files Browse the repository at this point in the history
Preparation for the NativeLink operator.
  • Loading branch information
aaronmondal authored Jul 8, 2024
1 parent 1b8e23b commit 6a40374
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
31 changes: 31 additions & 0 deletions native-cli/components/flux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package components

import (
"fmt"

"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

// The configuration for Flux.
type Flux struct {
Version string
}

// Install sets up Flux in the cluster.
func (component *Flux) Install(
ctx *pulumi.Context,
name string,
) ([]pulumi.Resource, error) {
flux, err := yaml.NewConfigFile(ctx, name, &yaml.ConfigFileArgs{
File: fmt.Sprintf(
"https://github.com/fluxcd/flux2/releases/download/v%s/install.yaml",
component.Version,
),
})
if err != nil {
return nil, fmt.Errorf("%w: %w", errPulumi, err)
}

return []pulumi.Resource{flux}, nil
}
12 changes: 12 additions & 0 deletions native-cli/programs/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
os.Exit(1)
}

flux, err := components.AddComponent(
ctx,
"flux",
&components.Flux{Version: "2.3.0"},
)
if err != nil {
log.Println(err)
os.Exit(1)
}

tektonPipelines, err := components.AddComponent(
ctx,
"tekton-pipelines",
Expand All @@ -83,6 +93,7 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
"tekton-dashboard",
&components.TektonDashboard{Version: "0.45.0"},
))

components.Check(components.AddComponent(
ctx,
"rebuild-nativelink",
Expand All @@ -93,6 +104,7 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
tektonTriggers,
localSources,
nixStore,
flux,
),
},
))
Expand Down

0 comments on commit 6a40374

Please sign in to comment.