Skip to content

Commit b4da33a

Browse files
committed
feat(k8s1.32): Add rego for v1.32 deprecations
Signed-off-by: dark0dave <[email protected]>
1 parent 94cd462 commit b4da33a

File tree

10 files changed

+224
-68
lines changed

10 files changed

+224
-68
lines changed

.github/workflows/main.yaml

+21-10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
env:
1010
REGISTRY: ghcr.io
1111
IMAGE_NAME: ${{ github.repository }}
12+
concurrency:
13+
group: ${{ github.ref }}-${{ github.workflow }}
14+
cancel-in-progress: true
1215
jobs:
1316
pre-commit:
1417
runs-on: ubuntu-latest
@@ -58,7 +61,6 @@ jobs:
5861
git config --global --add safe.directory /__w/kube-no-trouble/kube-no-trouble
5962
scripts/alpine-setup.sh
6063
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} make all
61-
make changelog
6264
shell: sh
6365
env:
6466
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -102,13 +104,14 @@ jobs:
102104
"kindest/node:v1.19.16",
103105
"kindest/node:v1.20.15",
104106
"kindest/node:v1.21.14",
105-
"kindest/node:v1.22.15",
106-
"kindest/node:v1.23.13",
107-
"kindest/node:v1.24.7",
108-
"kindest/node:v1.25.3",
109-
"kindest/node:v1.26.6",
110-
"kindest/node:v1.27.3",
111-
"kindest/node:v1.28.0"
107+
"kindest/node:v1.22.17",
108+
"kindest/node:v1.23.17",
109+
"kindest/node:v1.24.17",
110+
"kindest/node:v1.25.16",
111+
"kindest/node:v1.26.14",
112+
"kindest/node:v1.27.11",
113+
"kindest/node:v1.28.7",
114+
"kindest/node:v1.29.2"
112115
]
113116
steps:
114117
- name: Checkout
@@ -121,14 +124,14 @@ jobs:
121124
name: release-artifacts-linux-amd64
122125
path: release-artifacts
123126
- name: Create k8s Kind Cluster
124-
uses: helm/kind-action@v1.4.0
127+
uses: helm/kind-action@v1.10.0
125128
with:
126129
node_image: ${{ matrix.k8s_version }}
127130
cluster_name: kubent-test-cluster
128131
- name: run integration test
129132
run: |
130133
tar xvzf release-artifacts/kubent-*-linux-amd64.tar.gz
131-
kubectl version --short
134+
kubectl version
132135
kubectl cluster-info --context kind-kubent-test-cluster
133136
./kubent
134137
create-release:
@@ -141,6 +144,14 @@ jobs:
141144
upload_url: ${{ steps.create_release.outputs.upload_url }}
142145
tag_name: ${{ steps.get_tag.outputs.git_tag }}
143146
steps:
147+
- name: Checkout
148+
uses: actions/[email protected]
149+
with:
150+
fetch-depth: 0
151+
set-safe-directory: true
152+
- name: create release notes
153+
run: |
154+
make changelog
144155
- uses: actions/download-artifact@v1
145156
with:
146157
name: release-artifacts-linux-amd64

.pre-commit-config.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
1+
default_install_hook_types: [pre-commit, commit-msg]
12
repos:
23
- repo: https://github.com/pre-commit/pre-commit-hooks
34
rev: v4.5.0
45
hooks:
56
- id: check-json
7+
stages: [pre-commit]
68
- id: check-added-large-files
9+
stages: [pre-commit]
710
- id: trailing-whitespace
11+
stages: [pre-commit]
812
- id: end-of-file-fixer
13+
stages: [pre-commit]
914
exclude_types: [ svg ]
1015
- repo: https://github.com/jumanjihouse/pre-commit-hooks
1116
rev: 3.0.0
1217
hooks:
1318
- id: forbid-binary
19+
stages: [pre-commit]
1420
exclude_types: [ png ]
1521
- id: git-dirty
22+
stages: [pre-commit]
1623
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
1724
rev: v2.11.0
1825
hooks:
1926
- id: pretty-format-golang
27+
stages: [pre-commit]
2028
- repo: https://github.com/codespell-project/codespell
2129
rev: v2.2.6
2230
hooks:
2331
- id: codespell
32+
stages: [pre-commit]
2433
- repo: https://github.com/commitizen-tools/commitizen
2534
rev: v3.13.0
2635
hooks:

