Skip to content

Commit c4efc17

Browse files
committed
Implement central TLS configuration for PQC readiness
1 parent 9e29e6c commit c4efc17

File tree

912 files changed

+210804
-14
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

912 files changed

+210804
-14
lines changed

.github/codeql/codeql-config.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "Tekton Operator CodeQL Config"
2+
3+
# Suppress go/insecure-tls for tlsconfig.go
4+
# JUSTIFICATION: TLS configuration is inherited from OpenShift's validated
5+
# cluster-wide security profile (APIServer.spec.tlsSecurityProfile), not hardcoded.
6+
# This ensures compliance with administrator-defined security policies and enables
7+
# FIPS compliance and Post-Quantum Cryptography readiness.
8+
query-filters:
9+
- exclude:
10+
id: go/insecure-tls
11+
paths:
12+
- pkg/reconciler/openshift/common/tlsconfig.go
13+

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ jobs:
4747
uses: github/codeql-action/init@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10
4848
with:
4949
languages: ${{ matrix.language }}
50-
# If you wish to specify custom queries, you can do so here or in a config file.
51-
# By default, queries listed here will override any specified in a config file.
52-
# Prefix the list here with "+" to use these queries and those in the config file.
53-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
50+
config-file: ./.github/codeql/codeql-config.yml
5451

5552
- uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
5653
with:

