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

Added AAD Pod identity to connect to Storage Account #33

Closed
wants to merge 1 commit into from
Closed
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
4 changes: 2 additions & 2 deletions builder/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang AS builder
RUN mkdir /app
ADD . /app
WORKDIR /app
RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor github.com/Azure/aks-periscope/cmd/aks-periscope
RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor ./cmd/aks-periscope

FROM alpine
RUN apk --no-cache add ca-certificates
Expand All @@ -11,4 +11,4 @@ RUN chmod +x /usr/local/bin/kubectl
RUN mkdir /app
WORKDIR /app
COPY --from=builder /app/aks-periscope .
CMD ["./aks-periscope"]
CMD ["./aks-periscope"]
11 changes: 8 additions & 3 deletions cmd/aks-periscope/aks-periscope.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ import (

func main() {
zipAndExportMode := true
exporter := &exporter.AzureBlobExporter{}
var waitgroup sync.WaitGroup

err := utils.CreateCRD()
if err != nil {
log.Printf("Failed to create CRD: %+v", err)
log.Fatalf("Failed to create CRD: %+v", err)
}

exporter, err := exporter.NewAzureBlobExporter()
if err != nil {
log.Fatal(err)
}

var waitgroup sync.WaitGroup

collectors := []interfaces.Collector{}
containerLogsCollector := collector.NewContainerLogsCollector(exporter)
collectors = append(collectors, containerLogsCollector)
Expand Down
22 changes: 3 additions & 19 deletions deployment/aks-periscope.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: aks-periscope-service-account
namespace: aks-periscope
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -28,7 +27,6 @@ metadata:
subjects:
- kind: ServiceAccount
name: aks-periscope-service-account
namespace: aks-periscope
roleRef:
kind: ClusterRole
name: aks-periscope-role
Expand All @@ -41,7 +39,6 @@ metadata:
subjects:
- kind: ServiceAccount
name: aks-periscope-service-account
namespace: aks-periscope
roleRef:
kind: ClusterRole
name: view
Expand All @@ -51,7 +48,6 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
name: aks-periscope
namespace: aks-periscope
labels:
app: aks-periscope
spec:
Expand All @@ -63,13 +59,14 @@ spec:
labels:
app: aks-periscope
spec:
priorityClassName: system-node-critical
serviceAccountName: aks-periscope-service-account
hostPID: true
nodeSelector:
beta.kubernetes.io/os: linux
containers:
- name: aks-periscope
image: aksrepos.azurecr.io/staging/aks-periscope:v0.3
image: aks-periscope
securityContext:
privileged: true
imagePullPolicy: Always
Expand Down Expand Up @@ -98,37 +95,24 @@ spec:
path: /var/log/aks-periscope
type: DirectoryOrCreate
---
apiVersion: v1
kind: Secret
metadata:
name: azureblob-secret
namespace: aks-periscope
type: Opaque
data:
AZURE_BLOB_ACCOUNT_NAME: # <accountName, base64 encoded>
AZURE_BLOB_SAS_KEY: # <saskey, base64 encoded>
---
apiVersion: v1
kind: ConfigMap
metadata:
name: containerlogs-config
namespace: aks-periscope
data:
DIAGNOSTIC_CONTAINERLOGS_LIST: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
name: kubeobjects-config
namespace: aks-periscope
data:
DIAGNOSTIC_KUBEOBJECTS_LIST: kube-system/pod kube-system/service kube-system/deployment
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nodelogs-config
namespace: aks-periscope
data:
DIAGNOSTIC_NODELOGS_LIST: /var/log/azure/cluster-provision.log /var/log/cloud-init.log
---
Expand Down Expand Up @@ -159,4 +143,4 @@ spec:
singular: diagnostic
kind: Diagnostic
shortNames:
- apd
- apd
16 changes: 16 additions & 0 deletions deployment/identity.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: "aadpodidentity.k8s.io/v1"
kind: AzureIdentity
metadata:
name: aks-periscope
spec:
type: 0 # Set type: 0 for user-assigned MSI or type: 1 for Service Principal.
resourceID: dummy
clientID: dummy
---
apiVersion: "aadpodidentity.k8s.io/v1"
kind: AzureIdentityBinding
metadata:
name: aks-periscope-binding
spec:
azureIdentity: aks-periscope
selector: aks-periscope
43 changes: 43 additions & 0 deletions deployment/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: aks-periscope

resources:
# - identity.yaml # Remove this template if using SAS Token
- aks-periscope.yaml

# secretGenerator:
# - name: azureblob-secret
# literals:
# - AZURE_BLOB_ACCOUNT_NAME= # (Required) <accountName, base64 encoded>
# - AZURE_BLOB_SAS_KEY= # Required only if using SAS Key <saskey, base64 encoded>

# patches:
# # Remove this patch if using SAS Token
# - target:
# group: apps
# kind: DaemonSet
# name: aks-periscope
# version: v1
# patch: |-
# - op: add
# path: '/spec/template/metadata/labels/aadpodidbinding'
# value: aks-periscope
# # Remove this patch if using SAS Token
# - target:
# group: aadpodidentity.k8s.io
# kind: AzureIdentity
# name: aks-periscope
# version: v1
# patch: |-
# - op: replace
# path: '/spec/resourceID'
# value: <IDENTITY_RESOURCE_ID>
# - op: replace
# path: '/spec/clientID'
# value: <IDENTITY_CLIENT_ID>

images:
- name: aks-periscope
newName: aksrepos.azurecr.io/staging/aks-periscope:v0.3
13 changes: 5 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
module github.com/Azure/aks-periscope

go 1.15

require (
github.com/Azure/azure-storage-blob-go v0.7.0
github.com/Microsoft/go-winio v0.4.13 // indirect
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect
github.com/docker/distribution v2.7.1+incompatible // indirect
github.com/docker/docker v1.13.1 // indirect
github.com/docker/go-connections v0.4.0 // indirect
github.com/docker/go-units v0.4.0 // indirect
github.com/opencontainers/go-digest v1.0.0-rc1 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.8
github.com/kr/pretty v0.2.1 // indirect
github.com/pkg/errors v0.8.1 // indirect
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 // indirect
)
50 changes: 22 additions & 28 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,38 @@ github.com/Azure/azure-pipeline-go v0.2.1 h1:OLBdZJ3yvOn2MezlWvbrBMTEUQC72zAftRZ
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
github.com/Azure/azure-storage-blob-go v0.7.0 h1:MuueVOYkufCxJw5YZzF842DY2MBsp+hLuh2apKY0mck=
github.com/Azure/azure-storage-blob-go v0.7.0/go.mod h1:f9YQKtsG1nMisotuTPpO0tjNuEjKRYAcJU8/ydDI++4=
github.com/Microsoft/go-winio v0.4.13 h1:Hmi80lzZuI/CaYmlJp/b+FjZdRZhKu9c2mDVqKlLWVs=
github.com/Microsoft/go-winio v0.4.13/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f h1:JOrtw2xFKzlg+cbHpyrpLDmnN1HqhBfnX7WDiW7eG2c=
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.13.1 h1:IkZjBSIc8hBjLpqeAbeE5mca5mNgeatLHBy3GO78BWo=
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ=
github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest/adal v0.9.8 h1:bW6ZdxqMYWsxGikpM62SSE3jnvOXVu9SXzJTuj1WM3Y=
github.com/Azure/go-autorest/autorest/adal v0.9.8/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A=
github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk=
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk=
github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149 h1:HfxbT6/JcvIljmERptWhwa8XzP7H3T+Z2N26gTsaDaA=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU=
golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 h1:hb9wdF1z5waM+dSIICn1l0DkLVDT3hqhhQsDNUmHPRE=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 h1:Ao/3l156eZf2AW5wK8a7/smtodRU+gha3+BeqJ69lRk=
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7 h1:LepdCS8Gf/MVejFIt8lsiexZATdoGVyp5bcyS+rYoUI=
golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3 h1:4y9KwBHBgBNwDbtu44R5o1fdOCQUEXhbk/P4A9WmJq0=
golang.org/x/sys v0.0.0-20190801041406-cbf593c0f2f3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
22 changes: 22 additions & 0 deletions pkg/authentication/authentication.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package authentication

import (
"fmt"

"github.com/Azure/go-autorest/autorest/adal"
)

// GetTokenFromAssignedID retrieves a token from the environment config
func GetTokenFromAssignedID(resource string) (*adal.ServicePrincipalToken, error) {
msiEndpoint, err := adal.GetMSIEndpoint()
if err != nil {
return nil, fmt.Errorf("get MSI endpoint: %+v", err)
}

spToken, err := adal.NewServicePrincipalTokenFromMSI(msiEndpoint, resource)
if err != nil {
return nil, fmt.Errorf("acquire a SP token using the MSI endpoint (%s): %+v", msiEndpoint, err)
}

return spToken, nil
}
77 changes: 77 additions & 0 deletions pkg/blob/blob.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package blob

import (
"fmt"
"net/url"
"strconv"
"time"

"github.com/Azure/aks-periscope/pkg/authentication"
"github.com/Azure/azure-storage-blob-go/azblob"
"github.com/Azure/go-autorest/autorest/adal"
)

const (
tokenRefreshTolerance = 300
)

// CreateContainerURLFromSASKey creates a ContainerURL from a SAS Key
func CreateContainerURLFromSASKey(accountName string, containerName string, sasKey string) (azblob.ContainerURL, error) {
credentials := azblob.NewAnonymousCredential()

return createContainerURL(credentials, accountName, containerName, sasKey)
}

// CreateContainerURLFromAssignedIdentity creates a ContainerURL from the assigned identity
func CreateContainerURLFromAssignedIdentity(accountName string, containerName string) (azblob.ContainerURL, error) {
// The value can be found at azure.PublicCloud.ResourceIdentifiers.Storage
spToken, err := authentication.GetTokenFromAssignedID("https://storage.azure.com/")
if err != nil {
return azblob.ContainerURL{}, err
}

err = spToken.Refresh()
if err != nil {
return azblob.ContainerURL{}, fmt.Errorf("get token: %+v", err)
}

token := spToken.Token()
if token.IsZero() {
return azblob.ContainerURL{}, fmt.Errorf("cannot acquire initial token from the SP Token: %+v", token)
}

credentials := azblob.NewTokenCredential(token.AccessToken, defaultTokenRefreshFunction(spToken))
return createContainerURL(credentials, accountName, containerName, "")
}

func createContainerURL(credentials azblob.Credential, accountName string, containerName string, sasKey string) (azblob.ContainerURL, error) {
pipeline := azblob.NewPipeline(credentials, azblob.PipelineOptions{})

url, err := url.Parse(fmt.Sprintf("https://%s.blob.core.windows.net/%s%s", accountName, containerName, sasKey))
if err != nil {
return azblob.ContainerURL{}, fmt.Errorf("build blob container url: %+v", err)
}

containerURL := azblob.NewContainerURL(*url, pipeline)

return containerURL, nil
}

var defaultTokenRefreshFunction = func(spToken *adal.ServicePrincipalToken) func(credential azblob.TokenCredential) time.Duration {
return func(credential azblob.TokenCredential) time.Duration {
if err := spToken.Refresh(); err != nil {
fmt.Printf("refresh token: %+v", err)
return 0
}

expiresIn, err := strconv.ParseInt(string(spToken.Token().ExpiresIn), 10, 64)
if err != nil {
fmt.Printf("new token expiresIn cannot be parsed: %+v", err)
return 0
}

credential.SetToken(spToken.Token().AccessToken)

return time.Duration(expiresIn-tokenRefreshTolerance) * time.Second
}
}
4 changes: 3 additions & 1 deletion pkg/collector/collector.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package collector

import "github.com/Azure/aks-periscope/pkg/interfaces"
import (
"github.com/Azure/aks-periscope/pkg/interfaces"
)

// Type defines Collector Type
type Type int
Expand Down
Loading