Skip to content

Commit 60ea1ab

Browse files
merge
Signed-off-by: James Milligan <[email protected]>
2 parents 9546195 + 2942788 commit 60ea1ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+3050
-722
lines changed

.github/workflows/pr-checks.yml

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ on:
44
push:
55
branches:
66
- main
7+
paths-ignore:
8+
- '**.md'
79
pull_request:
10+
paths-ignore:
11+
- '**.md'
812
env:
913
# Default minimum version of Go to support.
10-
DEFAULT_GO_VERSION: 1.18
14+
DEFAULT_GO_VERSION: 1.19
1115

1216
permissions:
1317
contents: read
@@ -68,8 +72,6 @@ jobs:
6872
steps:
6973
- name: Checkout
7074
uses: actions/checkout@v3
71-
with:
72-
submodules: recursive
7375
- name: Set up QEMU
7476
uses: docker/setup-qemu-action@master
7577
with:
@@ -78,11 +80,12 @@ jobs:
7880
id: buildx
7981
uses: docker/setup-buildx-action@master
8082
- name: Build
81-
uses: docker/build-push-action@v2
83+
uses: docker/build-push-action@v3
8284
with:
85+
builder: ${{ steps.buildx.outputs.name }}
8386
context: .
8487
outputs: type=docker,dest=${{ github.workspace }}/open-feature-operator-local.tar
85-
tags: open-feature-operator-local:test
88+
tags: open-feature-operator-local:${{ github.sha }}
8689
- name: Run Trivy vulnerability scanner
8790
uses: aquasecurity/trivy-action@master
8891
with:
@@ -95,3 +98,39 @@ jobs:
9598
uses: github/codeql-action/upload-sarif@v2
9699
with:
97100
sarif_file: "trivy-results.sarif"
101+
- name: Upload image as artifact
102+
uses: actions/upload-artifact@v3
103+
with:
104+
name: open-feature-operator-local-${{ github.sha }}
105+
path: ${{ github.workspace }}/open-feature-operator-local.tar
106+
107+
e2e-test:
108+
runs-on: ubuntu-latest
109+
needs: docker-local
110+
steps:
111+
- name: Install Go
112+
uses: actions/setup-go@v3
113+
with:
114+
go-version: ${{ env.DEFAULT_GO_VERSION }}
115+
- name: Checkout
116+
uses: actions/checkout@v3
117+
- name: Download image
118+
uses: actions/download-artifact@v3
119+
with:
120+
name: open-feature-operator-local-${{ github.sha }}
121+
path: ${{ github.workspace }}
122+
- name: Load open-feature-operator image into docker
123+
run: |
124+
docker load --input ${{ github.workspace }}/open-feature-operator-local.tar
125+
- name: Create k8s Kind Cluster
126+
uses: helm/[email protected]
127+
with:
128+
config: ./test/e2e/kind-cluster.yml
129+
cluster_name: open-feature-operator-test
130+
- name: Load open-feature-operator image into Kind cluster
131+
run: |
132+
kind load docker-image open-feature-operator-local:${{ github.sha }} --name open-feature-operator-test
133+
- name: Run e2e test
134+
run: |
135+
IMG=open-feature-operator-local:${{ github.sha }} make deploy-operator
136+
IMG=open-feature-operator-local:${{ github.sha }} make e2e-test

.github/workflows/pr-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
name: Validate PR title
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: amannn/action-semantic-pull-request@v4
21+
- uses: amannn/action-semantic-pull-request@v5
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-please.yml

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ on:
66
- main
77

88
env:
9+
# Default minimum version of Go to support.
10+
DEFAULT_GO_VERSION: 1.19
911
REGISTRY: ghcr.io
1012
IMAGE_NAME: ${{ github.repository }}
13+
GITHUB_PAGES_BRANCH: gh-pages
1114

1215
permissions:
1316
contents: read
@@ -66,7 +69,7 @@ jobs:
6669
uses: docker/setup-buildx-action@master
6770

6871
- name: Build
69-
uses: docker/build-push-action@v2
72+
uses: docker/build-push-action@v3
7073
with:
7174
builder: ${{ steps.buildx.outputs.name }}
7275
context: .
@@ -110,12 +113,12 @@ jobs:
110113
- name: Setup go
111114
uses: actions/setup-go@v3
112115
with:
113-
go-version: '1.17.11'
116+
go-version: ${{ env.DEFAULT_GO_VERSION }}
114117
- run: |
115118
make update-flagd
116119
go mod tidy
117120
make controller-gen
118-
make helm-package
121+
IMG=ghcr.io/open-feature/open-feature-operator:${{ needs.release-please.outputs.release_tag_name }} make helm-package
119122
IMG=ghcr.io/open-feature/open-feature-operator:${{ needs.release-please.outputs.release_tag_name }} make release-manifests
120123
121124
- uses: anchore/sbom-action@v0
@@ -127,7 +130,47 @@ jobs:
127130
with:
128131
tag_name: ${{ needs.release-please.outputs.release_tag_name }}
129132
files: |
130-
config/webhook/certificate.yaml
131133
config/rendered/release.yaml
132134
config/samples/end-to-end.yaml
133135
open-feature-operator-sbom.spdx.json
136+
137+
release-charts:
138+
needs: release-please
139+
permissions:
140+
contents: write
141+
runs-on: ubuntu-latest
142+
if: ${{ needs.release-please.outputs.release_created }}
143+
steps:
144+
- name: Checkout
145+
uses: actions/checkout@v3
146+
with:
147+
fetch-depth: 0
148+
ref: ${{ env.GITHUB_PAGES_BRANCH }}
149+
150+
- name: Setup go
151+
uses: actions/setup-go@v3
152+
with:
153+
go-version: ${{ env.DEFAULT_GO_VERSION }}
154+
155+
- name: Configure Git
156+
run: |
157+
git config user.name "$GITHUB_ACTOR"
158+
git config user.email "[email protected]"
159+
160+
- name: Merge release to gh-pages
161+
run: git merge ${{ needs.release-please.outputs.release_tag_name }}
162+
163+
- name: Generate helm charts
164+
run: IMG=ghcr.io/open-feature/open-feature-operator:${{ needs.release-please.outputs.release_tag_name }} make helm-package
165+
166+
- name: Commit files
167+
run: |
168+
git add charts/
169+
git add index.yaml
170+
git commit -s -m "chore: released charts ${{ needs.release-please.outputs.release_tag_name }}"
171+
172+
- name: Push changes
173+
uses: ad-m/github-push-action@master
174+
with:
175+
github_token: ${{ secrets.GITHUB_TOKEN }}
176+
branch: ${{ env.GITHUB_PAGES_BRANCH }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ config/manager/manager.yaml
44
config/manager/kustomization.yaml
55
schemas
66
.vscode
7-
open-feature-operator
87
of-agent
98
# Binaries for programs and plugins
109
*.exe

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.2.17"
2+
".": "0.2.20"
33
}

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
# Changelog
22

3-
## [0.2.17](https://github.com/open-feature/open-feature-operator/compare/v0.2.16...v0.2.17) (2022-11-03)
3+
## [0.2.20](https://github.com/open-feature/open-feature-operator/compare/v0.2.19...v0.2.20) (2022-11-18)
4+
5+
6+
### Bug Fixes
7+
8+
* **deps:** update module sigs.k8s.io/controller-runtime to v0.13.1 ([edeffcd](https://github.com/open-feature/open-feature-operator/commit/edeffcd3ef6fe9a8d52d0d5c414512ef8cd80629))
9+
10+
## [0.2.19](https://github.com/open-feature/open-feature-operator/compare/v0.2.18...v0.2.19) (2022-11-15)
11+
12+
13+
### Features
14+
15+
* introduced v1beta1 of featureflagconfiguration CRD with conversion webhook to v1alpha1 ([a45bdef](https://github.com/open-feature/open-feature-operator/commit/a45bdef5eec87738ce731af5825daffeb69eb6cb))
16+
* structured the featureflagconfiguration CRD ([b056c7c](https://github.com/open-feature/open-feature-operator/commit/b056c7cdd76f4653c1a728342687beaa8279e314))
17+
18+
## [0.2.18](https://github.com/open-feature/open-feature-operator/compare/v0.2.17...v0.2.18) (2022-11-10)
19+
20+
21+
### Bug Fixes
22+
23+
* nil pointer dereference ([#216](https://github.com/open-feature/open-feature-operator/issues/216)) ([d975066](https://github.com/open-feature/open-feature-operator/commit/d975066f96a5f9caf8af8d513076480a33943257))
24+
25+
## [0.2.17](https://github.com/open-feature/open-feature-operator/compare/v0.2.16...v0.2.17) (2022-11-07)
426

527

628
### Bug Fixes

CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# These owners will be the default owners for everything in
22
# the repo. Unless a later match takes precedence
3-
* @AlexsJones @beeme1mr
3+
* @AlexsJones @beeme1mr @skyerus

CONTRIBUTING.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Guidelines
2+
3+
Welcome!
4+
5+
There are a few things to consider before contributing to open-feature-operator.
6+
7+
Firstly, there's [a code of conduct](https://github.com/open-feature/.github/blob/main/CODE_OF_CONDUCT.md).
8+
TLDR: be respectful.
9+
10+
Any contributions are expected to include tests. These can be validated with `make test` or the automated github workflow will run them on PR creation.
11+
12+
The go version in the `go.mod` is the currently supported version of go.
13+
14+
Thanks! Issues and pull requests following these guidelines are welcome.
15+
16+
## Development
17+
18+
### FeatureFlagConfiguration custom resource definition versioning
19+
Custom resource definitions support multiple versions. The kubebuilder framework exposes a system to seamlessly convert between versions (using a "hub and spoke" model) maintaining backwards compatibility. It does this by injecting conversion webhooks that call our defined convert functions. The hub version of the `FeatureFlagConfiguration` custom resource definition (the version to which all other versions are converted) is `v1alpha1`.
20+
Follow [this tutorial](https://book.kubebuilder.io/multiversion-tutorial/conversion-concepts.html) to implement a new version of the custom resource definition.

Makefile

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11

22
# Image URL to use all building/pushing image targets
33
IMG ?= controller:latest
4+
# customize overlay to be used in the build, DEFAULT or HELM
5+
KUSTOMIZE_OVERLAY ?= DEFAULT
46
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5-
FLAGD_VERSION=v0.2.5
6-
CHART_VERSION=v0.2.17# x-release-please-version
7-
ENVTEST_K8S_VERSION = 1.23
7+
FLAGD_VERSION=v0.2.7
8+
CHART_VERSION=v0.2.20# x-release-please-version
9+
ENVTEST_K8S_VERSION = 1.25
810

911
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
1012
ifeq (,$(shell go env GOBIN))
@@ -64,6 +66,13 @@ vet: ## Run go vet against code.
6466
test: manifests generate fmt vet envtest ## Run tests.
6567
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) -p path)" go test ./... -coverprofile cover.out
6668

69+
## Requires the operator to be deployed
70+
.PHONY: e2e-test
71+
e2e-test: manifests generate fmt vet
72+
kubectl -n open-feature-operator-system apply -f ./test/e2e/e2e.yml
73+
kubectl wait --for=condition=Available=True deploy --all -n 'open-feature-operator-system'
74+
./test/e2e/run.sh
75+
6776
.PHONY: lint
6877
lint:
6978
go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@@ -105,7 +114,14 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified
105114
release-manifests: manifests kustomize
106115
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
107116
mkdir -p config/rendered/
108-
$(KUSTOMIZE) build config/default > config/rendered/release.yaml
117+
@if [ ${KUSTOMIZE_OVERLAY} = DEFAULT ]; then\
118+
echo building default overlay;\
119+
$(KUSTOMIZE) build config/default > config/rendered/release.yaml;\
120+
fi
121+
@if [ ${KUSTOMIZE_OVERLAY} = HELM ]; then\
122+
echo building helm overlay;\
123+
$(KUSTOMIZE) build config/overlays/helm > chart/open-feature-operator/templates/rendered.yaml;\
124+
fi
109125

110126
.PHONY: deploy
111127
deploy: generate manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
@@ -138,7 +154,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
138154

139155
## Tool Versions
140156
KUSTOMIZE_VERSION ?= v4.5.7
141-
CONTROLLER_TOOLS_VERSION ?= v0.8.0
157+
CONTROLLER_TOOLS_VERSION ?= v0.10.0
142158

143159
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
144160
.PHONY: kustomize
@@ -166,9 +182,12 @@ $(HELM): $(LOCALBIN)
166182
[ -e "$(HELM)" ] && rm -rf "$(HELM)" || true
167183
cd $(LOCALBIN) && curl -s $(HELM_INSTALLER) | tar -xzf - -C $(LOCALBIN)
168184

169-
helm-package: generate release-manifests helm
170-
cp config/rendered/release.yaml chart/templates/rendered.yaml
171-
$(HELM) package --version $(CHART_VERSION) chart
172-
mkdir -p charts && mv ofo-*.tgz charts
185+
.PHONY: set-helm-overlay
186+
set-helm-overlay:
187+
${eval KUSTOMIZE_OVERLAY = HELM}
188+
189+
helm-package: set-helm-overlay generate release-manifests helm
190+
$(HELM) package --version $(CHART_VERSION) chart/open-feature-operator
191+
mkdir -p charts && mv open-feature-operator-*.tgz charts
173192
$(HELM) repo index --url https://open-feature.github.io/open-feature-operator/charts charts
174193
mv charts/index.yaml index.yaml

PROJECT

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@ resources:
1414
kind: FeatureFlagConfiguration
1515
path: github.com/open-feature/open-feature-operator/apis/core/v1alpha1
1616
version: v1alpha1
17+
webhooks:
18+
conversion: true
19+
webhookVersion: v1
20+
- api:
21+
crdVersion: v1
22+
namespaced: true
23+
domain: openfeature.dev
24+
group: core
25+
kind: FeatureFlagConfiguration
26+
path: github.com/open-feature/open-feature-operator/apis/core/v1alpha2
27+
version: v1alpha2
1728
version: "3"

0 commit comments

Comments
 (0)