-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from AustrianDataLAB/dev
feature: create run task implementation (#15)
- Loading branch information
Showing
24 changed files
with
645 additions
and
112 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 |
---|---|---|
|
@@ -55,8 +55,9 @@ jobs: | |
uses: ietf-tools/[email protected] | ||
with: | ||
token: ${{ github.token }} | ||
patchAll: true | ||
# fall back to dev because we want to have a valid semver | ||
branch: ${{ fromJSON('{"main":"dev"}')[github.ref_name] || github.ref_name }} | ||
branch: ${{ fromJSON('{"main":"main"}')[github.ref_name] || github.ref_name }} | ||
noVersionBumpBehavior: current | ||
|
||
- name: Set OPERATOR_VERSION | ||
|
@@ -198,7 +199,7 @@ jobs: | |
with: | ||
token: ${{ github.token }} | ||
# calculate the changelog from the last tag to the current dev state | ||
fromTag: ${{ fromJSON('{"main":"dev"}')[github.ref_name] || github.ref_name }} | ||
fromTag: ${{ fromJSON('{"main":"main"}')[github.ref_name] || github.ref_name }} | ||
toTag: ${{ env.CURRENT }} | ||
# Create a new release on GitHub with the semantic OPERATOR_VERSION number | ||
- name: Create Release | ||
|
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
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,5 @@ | ||
package v1alpha1 | ||
|
||
// swagger:enum CurrentPhase | ||
// ENUM(pending, building, running, buildComplete, runCompleted, failed) | ||
type CurrentPhase string |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
kcore "k8s.io/api/core/v1" | ||
"k8s.io/utils/pointer" | ||
) | ||
|
||
type RunPodSpecData struct { | ||
INIT_SH string | ||
ImageName string | ||
ImageTag string | ||
InputDataPath string | ||
OutputDataPath string | ||
} | ||
|
||
// SetPodSpec sets the pod spec for the run | ||
func (run *Run) SetPodSpec(podSpec *kcore.PodSpec, runPodSpecData RunPodSpecData) error { | ||
|
||
podSpec.RestartPolicy = kcore.RestartPolicyNever | ||
|
||
podSpec.Volumes = []kcore.Volume{ | ||
{ | ||
Name: "input", | ||
VolumeSource: kcore.VolumeSource{ | ||
EmptyDir: &kcore.EmptyDirVolumeSource{}, | ||
}, | ||
}, | ||
{ | ||
Name: "output", | ||
VolumeSource: kcore.VolumeSource{ | ||
EmptyDir: &kcore.EmptyDirVolumeSource{}, | ||
}, | ||
}, | ||
} | ||
|
||
podSpec.Containers = []kcore.Container{ | ||
{ | ||
Name: "buildah", | ||
Image: "harbor.caas-0013.dev.austrianopencloudcommunity.org/execdev/" + runPodSpecData.ImageName + ":" + runPodSpecData.ImageTag, | ||
ImagePullPolicy: kcore.PullIfNotPresent, | ||
Command: []string{"/bin/bash", "-c", "--"}, | ||
Args: []string{"trap : TERM INT; echo \"$INIT_SH\" | bash"}, | ||
TTY: true, | ||
Stdin: true, | ||
Env: []kcore.EnvVar{ | ||
{Name: "INIT_SH", Value: runPodSpecData.INIT_SH}, | ||
{Name: "MINIO_ENDPOINT", Value: "http://minio.single-minio.svc.cluster.local:9000"}, | ||
{Name: "MINIO_ACCESS_KEY", Value: "cache-user-1"}, | ||
{Name: "MINIO_SECRET_KEY", Value: "CACHE_USER_PASS_XYZ_123"}, | ||
{Name: "BUCKET_NAME", Value: "cache-bucket-1"}, | ||
{Name: "HOME", Value: "/tmp"}, | ||
}, | ||
SecurityContext: &kcore.SecurityContext{ | ||
RunAsUser: pointer.Int64(1000), | ||
RunAsGroup: pointer.Int64(1000), | ||
}, | ||
VolumeMounts: []kcore.VolumeMount{ | ||
{Name: "input", MountPath: runPodSpecData.InputDataPath}, | ||
{Name: "output", MountPath: runPodSpecData.OutputDataPath}, | ||
}, | ||
}, | ||
} | ||
podSpec.SecurityContext = &kcore.PodSecurityContext{ | ||
RunAsUser: pointer.Int64(1000), | ||
RunAsGroup: pointer.Int64(1000), | ||
} | ||
return nil | ||
} |
Oops, something went wrong.