Skip to content

Commit

Permalink
Merge branch 'main' into feature/opamp-base-url
Browse files Browse the repository at this point in the history
  • Loading branch information
echlebek authored Jan 9, 2024
2 parents d374e94 + 74067b8 commit 3465f7f
Show file tree
Hide file tree
Showing 16 changed files with 74 additions and 73 deletions.
1 change: 0 additions & 1 deletion .changelog/1316.breaking.txt

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/1358.added.txt

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/1363.added.txt

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/1381.added.txt

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/1393.changed.txt

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/1400.fixed.txt

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/1401.fixed.txt

This file was deleted.

1 change: 0 additions & 1 deletion .changelog/1408.fixed.txt

This file was deleted.

36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,42 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- towncrier release notes -->

## [v0.91.0-sumo-0]

### Released 2024-01-09

### Breaking Changes

- feat(sumologicschemaprocessor)!: deprecate in favor of sumologicprocessor [#1316]
- Removed deprecated InstallToken [#1367]

### Added

- feat(cascadingfilter): add collector_instances config option for spans_per_second global and policy limits scaling [#1358]
- feat: add support for sticky session in sumologic extension and sumologic exporter [#1363]
- Include a FIPS Capable linux/arm64 binary [#1381]

### Changed

- chore: upgrade otel core to `v0.91.0` [#1393]

### Fixed

- fix(k8stagger): allow uppercase characters inside tag keys [#1400]
- fix(k8stagger)!: change default pod id attribute name to k8s.pod.uid [#1401]
- sec: don't allow other users to read configuration files [#1408]

[#1316]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1316
[#1367]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1367
[#1358]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1358
[#1363]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1363
[#1381]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1381
[#1393]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1393
[#1400]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1400
[#1401]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1401
[#1408]: https://github.com/SumoLogic/sumologic-otel-collector/pull/1408
[v0.91.0-sumo-0]: https://github.com/SumoLogic/sumologic-otel-collector/releases/v0.91.0-sumo-0

## [v0.90.1-sumo-1]

### Released 2023-12-14
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
GOLANGCI_LINT_VERSION ?= v1.53.2
GOLANGCI_LINT_VERSION ?= v1.55.2
PRETTIER_VERSION ?= 3.0.3
TOWNCRIER_VERSION ?= 23.6.0
SHELL := /usr/bin/env bash
Expand Down
19 changes: 5 additions & 14 deletions pkg/scripts_test/check_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,11 @@ func checkConfigFilesOwnershipAndPermissions(ownerName string, ownerGroup string
}
}

func checkDeprecatedTokenInConfig(c check) {
require.NotEmpty(c.test, c.installOptions.deprecatedInstallToken, "installation token has not been provided")

conf, err := getConfig(userConfigPath)
require.NoError(c.test, err, "error while reading configuration")

require.Equal(c.test, c.installOptions.deprecatedInstallToken, conf.Extensions.Sumologic.InstallToken, "installation token is different than expected")
}

func checkDifferentTokenInConfig(c check) {
conf, err := getConfig(userConfigPath)
require.NoError(c.test, err, "error while reading configuration")

require.Equal(c.test, "different"+c.installOptions.installToken, conf.Extensions.Sumologic.InstallToken, "installation token is different than expected")
require.Equal(c.test, "different"+c.installOptions.installToken, conf.Extensions.Sumologic.InstallationToken, "installation token is different than expected")
}

func checkDifferentTokenInEnvFile(c check) {
Expand Down Expand Up @@ -142,7 +133,7 @@ func checkTokenInConfig(c check) {
conf, err := getConfig(userConfigPath)
require.NoError(c.test, err, "error while reading configuration")

require.Equal(c.test, c.installOptions.installToken, conf.Extensions.Sumologic.InstallToken, "installation token is different than expected")
require.Equal(c.test, c.installOptions.installToken, conf.Extensions.Sumologic.InstallationToken, "installation token is different than expected")
}

func checkTokenInSumoConfig(c check) {
Expand All @@ -151,7 +142,7 @@ func checkTokenInSumoConfig(c check) {
conf, err := getConfig(configPath)
require.NoError(c.test, err, "error while reading configuration")

require.Equal(c.test, c.installOptions.installToken, conf.Extensions.Sumologic.InstallToken, "installation token is different than expected")
require.Equal(c.test, c.installOptions.installToken, conf.Extensions.Sumologic.InstallationToken, "installation token is different than expected")
}

func checkTokenInEnvFile(c check) {
Expand Down Expand Up @@ -304,7 +295,7 @@ func preActionWriteDifferentTokenToUserConfig(c check) {
conf, err := getConfig(userConfigPath)
require.NoError(c.test, err)

conf.Extensions.Sumologic.InstallToken = "different" + c.installOptions.installToken
conf.Extensions.Sumologic.InstallationToken = "different" + c.installOptions.installToken
err = saveConfig(userConfigPath, conf)
require.NoError(c.test, err)
}
Expand All @@ -313,7 +304,7 @@ func preActionWriteTokenToUserConfig(c check) {
conf, err := getConfig(userConfigPath)
require.NoError(c.test, err)

conf.Extensions.Sumologic.InstallToken = c.installOptions.installToken
conf.Extensions.Sumologic.InstallationToken = c.installOptions.installToken
err = saveConfig(userConfigPath, conf)
require.NoError(c.test, err)
}
41 changes: 18 additions & 23 deletions pkg/scripts_test/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,24 @@ import (
)

type installOptions struct {
installToken string
deprecatedInstallToken string
autoconfirm bool
skipSystemd bool
tags map[string]string
skipConfig bool
skipInstallToken bool
fips bool
envs map[string]string
uninstall bool
purge bool
apiBaseURL string
configBranch string
downloadOnly bool
dontKeepDownloads bool
installHostmetrics bool
remotelyManaged bool
ephemeral bool
timeout float64
installToken string
autoconfirm bool
skipSystemd bool
tags map[string]string
skipConfig bool
skipInstallToken bool
fips bool
envs map[string]string
uninstall bool
purge bool
apiBaseURL string
configBranch string
downloadOnly bool
dontKeepDownloads bool
installHostmetrics bool
remotelyManaged bool
ephemeral bool
timeout float64
}

func (io *installOptions) string() []string {
Expand Down Expand Up @@ -120,10 +119,6 @@ func (io *installOptions) buildEnvs() []string {
e = append(e, fmt.Sprintf("%s=%s", installTokenEnv, io.installToken))
}

if io.deprecatedInstallToken != "" {
e = append(e, fmt.Sprintf("%s=%s", deprecatedInstallTokenEnv, io.deprecatedInstallToken))
}

return e
}

Expand Down
1 change: 0 additions & 1 deletion pkg/scripts_test/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type extensions struct {
}

type sumologicExtension struct {
InstallToken string `yaml:"install_token,omitempty"`
InstallationToken string `yaml:"installation_token,omitempty"`
Tags map[string]string `yaml:"collector_fields"`
APIBaseURL string `yaml:"api_base_url"`
Expand Down
7 changes: 3 additions & 4 deletions pkg/scripts_test/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ const (
cacheDirectory string = "/var/cache/otelcol-sumo/"
logDirPath string = "/var/log/otelcol-sumo"

installToken string = "token"
installTokenEnv string = "SUMOLOGIC_INSTALLATION_TOKEN"
deprecatedInstallTokenEnv string = "SUMOLOGIC_INSTALL_TOKEN"
apiBaseURL string = "https://open-collectors.sumologic.com"
installToken string = "token"
installTokenEnv string = "SUMOLOGIC_INSTALLATION_TOKEN"
apiBaseURL string = "https://open-collectors.sumologic.com"

curlTimeoutErrorCode int = 28
)
19 changes: 0 additions & 19 deletions pkg/scripts_test/install_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,6 @@ func TestInstallScript(t *testing.T) {
checkTokenEnvFileNotCreated,
},
},
{
name: "deprecated installation token only",
options: installOptions{
skipSystemd: true,
deprecatedInstallToken: installToken,
},
preChecks: []checkFunc{checkBinaryNotCreated, checkConfigNotCreated, checkUserConfigNotCreated, checkUserNotExists},
postChecks: []checkFunc{
checkBinaryCreated,
checkBinaryIsRunning,
checkConfigCreated,
checkConfigFilesOwnershipAndPermissions(rootUser, rootGroup),
checkUserConfigCreated,
checkDeprecatedTokenInConfig,
checkSystemdConfigNotCreated,
checkUserNotExists,
checkHostmetricsConfigNotCreated,
},
},
{
name: "installation token and hostmetrics",
options: installOptions{
Expand Down
14 changes: 11 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1220,15 +1220,23 @@ function write_installation_token() {
local ext_indentation
readonly ext_indentation="${3}"

# ToDo: ensure we override only sumologic `installation_token`
if grep "installation_token" "${file}" > /dev/null; then
# Do not expose token in sed command as it can be saw on processes list
echo "s/installation_token:.*$/installation_token: $(escape_sed "${token}")/" | sed -i.bak -f - "${file}"

return
fi

# ToDo: ensure we override only sumologic `install_token`
if grep "install_token" "${file}" > /dev/null; then
# Do not expose token in sed command as it can be saw on processes list
echo "s/install_token:.*$/install_token: $(escape_sed "${token}")/" | sed -i.bak -f - "${file}"
echo "s/install_token:.*$/installation_token: $(escape_sed "${token}")/" | sed -i.bak -f - "${file}"
else
# write installation token on the top of sumologic: extension
# Do not expose token in sed command as it can be saw on processes list
echo "s/sumologic:/sumologic:\\
\\${ext_indentation}install_token: $(escape_sed "${token}")/" | sed -i.bak -f - "${file}"
echo "1,/sumologic:/ s/sumologic:/sumologic:\\
\\${ext_indentation}installation_token: $(escape_sed "${token}")/" | sed -i.bak -f - "${file}"
fi
}

Expand Down

0 comments on commit 3465f7f

Please sign in to comment.