Skip to content

Commit 2a3bd1e

Browse files
committed
docs: add CI badges and LICENSE
Add GitHub Actions CI badge and Go Report Card badge to README. Include MIT LICENSE file. Fix gofmt alignment and ineffectual assignment in tests.
1 parent a6a3e3d commit 2a3bd1e

5 files changed

Lines changed: 45 additions & 30 deletions

File tree

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 aqstack
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Sentinel
22

3+
[![CI](https://github.com/aqstack/sentinel/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/aqstack/sentinel/actions/workflows/ci.yml)
4+
[![Go Report Card](https://goreportcard.com/badge/github.com/aqstack/sentinel)](https://goreportcard.com/report/github.com/aqstack/sentinel)
5+
36
Predictive failure detection and autonomous orchestration for Kubernetes edge nodes.
47

58
## What it does

cmd/predictor/main.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ type server struct {
4545

4646
func main() {
4747
var (
48-
configFile = flag.String("config", "", "Path to config file (YAML or JSON)")
49-
nodeName = flag.String("node", "", "Node name (default: hostname)")
50-
listenAddr = flag.String("listen", ":9101", "API listen address")
51-
metricsAddr = flag.String("metrics", ":9100", "Prometheus metrics listen address")
52-
interval = flag.Duration("interval", time.Second, "Metrics collection interval")
48+
configFile = flag.String("config", "", "Path to config file (YAML or JSON)")
49+
nodeName = flag.String("node", "", "Node name (default: hostname)")
50+
listenAddr = flag.String("listen", ":9101", "API listen address")
51+
metricsAddr = flag.String("metrics", ":9100", "Prometheus metrics listen address")
52+
interval = flag.Duration("interval", time.Second, "Metrics collection interval")
5353
consensusAddr = flag.String("consensus-addr", "", "Consensus listen address")
54-
peers = flag.String("peers", "", "Comma-separated peer addresses")
55-
logLevel = flag.String("log-level", "info", "Log level (debug, info, warn, error)")
56-
logFormat = flag.String("log-format", "text", "Log format (text, json)")
54+
peers = flag.String("peers", "", "Comma-separated peer addresses")
55+
logLevel = flag.String("log-level", "info", "Log level (debug, info, warn, error)")
56+
logFormat = flag.String("log-format", "text", "Log format (text, json)")
5757

5858
// Prediction thresholds
5959
warnThreshold = flag.Float64("warn-threshold", 0.3, "Warning threshold")

pkg/config/config.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ type ServerConfig struct {
3333

3434
// PredictorConfig holds prediction engine settings.
3535
type PredictorConfig struct {
36-
Interval time.Duration `json:"interval" yaml:"interval"`
37-
WarnThreshold float64 `json:"warn_threshold" yaml:"warn_threshold"`
38-
CriticalThreshold float64 `json:"critical_threshold" yaml:"critical_threshold"`
39-
MinConfidence float64 `json:"min_confidence" yaml:"min_confidence"`
40-
TimeToFailureWindow time.Duration `json:"time_to_failure_window" yaml:"time_to_failure_window"`
41-
RiskWeights RiskWeights `json:"risk_weights" yaml:"risk_weights"`
36+
Interval time.Duration `json:"interval" yaml:"interval"`
37+
WarnThreshold float64 `json:"warn_threshold" yaml:"warn_threshold"`
38+
CriticalThreshold float64 `json:"critical_threshold" yaml:"critical_threshold"`
39+
MinConfidence float64 `json:"min_confidence" yaml:"min_confidence"`
40+
TimeToFailureWindow time.Duration `json:"time_to_failure_window" yaml:"time_to_failure_window"`
41+
RiskWeights RiskWeights `json:"risk_weights" yaml:"risk_weights"`
4242
}
4343

4444
// RiskWeights holds risk factor weights.
@@ -53,9 +53,9 @@ type RiskWeights struct {
5353

5454
// ConsensusConfig holds consensus/partition settings.
5555
type ConsensusConfig struct {
56-
Enabled bool `json:"enabled" yaml:"enabled"`
57-
Addr string `json:"addr" yaml:"addr"`
58-
Peers []string `json:"peers" yaml:"peers"`
56+
Enabled bool `json:"enabled" yaml:"enabled"`
57+
Addr string `json:"addr" yaml:"addr"`
58+
Peers []string `json:"peers" yaml:"peers"`
5959
RateLimit RateLimitConfig `json:"rate_limit" yaml:"rate_limit"`
6060
}
6161

pkg/consensus/raft_lite_test.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -424,21 +424,12 @@ func TestTwoNodeCommunication(t *testing.T) {
424424
// Wait for election to complete
425425
time.Sleep(500 * time.Millisecond)
426426

427-
// One should be leader
428-
leaders := 0
429-
if node1.IsLeader() {
430-
leaders++
431-
}
432-
if node2.IsLeader() {
433-
leaders++
434-
}
435-
436427
// In a 2-node cluster, we need both to agree on leader
437428
// This test is somewhat flaky due to timing, so just log
438-
t.Logf("Node1: state=%s, term=%d, leader=%s",
439-
node1.State(), node1.Term(), node1.LeaderID())
440-
t.Logf("Node2: state=%s, term=%d, leader=%s",
441-
node2.State(), node2.Term(), node2.LeaderID())
429+
t.Logf("Node1: state=%s, term=%d, leader=%s, isLeader=%v",
430+
node1.State(), node1.Term(), node1.LeaderID(), node1.IsLeader())
431+
t.Logf("Node2: state=%s, term=%d, leader=%s, isLeader=%v",
432+
node2.State(), node2.Term(), node2.LeaderID(), node2.IsLeader())
442433
}
443434

444435
func TestRateLimiterTokenBucket(t *testing.T) {

0 commit comments

Comments
 (0)