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

fix: trim trailing and leading whitespace in secrets #1606

Merged
merged 4 commits into from
Dec 17, 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
2 changes: 1 addition & 1 deletion manifests/claudie/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ images:
- name: ghcr.io/berops/claudie/builder
newTag: 8f04fed-3189
- name: ghcr.io/berops/claudie/claudie-operator
newTag: 8f04fed-3189
newTag: 19fc605-3190
- name: ghcr.io/berops/claudie/kube-eleven
newTag: 8f04fed-3189
- name: ghcr.io/berops/claudie/kuber
Expand Down
35 changes: 18 additions & 17 deletions services/claudie-operator/pkg/controller/controler_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package controller

import (
"fmt"
"strings"
"unicode/utf8"

"github.com/berops/claudie/internal/generics"
Expand Down Expand Up @@ -45,8 +46,8 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret

providers.GCP = append(providers.GCP, manifest.GCP{
Name: p.ProviderName,
Credentials: gcpCredentials,
GCPProject: gcpProject,
Credentials: strings.TrimSpace(gcpCredentials),
GCPProject: strings.TrimSpace(gcpProject),
Templates: p.Templates,
})

Expand All @@ -62,8 +63,8 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret

providers.AWS = append(providers.AWS, manifest.AWS{
Name: p.ProviderName,
AccessKey: awsAccesskey,
SecretKey: awsSecretkey,
AccessKey: strings.TrimSpace(awsAccesskey),
SecretKey: strings.TrimSpace(awsSecretkey),
Templates: p.Templates,
})
case v1beta.GENESIS_CLOUD:
Expand All @@ -73,7 +74,7 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret
}
var genCloud = manifest.GenesisCloud{
Name: p.ProviderName,
ApiToken: gcToken,
ApiToken: strings.TrimSpace(gcToken),
Templates: p.Templates,
}
providers.GenesisCloud = append(providers.GenesisCloud, genCloud)
Expand All @@ -84,7 +85,7 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret
}
var hetzner = manifest.Hetzner{
Name: p.ProviderName,
Credentials: hetzner_key,
Credentials: strings.TrimSpace(hetzner_key),
Templates: p.Templates,
}
providers.Hetzner = append(providers.Hetzner, hetzner)
Expand Down Expand Up @@ -112,11 +113,11 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret

providers.OCI = append(providers.OCI, manifest.OCI{
Name: p.ProviderName,
PrivateKey: ociPrivateKey,
KeyFingerprint: ociFingerPrint,
TenancyOCID: ociTenant,
CompartmentID: ociCompartmentOcid,
UserOCID: ociUserOcid,
PrivateKey: strings.TrimSpace(ociPrivateKey),
KeyFingerprint: strings.TrimSpace(ociFingerPrint),
TenancyOCID: strings.TrimSpace(ociTenant),
CompartmentID: strings.TrimSpace(ociCompartmentOcid),
UserOCID: strings.TrimSpace(ociUserOcid),
Templates: p.Templates,
})
case v1beta.AZURE:
Expand All @@ -142,10 +143,10 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret

providers.Azure = append(providers.Azure, manifest.Azure{
Name: p.ProviderName,
SubscriptionId: azureSubscriptionId,
TenantId: azureTenantId,
ClientId: azureClientId,
ClientSecret: azureClientSecret,
SubscriptionId: strings.TrimSpace(azureSubscriptionId),
TenantId: strings.TrimSpace(azureTenantId),
ClientId: strings.TrimSpace(azureClientId),
ClientSecret: strings.TrimSpace(azureClientSecret),
Templates: p.Templates,
})
case v1beta.CLOUDFLARE:
Expand All @@ -155,7 +156,7 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret
}
providers.Cloudflare = append(providers.Cloudflare, manifest.Cloudflare{
Name: p.ProviderName,
ApiToken: cfApiToken,
ApiToken: strings.TrimSpace(cfApiToken),
Templates: p.Templates,
})

Expand All @@ -166,7 +167,7 @@ func mergeInputManifestWithSecrets(crd v1beta.InputManifest, providersWithSecret
}
providers.HetznerDNS = append(providers.HetznerDNS, manifest.HetznerDNS{
Name: p.ProviderName,
ApiToken: hetznerDNSCredentials,
ApiToken: strings.TrimSpace(hetznerDNSCredentials),
Templates: p.Templates,
})
}
Expand Down