cmd/openshift/webhook/main.go

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ import (
2020
"context"
2121
"os"
2222

23+
occommon "github.com/tektoncd/operator/pkg/reconciler/openshift/common"
2324
"github.com/tektoncd/operator/pkg/webhook"
2425
"knative.dev/pkg/injection"
2526
"knative.dev/pkg/injection/sharedmain"
27+
"knative.dev/pkg/logging"
2628
"knative.dev/pkg/signals"
2729
kwebhook "knative.dev/pkg/webhook"
2830
"knative.dev/pkg/webhook/certificates"
@@ -39,14 +41,40 @@ func main() {
3941
secretName = "tekton-operator-webhook-certs"
4042
}
4143

42-
//Set up a signal context with our webhook options
43-
ctx := kwebhook.WithOptions(signals.NewContext(), kwebhook.Options{
44+
cfg := injection.ParseAndGetRESTConfigOrDie()
45+
ctx := signals.NewContext()
46+
ctx, _ = injection.EnableInjectionOrDie(ctx, cfg)
47+
48+
logger := logging.FromContext(ctx)
49+
50+
// Observe TLS configuration from OpenShift APIServer if feature is enabled
51+
webhookOpts := kwebhook.Options{
4452
ServiceName: serviceName,
4553
Port: 8443,
4654
SecretName: secretName,
47-
})
48-
cfg := injection.ParseAndGetRESTConfigOrDie()
49-
ctx, _ = injection.EnableInjectionOrDie(ctx, cfg)
55+
}
56+
57+
if occommon.IsCentralTLSConfigEnabled() {
58+
logger.Info("Central TLS config is enabled for webhook, observing APIServer TLS profile")
59+
60+
// Observe TLS config (stores in context)
61+
ctx = occommon.ObserveAndStoreTLSConfig(ctx, cfg)
62+
63+
// Get TLS config from context
64+
if tlsConfig := occommon.GetTLSConfigFromContext(ctx); tlsConfig != nil {
65+
// Only set MinVersion (not cipher suites or curves) to avoid knative version bump
66+
webhookOpts.TLSMinVersion = tlsConfig.MinVersion
67+
logger.Infof("Webhook TLS min version set to: %s", occommon.TLSVersionToString(tlsConfig.MinVersion))
68+
} else {
69+
logger.Warn("Central TLS config enabled but TLS config not available from context")
70+
}
71+
} else {
72+
logger.Info("Central TLS config is disabled for webhook")
73+
}
74+
75+
// Set up context with webhook options
76+
ctx = kwebhook.WithOptions(ctx, webhookOpts)
77+
5078
webhook.CreateWebhookResources(ctx)
5179
webhook.SetTypes("openshift")
5280

config/openshift/base/operator.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ spec:
7373
value: tekton.dev/operator
7474
- name: VERSION
7575
value: "devel"
76+
- name: ENABLE_CENTRAL_TLS_CONFIG
77+
value: "false"
7678
- name: AUTOINSTALL_COMPONENTS
7779
valueFrom:
7880
configMapKeyRef:
@@ -138,6 +140,8 @@ spec:
138140
value: "9009"
139141
- name: VERSION
140142
value: "devel"
143+
- name: ENABLE_CENTRAL_TLS_CONFIG
144+
value: "false"
141145
- name: METRICS_DOMAIN
142146
value: tekton.dev/operator
143147
- name: CONFIG_LEADERELECTION_NAME

config/openshift/base/role.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,3 +396,12 @@ rules:
396396
- delete
397397
- update
398398
- patch
399+
# to observe APIServer TLS security profile for central TLS configuration
400+
- apiGroups:
401+
- config.openshift.io
402+
resources:
403+
- apiservers
404+
verbs:
405+
- get
406+
- list
407+
- watch

go.mod

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ require (
1414
github.com/openshift/api v0.0.0-20240521185306-0314f31e7774
1515
github.com/openshift/apiserver-library-go v0.0.0-20230816171015-6bfafa975bfb
1616
github.com/openshift/client-go v0.0.0-20240523113335-452272e0496d
17+
github.com/openshift/library-go v0.0.0-20230503173034-95ca3c14e50a
1718
github.com/sigstore/cosign/v2 v2.6.2
1819
github.com/spf13/cobra v1.10.2
1920
github.com/spf13/viper v1.21.0
@@ -139,10 +140,12 @@ require (
139140
github.com/dustin/go-humanize v1.0.1 // indirect
140141
github.com/emicklei/go-restful/v3 v3.13.0 // indirect
141142
github.com/emicklei/proto v1.14.2 // indirect
143+
github.com/evanphx/json-patch v5.9.0+incompatible // indirect
142144
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
143145
github.com/felixge/httpsnoop v1.0.4 // indirect
144146
github.com/fsnotify/fsnotify v1.9.0 // indirect
145147
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
148+
github.com/ghodss/yaml v1.0.0 // indirect
146149
github.com/go-chi/chi/v5 v5.2.3 // indirect
147150
github.com/go-ini/ini v1.67.0 // indirect
148151
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
@@ -196,6 +199,7 @@ require (
196199
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
197200
github.com/hashicorp/golang-lru v1.0.2 // indirect
198201
github.com/henvic/httpretty v0.0.6 // indirect
202+
github.com/imdario/mergo v0.3.7 // indirect
199203
github.com/in-toto/attestation v1.1.2 // indirect
200204
github.com/in-toto/in-toto-golang v0.9.0 // indirect
201205
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -248,6 +252,7 @@ require (
248252
github.com/protocolbuffers/txtpbfmt v0.0.0-20251016062345-16587c79cd91 // indirect
249253
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
250254
github.com/rivo/uniseg v0.4.7 // indirect
255+
github.com/robfig/cron v1.2.0 // indirect
251256
github.com/rogpeppe/go-internal v1.14.1 // indirect
252257
github.com/sagikazarmark/locafero v0.11.0 // indirect
253258
github.com/sassoftware/relic v7.2.1+incompatible // indirect
@@ -315,12 +320,16 @@ require (
315320
gopkg.in/inf.v0 v0.9.1 // indirect
316321
gopkg.in/ini.v1 v1.67.0 // indirect
317322
gopkg.in/yaml.v2 v2.4.0 // indirect
323+
k8s.io/apiserver v0.32.9 // indirect
324+
k8s.io/component-base v0.32.9 // indirect
318325
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
319326
k8s.io/klog/v2 v2.130.1 // indirect
327+
k8s.io/kube-aggregator v0.27.1 // indirect
320328
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
321329
knative.dev/hack v0.0.0-20250331013814-c577ed9f7775 // indirect
322330
sigs.k8s.io/controller-runtime v0.15.3 // indirect
323331
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
332+
sigs.k8s.io/kube-storage-version-migrator v0.0.4 // indirect
324333
sigs.k8s.io/randfill v1.0.0 // indirect
325334
sigs.k8s.io/release-utils v0.12.2 // indirect
326335
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect

0 commit comments

Comments
 (0)