Skip to content

Commit

Permalink
Merge pull request #935 from rancher/infra-packaging-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kralicky authored Dec 20, 2022
2 parents 145d06c + f69662d commit 958ded4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
30 changes: 21 additions & 9 deletions infra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,38 +75,46 @@ func run(ctx *Context) (runErr error) {
if err != nil {
return err
}
// FIXME: ability for agent v1
var opniCrdChart, opniChart /*,opniAgentChart*/ string
var opniCrdChart, opniPrometheusCrdChart, opniChart string
var chartRepoOpts *helm.RepositoryOptsArgs
if conf.UseLocalCharts {
var ok bool
if opniCrdChart, ok = findLocalChartDir("opni-crd"); !ok {
return errors.New("could not find local opni-crd chart")
}
if opniPrometheusCrdChart, ok = findLocalChartDir("opni-prometheus-crd"); !ok {
return errors.New("could not find local opni-prometheus-crd chart")
}
if opniChart, ok = findLocalChartDir("opni"); !ok {
return errors.New("could not find local opni chart")
}
// if opniAgentChart, ok = findLocalChartDir("opni-agent"); !ok {
// return errors.New("could not find local opni-agent chart")
// }
} else {
chartRepoOpts = &helm.RepositoryOptsArgs{
Repo: StringPtr(conf.ChartsRepo),
}
opniCrdChart = "opni-crd"
opniPrometheusCrdChart = "opni-prometheus-crd"
opniChart = "opni"
// opniAgentChart = "opni-agent"
}

opniServiceLB := mainCluster.Provider.ApplyT(func(k *kubernetes.Provider) (StringOutput, error) {
//FIXME
opniCrd, err := helm.NewRelease(ctx, "opni-crd", &helm.ReleaseArgs{
Chart: String(opniCrdChart),
RepositoryOpts: chartRepoOpts,
Version: StringPtr(conf.ChartVersion),
Namespace: String("opni"),
Timeout: Int(60),
}, Provider(k))
}, Provider(k), RetainOnDelete(true))
if err != nil {
return StringOutput{}, errors.WithStack(err)
}

opniPrometheusCrd, err := helm.NewRelease(ctx, "opni-prometheus-crd", &helm.ReleaseArgs{
Chart: String(opniPrometheusCrdChart),
RepositoryOpts: chartRepoOpts,
Namespace: String("opni"),
Timeout: Int(60),
}, Provider(k), RetainOnDelete(true))
if err != nil {
return StringOutput{}, errors.WithStack(err)
}
Expand All @@ -116,6 +124,7 @@ func run(ctx *Context) (runErr error) {
Chart: String(opniChart),
RepositoryOpts: chartRepoOpts,
Version: StringPtr(conf.ChartVersion),
SkipCrds: Bool(true),
Namespace: String("opni"),
Values: Map{
"image": Map{
Expand Down Expand Up @@ -160,6 +169,9 @@ func run(ctx *Context) (runErr error) {
"agent": Map{
"version": String("v2"),
},
"persistence": Map{
"mode": String("pvc"),
},
//FIXME change to a config value
"kube-prometheus-stack": Map{
"enabled": Bool(true),
Expand All @@ -168,7 +180,7 @@ func run(ctx *Context) (runErr error) {
},
Timeout: Int(300),
WaitForJobs: Bool(true),
}, Provider(k), DependsOn([]Resource{opniCrd}), RetainOnDelete(true))
}, Provider(k), DependsOn([]Resource{opniCrd, opniPrometheusCrd}), RetainOnDelete(true))
if err != nil {
return StringOutput{}, errors.WithStack(err)
}
Expand Down
2 changes: 1 addition & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func Protobuf() {
func Minimal() error {
if err := goBuild(
"-tags",
"noagentv1,noplugins,nohooks,norealtime,nocortex,nodebug,noevents,nogateway,noetcd,noscheme_thirdparty,noalertmanager,nomsgpack",
"noagentv1,noplugins,nohooks,norealtime,nomanager,nocortex,nodebug,noevents,nogateway,noetcd,noscheme_thirdparty,noalertmanager,nomsgpack",
"./cmd/opni",
); err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion test/integration/agent/agent_mem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func buildExamplePlugin(destDir string) error {
func buildMinimalAgent() (string, error) {
test.Log.Info("building minimal agent...")
return gexec.BuildWithEnvironment("github.com/rancher/opni/cmd/opni", []string{"CGO_ENABLED=0"},
"-tags=noagentv1,noplugins,nohooks,norealtime,nocortex,nodebug,noevents,nogateway,noscheme_thirdparty,nomsgpack",
"-tags=noagentv1,noplugins,nohooks,norealtime,nomanager,nocortex,nodebug,noevents,nogateway,noscheme_thirdparty,noalertmanager,nomsgpack",
)
}

Expand Down

0 comments on commit 958ded4

Please sign in to comment.