forked from kubeflow/kubeflow
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(notebook-controller): added metrics lookup to notebook culling (#…
…213) * added prometheus calls to culling logic * updated to match upstream 1.7 tag * removed dockle * commented out make test workflow on notebook-controller * changed workflow to only use non-dev ACR * added flag to check if last activited updated * added comparaison to kernel activity check * reduced logging and removed nightly build --------- Co-authored-by: Mathis Marcotte <[email protected]>
- Loading branch information
1 parent
7e710a0
commit e508893
Showing
8 changed files
with
242 additions
and
50 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
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,102 @@ | ||
name: component/notebook-controller | ||
on: | ||
push: | ||
branches: | ||
- kubeflow-aaw2.0 | ||
paths: | ||
- components/notebook-controller/** | ||
pull_request: | ||
paths: | ||
- components/notebook-controller/** | ||
types: | ||
- 'opened' | ||
- 'synchronize' | ||
- 'reopened' | ||
# Environment variables available to all jobs and steps in this workflow | ||
env: | ||
REGISTRY_NAME: k8scc01covidacr | ||
DEV_REGISTRY_NAME: k8scc01covidacrdev | ||
CLUSTER_NAME: k8s-cancentral-02-covid-aks | ||
CLUSTER_RESOURCE_GROUP: k8s-cancentral-01-covid-aks | ||
TRIVY_VERSION: "v0.43.1" | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
HADOLINT_VERSION: "2.12.0" | ||
|
||
jobs: | ||
build-push: | ||
runs-on: ubuntu-latest | ||
services: | ||
registry: | ||
image: registry:2 | ||
ports: | ||
- 5000:5000 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Determine if pushing to Prod or Dev ACR | ||
- name: Set ENV variables for a PR containing the auto-deploy tag | ||
if: github.event_name == 'pull_request' && contains( github.event.pull_request.labels.*.name, 'auto-deploy') | ||
run: echo "REGISTRY=${{env.REGISTRY_NAME}}.azurecr.io" >> "$GITHUB_ENV" | ||
|
||
- name: Set ENV variable for pushes to master | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/kubeflow-aaw2.0' | ||
run: echo "REGISTRY=${{env.REGISTRY_NAME}}.azurecr.io" >> "$GITHUB_ENV" | ||
|
||
# Connect to Azure Container registry (ACR) | ||
- uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ env.REGISTRY_NAME }}.azurecr.io | ||
username: ${{ secrets.REGISTRY_USERNAME }} | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
|
||
# Connect to DEV Azure Container registry (ACR) | ||
- uses: azure/docker-login@v1 | ||
with: | ||
login-server: ${{ env.DEV_REGISTRY_NAME }}.azurecr.io | ||
username: ${{ secrets.DEV_REGISTRY_USERNAME }} | ||
password: ${{ secrets.DEV_REGISTRY_PASSWORD }} | ||
|
||
- name: Run Hadolint | ||
run: | | ||
sudo curl -L https://github.com/hadolint/hadolint/releases/download/v${{ env.HADOLINT_VERSION }}/hadolint-Linux-x86_64 --output hadolint | ||
sudo chmod +x hadolint | ||
./hadolint ./components/notebook-controller/Dockerfile --no-fail | ||
# Container build to a Azure Container registry (ACR) | ||
- name: Docker build | ||
run: | | ||
cd ./components/notebook-controller | ||
make docker-build IMG=localhost:5000/kubeflow/notebook-controller TAG=${{ github.sha }} | ||
docker push localhost:5000/kubeflow/notebook-controller:${{ github.sha }} | ||
docker image prune | ||
# Scan image for vulnerabilities | ||
- name: Aqua Security Trivy image scan | ||
run: | | ||
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin ${{ env.TRIVY_VERSION }} | ||
trivy image localhost:5000/kubeflow/notebook-controller:${{ github.sha }} --exit-code 1 --timeout=20m --security-checks vuln --severity CRITICAL | ||
# Pushes if this is a push to master or an update to a PR that has auto-deploy label | ||
- name: Test if we should push to ACR | ||
id: should-i-push | ||
if: | | ||
github.event_name == 'push' || | ||
( | ||
github.event_name == 'pull_request' && | ||
contains( github.event.pull_request.labels.*.name, 'auto-deploy') | ||
) | ||
run: echo "::set-output name=boolean::true" | ||
|
||
- name: Docker push | ||
if: steps.should-i-push.outputs.boolean == 'true' | ||
run: | | ||
docker pull localhost:5000/kubeflow/notebook-controller:${{ github.sha }} | ||
docker tag localhost:5000/kubeflow/notebook-controller:${{ github.sha }} ${{ env.REGISTRY }}/kubeflow/notebook-controller:${{ github.sha }} | ||
docker push ${{ env.REGISTRY }}/kubeflow/notebook-controller:${{ github.sha }} | ||
- name: Slack Notification | ||
if: failure() && github.event_name=='schedule' | ||
uses: act10ns/slack@v1 | ||
with: | ||
status: failure | ||
message: kubeflow build failed. https://github.com/StatCan/kubeflow/actions/runs/${{github.run_id}} |
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
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