Use local paths when possible, some AI cleanup

This commit is contained in:
Tanishq Dubey 2025-05-16 21:20:39 -04:00
parent 4f6365d453
commit 2f6d3c9bb2
No known key found for this signature in database
GPG Key ID: CFC1931B84DFC3F9
7 changed files with 21 additions and 25 deletions

View File

@ -174,7 +174,7 @@ func runInit(cmd *cobra.Command, args []string) {
log.Printf("Failed to generate leader key and CSR: %v", err) log.Printf("Failed to generate leader key and CSR: %v", err)
} else { } else {
// Read the CSR file // Read the CSR file
csrData, err := os.ReadFile(leaderCSRPath) _, err := os.ReadFile(leaderCSRPath)
if err != nil { if err != nil {
log.Printf("Failed to read leader CSR file: %v", err) log.Printf("Failed to read leader CSR file: %v", err)
} else { } else {

View File

@ -3,8 +3,8 @@ kind: ClusterConfiguration
metadata: metadata:
name: my-kat-cluster name: my-kat-cluster
spec: spec:
clusterCIDR: "10.100.0.0/16" cluster_CIDR: "10.100.0.0/16"
serviceCIDR: "10.200.0.0/16" service_CIDR: "10.200.0.0/16"
nodeSubnetBits: 7 # Results in /23 node subnets (e.g., 10.100.0.0/23, 10.100.2.0/23) nodeSubnetBits: 7 # Results in /23 node subnets (e.g., 10.100.0.0/23, 10.100.2.0/23)
clusterDomain: "kat.example.local" # Overriding default clusterDomain: "kat.example.local" # Overriding default
apiPort: 9115 apiPort: 9115

View File

@ -201,8 +201,8 @@ func TestValidateClusterConfiguration_InvalidValues(t *testing.T) {
ApiPort: 10251, ApiPort: 10251,
EtcdPeerPort: 2380, EtcdPeerPort: 2380,
EtcdClientPort: 2379, EtcdClientPort: 2379,
VolumeBasePath: "/var/lib/kat/volumes", VolumeBasePath: "~/.kat/volumes",
BackupPath: "/var/lib/kat/backups", BackupPath: "~/.kat/backups",
BackupIntervalMinutes: 30, BackupIntervalMinutes: 30,
AgentTickSeconds: 15, AgentTickSeconds: 15,
NodeLossTimeoutSeconds: 60, NodeLossTimeoutSeconds: 60,

View File

@ -11,8 +11,8 @@ const (
DefaultApiPort = 9115 DefaultApiPort = 9115
DefaultEtcdPeerPort = 2380 DefaultEtcdPeerPort = 2380
DefaultEtcdClientPort = 2379 DefaultEtcdClientPort = 2379
DefaultVolumeBasePath = "/var/lib/kat/volumes" DefaultVolumeBasePath = "~/.kat/volumes"
DefaultBackupPath = "/var/lib/kat/backups" DefaultBackupPath = "~/.kat/backups"
DefaultBackupIntervalMins = 30 DefaultBackupIntervalMins = 30
DefaultAgentTickSeconds = 15 DefaultAgentTickSeconds = 15
DefaultNodeLossTimeoutSec = 60 // DefaultNodeLossTimeoutSeconds = DefaultAgentTickSeconds * 4 (example logic) DefaultNodeLossTimeoutSec = 60 // DefaultNodeLossTimeoutSeconds = DefaultAgentTickSeconds * 4 (example logic)

View File

@ -1,15 +1,11 @@
package pki package pki
import ( import (
"crypto/rand"
"crypto/rsa" "crypto/rsa"
"crypto/x509" "crypto/x509"
"crypto/x509/pkix"
"encoding/pem" "encoding/pem"
"fmt" "fmt"
"net"
"os" "os"
"time"
) )
// ParseCSRFromBytes parses a PEM-encoded CSR from bytes // ParseCSRFromBytes parses a PEM-encoded CSR from bytes

View File

@ -87,7 +87,7 @@ func TestSignCertificateRequest(t *testing.T) {
// Sign CSR // Sign CSR
certPath := filepath.Join(tempDir, "node.crt") certPath := filepath.Join(tempDir, "node.crt")
err = SignCertificateRequest(caKeyPath, caCertPath, csrData, certPath, 30) // 30 days validity err = SignCertificateRequest(caKeyPath, caCertPath, string(csrData), certPath, 30) // 30 days validity
if err != nil { if err != nil {
t.Fatalf("SignCertificateRequest failed: %v", err) t.Fatalf("SignCertificateRequest failed: %v", err)
} }

View File

@ -51,8 +51,8 @@ spec:
apiPort: 9115 apiPort: 9115
etcdPeerPort: 2380 etcdPeerPort: 2380
etcdClientPort: 2379 etcdClientPort: 2379
volumeBasePath: "/var/lib/kat/volumes" volumeBasePath: "~/.kat/volumes"
backupPath: "/var/lib/kat/backups" backupPath: "~/.kat/backups"
backupIntervalMinutes: 30 backupIntervalMinutes: 30
agentTickSeconds: 15 agentTickSeconds: 15
nodeLossTimeoutSeconds: 60 nodeLossTimeoutSeconds: 60