-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3668] Store rack install & rack update telemetry data (V2)
### What is the feature/fix? ![Screenshot 2023-04-25 at 11 14 26](https://user-images.githubusercontent.com/759623/234304722-24209b72-d129-45bd-8d1e-0756b6554021.png) ### Add screenshot or video (optional) Doc: https://convox602-my.sharepoint.com/:w:/g/personal/yuri_adams_convox_com/ERKCC87MHOxLi6_3F8PqWqIBOWecg2nEg06tIbl9NA6ujQ?e=8bW5AX ### Does it has a breaking change? No
- Loading branch information
Showing
3 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package aws | ||
|
||
import ( | ||
"crypto/sha256" | ||
"encoding/hex" | ||
"strings" | ||
) | ||
|
||
var ( | ||
skipParams = strings.Join([]string{ | ||
"DefaultAmi", | ||
"DefaultAmiArm", | ||
"Telemetry", | ||
}, ",") | ||
|
||
redactedParams = strings.Join([]string{ | ||
"Ami", | ||
"ApiCount", | ||
"ApiCpu", | ||
"ApiMonitorMemory", | ||
"ApiRouter", | ||
"ApiWebMemory", | ||
"Autoscale", | ||
"AvailabilityZones", | ||
"BuildCpu", | ||
"BuildImage", | ||
"BuildInstance", | ||
"BuildInstancePolicy", | ||
"BuildMemory", | ||
"BuildVolumeSize", | ||
"ClientId", | ||
"Development", | ||
"EcsPollInterval", | ||
"EncryptEbs", | ||
"Encryption", | ||
"ExistingVpc", | ||
"HighAvailability", | ||
"HttpProxy", | ||
"ImagePullBehavior", | ||
"IMDSHttpTokens", | ||
"Internal", | ||
"InternalOnly", | ||
"InternalSuffix", | ||
"InstanceBootCommand", | ||
"InstanceRunCommand", | ||
"InstanceType", | ||
"InstanceUpdateBatchSize", | ||
"InstancePolicy", | ||
"InstanceSecurityGroup", | ||
"BuildInstanceSecurityGroup", | ||
"InternetGateway", | ||
"Key", | ||
"LogBucket", | ||
"LogDriver", | ||
"LogRetention", | ||
"Password", | ||
"Private", | ||
"PrivateApi", | ||
"PrivateApiSecurityGroup", | ||
"PrivateBuild", | ||
"RouterInternalSecurityGroup", | ||
"RouterSecurityGroup", | ||
"ScheduleRackScaleDown", | ||
"ScheduleRackScaleUp", | ||
"SpotInstanceBid", | ||
"SslPolicy", | ||
"Subnet0CIDR", | ||
"Subnet1CIDR", | ||
"Subnet2CIDR", | ||
"SubnetPrivate0CIDR", | ||
"SubnetPrivate1CIDR", | ||
"SubnetPrivate2CIDR", | ||
"SwapSize", | ||
"SyslogDestination", | ||
"SyslogFormat", | ||
"Version", | ||
"VPCCIDR", | ||
"Tenancy", | ||
"WhiteList", | ||
}, ",") | ||
) | ||
|
||
func (p *Provider) RackParamsToSync(params map[string]string) map[string]string { | ||
toSync := make(map[string]string) | ||
for k, v := range params { | ||
if !strings.Contains(skipParams, k) { | ||
if strings.Contains(redactedParams, k) { | ||
toSync[k] = hashParamValue(v) | ||
} else { | ||
toSync[k] = v | ||
} | ||
} | ||
} | ||
|
||
return toSync | ||
} | ||
|
||
func hashParamValue(value string) string { | ||
hasher := sha256.New() | ||
hasher.Write([]byte(value)) | ||
return hex.EncodeToString(hasher.Sum(nil)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters