This repository has been archived by the owner on Sep 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use init container for worker pod to wait master pod ready
fix [186](#186)
- Loading branch information
Showing
4 changed files
with
91 additions
and
24 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package config | ||
|
||
import ( | ||
"io/ioutil" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
var initContainerTemplate string | ||
|
||
func init() { | ||
bytes, err := ioutil.ReadFile("/etc/config/initContainer.yaml") | ||
if err != nil { | ||
log.Warningf("error while read initContainerTemplate, use default. error: %s", err) | ||
setDefaultInitContainerTemplate() | ||
} else { | ||
initContainerTemplate = string(bytes) | ||
} | ||
} | ||
|
||
func setDefaultInitContainerTemplate() { | ||
initContainerTemplate = ` | ||
- name: init-pytorch | ||
image: busybox | ||
command: ['sh', '-c', 'until nslookup {{.MasterAddr}}; do echo waiting for master; sleep 2; done;']` | ||
} | ||
|
||
func GetInitContainerTemplate() string { | ||
return initContainerTemplate | ||
} |
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