-
Notifications
You must be signed in to change notification settings - Fork 30
CORENET-7375 d/s merge Bump Kubernetes to 1.36.2 and Go to 1.26 #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ed565b2
b398ef4
8940167
5a6417b
730add9
39446f4
2317965
2d00cf5
cfc3955
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,20 +4,20 @@ jobs: | |
| test: | ||
| strategy: | ||
| matrix: | ||
| go-version: [1.25.x] | ||
| go-version: [1.26.x] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: rg -n 'matrix\.(go|go-version)' .github/workflows/test.ymlRepository: openshift/multus-admission-controller Length of output: 265 🏁 Script executed: sed -n '1,80p' .github/workflows/test.ymlRepository: openshift/multus-admission-controller Length of output: 1250 Use Proposed fix- flag-name: Go-${{ matrix.go }}
+ flag-name: Go-${{ matrix.go-version }}🤖 Prompt for AI Agents |
||
| os: [ubuntu-latest] | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - name: Install Go | ||
| uses: actions/setup-go@v3 | ||
| uses: actions/setup-go@be3c94b385c4f180051c996d336f57a34c397495 # v3 | ||
| with: | ||
| go-version: ${{ matrix.go-version }} | ||
|
|
||
| - name: Checkout code | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3 | ||
|
|
||
| - name: Run Revive Action by pulling pre-built image | ||
| uses: docker://morphy/revive-action:v2 | ||
| uses: docker://morphy/revive-action@sha256:1ec5904abc4d8b2cd5fbb2987fc79a227f21a4231d757cc9a09a9ee3ab3c328b # v2 | ||
| with: | ||
| exclude: "./vendor/..." | ||
|
|
||
|
|
@@ -32,7 +32,7 @@ jobs: | |
| run: sudo ./hack/test.sh | ||
|
|
||
| - name: Send coverage | ||
| uses: shogo82148/actions-goveralls@v1 | ||
| uses: shogo82148/actions-goveralls@8781f5dd05b691c4dd042d5e859c11c73e0104fa # v1 | ||
| with: | ||
| path-to-profile: coverage.out | ||
| flag-name: Go-${{ matrix.go }} | ||
|
|
@@ -43,6 +43,6 @@ jobs: | |
| needs: test | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: shogo82148/actions-goveralls@v1 | ||
| - uses: shogo82148/actions-goveralls@8781f5dd05b691c4dd042d5e859c11c73e0104fa # v1 | ||
| with: | ||
| parallel-finished: true | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,16 +17,12 @@ package main | |
|
|
||
| import ( | ||
| "context" | ||
| "crypto/sha512" | ||
| "crypto/tls" | ||
| "encoding/hex" | ||
| "errors" | ||
| "flag" | ||
| "fmt" | ||
| "io/ioutil" | ||
| "net/http" | ||
| "os" | ||
| "path/filepath" | ||
| "strings" | ||
| "syscall" | ||
| "time" | ||
|
|
@@ -98,6 +94,13 @@ func main() { | |
|
|
||
| glog.Infof("starting net-attach-def-admission-controller webhook server") | ||
|
|
||
| // Capture the certificate baseline immediately before loading the key pair. | ||
| // Any replacement after this point will be detected by the watcher below. | ||
| previousCertInfo, err := os.Stat(*cert) | ||
| if err != nil { | ||
| glog.Fatalf("failed to stat certificate file %s: %v", *cert, err) | ||
| } | ||
|
|
||
| keyPair, err := webhook.NewTLSKeypairReloader(*cert, *key) | ||
| if err != nil { | ||
| glog.Fatalf("error load certificate: %s", err.Error()) | ||
|
|
@@ -130,34 +133,33 @@ func main() { | |
| // Start watching for pod creations | ||
| go controller.StartWatching(ignoreNamespaces) | ||
|
|
||
| // watch the cert file and restart http sever if the file updated. | ||
| oldHashVal := "" | ||
| // Watch certificate metadata and reload the key pair when the certificate is | ||
| // updated. Avoid reading the file contents here: NewTLSKeypairReloader is the | ||
| // only component that needs access to the certificate and private key data. | ||
| for { | ||
| hasher := sha512.New() | ||
| certPath, err := filepath.Abs(*cert) | ||
| if err != nil { | ||
| glog.Fatalf("illegal path %s in certPath: %s: %v", *cert, certPath, err) | ||
| os.Exit(1) | ||
| } | ||
| s, err := ioutil.ReadFile(certPath) | ||
| hasher.Write(s) | ||
| currentCertInfo, err := os.Stat(*cert) | ||
| if err != nil { | ||
| glog.Fatalf("failed to read file %s: %v", *cert, err) | ||
| os.Exit(1) | ||
| glog.Fatalf("failed to stat certificate file %s: %v", *cert, err) | ||
| } | ||
| newHashVal := hex.EncodeToString(hasher.Sum(nil)) | ||
| if oldHashVal != "" && newHashVal != oldHashVal { | ||
|
|
||
| if certificateFileChanged(previousCertInfo, currentCertInfo) { | ||
| if err := proc.Signal(syscall.SIGHUP); err != nil { | ||
| glog.Fatalf("failed to send certificate update notification: %v", err) | ||
| } | ||
| } | ||
| oldHashVal = newHashVal | ||
| previousCertInfo = currentCertInfo | ||
|
|
||
| time.Sleep(1 * time.Second) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| func certificateFileChanged(previous, current os.FileInfo) bool { | ||
| return !os.SameFile(previous, current) || | ||
| previous.Size() != current.Size() || | ||
| !previous.ModTime().Equal(current.ModTime()) | ||
| } | ||
|
Comment on lines
+157
to
+161
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Metadata equality does not prove certificate equality. An in-place rewrite can retain the inode and size, and can have the same modtime on coarse-resolution filesystems or when timestamps are preserved. This returns 🤖 Prompt for AI Agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the odds of hitting this in a prod env are so low that we can ignore this, if we ever hit this edge case we can re-eval There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| func startHTTPServers(config *ServerConfig) (func(), error) { | ||
| // Parse TLS configuration | ||
| tlsCipherSuiteIDs, err := cliflag.TLSCipherSuites(config.TLSCipherSuites) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.