-
Notifications
You must be signed in to change notification settings - Fork 49
feat: Toleration expose #669
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
Open
Vishvajeet590
wants to merge
16
commits into
main
Choose a base branch
from
toleration-expose
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d3417cc
add: Enabled option to add the toleration while model deployment.
3682189
add: made UI changes for toleration.
b0f47e6
update: fixing e2e timeout.
e264a46
update: fixing e2e timeout.
9886402
update: fixing e2e timeout.
2c73da0
fix: fixed merge toleration.
e65bf29
removed unwanted test
8e94650
fix: reconcile transformer resource request validation
34e367f
Merge remote-tracking branch 'origin/main' into toleration-expose
6b963e3
revert: remove orphaned UTF-8 sanitize test
8100811
Merge remote-tracking branch 'origin/toleration-expose' into tolerati…
09c28c5
fix: ui fixed
a59b335
added get nodes in merlin
e5ce4cc
added cross cluster node fetch.
4ce562f
added node list and selector
1c375a8
added node list and selector
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,178 @@ | ||
| name: Fast API Image CI | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| image_tag: | ||
| description: Docker image tag to use. Defaults to the commit SHA. | ||
| required: false | ||
| type: string | ||
| push_image: | ||
| description: Push the built image to GHCR. | ||
| required: true | ||
| default: true | ||
| type: boolean | ||
|
|
||
| env: | ||
| GO_VERSION: "1.22" | ||
| DOCKER_REGISTRY: ghcr.io | ||
|
|
||
| jobs: | ||
| prepare: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| image_tag: ${{ steps.meta.outputs.image_tag }} | ||
| artifact_name: ${{ steps.meta.outputs.artifact_name }} | ||
| transformer_artifact_name: ${{ steps.meta.outputs.transformer_artifact_name }} | ||
| steps: | ||
| - id: meta | ||
| env: | ||
| INPUT_IMAGE_TAG: ${{ inputs.image_tag }} | ||
| run: | | ||
| IMAGE_TAG="${INPUT_IMAGE_TAG}" | ||
| if [ -z "${IMAGE_TAG}" ]; then | ||
| IMAGE_TAG="${GITHUB_SHA}" | ||
| fi | ||
|
|
||
| echo "image_tag=${IMAGE_TAG}" >> "$GITHUB_OUTPUT" | ||
| echo "artifact_name=merlin.${IMAGE_TAG}.tar" >> "$GITHUB_OUTPUT" | ||
| echo "transformer_artifact_name=merlin-transformer.${IMAGE_TAG}.tar" >> "$GITHUB_OUTPUT" | ||
|
|
||
| test-api: | ||
| runs-on: ubuntu-latest | ||
| services: | ||
| postgres: | ||
| image: postgres:12.4 | ||
| env: | ||
| POSTGRES_DB: postgres | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: postgres | ||
| ports: | ||
| - 5432:5432 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
| cache-dependency-path: api/go.sum | ||
| - name: Install dependencies | ||
| run: | | ||
| make setup | ||
| make init-dep-api | ||
| - name: Test API files | ||
| env: | ||
| POSTGRES_HOST: localhost | ||
| POSTGRES_DB: postgres | ||
| POSTGRES_USER: postgres | ||
| POSTGRES_PASSWORD: postgres | ||
| run: make it-test-api-ci | ||
|
|
||
| build-ui: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: yarn | ||
| cache-dependency-path: ui/yarn.lock | ||
| - name: Install dependencies | ||
| run: make init-dep-ui | ||
| - name: Build UI static files | ||
| run: make build-ui | ||
| - name: Publish UI artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: merlin-ui-dist-fast | ||
| path: ui/build/ | ||
|
|
||
| build-transformer: | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - prepare | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ${{ env.GO_VERSION }} | ||
| cache-dependency-path: api/go.sum | ||
| - name: Install dependencies | ||
| run: make init-dep-api | ||
| - name: Build Standard Transformer | ||
| run: make build-transformer | ||
| - name: Build Standard Transformer Docker image | ||
| run: docker build -t merlin-transformer:${{ needs.prepare.outputs.image_tag }} -f transformer.Dockerfile . | ||
| - name: Save Standard Transformer Docker image | ||
| run: docker image save --output "${{ needs.prepare.outputs.transformer_artifact_name }}" "merlin-transformer:${{ needs.prepare.outputs.image_tag }}" | ||
| - name: Publish Standard Transformer Docker artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ needs.prepare.outputs.transformer_artifact_name }} | ||
| path: ${{ needs.prepare.outputs.transformer_artifact_name }} | ||
|
|
||
| build-api-image: | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - prepare | ||
| - test-api | ||
| - build-ui | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Download UI artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: merlin-ui-dist-fast | ||
| path: ui/build | ||
| - name: Build API Docker image | ||
| run: docker build -t merlin:${{ needs.prepare.outputs.image_tag }} -f Dockerfile . | ||
| - name: Save API Docker image | ||
| run: docker image save --output "${{ needs.prepare.outputs.artifact_name }}" "merlin:${{ needs.prepare.outputs.image_tag }}" | ||
| - name: Publish API Docker artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ needs.prepare.outputs.artifact_name }} | ||
| path: ${{ needs.prepare.outputs.artifact_name }} | ||
|
|
||
| push-api-image: | ||
| if: ${{ inputs.push_image }} | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - prepare | ||
| - build-api-image | ||
| permissions: | ||
| packages: write | ||
| steps: | ||
| - name: Download API Docker artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ needs.prepare.outputs.artifact_name }} | ||
| - name: Push Docker image | ||
| env: | ||
| IMAGE_TAG: ghcr.io/${{ github.repository }}/merlin:${{ needs.prepare.outputs.image_tag }} | ||
| run: | | ||
| docker login ${{ env.DOCKER_REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} | ||
| docker image load --input "${{ needs.prepare.outputs.artifact_name }}" | ||
| docker tag "merlin:${{ needs.prepare.outputs.image_tag }}" "${IMAGE_TAG}" | ||
| docker push "${IMAGE_TAG}" | ||
|
|
||
| push-transformer-image: | ||
| if: ${{ inputs.push_image }} | ||
| runs-on: ubuntu-latest | ||
| needs: | ||
| - prepare | ||
| - build-transformer | ||
| permissions: | ||
| packages: write | ||
| steps: | ||
| - name: Download Standard Transformer Docker artifact | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ needs.prepare.outputs.transformer_artifact_name }} | ||
| - name: Push Docker image | ||
| env: | ||
| IMAGE_TAG: ghcr.io/${{ github.repository }}/merlin-transformer:${{ needs.prepare.outputs.image_tag }} | ||
| run: | | ||
| docker login ${{ env.DOCKER_REGISTRY }} -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} | ||
| docker image load --input "${{ needs.prepare.outputs.transformer_artifact_name }}" | ||
| docker tag "merlin-transformer:${{ needs.prepare.outputs.image_tag }}" "${IMAGE_TAG}" | ||
| docker push "${IMAGE_TAG}" |
This file contains hidden or 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,53 @@ | ||
| // Copyright 2020 The Merlin 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 api | ||
|
|
||
| import ( | ||
| "errors" | ||
| "fmt" | ||
| "net/http" | ||
|
|
||
| "gorm.io/gorm" | ||
| ) | ||
|
|
||
| // NodeController serves node listing for a deployment environment. | ||
| type NodeController struct { | ||
| *AppContext | ||
| } | ||
|
|
||
| // ListNodes returns the nodes (name, status, labels, taints) of the cluster | ||
| // backing the given environment, so the UI can offer them for model placement. | ||
| func (c *NodeController) ListNodes(r *http.Request, vars map[string]string, _ interface{}) *Response { | ||
| ctx := r.Context() | ||
|
|
||
| environmentName := vars["environment_name"] | ||
| env, err := c.EnvironmentService.GetEnvironment(environmentName) | ||
| if err != nil { | ||
| if errors.Is(err, gorm.ErrRecordNotFound) { | ||
| return NotFound(fmt.Sprintf("Environment not found: %v", err)) | ||
| } | ||
| return InternalServerError(fmt.Sprintf("Error getting environment: %v", err)) | ||
| } | ||
|
|
||
| // Route by environment name — this selects the same per-environment controller | ||
| // that deployment uses, so nodes are read from the exact cluster the model | ||
| // deploys to (in-cluster SA locally, or mTLS client cert for a remote cluster). | ||
| nodes, err := c.NodeService.ListNodes(ctx, env.Name) | ||
| if err != nil { | ||
| return InternalServerError(fmt.Sprintf("Error listing nodes: %v", err)) | ||
| } | ||
|
|
||
| return Ok(nodes) | ||
| } |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why we create this new workflow?