Compare commits

..
8 Commits
Author SHA1 Message Date
Robert Brennan c304036f97 Revert "go mod tidy"
This reverts commit 3eb2b6e2c9.
2020-05-21 11:14:48 +00:00
Robert Brennan c1061b50e0 Revert "fix go.sum"
This reverts commit 3b07496a4d.
2020-05-21 11:14:36 +00:00
Robert Brennan 3b07496a4d fix go.sum 2020-05-21 11:08:09 +00:00
Robert Brennan 3eb2b6e2c9 go mod tidy 2020-05-21 10:42:00 +00:00
Robert Brennan 5f5da069fd update deps 2020-05-21 10:38:58 +00:00
Robert Brennan ceeffb97a0 update to 1.0.2 2020-05-21 10:29:59 +00:00
Robert Brennan 27faab919c handle case where RBAC is missing for a CRD (#305)
* handle case where RBAC is missing for a CRD

* handle error
2020-05-21 06:27:15 -04:00
Robert Brennan f4fc7c1b5d add ARM support (#303) 2020-05-20 10:40:08 -04:00
7 changed files with 44 additions and 36 deletions
+13
View File
@@ -6,6 +6,19 @@ changelog:
exclude:
- '^docs:'
- '^test:'
builds:
- id: watcher
env:
- CGO_ENABLED=0
- GO111MODULE=on
goarch:
- amd64
- arm
- arm64
- 386
goarm:
- 6
- 7
brews:
- name: polaris
github:
+6
View File
@@ -1,5 +1,11 @@
# x.x.x (next release)
# 1.0.2
* Fixed case where custom CRDs are not covered by RBAC
# 1.0.1
* Added ARM binaries to releases
# 1.0.0
## New Features
* Added support for custom checks using JSON Schema
+1 -1
View File
@@ -5,7 +5,7 @@
[![Version][version-image]][version-link] [![CircleCI][circleci-image]][circleci-link] [![Go Report Card][goreport-image]][goreport-link]
</div>
[version-image]: https://img.shields.io/static/v1.svg?label=Version&message=1.0.0&color=239922
[version-image]: https://img.shields.io/static/v1.svg?label=Version&message=1.0.2&color=239922
[version-link]: https://github.com/FairwindsOps/polaris
[goreport-image]: https://goreportcard.com/badge/github.com/FairwindsOps/polaris
+1 -1
View File
@@ -79,7 +79,7 @@ require (
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299
golang.org/x/text v0.3.2
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
golang.org/x/tools v0.0.0-20200519205726-57a9e4404bf7
golang.org/x/tools v0.0.0-20200520220537-cf2d1e09c845
google.golang.org/api v0.5.0
google.golang.org/appengine v1.6.6
google.golang.org/genproto v0.0.0-20190516172635-bb713bdc0e52
+2
View File
@@ -602,6 +602,8 @@ golang.org/x/tools v0.0.0-20200518172458-c79c01b1c51c h1:ZRonYJXo3PhAXRjx2yu3CH6
golang.org/x/tools v0.0.0-20200518172458-c79c01b1c51c/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200519205726-57a9e4404bf7 h1:nm4zDh9WvH4jiuUpMY5RUsvOwrtTVVAsUaCdLW71hfY=
golang.org/x/tools v0.0.0-20200519205726-57a9e4404bf7/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/tools v0.0.0-20200520220537-cf2d1e09c845 h1:F4gQH8TKyCccYDuNHX5TfZwiM8QWnPbSPUFE96qvGbs=
golang.org/x/tools v0.0.0-20200520220537-cf2d1e09c845/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+1 -1
View File
@@ -20,7 +20,7 @@ import (
const (
// Version represents the current release version of Polaris
Version = "1.0.0"
Version = "1.0.2"
)
func main() {
+20 -33
View File
@@ -62,48 +62,35 @@ func NewGenericWorkload(podResource kubeAPICoreV1.Pod, dynamicClientPointer *dyn
key := fmt.Sprintf("%s/%s/%s", firstOwner.Kind, workload.ObjectMeta.GetNamespace(), firstOwner.Name)
lastKey = key
abstractObject, ok := objectCache[key]
if ok {
objMeta, err := meta.Accessor(&abstractObject)
if !ok {
fqKind := schema.FromAPIVersionAndKind(firstOwner.APIVersion, firstOwner.Kind)
mapping, err := restMapper.RESTMapping(fqKind.GroupKind(), fqKind.Version)
if err != nil {
logrus.Warnf("Error retrieving parent metadata %s of API %s and Kind %s because of error: %v ", firstOwner.Name, firstOwner.APIVersion, firstOwner.Kind, err)
logrus.Warnf("Error retrieving mapping %s of API %s and Kind %s because of error: %v ", firstOwner.Name, firstOwner.APIVersion, firstOwner.Kind, err)
return workload, err
}
workload.ObjectMeta = objMeta
owners = abstractObject.GetOwnerReferences()
continue
cacheAllObjectsOfKind(dynamicClient, mapping.Resource, objectCache)
if err != nil {
logrus.Warnf("Error getting objects of Kind %s %v", firstOwner.Kind, err)
return workload, nil // Note -we don't return an error so we can recover from the case where RBAC is insufficient
}
abstractObject, ok = objectCache[key]
if !ok {
logrus.Errorf("Cache missed %s again", key)
return workload, errors.New("Could not retrieve parent object")
}
}
fqKind := schema.FromAPIVersionAndKind(firstOwner.APIVersion, firstOwner.Kind)
mapping, err := restMapper.RESTMapping(fqKind.GroupKind(), fqKind.Version)
objMeta, err := meta.Accessor(&abstractObject)
if err != nil {
logrus.Warnf("Error retrieving mapping %s of API %s and Kind %s because of error: %v ", firstOwner.Name, firstOwner.APIVersion, firstOwner.Kind, err)
return workload, nil
}
err = cacheAllObjectsOfKind(dynamicClient, mapping.Resource, objectCache)
if err != nil {
logrus.Warnf("Error getting objects of Kind %s %v", firstOwner.Kind, err)
logrus.Warnf("Error retrieving parent metadata %s of API %s and Kind %s because of error: %v ", firstOwner.Name, firstOwner.APIVersion, firstOwner.Kind, err)
return workload, err
}
abstractObject, ok = objectCache[key]
if ok {
objMeta, err := meta.Accessor(&abstractObject)
if err != nil {
logrus.Warnf("Error retrieving parent metadata %s of API %s and Kind %s because of error: %v ", firstOwner.Name, firstOwner.APIVersion, firstOwner.Kind, err)
return workload, err
}
workload.ObjectMeta = objMeta
owners = abstractObject.GetOwnerReferences()
continue
} else {
logrus.Errorf("Cache missed again %s", key)
return workload, errors.New("Could not retrieve parent object")
}
workload.ObjectMeta = objMeta
owners = abstractObject.GetOwnerReferences()
}
if lastKey != "" {
bytes, err := json.Marshal(objectCache[lastKey])
if err != nil {