-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new systemd service that simply executes `pivot`. But note that we don't have a `pivot.path` unit to auto-trigger it: this needs to be triggered explicitly by whatever drives pivot. Making it a service and standizing on a path in `/etc` means that we can trigger a pivot on boot from Ignition (patch to preset enable the service is pending), as well as from the MCD by directly starting the unit. Related: openshift/machine-config-operator#314
- Loading branch information
Showing
7 changed files
with
94 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ pivot | |
*.out | ||
# editor | ||
.vscode | ||
|
||
systemd/pivot.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
%define debug_package %{nil} | ||
|
||
Name: pivot | ||
Version: 0.0.2 | ||
Release: 0.1%{?dist} | ||
Version: 0.0.3 | ||
Release: 1%{?dist} | ||
Summary: allows moving from one OSTree deployment to another | ||
|
||
License: ASL 2.0 | ||
|
@@ -21,7 +21,7 @@ deployment to another with minimal effort. | |
%prep | ||
%autosetup -n %{name}-%{version} | ||
mkdir -p src/github.com/openshift/%{name}/ | ||
cp -rf cmd Gopkg.lock Gopkg.toml LICENSE main.go Makefile pivot.spec README.md types utils vendor VERSION src/github.com/openshift/%{name} | ||
cp -rf cmd Gopkg.lock Gopkg.toml LICENSE main.go Makefile pivot.spec README.md types utils vendor VERSION systemd src/github.com/openshift/%{name} | ||
|
||
%build | ||
export GOPATH=`pwd` | ||
|
@@ -36,9 +36,12 @@ make install DESTDIR=%{buildroot} | |
%license LICENSE | ||
%doc README.md | ||
%{_bindir}/%{name} | ||
|
||
%{_prefix}/lib/systemd/system/pivot.* | ||
|
||
%changelog | ||
* Tue Feb 05 2019 Jonathan Lebon <[email protected]> - 0.0.3-1 | ||
- Add systemd service unit | ||
|
||
* Wed Nov 14 2018 Steve Milner <[email protected]> - 0.0.2-0.1 | ||
- Makefile: Add changelog target | ||
- cmd/root: Print pivoting msg before pull | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=Pivot Tool | ||
ConditionPathExists=/etc/pivot/image-pullspec | ||
After=ignition-firstboot-complete.service | ||
Before=kubelet.service | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=@@PIVOT_BINARY_PATH@@ | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package utils | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/golang/glog" | ||
) | ||
|
||
// FileExists checks if the file exists, gracefully handling ENOENT. | ||
func FileExists(path string) bool { | ||
if _, err := os.Stat(path); err != nil { | ||
if os.IsNotExist(err) { | ||
return false | ||
} | ||
glog.Fatalf("Failed to stat %s: %v", path, err) | ||
} | ||
return true | ||
} |