Skip to content

Commit

Permalink
service for searching across kubernetes git repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
dims committed Jan 6, 2018
1 parent becdcae commit a8894ab
Show file tree
Hide file tree
Showing 6 changed files with 322 additions and 0 deletions.
31 changes: 31 additions & 0 deletions hound/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2017 The Kubernetes 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.

FROM golang:1.9.2

LABEL maintainer="Davanum Srinivas <davanum@gmail.com>"

COPY config.json /data/config.json

ENV GOPATH /go

RUN go get -d github.com/etsy/hound/cmds/...
RUN cd /go/src/github.com/etsy/hound && git checkout 1b9c3e53594f7eded11fc259537c443853db4587
RUN go install github.com/etsy/hound/cmds/houndd

VOLUME ["/data"]

EXPOSE 6080

ENTRYPOINT ["/go/bin/houndd", "-conf", "/data/config.json"]
24 changes: 24 additions & 0 deletions hound/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2017 The Kubernetes 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.

TAG = v0.1.0
IMAGE_NAME = docker.io/dims/hound

image:
docker build -t "$(IMAGE_NAME):$(TAG)" . --pull

push: image
gcloud docker -- push "$(IMAGE_NAME):$(TAG)"

.PHONY: image push
35 changes: 35 additions & 0 deletions hound/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Hound

Hound is an extremely fast source code search engine. See some details here:
https://hub.docker.com/r/etsy/hound/

and the code here:
https://github.com/etsy/hound

# How to

* To build the docker image:

```
make image
```

* Try the image using docker:

```
docker run -d -p 6080:6080 --name hound gcr.io/google_containers/hound:v0.1.0
```

* To deploy in kubernetes use the deployment.yaml and service.yaml

NOTE: hound takes a while to fetch data from github and only after that it starts listening on
the port 6080, so look at the logs to see if the endpoint has started. When it is done you will
see the following:

