Skip to content

Commit

Permalink
Updated Readme + removed license header from krew template
Browse files Browse the repository at this point in the history
  • Loading branch information
mikouaj committed Nov 3, 2023
1 parent 1ad9024 commit f139082
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 15 deletions.
14 changes: 0 additions & 14 deletions .krew.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ docker run --rm ghcr.io/google/gke-policy-automation check \
-project my-project -location europe-west2 -name my-cluster
```

### Krew

The GKE Policy Automation is available as a [Krew](https://krew.sigs.k8s.io) plugin.

```sh
kubectl krew install gke-policy
kubectl gke-policy check --discovery -p my-project
```

### Binary

Binaries for Linux, Windows and Mac are available as tarballs in the
Expand Down
114 changes: 114 additions & 0 deletions krew/gke-policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: gke-policy
spec:
shortDescription: Validates GKE clusters configuration
homepage: https://github.com/google/gke-policy-automation
description: |
Tool and policy library for validating Google Kubernetes Engine clusters
against the configuration best practices and scalability limits.
caveats: |
The plugin requires Google Cloud credentials to work.
Use "gcloud auth application-default login" command to authenticate or
specify credentials file as an argument.
version: v1.3.2
platforms:
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_linux_386.zip
sha256: 777f8767744f2ac18764e8dd6a90d65906375da3a03941219d3bbc8d656269c7
selector:
matchLabels:
os: linux
arch: 386
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_linux_arm.zip
sha256: 10306fd19cd963c55347dd650299e204b82268db0e49fa94683d662a45113dd3
selector:
matchLabels:
os: linux
arch: arm
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_linux_amd64.zip
sha256: bd1778d49be6394194f5080f8ce1f12f922c46e983de81881a6f3e64a2edc0ee
selector:
matchLabels:
os: linux
arch: amd64
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_linux_arm64.zip
sha256: 8d7d944cde52337172ebcd619a97b2951d147b98ececf5c04c04ef36fa782934
selector:
matchLabels:
os: linux
arch: arm64
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_windows_386.zip
sha256: 07b9edc4d19a6856667be4b9e5c062f4192f707020db47bbccdbaf18a1f7bfb5
selector:
matchLabels:
os: windows
arch: 386
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_windows_arm.zip
sha256: a0ce0c9458d46fe54d2523d15eadcc5a788bc3a8935e4092de35d8396f45ed54
selector:
matchLabels:
os: windows
arch: arm
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_windows_amd64.zip
sha256: 100c5ba1bb8affb9f82355066aef0476af86fe8d49d1e54b927aedc919658a46
selector:
matchLabels:
os: windows
arch: amd64
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_windows_arm64.zip
sha256: 33b5261cbeb05278c886fb2f314f4145fcbbace75fd50a36e99a0e692f162f60
selector:
matchLabels:
os: windows
arch: arm64
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_freebsd_386.zip
sha256: fefb000928560e1203fa0cb630427d7a7fbbef8ef09082e17171004cc4048070
selector:
matchLabels:
os: freebsd
arch: 386
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_freebsd_arm.zip
sha256: ef3514b68e91f2aaf41160e0f5b06c4449a94e1d445400d0c7c85a5ff60ec10a
selector:
matchLabels:
os: freebsd
arch: arm
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_freebsd_amd64.zip
sha256: c8952e36728c24f9ec5c789218abbdd3d1dd5eeb344d4590dec9d0f4bc2b5b7b
selector:
matchLabels:
os: freebsd
arch: amd64
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_freebsd_arm64.zip
sha256: c5a30a47c723ca251ebb88195f1f2c2a84fb22a9c4462b42dac895080da8f4df
selector:
matchLabels:
os: freebsd
arch: arm64
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_darwin_amd64.zip
sha256: 80bc6505a8e9265545ab9de367a7a158523d961fb7a65eed4677d721f1857e58
selector:
matchLabels:
os: darwin
arch: amd64
- bin: gke-policy
uri: https://github.com/google/gke-policy-automation/releases/download/v1.3.2/gke-policy-automation_1.3.2_darwin_arm64.zip
sha256: 92cfbb2c8b432d56bdbbc582a2ef56f3b37f603fa493fdbb11b4d9d7b064817e
selector:
matchLabels:
os: darwin
arch: arm64
5 changes: 4 additions & 1 deletion scripts/license_header_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@

_EXCLUDE_DIRS = ('.git', '.terraform')
_EXCLUDE_RE = re.compile(r'# skip boilerplate check')
_EXCLUDE_FILES = {".krew.yaml"}
_MATCH_FILES = ('Dockerfile', '.py', '.sh', '.tf', '.yaml', '.yml', '.go', '.rego')
_MATCH_STRING = (r'^\s*([#\*]|[/]{2})\sCopyright [0-9]{4} Google LLC$\s+([#\*]|[/]{2})\s+'
r'([#\*]|[/]{2})\sLicensed under the Apache License, Version 2.0 '
r'\(the "License"\);\s+')
_MATCH_RE = re.compile(_MATCH_STRING, re.M)


def main(base_dirs):
"Cycle through files in base_dirs and check for the Apache 2.0 boilerplate."
errors, warnings = [], []
Expand All @@ -45,6 +45,9 @@ def main(base_dirs):
if fname in _MATCH_FILES or os.path.splitext(fname)[1] in _MATCH_FILES:
fpath = os.path.abspath(os.path.join(root, fname))
content = open(fpath).read()
relPath = os.path.relpath(fpath, dir)
if relPath in _EXCLUDE_FILES:
continue
if _EXCLUDE_RE.search(content):
continue
try:
Expand Down

0 comments on commit f139082

Please sign in to comment.