Skip to content

Commit

Permalink
KEP-2170: Add directories for the V2 APIs (#2221)
Browse files Browse the repository at this point in the history
* KEP-2170: Add directories for the V2 APIs

Signed-off-by: Andrey Velichkevich <[email protected]>

* Fix default value for prefix in build

Signed-off-by: Andrey Velichkevich <[email protected]>

* Fix Docker image

Signed-off-by: Andrey Velichkevich <[email protected]>

---------

Signed-off-by: Andrey Velichkevich <[email protected]>
  • Loading branch information
andreyvelich committed Aug 15, 2024
1 parent ff19a10 commit 6f36eb7
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .github/workflows/build-and-publish-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ on:
required: false
type: string
default: .
tag-prefix:
required: false
type: string
default: v1
secrets:
DOCKERHUB_USERNAME:
required: false
Expand Down Expand Up @@ -57,6 +61,7 @@ jobs:
platforms: ${{ inputs.platforms }}
context: ${{ inputs.context }}
push: true
tag-prefix: ${{ inputs.tag-prefix }}

- name: Test Build For Component ${{ inputs.component-name }}
if: steps.publish.outcome == 'skipped'
Expand All @@ -67,3 +72,4 @@ jobs:
platforms: ${{ inputs.platforms }}
context: ${{ inputs.context }}
push: false
tag-prefix: ${{ inputs.tag-prefix }}
9 changes: 9 additions & 0 deletions .github/workflows/publish-core-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
platforms: ${{ matrix.platforms }}
dockerfile: ${{ matrix.dockerfile }}
context: ${{ matrix.context }}
tag-prefix: ${{ matrix.tag-prefix }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Expand All @@ -24,14 +25,22 @@ jobs:
- component-name: training-operator
dockerfile: build/images/training-operator/Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
tag-prefix: v1
- component-name: training-operator
dockerfile: cmd/training-operator.v2alpha1/Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
tag-prefix: v2alpha1
- component-name: kubectl-delivery
dockerfile: build/images/kubectl-delivery/Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
tag-prefix: v1
- component-name: storage-initializer
dockerfile: sdk/python/kubeflow/storage_initializer/Dockerfile
context: sdk/python/kubeflow/storage_initializer
platforms: linux/amd64,linux/arm64
tag-prefix: v1
- component-name: trainer-huggingface
dockerfile: sdk/python/kubeflow/trainer/Dockerfile
context: sdk/python/kubeflow/trainer
platforms: linux/amd64,linux/arm64
tag-prefix: v1
6 changes: 5 additions & 1 deletion .github/workflows/template-publish-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ inputs:
push:
required: true
description: whether to push container images or not
tag-prefix:
required: false
default: v1
description: Prefix for the image tag, e.g. v1 or v2alpha1

runs:
using: composite
Expand All @@ -38,7 +42,7 @@ runs:
images: ${{ inputs.image }}
tags: |
type=raw,latest
type=sha,prefix=v1-
type=sha,prefix=${{ inputs.tag-prefix }}-
- name: Build and Push
uses: docker/build-push-action@v5
Expand Down
23 changes: 23 additions & 0 deletions cmd/training-operator.v2alpha1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Build the manager binary
FROM golang:1.22 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download

# Copy the go source
COPY . .

# Build
RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -o manager cmd/training-operator.v2alpha1/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY --from=builder /workspace/manager .
ENTRYPOINT ["/manager"]
21 changes: 21 additions & 0 deletions cmd/training-operator.v2alpha1/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
Copyright 2024 The Kubeflow Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

func main() {

}
17 changes: 17 additions & 0 deletions pkg/apis/kubeflow.org/v2alpha1/trainingruntime_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2024 The Kubeflow Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v2alpha1
17 changes: 17 additions & 0 deletions pkg/apis/kubeflow.org/v2alpha1/trainjob_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2024 The Kubeflow Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v2alpha1
17 changes: 17 additions & 0 deletions pkg/controller.v2/trainjob_controller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2024 The Kubeflow Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package controllerv2
17 changes: 17 additions & 0 deletions pkg/webhook.v2/trainjob_webhook.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2024 The Kubeflow Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package webhookv2

0 comments on commit 6f36eb7

Please sign in to comment.