Skip to content

Commit b29012e

Browse files
committed
wip
Signed-off-by: Joe Lanford <[email protected]>
1 parent 0ec29f4 commit b29012e

17 files changed

+392
-371
lines changed

.github/workflows/e2e.yaml

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

.github/workflows/release.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ jobs:
2626
with:
2727
go-version-file: "go.mod"
2828

29+
- uses: actions/cache@v3
30+
with:
31+
path: |
32+
~/.cache/go-build
33+
~/go/pkg/mod
34+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
35+
restore-keys: |
36+
${{ runner.os }}-go-
37+
2938
- name: Docker Login
3039
if: ${{ github.event_name != 'pull_request' }}
3140
uses: docker/login-action@v1
@@ -52,12 +61,10 @@ jobs:
5261
echo IMAGE_TAG="$(git describe --tags --always)" >> $GITHUB_ENV
5362
fi
5463
55-
- name: Generate the operator-controller release manifests
56-
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
57-
run: |
58-
make quickstart VERSION=${GITHUB_REF#refs/tags/}
64+
- name: Install Task
65+
run: go install github.com/go-task/task/v3/cmd/task@latest
5966

6067
- name: Run goreleaser
61-
run: make release
68+
run: task release
6269
env:
6370
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/test.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
test: [ sanity, unit, e2e ]
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- uses: actions/setup-go@v3
20+
with:
21+
go-version-file: go.mod
22+
23+
- uses: actions/cache@v3
24+
with:
25+
path: |
26+
~/.cache/go-build
27+
~/go/pkg/mod
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-
31+
32+
- name: Install Task
33+
run: go install github.com/go-task/task/v3/cmd/task@latest
34+
35+
- name: Run ${{matrix.test}} test
36+
run: |
37+
task test:${{matrix.test}}

.github/workflows/unit-test.yaml

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

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
*.so
77
*.dylib
88
bin/*
9-
testbin/*
10-
Dockerfile.cross
9+
hack/tools/bin/*
1110

1211
# Test binary, build with `go test -c`
1312
*.test
@@ -17,8 +16,8 @@ Dockerfile.cross
1716

1817
# Release output
1918
dist/**
20-
.goreleaser.yml
21-
operator-controller.yaml
19+
/install.sh
20+
/operator-controller.yaml
2221

2322
# Kubernetes Generated files - skip generated files, except for vendored files
2423

.goreleaser.template.yml

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

.goreleaser.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
env:
2+
- GOPROXY=https://proxy.golang.org|direct
3+
- GO111MODULE=on
4+
- CGO_ENABLED=0
5+
before:
6+
hooks:
7+
- go mod tidy
8+
- go mod download
9+
builds:
10+
- id: operator-controller
11+
main: ./
12+
binary: bin/manager
13+
tags: upstream
14+
goos:
15+
- linux
16+
ldflags:
17+
- -X main.Version={{ .Version }}
18+
dockers:
19+
- image_templates:
20+
- "{{ .Env.IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}"
21+
dockerfile: Dockerfile
22+
goos: linux
23+
docker_manifests:
24+
- name_template: "{{ .Env.IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}"
25+
image_templates:
26+
- "{{ .Env.IMAGE_REPO }}:{{ .Env.IMAGE_TAG }}"
27+
checksum:
28+
name_template: 'checksums.txt'
29+
snapshot:
30+
name_template: "{{ incpatch .Version }}-next"
31+
changelog:
32+
use: github-native
33+
skip: "{{ .Env.DISABLE_RELEASE_PIPELINE }}"
34+
release:
35+
disable: "{{ .Env.DISABLE_RELEASE_PIPELINE }}"
36+
extra_files:
37+
- glob: 'install.sh'
38+
- glob: 'operator-controller.yaml'
39+
header: |
40+
## Installation
41+
42+
```bash
43+
curl -sSL https://github.com/operator-framework/operator-controller/releases/download/{{ .Env.IMAGE_TAG }}/install.sh | bash
44+
```

.taskfile.build.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
version: '3'
2+
3+
includes:
4+
tools:
5+
taskfile: .taskfile.tools.yaml
6+
internal: true
7+
8+
vars:
9+
BIN: "{{.ROOT_DIR}}/bin"
10+
OPERATOR_CONTROLLER_MANIFEST: ./operator-controller.yaml
11+
12+
CERT_MANAGER_VERSION: v1.9.0
13+
RUKPAK_VERSION: v0.11.0
14+
15+
env:
16+
IMAGE_REPO: quay.io/operator-framework/operator-controller
17+
IMAGE_TAG: devel
18+
19+
tasks:
20+
generate:
21+
desc: "Run code generation"
22+
cmds:
23+
- go generate ./...
24+
- "{{.TOOLSBIN}}/controller-gen object:headerFile=hack/boilerplate.go.txt paths=./..."
25+
- "{{.TOOLSBIN}}/controller-gen rbac:roleName=manager-role crd webhook paths=./... output:crd:artifacts:config=config/crd/bases"
26+
deps: [tools:controller-gen]
27+
28+
binary:
29+
desc: "Build the binaries for the current OS"
30+
cmds:
31+
- mkdir -p {{.BIN}}
32+
- GOOS={{.GOOS}} {{.TOOLSBIN}}/goreleaser build --single-target --snapshot --clean --output {{.BIN}}/manager
33+
deps: [tools:goreleaser, generate]
34+
35+
docker:
36+
desc: "Build the docker image"
37+
cmds:
38+
- docker build -f Dockerfile -t $IMAGE_REPO:$IMAGE_TAG bin/linux
39+
deps:
40+
- task: binary
41+
vars:
42+
BIN: "{{.ROOT_DIR}}/bin/linux"
43+
GOOS: linux
44+
45+
manifest:
46+
desc: "Generate the operator manifest"
47+
cmds:
48+
- cd config/manager && {{.TOOLSBIN}}/kustomize edit set image controller=$IMAGE_REPO:$IMAGE_TAG
49+
- echo "---" > ./operator-controller.yaml
50+
- "{{.TOOLSBIN}}/kustomize build config/crd >> ./operator-controller.yaml"
51+
- echo "---" >> ./operator-controller.yaml
52+
- "{{.TOOLSBIN}}/kustomize build config/default >> ./operator-controller.yaml"
53+
deps: [tools:kustomize, generate]
54+
55+
install-script:
56+
desc: "Generate the install script"
57+
silent: true
58+
cmds:
59+
- |
60+
cat << EOF > ./install.sh
61+
#!/usr/bin/env bash
62+
set -o pipefail -o errexit -o nounset
63+
64+
# Install cert-manager
65+
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/{{.CERT_MANAGER_VERSION}}/cert-manager.yaml
66+
kubectl wait --for=condition=Available --namespace=cert-manager deployment/cert-manager-webhook --timeout=60s
67+
68+
# Install rukpak
69+
kubectl apply -f https://github.com/operator-framework/rukpak/releases/download/{{.RUKPAK_VERSION}}/rukpak.yaml
70+
kubectl wait --for=condition=Available --namespace=rukpak-system deployment/core --timeout=60s
71+
kubectl wait --for=condition=Available --namespace=rukpak-system deployment/helm-provisioner --timeout=60s
72+
kubectl wait --for=condition=Available --namespace=rukpak-system deployment/rukpak-webhooks --timeout=60s
73+
kubectl wait --for=condition=Available --namespace=crdvalidator-system deployment/crd-validation-webhook --timeout=60s
74+
75+
# Install operator-controller
76+
kubectl apply -f {{.OPERATOR_CONTROLLER_MANIFEST}}
77+
kubectl wait --for=condition=Available --namespace=operator-controller-system deployment/operator-controller-controller-manager --timeout=60s
78+
EOF
79+
- chmod +x ./install.sh

.taskfile.deploy.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: '3'
2+
3+
includes:
4+
tools:
5+
taskfile: .taskfile.tools.yaml
6+
internal: true
7+
build:
8+
taskfile: .taskfile.build.yaml
9+
internal: true
10+
kind:
11+
taskfile: .taskfile.kind.yaml
12+
internal: true
13+
14+
tasks:
15+
kind:
16+
cmds:
17+
- task: kind:load-image
18+
vars:
19+
IMAGE: "$IMAGE_REPO:$IMAGE_TAG"
20+
KIND_CLUSTER_NAME: "{{.KIND_CLUSTER_NAME}}"
21+
- ./install.sh
22+
deps:
23+
- task: build:docker
24+
- task: build:manifest
25+
- task: build:install-script
26+
- task: kind:create
27+
vars:
28+
KIND_CLUSTER_NAME: "{{.KIND_CLUSTER_NAME}}"
29+
desc: "Run the operator in a fresh kind cluster"

.taskfile.kind.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: '3'
2+
3+
vars:
4+
KIND_CLUSTER_NAME: "operator-controller"
5+
6+
includes:
7+
tools:
8+
taskfile: .taskfile.tools.yaml
9+
internal: true
10+
11+
tasks:
12+
create:
13+
desc: "Create a fresh kind cluster"
14+
cmds:
15+
- "{{.TOOLSBIN}}/kind create cluster --name {{.KIND_CLUSTER_NAME}}"
16+
deps:
17+
- tools:kind
18+
- task: delete
19+
vars:
20+
KIND_CLUSTER_NAME: "{{.KIND_CLUSTER_NAME}}"
21+
22+
delete:
23+
desc: "Delete a kind cluster"
24+
cmds:
25+
- "{{.TOOLSBIN}}/kind delete cluster --name {{.KIND_CLUSTER_NAME}}"
26+
deps: [tools:kind]
27+
28+
load-image:
29+
desc: "Load the image into the kind cluster"
30+
cmds:
31+
- "{{.TOOLSBIN}}/kind load docker-image {{.IMAGE}} --name {{.KIND_CLUSTER_NAME}}"
32+
deps: [tools:kind]

0 commit comments

Comments
 (0)