Skip to content
This repository was archived by the owner on Jan 31, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Label_Microservice/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
CONTEXT=issue-label-bot

hydrate-prod:
rm -rf .build/prod
mkdir -p .build/prod
kustomize build -o .build/prod deployment/overlays/prod
rm -f ../acm-repos/issue-label-bot/namespaces/label-bot-prod/*
kustomize build -o ../acm-repos/issue-label-bot/namespaces/label-bot-prod deployment/overlays/prod

apply-prod: hydrate-prod
kubectl --context=$(CONTEXT) apply -f .build/prod
update-image:
skaffold build --kube-context=${CONTEXT} -v info --file-output=latest_image.json
cd deployment/overlays/prod && kustomize edit set image gcr.io/issue-label-bot-dev/bot-worker=$(shell yq r latest_image.json builds[0].tag )
21 changes: 19 additions & 2 deletions Label_Microservice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ The following describes the GCP projects and clusters where the two services are
1. Repo-specific label microservice
- **repository**: [kubeflow/code-intelligence](https://github.com/kubeflow/code-intelligence/tree/master/Label_Microservice)
- **GCP project**: issue-label-bot-dev
- **cluster**: github-mlapp-test
- **namespace**: default
- **cluster**: label-bot-dev
- **namespace**: labelbot-dev
- **yaml files**: [Label\_Microservice/deployment](https://github.com/kubeflow/code-intelligence/tree/master/Label_Microservice/deployment)

1, GitHub bot - **kf-label-bot-dev**
Expand All @@ -95,6 +95,23 @@ The following describes the GCP projects and clusters where the two services are

## Instructions

### Deploying

#### Production instance

1. Build a docker image and update the kustomization

```
CONTEXT=<kube context> make update-image
```

#### Dev instance of the label bot worker

Use skaffold

```
skaffold --kube-context=${KUBE_CONTEXT} dev -v info
```
### Installation

If you would like to install the new repo-specific label microservice to your repositories, you need to follow the procedures in [the doc](./docs/onboarding_new_repositories.md).
Expand Down
4 changes: 4 additions & 0 deletions Label_Microservice/deployment/base/configs/model_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# This file describes the models to load
orgs:
- name: kubeflow
automl_model: "projects/976279526634/locations/us-central1/models/TCN654213816573231104"
13 changes: 9 additions & 4 deletions Label_Microservice/deployment/base/deployments.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: worker
Expand All @@ -10,6 +10,9 @@ spec:
app: worker
spec:
volumes:
- name: config
configMap:
name: model-config
- name: github-app
secret:
secretName: github-app
Expand All @@ -26,6 +29,9 @@ spec:
memory: "4Gi"
cpu: "4"
volumeMounts:
- name: config
mountPath: /var/config
readOnly: true
- name: github-app
mountPath: /var/secrets/github
env:
Expand All @@ -42,9 +48,8 @@ spec:
value: "50112"
- name: GITHUB_APP_PEM_KEY
value: /var/secrets/github/kf-label-bot-dev.private-key.pem
# TODO(jlewi):Not needed because we use workload identity
#- name: GOOGLE_APPLICATION_CREDENTIALS
# value: /var/secrets/google/user-gcp-sa.json
- name: MODEL_CONFIG
value: /var/config/model_config.yaml
restartPolicy: Always
# We need to set a service account corresponding to workload
# identity
Expand Down
4 changes: 4 additions & 0 deletions Label_Microservice/deployment/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ images:
resources:
- service.yaml
- deployments.yaml
configMapGenerator:
- name: model-config
files:
- configs/model_config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: worker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
name: worker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ patchesStrategicMerge:
- deployments.yaml
resources:
- ../../base
- namespace.yaml
images:
- name: gcr.io/issue-label-bot-dev/bot-worker
newName: gcr.io/issue-label-bot-dev/bot-worker
newTag: 6848ad6
- digest: sha256:2faaf9d94c9beba082f184790770d1d08cb06a94b1ad4a8e797033f0bccb4cf7
name: gcr.io/issue-label-bot-dev/bot-worker
newName: gcr.io/issue-label-bot-dev/bot-worker:f0bf8d1-dirty
4 changes: 4 additions & 0 deletions Label_Microservice/deployment/overlays/prod/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: label-bot-prod
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Requirements for the universal model.
# These requirements are largely copied from
# https://github.com/machine-learning-apps/Issue-Label-Bot/blob/master/deployment/Dockerfile
h5py==2.9.0
ktext==0.34
h5py==2.9.0
# Newer versions of Keras appear to require TensorFlow 2.2
Keras==2.3.1
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.0
ktext==0.34
1 change: 1 addition & 0 deletions Label_Microservice/latest_image.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"builds":[{"imageName":"gcr.io/issue-label-bot-dev/bot-worker","tag":"gcr.io/issue-label-bot-dev/bot-worker:f0bf8d1-dirty@sha256:2faaf9d94c9beba082f184790770d1d08cb06a94b1ad4a8e797033f0bccb4cf7"}]}
5 changes: 5 additions & 0 deletions acm-repos/issue-label-bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Anthos Configuration Management Directory

This is the root directory for Anthos Configuration Management.

See [our documentation](https://cloud.google.com/anthos-config-management/docs/repo) for how to use each subdirectory.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: extensions/v1beta1
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
Expand Down Expand Up @@ -42,18 +42,26 @@ spec:
value: "27079"
- name: GITHUB_APP_PEM_KEY
value: /var/secrets/github/issue-label-bot-github-app.private-key.pem
image: gcr.io/issue-label-bot-dev/bot-worker:6848ad6
- name: MODEL_CONFIG
value: /var/config/model_config.yaml
image: gcr.io/issue-label-bot-dev/bot-worker:f0bf8d1-dirty@sha256:2faaf9d94c9beba082f184790770d1d08cb06a94b1ad4a8e797033f0bccb4cf7
name: app
resources:
requests:
cpu: "4"
memory: 4Gi
volumeMounts:
- mountPath: /var/config
name: config
readOnly: true
- mountPath: /var/secrets/github
name: github-app
restartPolicy: Always
serviceAccountName: default-editor
volumes:
- configMap:
name: label-bot-model-config-7fdmtg95kc
name: config
- name: github-app
secret:
secretName: github-app
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
data:
model_config.yaml: |-
# This file describes the models to load
orgs:
- name: kubeflow
automl_model: "projects/976279526634/locations/us-central1/models/TCN654213816573231104"
kind: ConfigMap
metadata:
labels:
app: label-bot
environment: prod
service: label-bot
name: label-bot-model-config-7fdmtg95kc
namespace: label-bot-prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
environment: prod
name: label-bot-prod
3 changes: 3 additions & 0 deletions acm-repos/issue-label-bot/system/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# System

This directory contains system configs such as the repo version and how resources are synced.
6 changes: 6 additions & 0 deletions acm-repos/issue-label-bot/system/repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: configmanagement.gke.io/v1
kind: Repo
metadata:
name: repo
spec:
version: 1.0.0
Loading