Skip to content

Commit 6a40374

Browse files
authored
Add Flux to development cluster (TraceMachina#1096)
Preparation for the NativeLink operator.
1 parent 1b8e23b commit 6a40374

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

native-cli/components/flux.go

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package components
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/pulumi/pulumi-kubernetes/sdk/v4/go/kubernetes/yaml"
7+
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
8+
)
9+
10+
// The configuration for Flux.
11+
type Flux struct {
12+
Version string
13+
}
14+
15+
// Install sets up Flux in the cluster.
16+
func (component *Flux) Install(
17+
ctx *pulumi.Context,
18+
name string,
19+
) ([]pulumi.Resource, error) {
20+
flux, err := yaml.NewConfigFile(ctx, name, &yaml.ConfigFileArgs{
21+
File: fmt.Sprintf(
22+
"https://github.com/fluxcd/flux2/releases/download/v%s/install.yaml",
23+
component.Version,
24+
),
25+
})
26+
if err != nil {
27+
return nil, fmt.Errorf("%w: %w", errPulumi, err)
28+
}
29+
30+
return []pulumi.Resource{flux}, nil
31+
}

native-cli/programs/local.go

+12
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
5858
os.Exit(1)
5959
}
6060

61+
flux, err := components.AddComponent(
62+
ctx,
63+
"flux",
64+
&components.Flux{Version: "2.3.0"},
65+
)
66+
if err != nil {
67+
log.Println(err)
68+
os.Exit(1)
69+
}
70+
6171
tektonPipelines, err := components.AddComponent(
6272
ctx,
6373
"tekton-pipelines",
@@ -83,6 +93,7 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
8393
"tekton-dashboard",
8494
&components.TektonDashboard{Version: "0.45.0"},
8595
))
96+
8697
components.Check(components.AddComponent(
8798
ctx,
8899
"rebuild-nativelink",
@@ -93,6 +104,7 @@ func ProgramForLocalCluster(ctx *pulumi.Context) error {
93104
tektonTriggers,
94105
localSources,
95106
nixStore,
107+
flux,
96108
),
97109
},
98110
))

0 commit comments

Comments
 (0)