Skip to content

Commit

Permalink
Merge pull request #686 from rancher/update-pulumi-template
Browse files Browse the repository at this point in the history
  • Loading branch information
kralicky authored Oct 18, 2022
2 parents d8153d3 + 86b9da0 commit d26f8ed
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 15 deletions.
12 changes: 12 additions & 0 deletions Pulumi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ template:
opni:namePrefix:
description: "Deployment Name"
default: opni
opni:cluster.nodeGroupDesiredSize:
description: "Desired number of nodes in the cluster"
default: 3
opni:cluster.nodeGroupMaxSize:
description: "Maximum number of nodes in the cluster"
default: 3
opni:cluster.nodeGroupMinSize:
description: "Minimum number of nodes in the cluster"
default: 3
opni:cluster.nodeInstanceType:
description: "Instance type for worker nodes"
default: r6a.xlarge
opni:zoneID:
description: "AWS Route53 Zone ID"
aws:region:
Expand Down
9 changes: 5 additions & 4 deletions infra/Pulumi.e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ config:
aws:skipRequestingAccountId: "true"
opni:cloud: aws
opni:cluster:
nodeGroupDesiredSize: 2
nodeGroupDesiredSize: 3
nodeGroupMaxSize: 3
nodeGroupMinSize: 2
nodeInstanceType: t3.xlarge
nodeGroupMinSize: 3
nodeInstanceType: r6a.xlarge
opni:imageRepo: rancher/opni
opni:imageTag: main
opni:namePrefix: opni-e2e-test
opni:useLocalCharts: "true"
opni:useIdInDnsNames: "true"
opni:zoneID:
secure: AAABAEgKAveQVLuL3+ZeK4BI7td1AWO5Oojkr/eScHxNIr2OPoI4H61WGPnmOQ==
pulumi:disable-default-providers:
- kubernetes
- kubernetes
12 changes: 6 additions & 6 deletions infra/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func LoadConfig(ctx *pulumi.Context) *Config {
config.GetObject(ctx, "opni:cluster", &clusterConfig)
tags := map[string]string{}
config.GetObject(ctx, "opni:tags", &tags)
noIdInDnsNames := config.GetBool(ctx, "opni:noIdInDnsNames")
useIdInDnsNames := config.GetBool(ctx, "opni:useIdInDnsNames")
clusterConfig.LoadDefaults()

var cloud, imageRepo, imageTag, minimalImageTag string
Expand Down Expand Up @@ -51,7 +51,7 @@ func LoadConfig(ctx *pulumi.Context) *Config {
UseLocalCharts: useLocalCharts,
Cluster: clusterConfig,
Tags: tags,
NoIdInDnsNames: noIdInDnsNames,
UseIdInDnsNames: useIdInDnsNames,
}
conf.LoadDefaults()
return conf
Expand All @@ -70,7 +70,7 @@ type Config struct {
KubePrometheusEnabled bool `json:"kubePrometheusEnabled"`
Cluster ClusterConfig `json:"cluster"`
Tags map[string]string `json:"tags"`
NoIdInDnsNames bool `json:"noIdInDnsNames"`
UseIdInDnsNames bool `json:"useIdInDnsNames"`
}

type ClusterConfig struct {
Expand Down Expand Up @@ -101,15 +101,15 @@ func (c *Config) LoadDefaults() {

func (c *ClusterConfig) LoadDefaults() {
if c.NodeInstanceType == "" {
c.NodeInstanceType = "t3.large"
c.NodeInstanceType = "r6a.xlarge"
}
if c.NodeGroupMinSize == 0 {
c.NodeGroupMinSize = 2
c.NodeGroupMinSize = 3
}
if c.NodeGroupMaxSize == 0 {
c.NodeGroupMaxSize = 3
}
if c.NodeGroupDesiredSize == 0 {
c.NodeGroupDesiredSize = 2
c.NodeGroupDesiredSize = 3
}
}
2 changes: 1 addition & 1 deletion infra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func run(ctx *Context) (runErr error) {
NodeGroupDesiredSize: conf.Cluster.NodeGroupDesiredSize,
ZoneID: conf.ZoneID,
Tags: tags,
NoIdInDnsNames: conf.NoIdInDnsNames,
UseIdInDnsNames: conf.UseIdInDnsNames,
})
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions infra/pkg/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ func (p *provisioner) buildDnsResources(ctx *Context, conf resources.MainCluster
}

grafanaFqdn := All(conf.ID, zone.Name).ApplyT(func(idZoneName []any) string {
if !conf.NoIdInDnsNames {
if conf.UseIdInDnsNames {
return fmt.Sprintf("grafana.%s.%s.%s", idZoneName[0], conf.NamePrefix, idZoneName[1])
}
return fmt.Sprintf("grafana.%s.%s", conf.NamePrefix, idZoneName[1])
}).(StringOutput)
gatewayFqdn := All(conf.ID, zone.Name).ApplyT(func(idZoneName []any) string {
if !conf.NoIdInDnsNames {
if conf.UseIdInDnsNames {
return fmt.Sprintf("%s.%s.%s", idZoneName[0], conf.NamePrefix, idZoneName[1])
}
return fmt.Sprintf("%s.%s", conf.NamePrefix, idZoneName[1])
Expand Down
2 changes: 1 addition & 1 deletion infra/pkg/resources/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type MainClusterConfig struct {
NodeGroupDesiredSize int
ZoneID string
Tags map[string]string
NoIdInDnsNames bool
UseIdInDnsNames bool
}

type DNSRecordConfig struct {
Expand Down
2 changes: 1 addition & 1 deletion packages/opni/opni/charts/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ ai:
internal: {}

opni-prometheus-crd:
enabled: true
enabled: true # set to false if `opni-agent.kube-prometheus-stack.enabled` is true

opni-agent:
enabled: true
Expand Down

0 comments on commit d26f8ed

Please sign in to comment.