Skip to content

Commit d33d50c

Browse files
authored
Merge branch 'main' into issue-390-publicecr
2 parents 16e18e7 + d66bf0b commit d33d50c

File tree

30 files changed

+1598
-117
lines changed

30 files changed

+1598
-117
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @davidcollom
1+
* @davidcollom @maria-reynoso

.github/workflows/build-test.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ concurrency:
88
group: ${{ github.workflow }}-${{ github.ref }}
99
cancel-in-progress: true
1010

11+
# Setting some default permissions for all jobs
12+
permissions:
13+
contents: read
14+
security-events: read
15+
pull-requests: read
16+
checks: write
17+
1118
jobs:
1219
lint:
13-
permissions:
14-
contents: read # for actions/checkout to fetch code
15-
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
16-
checks: write # for golangci/golangci-lint-action to annotate Pull Requests
1720
name: Lint Go code
1821
runs-on: ubuntu-latest
1922
steps:
@@ -35,6 +38,8 @@ jobs:
3538
code-scan:
3639
name: Code Scan
3740
runs-on: ubuntu-latest
41+
permissions:
42+
security-events: write
3843
steps:
3944
- name: Checkout code
4045
uses: actions/checkout@v5
@@ -51,13 +56,15 @@ jobs:
5156
severity: "CRITICAL,HIGH,MEDIUM"
5257

5358
- name: Upload Trivy scan results to GitHub Security tab
54-
uses: github/codeql-action/upload-sarif@v3
59+
uses: github/codeql-action/upload-sarif@v4
5560
with:
5661
sarif_file: "trivy-results.sarif"
5762

5863
govulncheck:
5964
runs-on: ubuntu-latest
6065
name: Run govulncheck
66+
permissions:
67+
security-events: write
6168
steps:
6269
# We only need to checkout as govuln does the go setup...
6370
- name: Checkout code
@@ -98,7 +105,7 @@ jobs:
98105
continue-on-error: true
99106

100107
- name: Generate code coverage artifacts
101-
uses: actions/upload-artifact@v4
108+
uses: actions/upload-artifact@v5
102109
with:
103110
name: code-coverage
104111
path: coverage.out

.github/workflows/helm-test.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
1212
cancel-in-progress: true
1313

14+
permissions:
15+
contents: read
16+
pull-requests: read
17+
checks: write
18+
1419
jobs:
1520
lint:
16-
permissions:
17-
contents: read # for actions/checkout to fetch code
18-
pull-requests: read # for golangci/golangci-lint-action to fetch pull requests
1921
name: Lint Helm Chart
2022
runs-on: ubuntu-latest
2123
steps:
@@ -28,6 +30,8 @@ jobs:
2830
go-version-file: go.mod
2931

3032
- uses: azure/setup-helm@v4
33+
with:
34+
version: v3.19.0
3135

3236
- run: helm lint deploy/charts/version-checker
3337

@@ -44,6 +48,8 @@ jobs:
4448
go-version-file: go.mod
4549

4650
- uses: azure/setup-helm@v4
51+
with:
52+
version: v3.19.0
4753

4854
- name: Install helm Plugins
4955
run: |

.github/workflows/release-tagger.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ concurrency:
1111
group: ${{ github.workflow }}-${{ github.ref }}
1212
cancel-in-progress: true
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
release-name:
1619
name: Generate a clean release name from the branch/tag
@@ -110,12 +113,13 @@ jobs:
110113

111114
- name: Build Changelog
112115
id: github_release
113-
uses: mikepenz/release-changelog-builder-action@v5
116+
uses: mikepenz/release-changelog-builder-action@v6
114117
with:
115118
ignorePreReleases: true
119+
toTag: "main"
116120

117121
- name: Create Release PR
118-
uses: devops-infra/action-pull-request@v0.6.1
122+
uses: devops-infra/action-pull-request@v1.0.2
119123
with:
120124
github_token: ${{ secrets.GITHUB_TOKEN }}
121125
target_branch: main
@@ -154,6 +158,8 @@ jobs:
154158

155159
- name: Setup Helm
156160
uses: azure/setup-helm@v4
161+
with:
162+
version: v3.19.0
157163

158164
# FIXME: We need a Repo Created in Quay ahead of time for this to work
159165
# - name: Login to Quay.io for OCI Push
@@ -207,7 +213,7 @@ jobs:
207213
# Install the cosign tool except on PR
208214
# https://github.com/sigstore/cosign-installer
209215
- name: Install cosign
210-
uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 #v3.10.0
216+
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad #v4.0.0
211217
with:
212218
cosign-release: "v2.2.4"
213219

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ARG TARGETOS TARGETARCH
99
RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -o ./bin/version-checker ./cmd/.
1010

1111

12-
FROM alpine:3.22.1
12+
FROM alpine:3.22.2
1313
LABEL description="Kubernetes utility for exposing used image versions compared to the latest version, as metrics."
1414

1515
RUN apk --no-cache add ca-certificates

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ verify: test build ## tests and builds version-checker
2222

2323
image: ## build docker image
2424
GOARCH=$(ARCH) GOOS=linux CGO_ENABLED=0 go build -o ./bin/version-checker-linux ./cmd/.
25-
docker build -t quay.io/jetstack/version-checker:v0.9.3 .
25+
docker build -t quay.io/jetstack/version-checker:v0.10.0 .
2626

