Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: correct typos in comments and code #3349

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions internal/infrastructure/kubernetes/proxy/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ func expectedProxyContainers(infra *ir.ProxyInfra,
proxyMetrics = infra.Config.Spec.Telemetry.Metrics
}

maxHeapSizeBytes := caclulateMaxHeapSizeBytes(containerSpec.Resources)
maxHeapSizeBytes := calculateMaxHeapSizeBytes(containerSpec.Resources)

// Get the default Bootstrap
bootstrapConfigurations, err := bootstrap.GetRenderedBootstrapConfig(&bootstrap.RenderBootsrapConfigOptions{
bootstrapConfigurations, err := bootstrap.GetRenderedBootstrapConfig(&bootstrap.RenderBootstrapConfigOptions{
ProxyMetrics: proxyMetrics,
MaxHeapSizeBytes: maxHeapSizeBytes,
})
Expand Down Expand Up @@ -395,9 +395,9 @@ func expectedContainerEnv(containerSpec *egv1a1.KubernetesContainerSpec) []corev
}
}

// caclulateMaxHeapSizeBytes calculates the maximum heap size in bytes as 80% of Envoy container memory limits.
// calculateMaxHeapSizeBytes calculates the maximum heap size in bytes as 80% of Envoy container memory limits.
// In case no limits are defined '0' is returned, which means no heap size limit is set.
func caclulateMaxHeapSizeBytes(envoyResourceRequirements *corev1.ResourceRequirements) uint64 {
func calculateMaxHeapSizeBytes(envoyResourceRequirements *corev1.ResourceRequirements) uint64 {
if envoyResourceRequirements == nil || envoyResourceRequirements.Limits == nil {
return 0
}
Expand Down
18 changes: 9 additions & 9 deletions internal/xds/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ var bootstrapTmplStr string

var bootstrapTmpl = template.Must(template.New(envoyCfgFileName).Parse(bootstrapTmplStr))

// envoyBootstrap defines the envoy Bootstrap configuration.
// bootstrapConfig defines the envoy Bootstrap configuration.
type bootstrapConfig struct {
// parameters defines configurable bootstrap configuration parameters.
parameters bootstrapParameters
// rendered is the rendered bootstrap configuration.
rendered string
}

// envoyBootstrap defines the envoy Bootstrap configuration.
// bootstrapParameters defines the envoy Bootstrap configuration.
type bootstrapParameters struct {
// XdsServer defines the configuration of the XDS server.
XdsServer xdsServerParameters
Expand All @@ -70,7 +70,7 @@ type bootstrapParameters struct {

// OtelMetricSinks defines the configuration of the OpenTelemetry sinks.
OtelMetricSinks []metricSink
// EnableStatConfig defines whether to to customize the Envoy proxy stats.
// EnableStatConfig defines whether to customize the Envoy proxy stats.
EnableStatConfig bool
// StatsMatcher is to control creation of custom Envoy stats with prefix,
// suffix, and regex expressions match on the name of the stats.
Expand Down Expand Up @@ -113,16 +113,16 @@ type readyServerParameters struct {

type StatsMatcherParameters struct {
Exacts []string
Prefixs []string
Suffixs []string
Prefixes []string
Suffixes []string
RegularExpressions []string
}

type overloadManagerParameters struct {
MaxHeapSizeBytes uint64
}

type RenderBootsrapConfigOptions struct {
type RenderBootstrapConfigOptions struct {
ProxyMetrics *egv1a1.ProxyMetrics
MaxHeapSizeBytes uint64
}
Expand All @@ -139,7 +139,7 @@ func (b *bootstrapConfig) render() error {
}

// GetRenderedBootstrapConfig renders the bootstrap YAML string
func GetRenderedBootstrapConfig(opts *RenderBootsrapConfigOptions) (string, error) {
func GetRenderedBootstrapConfig(opts *RenderBootstrapConfigOptions) (string, error) {
var (
enablePrometheus = true
enablePrometheusCompression = false
Expand Down Expand Up @@ -199,9 +199,9 @@ func GetRenderedBootstrapConfig(opts *RenderBootsrapConfigOptions) (string, erro
case egv1a1.StringMatchExact:
StatsMatcher.Exacts = append(StatsMatcher.Exacts, match.Value)
case egv1a1.StringMatchPrefix:
StatsMatcher.Prefixs = append(StatsMatcher.Prefixs, match.Value)
StatsMatcher.Prefixes = append(StatsMatcher.Prefixes, match.Value)
case egv1a1.StringMatchSuffix:
StatsMatcher.Suffixs = append(StatsMatcher.Suffixs, match.Value)
StatsMatcher.Suffixes = append(StatsMatcher.Suffixes, match.Value)
case egv1a1.StringMatchRegularExpression:
if err := regex.Validate(match.Value); err != nil {
return "", err
Expand Down
4 changes: 2 additions & 2 deletions internal/xds/bootstrap/bootstrap.yaml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ stats_config:
{{- range $_, $item := .StatsMatcher.Exacts }}
- exact: {{$item}}
{{- end}}
{{- range $_, $item := .StatsMatcher.Prefixs }}
{{- range $_, $item := .StatsMatcher.Prefixes }}
- prefix: {{$item}}
{{- end}}
{{- range $_, $item := .StatsMatcher.Suffixs }}
{{- range $_, $item := .StatsMatcher.Suffixes }}
- suffix: {{$item}}
{{- end}}
{{- range $_, $item := .StatsMatcher.RegularExpressions }}
Expand Down
16 changes: 8 additions & 8 deletions internal/xds/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import (
func TestGetRenderedBootstrapConfig(t *testing.T) {
cases := []struct {
name string
opts *RenderBootsrapConfigOptions
opts *RenderBootstrapConfigOptions
}{
{
name: "disable-prometheus",
opts: &RenderBootsrapConfigOptions{
opts: &RenderBootstrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Prometheus: &egv1a1.ProxyPrometheusProvider{
Disable: true,
Expand All @@ -36,15 +36,15 @@ func TestGetRenderedBootstrapConfig(t *testing.T) {
},
{
name: "enable-prometheus",
opts: &RenderBootsrapConfigOptions{
opts: &RenderBootstrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Prometheus: &egv1a1.ProxyPrometheusProvider{},
},
},
},
{
name: "enable-prometheus-gzip-compression",
opts: &RenderBootsrapConfigOptions{
opts: &RenderBootstrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Prometheus: &egv1a1.ProxyPrometheusProvider{
Compression: &egv1a1.Compression{
Expand All @@ -56,7 +56,7 @@ func TestGetRenderedBootstrapConfig(t *testing.T) {
},
{
name: "otel-metrics",
opts: &RenderBootsrapConfigOptions{
opts: &RenderBootstrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Prometheus: &egv1a1.ProxyPrometheusProvider{
Disable: true,
Expand All @@ -75,7 +75,7 @@ func TestGetRenderedBootstrapConfig(t *testing.T) {
},
{
name: "otel-metrics-backendref",
opts: &RenderBootsrapConfigOptions{
opts: &RenderBootstrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Prometheus: &egv1a1.ProxyPrometheusProvider{
Disable: true,
Expand Down Expand Up @@ -103,7 +103,7 @@ func TestGetRenderedBootstrapConfig(t *testing.T) {
},
{
name: "custom-stats-matcher",
opts: &RenderBootsrapConfigOptions{
opts: &RenderBootstrapConfigOptions{
ProxyMetrics: &egv1a1.ProxyMetrics{
Matches: []egv1a1.StringMatch{
{
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestGetRenderedBootstrapConfig(t *testing.T) {
},
{
name: "with-max-heap-size-bytes",
opts: &RenderBootsrapConfigOptions{
opts: &RenderBootstrapConfigOptions{
MaxHeapSizeBytes: 1073741824,
},
},
Expand Down
Loading