Skip to content
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

[v1.6.x] Use YAML content for Elemental Agent config (#765) #770

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/support/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
elementalAgentPlanDir = "/var/lib/elemental/agent/applied/"
rancherAgentPlanDir = "/var/lib/rancher/agent/applied/"
rancherAgentConf = "/etc/rancher/agent/config.yaml"
elementalAgentConf = "/etc/rancher/agent/config.yaml"
elementalAgentConf = "/etc/rancher/elemental/agent/config.yaml"
osRelease = "/etc/os-release"
hostnameFile = "/etc/hostname"
resolvConf = "/etc/resolv.conf"
Expand Down
24 changes: 12 additions & 12 deletions internal/system-agent/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ type HTTPGetAction struct {
}

type AgentConfig struct {
WorkDir string `json:"workDirectory,omitempty"`
LocalEnabled bool `json:"localEnabled,omitempty"`
LocalPlanDir string `json:"localPlanDirectory,omitempty"`
AppliedPlanDir string `json:"appliedPlanDirectory,omitempty"`
RemoteEnabled bool `json:"remoteEnabled,omitempty"`
ConnectionInfoFile string `json:"connectionInfoFile,omitempty"`
PreserveWorkDir bool `json:"preserveWorkDirectory,omitempty"`
ImagesDir string `json:"imagesDirectory,omitempty"`
AgentRegistriesFile string `json:"agentRegistriesFile,omitempty"`
ImageCredentialProviderConfig string `json:"imageCredentialProviderConfig,omitempty"`
ImageCredentialProviderBinDir string `json:"imageCredentialProviderBinDirectory,omitempty"`
InterlockDir string `json:"interlockDirectory,omitempty"`
WorkDir string `json:"workDirectory,omitempty" yaml:"workDirectory,omitempty"`
LocalEnabled bool `json:"localEnabled,omitempty" yaml:"localEnabled,omitempty"`
LocalPlanDir string `json:"localPlanDirectory,omitempty" yaml:"localPlanDirectory,omitempty"`
AppliedPlanDir string `json:"appliedPlanDirectory,omitempty" yaml:"appliedPlanDirectory,omitempty"`
RemoteEnabled bool `json:"remoteEnabled,omitempty" yaml:"remoteEnabled,omitempty"`
ConnectionInfoFile string `json:"connectionInfoFile,omitempty" yaml:"connectionInfoFile,omitempty"`
PreserveWorkDir bool `json:"preserveWorkDirectory,omitempty" yaml:"preserveWorkDirectory,omitempty"`
ImagesDir string `json:"imagesDirectory,omitempty" yaml:"imagesDirectory,omitempty"`
AgentRegistriesFile string `json:"agentRegistriesFile,omitempty" yaml:"agentRegistriesFile,omitempty"`
ImageCredentialProviderConfig string `json:"imageCredentialProviderConfig,omitempty" yaml:"imageCredentialProviderConfig,omitempty"`
ImageCredentialProviderBinDir string `json:"imageCredentialProviderBinDirectory,omitempty" yaml:"imageCredentialProviderBinDirectory,omitempty"`
InterlockDir string `json:"interlockDirectory,omitempty" yaml:"interlockDirectory,omitempty"`
}

type ConnectionInfo struct {
Expand Down
7 changes: 6 additions & 1 deletion pkg/install/_testdata/system-agent-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ stages:
permissions: 384
owner: 0
group: 0
content: '{"workDirectory":"/var/lib/elemental/agent/work","localPlanDirectory":"/var/lib/elemental/agent/plans","appliedPlanDirectory":"/var/lib/elemental/agent/applied","remoteEnabled":true,"connectionInfoFile":"/var/lib/elemental/agent/elemental_connection.json"}'
content: |
workDirectory: /var/lib/elemental/agent/work
localPlanDirectory: /var/lib/elemental/agent/plans
appliedPlanDirectory: /var/lib/elemental/agent/applied
remoteEnabled: true
connectionInfoFile: /var/lib/elemental/agent/elemental_connection.json
encoding: ""
ownerstring: ""
2 changes: 1 addition & 1 deletion pkg/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ func (i *installer) getAgentConfigBytes() ([]byte, error) {
PreserveWorkDir: false,
}

agentConfigBytes, err := json.Marshal(agentConfig)
agentConfigBytes, err := yaml.Marshal(agentConfig)
if err != nil {
return nil, fmt.Errorf("encoding agentConfig: %w", err)
}
Expand Down
Loading