Skip to content

Commit bb504e8

Browse files
committed
Add automatic pod restart on PTP security secret changes
Watch for changes to secrets referenced in PtpConfig and automatically restart linuxptp-daemon pods via SHA256 hash annotation. Each profile can specify independent secret and sa_file configurations. Security volumes use -ptpconfig-sec suffix for identification and are preserved during PtpOperatorConfig reconciliation via merge logic.
1 parent 1954555 commit bb504e8

File tree

6 files changed

+495
-291
lines changed

6 files changed

+495
-291
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
155155

156156
## Tool Versions
157157
KUSTOMIZE_VERSION ?= v4.5.7
158-
CONTROLLER_TOOLS_VERSION ?= latest
158+
CONTROLLER_TOOLS_VERSION ?= v0.15.0
159159

160160
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
161161
.PHONY: kustomize

api/v1/ptpconfig_webhook.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,26 @@ type ptp4lConf struct {
6161
sections map[string]ptp4lConfSection
6262
}
6363

64+
// Ptp4lConf is a public wrapper for ptp4lConf
65+
type Ptp4lConf struct {
66+
conf ptp4lConf
67+
}
68+
69+
// PopulatePtp4lConf parses the ptp4l configuration
70+
func (p *Ptp4lConf) PopulatePtp4lConf(config *string, ptp4lopts *string) error {
71+
return p.conf.populatePtp4lConf(config, ptp4lopts)
72+
}
73+
74+
// GetOption retrieves an option value from a specific section
75+
func (p *Ptp4lConf) GetOption(section, key string) string {
76+
if sec, ok := p.conf.sections[section]; ok {
77+
if val, ok := sec.options[key]; ok {
78+
return val
79+
}
80+
}
81+
return ""
82+
}
83+
6484
func (output *ptp4lConf) populatePtp4lConf(config *string, ptp4lopts *string) error {
6585
var string_config string
6686
if config != nil {

0 commit comments

Comments
 (0)