Skip to content

Commit 9fb33d2

Browse files
Removed LR specific files and amends, add Dockerfile.test and updated the README
1 parent 6254699 commit 9fb33d2

File tree

12 files changed

+265
-365
lines changed

12 files changed

+265
-365
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/sync.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ anaconda-mode/
6363
*.dylib
6464
# Test binary, build with 'go test -c'
6565
*.test
66+
!Dockerfile.test
6667
# Output of the go coverage tool, specifically when used with LiteIDE
6768
*.out
6869
### Vim ###

Dockerfile.test

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Build the manager binary
2+
FROM golang:1.16 as tester
3+
4+
ENV version 1.0.8
5+
ENV arch amd64
6+
7+
# Copy everything in the go src
8+
WORKDIR /go/src/cdap.io/cdap-operator
9+
COPY ./ ./
10+
11+
# Install Kubebuilder
12+
RUN curl -L -O "https://github.com/kubernetes-sigs/kubebuilder/releases/download/v${version}/kubebuilder_${version}_linux_${arch}.tar.gz" && \
13+
tar -zxvf kubebuilder_${version}_linux_${arch}.tar.gz && \
14+
mv kubebuilder_${version}_linux_${arch} /usr/local/kubebuilder && \
15+
cp /usr/local/kubebuilder/bin/* /usr/local/bin
16+
17+
# Install setup-envtest
18+
RUN go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
19+
20+
# download envtest 1.19.x for kubebuilder and to set KUBEBUILDER_ASSETS environment variable
21+
RUN $(go env GOPATH)/bin/setup-envtest use -p env 1.19.x > /tmp/setup_envtest.sh && \
22+
eval `$(go env GOPATH)/bin/setup-envtest use -p env 1.19.x` && \
23+
rm /tmp/setup_envtest.sh
24+
25+
CMD make test

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Image URL to use all building/pushing image targets
33
IMG ?= controller:latest
44
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
5-
CRD_OPTIONS ?= "crd:trivialVersions=true,maxDescLen=0"
5+
CRD_OPTIONS ?= "crd:trivialVersions=true"
66

77
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
88
ifeq (,$(shell go env GOBIN))

README.md

Lines changed: 13 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,9 @@ The CDAP Operator is still under active development and has not been extensively
1212

1313
## Quick Start
1414

15-
### Repository Setup
16-
17-
The core of this codebase has contributors both in `LiveRamp` and `cdapio` Github organisations so we have customised the Git setup to enable LiveRamp devs to pull request against an internal production branch called `lr-main` whereas `develop` tracks an upstream branch, namely `cdapio/cdap-operator/tree/develop`. This is enabled through a Github action that runs sync upstream tags and the `remote` branch every night.
18-
19-
### Local Git Setup
20-
21-
Given the repository setup we reccomend the following local git setup:
22-
23-
```
24-
origin git@github.com:LiveRamp/cdap-operator.git (fetch)
25-
origin git@github.com:LiveRamp/cdap-operator.git (push)
26-
upstream https://github.com/cdapio/cdap-operator (fetch)
27-
upstream DISABLE (push)
28-
```
29-
30-
This enables a developer to develop and PR against the LiveRamp "fork" as the `origin` while the `upstream` managed by the Google CDAP team can be pulled in at any time as well. Although not strictly necessary the following can be achieved by cloning this repo and then running
31-
32-
`git remote add upstream https://github.com/cdapio/cdap-operator.git`
33-
34-
`git fetch upstream`
35-
36-
`git remote --push upstream no-pushing`
37-
38-
### CI
39-
40-
Automated CI for this project runs for PR and Branch commits against `lr-main` as the base branch. CI is enabled through Google Cloud Build. Images are currently pushed to `eu.gcr.io/liveramp-eng-data-ops-dev/cdap-controller` , a container registry managed by the DataOps team. Builds off of `lr-main` are pushed with a `latest` tag whereas builds from PRs are pushed with tag `{pr_number}`. It is reccomended for production deploys a purpose built tag be used. Please see `cloudbuild.yaml` and the [cloud build triggers](https://console.cloud.google.com/cloud-build/triggers?project=liveramp-eng-data-ops-dev) config for more details on the build configuration.
41-
42-
### CD
43-
44-
CD for this repo is managed seperately through the `LiveRamp/dop-infra` repository. This is so that we can have both the `cdap-operator` and `cdap` deployments managed through a single helm configuration. They are usually deployed in conjunction.
45-
46-
In the future we may look to change the CI process to use a LiveRamp build tool like Jenkins but at the moment this does not add any additional value for us as the `cdap-operator` codebase does not depend on any LiveRamp artifacts.
47-
48-
For any PR against `lr-main` you may manually trigger a one off build by typing `/gcbrun` as a comment.
49-
5015
### Build and Run Locally
5116

52-
You can checkout the CDAP Operator source code, build and run locally. To build the CDAP Operator, you need to setup your environment for the [Go](https://golang.org/doc/install) language. Also, you should have a Kubernetes cluster running and accessible in your current `kubectl` context. This could be either a Kubernetes cluster hosted on a cloud platform like GCP GKE or on a local Minikube instance.
17+
You can checkout the CDAP Operator source code, build and run locally. To build the CDAP Operator, you need to setup your environment for the [Go](https://golang.org/doc/install) language. Also, you should have a Kubernetes cluster
5318

5419
1. Checkout CDAP Operator source
5520
```
@@ -75,7 +40,7 @@ You can checkout the CDAP Operator source code, build and run locally. To build
7540
kubectl apply -f config/samples/cdap_v1alpha1_cdapmaster.yaml
7641
```
7742

78-
### Build Controller Docker Image and Deploy in Kubernetes Manually
43+
### Build Controller Docker Image and Deploy in Kubernetes
7944

8045
You can also build a docker image containing the CDAP controller and deploy it to Kubernetes.
8146

@@ -117,3 +82,14 @@ rm /tmp/setup_envtest.sh
11782
```
11883

11984
4. Run `make test`
85+
86+
#### Running Unit Tests in a docker image
87+
88+
From the project root folder build the test image by running the following
89+
```
90+
docker build -f Dockerfile.test . -t test
91+
```
92+
Execute the image with
93+
```
94+
docker run test
95+
```

cloudbuild.yaml

Lines changed: 0 additions & 12 deletions
This file was deleted.

config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
44
kind: Kustomization
55
images:
66
- name: controller
7-
newName: http://eu.gcr.io/liveramp-eng-data-ops-dev/cdap-controller
8-
newTag: 2.1.0
7+
newName: controller
8+
newTag: latest

controllers/__debug_bin

-40.7 MB
Binary file not shown.

0 commit comments

Comments
 (0)