2727
clean: ## clean up created files
2828
rm -rf \

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,29 @@
66
![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/jetstack/version-checker)
77

88
version-checker is a Kubernetes utility for observing the current versions of
9-
images running in the cluster, as well as the latest available upstream. These
10-
checks get exposed as Prometheus metrics to be viewed on a dashboard, or _soft_
11-
alert cluster operators.
9+
images running in the cluster, as well as the latest available upstream. Additionally,
10+
it monitors the Kubernetes cluster version against the latest available releases
11+
using official Kubernetes release channels. These checks get exposed as Prometheus
12+
metrics to be viewed on a dashboard, or _soft_ alert cluster operators.
13+
14+
## Features
15+
16+
- **Container Image Version Checking**: Monitor and compare container image versions running in the cluster against their latest upstream versions
17+
- **Kubernetes Version Monitoring**: Track your cluster's Kubernetes version against the latest available releases from official Kubernetes channels
18+
- **Prometheus Metrics Integration**: Export all version information as Prometheus metrics for monitoring and alerting
19+
- **Flexible Channel Selection**: Configure which Kubernetes release channel to track (stable, latest, etc.)
1220

1321
---
1422

1523
## Why Use version-checker?
1624

17-
- **Improved Security**: Ensures images are up-to-date, reducing the risk of using vulnerable or compromised versions.
18-
- **Enhanced Visibility**: Provides a clear overview of all running container versions across clusters.
19-
- **Operational Efficiency**: Automates image tracking and reduces manual intervention in version management.
20-
- **Compliance and Policy**: Enforcement: Helps maintain version consistency and adherence to organizational policies.
25+
- **Improved Security**: Ensures images and Kubernetes clusters are up-to-date, reducing the risk of using vulnerable or compromised versions.
26+
- **Enhanced Visibility**: Provides a clear overview of all running container versions and cluster versions across clusters.
27+
- **Operational Efficiency**: Automates image and Kubernetes version tracking and reduces manual intervention in version management.
28+
- **Compliance and Policy Enforcement**: Helps maintain version consistency and adherence to organizational policies for both applications and infrastructure.
2129
- **Incremental Upgrades**: Facilitates frequent, incremental updates to reduce the risk of large, disruptive upgrades.
2230
- **Add-On Compatibility**: Ensures compatibility with the latest versions of Kubernetes add-ons and dependencies.
31+
- **Proactive Cluster Management**: Stay informed about Kubernetes security updates and new features through automated version monitoring.
2332

2433
---
2534

@@ -45,6 +54,7 @@ These registries support authentication.
4554

4655
- [Installation Guide](docs/installation.md)
4756
- [Metrics](docs/metrics.md)
57+
- [New Features](docs/new_features.md)
4858

4959
---
5060

cmd/app/app.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,36 @@ func NewCommand(ctx context.Context) *cobra.Command {
110110
return fmt.Errorf("failed to setup image registry clients: %s", err)
111111
}
112112

113-
c := controller.NewPodReconciler(opts.CacheTimeout,
113+
_ = client
114+
115+
podController := controller.NewPodReconciler(opts.CacheTimeout,
114116
metricsServer,
115117
client,
116118
mgr.GetClient(),
117119
log,
118120
opts.RequeueDuration,
119121
opts.DefaultTestAll,
120122
)
121-
122-
if err := c.SetupWithManager(mgr); err != nil {
123+
if err := podController.SetupWithManager(mgr); err != nil {
123124
return err
124125
}
125126

127+
kubeController := controller.NewKubeReconciler(
128+
log,
129+
mgr.GetConfig(),
130+
metricsServer,
131+
opts.KubeInterval,
132+
opts.KubeChannel,
133+
)
134+
135+
// Only add to manager if controller was created (channel was specified)
136+
if kubeController != nil {
137+
if err := mgr.Add(kubeController); err != nil {
138+
return err
139+
}
140+
log.WithField("channel", opts.KubeChannel).Info("Kubernetes version checking enabled")
141+
}
142+
126143
// Start the manager and all controllers
127144
log.Info("Starting controller manager")
128145
if err := mgr.Start(ctx); err != nil {

cmd/app/options.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ type Options struct {
7575
CacheSyncPeriod time.Duration
7676
RequeueDuration time.Duration
7777

78+
KubeChannel string
79+
KubeInterval time.Duration
80+
81+
// kubeConfigFlags holds the flags for the kubernetes client
7882
kubeConfigFlags *genericclioptions.ConfigFlags
7983

8084
selfhosted selfhosted.Options
@@ -141,7 +145,15 @@ func (o *Options) addAppFlags(fs *pflag.FlagSet) {
141145

142146
fs.DurationVarP(&o.CacheSyncPeriod,
143147
"cache-sync-period", "", 5*time.Hour,
144-
"The time in which all resources should be updated.")
148+
"The duration in which all resources should be updated.")
149+
150+
fs.DurationVarP(&o.KubeInterval,
151+
"kube-interval", "", o.CacheSyncPeriod,
152+
"The time in which kubernetes channels updates are checked.")
153+
154+
fs.StringVarP(&o.KubeChannel,
155+
"kube-channel", "", "stable",
156+
"The Kubernetes channel to check against for cluster updates.")
145157

146158
fs.DurationVarP(&o.GracefulShutdownTimeout,
147159
"graceful-shutdown-timeout", "", 10*time.Second,

0 commit comments

Comments
 (0)