```
2017/12/15 14:55:58 All indexes built!
2017/12/15 14:55:58 running server at http://localhost:6080...
2017/12/15 15:02:01 Rebuilding kubernetes-bootcamp for af23e77ef9e90c4563d1a3bbb2c7313eec7ffb23
2017/12/15 15:02:01 merge 0 files + mem
2017/12/15 15:02:01 11802 data bytes, 35923 index bytes
```
190 changes: 190 additions & 0 deletions hound/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
{
"max-concurrent-indexers": 2,
"dbpath": "data",
"repos": {
"kubernetes": {
"url": "https://github.com/kubernetes/kubernetes.git",
"ms-between-poll": 360000
},
"test-infra": {
"url": "https://github.com/kubernetes/test-infra.git",
"ms-between-poll": 360000
},
"community": {
"url": "https://github.com/kubernetes/community.git",
"ms-between-poll": 360000
},
"kubernetes.github.io": {
"url": "https://github.com/kubernetes/kubernetes.github.io.git",
"ms-between-poll": 360000
},
"kops": {
"url": "https://github.com/kubernetes/kops.git",
"ms-between-poll": 360000
},
"helm": {
"url": "https://github.com/kubernetes/helm.git",
"ms-between-poll": 360000
},
"repo-infra": {
"url": "https://github.com/kubernetes/repo-infra.git",
"ms-between-poll": 360000
},
"charts": {
"url": "https://github.com/kubernetes/charts.git",
"ms-between-poll": 360000
},
"kubeadm": {
"url": "https://github.com/kubernetes/kubeadm.git",
"ms-between-poll": 360000
},
"features": {
"url": "https://github.com/kubernetes/features.git",
"ms-between-poll": 360000
},
"kube-state-metrics": {
"url": "https://github.com/kubernetes/kube-state-metrics.git",
"ms-between-poll": 360000
},
"minikube": {
"url": "https://github.com/kubernetes/minikube.git",
"ms-between-poll": 360000
},
"contrib": {
"url": "https://github.com/kubernetes/contrib.git",
"ms-between-poll": 360000
},
"dashboard": {
"url": "https://github.com/kubernetes/dashboard.git",
"ms-between-poll": 360000
},
"autoscaler": {
"url": "https://github.com/kubernetes/autoscaler.git",
"ms-between-poll": 360000
},
"heapster": {
"url": "https://github.com/kubernetes/heapster.git",
"ms-between-poll": 360000
},
"frakti": {
"url": "https://github.com/kubernetes/frakti.git",
"ms-between-poll": 360000
},
"kompose": {
"url": "https://github.com/kubernetes/kompose.git",
"ms-between-poll": 360000
},
"kubernetes-anywhere": {
"url": "https://github.com/kubernetes/kubernetes-anywhere.git",
"ms-between-poll": 360000
},
"release": {
"url": "https://github.com/kubernetes/release.git",
"ms-between-poll": 360000
},
"node-problem-detector": {
"url": "https://github.com/kubernetes/node-problem-detector.git",
"ms-between-poll": 360000
},
"kube-openapi": {
"url": "https://github.com/kubernetes/kube-openapi.git",
"ms-between-poll": 360000
},
"cluster-registry": {
"url": "https://github.com/kubernetes/cluster-registry.git",
"ms-between-poll": 360000
},
"k8s.io": {
"url": "https://github.com/kubernetes/k8s.io.git",
"ms-between-poll": 360000
},
"apiserver": {
"url": "https://github.com/kubernetes/apiserver.git",
"ms-between-poll": 360000
},
"steering": {
"url": "https://github.com/kubernetes/steering.git",
"ms-between-poll": 360000
},
"examples": {
"url": "https://github.com/kubernetes/examples.git",
"ms-between-poll": 360000
},
"kubernetes-bootcamp": {
"url": "https://github.com/kubernetes/kubernetes-bootcamp.git",
"ms-between-poll": 360000
},
"dns": {
"url": "https://github.com/kubernetes/dns.git",
"ms-between-poll": 360000
},
"apiextensions-apiserver": {
"url": "https://github.com/kubernetes/apiextensions-apiserver.git",
"ms-between-poll": 360000
},
"metrics": {
"url": "https://github.com/kubernetes/metrics.git",
"ms-between-poll": 360000
},
"apimachinery": {
"url": "https://github.com/kubernetes/apimachinery.git",
"ms-between-poll": 360000
},
"api": {
"url": "https://github.com/kubernetes/api.git",
"ms-between-poll": 360000
},
"client-go": {
"url": "https://github.com/kubernetes/client-go.git",
"ms-between-poll": 360000
},
"kube-aggregator": {
"url": "https://github.com/kubernetes/kube-aggregator.git",
"ms-between-poll": 360000
},
"sample-apiserver": {
"url": "https://github.com/kubernetes/sample-apiserver.git",
"ms-between-poll": 360000
},
"utils": {
"url": "https://github.com/kubernetes/utils.git",
"ms-between-poll": 360000
},
"kubernetes-template-project": {
"url": "https://github.com/kubernetes/kubernetes-template-project.git",
"ms-between-poll": 360000
},
"gengo": {
"url": "https://github.com/kubernetes/gengo.git",
"ms-between-poll": 360000
},
"kube-ui": {
"url": "https://github.com/kubernetes/kube-ui.git",
"ms-between-poll": 360000
},
"md-check": {
"url": "https://github.com/kubernetes/md-check.git",
"ms-between-poll": 360000
},
"sig-release": {
"url": "https://github.com/kubernetes/sig-release.git",
"ms-between-poll": 360000
},
"kube-deploy": {
"url": "https://github.com/kubernetes/kube-deploy.git",
"ms-between-poll": 360000
},
"git-sync": {
"url": "https://github.com/kubernetes/git-sync.git",
"ms-between-poll": 360000
},
"perf-tests": {
"url": "https://github.com/kubernetes/perf-tests.git",
"ms-between-poll": 360000
},
"kubectl": {
"url": "https://github.com/kubernetes/kubectl.git",
"ms-between-poll": 360000
}
}
}
26 changes: 26 additions & 0 deletions hound/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: hound
labels:
app: hound
spec:
replicas: 2
# selector defaults from template labels
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
type: RollingUpdate
template:
metadata:
labels:
app: hound
spec:
terminationGracePeriodSeconds: 30
containers:
- name: hound
image: gcr.io/google_containers/hound:v0.1.0
ports:
- containerPort: 6080
protocol: TCP
16 changes: 16 additions & 0 deletions hound/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: hound
labels:
app: hound
spec:
selector:
app: hound
type: LoadBalancer
# FIXME(dims) - we need a fixed IP address for the load balancer
#loadBalancerIP: 104.197.177.166
ports:
- name: http
port: 80
targetPort: 6080

0 comments on commit a8894ab

Please sign in to comment.