cliff.toml

+28-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,44 @@
11
# git-cliff ~ default configuration file
22
# https://git-cliff.org/docs/configuration
3-
#
4-
# Lines starting with "#" are comments.
5-
# Configuration options are organized into tables and keys.
6-
# See documentation for more information on available options.
7-
3+
[remote.github]
4+
owner = "doitintl"
5+
repo = "kube-no-trouble"
86
[changelog]
97
# changelog header
108
header = ""
119
# template for the changelog body
1210
# https://tera.netlify.app/docs
1311
body = """
14-
**Docker Image**: {{ get_env(name='REGISTRY', default='') }}/{{ get_env(name='IMAG_NAME', default='') }}:{{ get_env(name='GITHUB_REF_NAME', default='') }}
15-
16-
### Changelog
12+
### Changelog \
1713
{% for group, commits in commits | group_by(attribute="group") %}
1814
\n#### {{ group | striptags | trim | upper_first }}:
1915
{% for commit in commits
2016
| filter(attribute="group")
21-
| sort(attribute="scope") %}
17+
| unique(attribute="message")
18+
| filter(attribute="merge_commit", value=false) %}
2219
- {{commit.scope}}: \
23-
{{ commit.message }} ([{{ commit.id | truncate(length=7, end="") }}](https://github.com/doitintl/kube-no-trouble/commit/{{ commit.id }}) by [{{ commit.author.name }}](https://github.com/{{ commit.author.name }}))
20+
{{ commit.message }}\
21+
{% if not commit.github.pr_number %} [{{ commit.id | truncate(length=7, end="") }}]({{ self::remote_url() }}/commit/{{ commit.id }}){%- endif %}\
22+
{% if commit.github.username %} by @{{ commit.github.username }}\
23+
{% else %} by [{{ commit.author.name }}](https://github.com/{{ commit.author.name }}){%- endif %}\
2424
{%- endfor -%}
2525
{% endfor %}
26+
{% if version %}
27+
{% if previous.version %}\
28+
Full Changelog: [{{ previous.version }}...{{ version }}]({{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }})\
29+
{% endif %}\
30+
{% else -%}\
31+
{% raw %}\n{% endraw %}\
32+
{% endif %}\
33+
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
34+
### New Contributors
35+
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
36+
* @{{ contributor.username }} made their first contribution in #{{ contributor.pr_number }}
37+
{%- endfor -%}
38+
{%- endif %}
39+
{%- macro remote_url() -%}
40+
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
41+
{%- endmacro -%}
2642
"""
2743
# remove the leading and trailing whitespace from the template
2844
trim = true
@@ -42,6 +58,8 @@ split_commits = false
4258
# regex for preprocessing the commit messages
4359
commit_preprocessors = [
4460
# { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"}, # replace issue numbers
61+
# remove pr numbers from commits
62+
{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "" },
4563
]
4664
# regex for parsing and grouping commits
4765
commit_parsers = [

fixtures/flowschema-v1beta3.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: flowcontrol.apiserver.k8s.io/v1beta3
2+
kind: FlowSchema
3+
metadata:
4+
name: service-accounts-test
5+
spec:
6+
distinguisherMethod:
7+
type: ByUser
8+
matchingPrecedence: 9000
9+
priorityLevelConfiguration:
10+
name: workload-medium
11+
rules:
12+
- nonResourceRules:
13+
- nonResourceURLs:
14+
- '*'
15+
verbs:
16+
- '*'
17+
resourceRules:
18+
- apiGroups:
19+
- '*'
20+
clusterScope: true
21+
namespaces:
22+
- '*'
23+
resources:
24+
- '*'
25+
verbs:
26+
- '*'
27+
subjects:
28+
- group:
29+
name: system:serviceaccounts
30+
kind: Group
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: flowcontrol.apiserver.k8s.io/v1beta3
2+
kind: PriorityLevelConfiguration
3+
metadata:
4+
name: workload-medium
5+
spec:
6+
limited:
7+
assuredConcurrencyShares: 70
8+
limitResponse:
9+
queuing:
10+
handSize: 6
11+
queueLengthLimit: 50
12+
queues: 128
13+
type: Queue
14+
type: Limited

go.mod

+6-7
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ toolchain go1.22.1
66

77
require (
88
github.com/ghodss/yaml v1.0.0
9-
github.com/hashicorp/go-version v1.6.0
9+
github.com/hashicorp/go-version v1.7.0
1010
github.com/open-policy-agent/opa v0.64.1
11-
github.com/rs/zerolog v1.32.0
11+
github.com/rs/zerolog v1.33.0
1212
github.com/spf13/pflag v1.0.5
1313
helm.sh/helm/v3 v3.13.3
14-
k8s.io/apimachinery v0.28.4
14+
k8s.io/apimachinery v0.30.2
1515
k8s.io/client-go v0.28.4 // Change me and break everything
1616
k8s.io/klog/v2 v2.120.1
1717
)
@@ -38,7 +38,6 @@ require (
3838
github.com/gogo/protobuf v1.3.2 // indirect
3939
github.com/golang/protobuf v1.5.4 // indirect
4040
github.com/google/gnostic-models v0.6.8 // indirect
41-
github.com/google/go-cmp v0.6.0 // indirect
4241
github.com/google/gofuzz v1.2.0 // indirect
4342
github.com/google/uuid v1.6.0 // indirect
4443
github.com/gorilla/mux v1.8.1 // indirect
@@ -87,9 +86,9 @@ require (
8786
gopkg.in/yaml.v3 v3.0.1 // indirect
8887
k8s.io/api v0.28.4 // indirect
8988
k8s.io/apiextensions-apiserver v0.28.4 // indirect
90-
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
91-
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 // indirect
89+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
90+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
9291
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
93-
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
92+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
9493
sigs.k8s.io/yaml v1.4.0 // indirect
9594
)

go.sum

+12
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 h1:YBftPWNWd4WwGqtY2yeZL2ef8rH
108108
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
109109
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
110110
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
111+
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
112+
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
111113
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
112114
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
113115
github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g=
@@ -192,6 +194,8 @@ github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncj
192194
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
193195
github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0=
194196
github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
197+
github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8=
198+
github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss=
195199
github.com/rubenv/sql-migrate v1.5.2 h1:bMDqOnrJVV/6JQgQ/MxOpU+AdO8uzYYA/TxFUBzFtS0=
196200
github.com/rubenv/sql-migrate v1.5.2/go.mod h1:H38GW8Vqf8F0Su5XignRyaRcbXbJunSWxs+kmzlg0Is=
197201
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
@@ -318,17 +322,25 @@ k8s.io/apiextensions-apiserver v0.28.4 h1:AZpKY/7wQ8n+ZYDtNHbAJBb+N4AXXJvyZx6ww6
318322
k8s.io/apiextensions-apiserver v0.28.4/go.mod h1:pgQIZ1U8eJSMQcENew/0ShUTlePcSGFq6dxSxf2mwPM=
319323
k8s.io/apimachinery v0.28.4 h1:zOSJe1mc+GxuMnFzD4Z/U1wst50X28ZNsn5bhgIIao8=
320324
k8s.io/apimachinery v0.28.4/go.mod h1:wI37ncBvfAoswfq626yPTe6Bz1c22L7uaJ8dho83mgg=
325+
k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg=
326+
k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
321327
k8s.io/client-go v0.28.4 h1:Np5ocjlZcTrkyRJ3+T3PkXDpe4UpatQxj85+xjaD2wY=
322328
k8s.io/client-go v0.28.4/go.mod h1:0VDZFpgoZfelyP5Wqu0/r/TRYcLYuJ2U1KEeoaPa1N4=
323329
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
324330
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
325331
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 h1:LyMgNKD2P8Wn1iAwQU5OhxCKlKJy0sHc+PcDwFB24dQ=
326332
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9/go.mod h1:wZK2AVp1uHCp4VamDVgBP2COHZjqD1T68Rf0CM3YjSM=
333+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag=
334+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
327335
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2 h1:qY1Ad8PODbnymg2pRbkyMT/ylpTrCM8P2RJ0yroCyIk=
328336
k8s.io/utils v0.0.0-20230406110748-d93618cff8a2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
337+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI=
338+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
329339
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
330340
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
331341
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE=
332342
sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E=
343+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4=
344+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08=
333345
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
334346
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=

0 commit comments

Comments
 (0)