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

WIP - support for KubernetesInDocker (kind) clusters #75

Closed
wants to merge 60 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
dc4884b
support for collecting from CRDs using default deployment yaml
davidkydd Apr 22, 2021
bc21285
Merge branch 'master' into dakydd/master
davidkydd Apr 22, 2021
b516b5c
Merge branch 'master' of https://github.com/Azure/aks-periscope
davidkydd May 6, 2021
f2683a6
revert additional resource permissions
davidkydd May 6, 2021
9a8e367
expose a feature flag for collectors and diagnosers
davidkydd May 6, 2021
5d344b9
typo
davidkydd May 6, 2021
5104ef7
fix targeting configmap rather than config itself
davidkydd May 6, 2021
178b618
- treat exporters the same as collectors + diagnosers
davidkydd May 7, 2021
ecfe3ff
minor tidy
davidkydd May 7, 2021
864297a
create dev deployment yaml in its own subdir and revert changes to to…
davidkydd May 7, 2021
790744a
go fmt
davidkydd May 8, 2021
2b66c39
rename for clarity
davidkydd May 8, 2021
308e350
Helm chart for azure-k8s-periscope
safeermohammed Apr 28, 2021
d569772
add new configmaps to chart
davidkydd May 10, 2021
4e69de1
WIP - support for KubernetesInDocker (kind) clusters
davidkydd Jun 20, 2021
a377636
simplify err => boolean
davidkydd Jun 20, 2021
228cf6b
reset line endings to crlf
davidkydd Jun 20, 2021
bdb3847
Add text=auto in .gitattributes (#70)
davidkydd Jun 22, 2021
a905fe9
Merge branch 'collectorDiagnoserConfig' into kindClusterSupport
davidkydd Jun 23, 2021
7c5c80d
Fix additional merge issues
davidkydd Jun 23, 2021
9b9a582
overload collectors-config to support both ENABLED_COLLECTORS and COL…
davidkydd Jun 23, 2021
915b745
Remove helm
davidkydd Jun 23, 2021
7032976
Remove dev periscope yaml
davidkydd Jun 23, 2021
5a1df46
Handle kubeadm (perhaps poorly) and aks-engine fqdn -> containerName …
davidkydd Jun 23, 2021
92a767c
additional test cases
davidkydd Jun 23, 2021
12bbfd3
new containerlogs collector for containerd clusters - still needs to …
davidkydd Jun 25, 2021
0a5aa64
register containerD collector
davidkydd Jun 25, 2021
2bb4a37
reverse the kind vs. non-kind check to be AKS vs. non-AKS
davidkydd Jun 25, 2021
0c61fed
register the containerlogscontainerd collector for the kind deploymen…
davidkydd Jun 25, 2021
fc7bc03
remove unused config
davidkydd Jun 25, 2021
248d8fd
register new collector in initialization, fix typo + collector name
davidkydd Jun 25, 2021
c32622a
zip_and_export flag added to exporter config, false for KIND, default…
davidkydd Jun 25, 2021
c575b09
containerD collector needs to copy files from host to container prior…
davidkydd Jun 25, 2021
99fb06c
fixes for when running on AKS - image: dakyddacr.azurecr.io/periscope…
davidkydd Jun 26, 2021
c68790f
Merge branch 'master' into kindClusterSupport
davidkydd Jun 28, 2021
3fd2587
fix golint errors
davidkydd Jun 28, 2021
a5c93de
Merge pull request #69 from davidkydd/kindClusterSupport
davidkydd Jun 28, 2021
837b5c9
use lookupEnv, not getEnv which returns empty string not nil
davidkydd Jun 28, 2021
d84c806
Merge branch 'upstream-master' into kindClusterSupport
davidkydd Jun 29, 2021
d3ee257
Merge branch 'upstream-master' into kindClusterSupport
davidkydd Jun 30, 2021
5ac3a69
Merge branch 'upstream-master' into kindClusterSupport
davidkydd Jul 1, 2021
2528c28
fix return type in createContainerUrl, remove helper functions from A…
davidkydd Jul 2, 2021
ef2dc38
containerd containerlog collector to new collector format
davidkydd Jul 2, 2021
998cb9d
remove unused "base types"
davidkydd Jul 2, 2021
f000cd2
fix containerD collector to new collector format, remove private meth…
davidkydd Jul 2, 2021
ac0f062
exportReader needs to be callable via exporter interface
davidkydd Jul 2, 2021
4f8ed12
blobExporter_test to call method directly as part of package, not via…
davidkydd Jul 2, 2021
f284b5d
Contains as exported method of utils / helper. Fix test error string.…
davidkydd Jul 2, 2021
77dd262
fix containerd logs tests
davidkydd Jul 2, 2021
f759365
remove golangci-lint
davidkydd Jul 2, 2021
7f957de
recalc go.sum
davidkydd Jul 2, 2021
562f1bf
correct test expectation
davidkydd Jul 2, 2021
0439046
replace additional deployment yaml with kustomize
davidkydd Jul 2, 2021
ff57ee0
remove AKS specificity in getStorageContainerName now that the shared…
davidkydd Jul 2, 2021
f7b431f
Merge branch 'upstream-master' into kindClusterSupport
davidkydd Jul 2, 2021
6967c8b
remove IsRunningInAks check, ReadKubeletConfig now just tries both ku…
davidkydd Jul 2, 2021
5335b60
return combined result. Change errorf string format
davidkydd Jul 3, 2021
fb94b99
enforce varlog volume as a directory. Make it readonly as per: https:…
davidkydd Jul 4, 2021
b4963c3
fix name of collector
davidkydd Jul 7, 2021
1747a88
Merge branch 'upstream-master' into kindClusterSupport
davidkydd Jul 8, 2021
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
Prev Previous commit
Next Next commit
reverse the kind vs. non-kind check to be AKS vs. non-AKS
  • Loading branch information
davidkydd committed Jun 25, 2021
commit 2bb4a370c1255be2da159f3a1c868dcb3b474efb
14 changes: 8 additions & 6 deletions pkg/exporter/azureblob_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,28 @@ func NewAzureBlobExporter() *AzureBlobExporter {
func (exporter *AzureBlobExporter) GetStorageContainerName(APIServerFQDN string) (string, error) {
var containerName string
var err error
if utils.IsKubernetesInDocker() {
containerName, err = exporter.GetKubernetesInDockerStorageContainerName(APIServerFQDN)
if utils.IsRunningInAks() {
containerName, err = exporter.GetAKSStorageContainerName(APIServerFQDN)
} else {
containerName, err = exporter.GetNonKINDStorageContainerName(APIServerFQDN)
containerName, err = exporter.GetNonAKSStorageContainerName(APIServerFQDN)
}

//TODO run a sanitizer over the final chars in the containerName
return containerName, err
}

func (exporter *AzureBlobExporter) GetKubernetesInDockerStorageContainerName(APIServerFQDN string) (string, error) {
//GetNonAKSStorageContainerName get the storage container name for non AKS cluster
func (exporter *AzureBlobExporter) GetNonAKSStorageContainerName(APIServerFQDN string) (string, error) {
containerName := strings.Replace(APIServerFQDN, ".", "-", -1)

return containerName, nil
}

func (exporter *AzureBlobExporter) GetNonKINDStorageContainerName(APIServerFQDN string) (string, error) {
//GetAKSStorageContainerName get the storage container name when running on an AKS cluster
func (exporter *AzureBlobExporter) GetAKSStorageContainerName(APIServerFQDN string) (string, error) {
containerName := strings.Replace(APIServerFQDN, ".", "-", -1)

//TODO I really dont like the line below, it makes for weird behaviour if e.g. .hcp. or -hcp- is in the fqdn for some reason other than being auto-added by AKS
//TODO DK: I really dont like the line below, it makes for weird behaviour if e.g. .hcp. or -hcp- is in the fqdn for some reason other than being auto-added by AKS
length := strings.Index(containerName, "-hcp-")

if length == -1 {
Expand Down
6 changes: 3 additions & 3 deletions pkg/exporter/azureblob_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ var getStorageContainerNameTests = []struct {
{"extra.super.duper.long.apiserverfqdn.that.has.more.than.63.characters", "extra-super-duper-long-apiserverfqdn-that-has-more-than-63-char"},
}

// TestGetNonKINDStorageContainerName get storage container name for non kind cluster
func TestGetNonKINDStorageContainerName(t *testing.T) {
// TestGetAKSStorageContainerName get storage container name for non kind cluster
func TestGetAKSStorageContainerName(t *testing.T) {
for _, tt := range getStorageContainerNameTests {
t.Run(tt.apiServerFqdn, func(t *testing.T) {
var blobExporter = &AzureBlobExporter{}
containerName, _ := blobExporter.GetNonKINDStorageContainerName(tt.apiServerFqdn)
containerName, _ := blobExporter.GetAKSStorageContainerName(tt.apiServerFqdn)

if containerName != tt.containerName {
t.Errorf("Sprintf(%q, &blobExporter) => %q, want %q",
davidkydd marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading