Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add make bin command #75

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e60525e
add dependabot config (#31)
Nexucis Dec 6, 2024
13a6a54
Bump golangci/golangci-lint-action from 6.1.0 to 6.1.1 (#32)
dependabot[bot] Dec 6, 2024
6dc9daa
Bump sigs.k8s.io/controller-runtime from 0.19.0 to 0.19.3 (#33)
dependabot[bot] Dec 6, 2024
1773816
Bump github.com/onsi/gomega from 1.33.1 to 1.36.0 (#34)
dependabot[bot] Dec 6, 2024
2ac4ada
Bump github.com/onsi/ginkgo/v2 from 2.19.0 to 2.22.0 (#35)
dependabot[bot] Dec 6, 2024
b85ad8e
Add CNCF code of conduct
Nexucis Dec 17, 2024
f5bafb0
Bump the k8s-io group with 2 updates (#36)
dependabot[bot] Dec 17, 2024
744e570
Bump github.com/onsi/gomega from 1.36.0 to 1.36.1 (#37)
dependabot[bot] Dec 17, 2024
02d0079
fix local development documentation and setup
jgbernalp Dec 19, 2024
acd96f0
Merge pull request #39 from perses/fix-documentation-and-local-setup
jgbernalp Dec 19, 2024
da21371
use the distroless image for development with a cluster (#41)
jgbernalp Dec 23, 2024
91aff6b
Bump github.com/perses/perses (#42)
dependabot[bot] Jan 7, 2025
ddae621
Bump perses/github-actions from 0.7.1 to 0.8.0 (#44)
dependabot[bot] Jan 7, 2025
642d55a
Bump github.com/onsi/gomega from 1.36.1 to 1.36.2
dependabot[bot] Jan 7, 2025
2198a2a
add testing docker image for local tests
jgbernalp Jan 8, 2025
44d5fc2
Merge pull request #48 from perses/add-testing-image-command
jgbernalp Jan 8, 2025
97026f5
Merge pull request #46 from perses/dependabot/go_modules/github.com/o…
jgbernalp Jan 8, 2025
bbb4c74
Bump github.com/onsi/ginkgo/v2 from 2.22.0 to 2.22.2
dependabot[bot] Jan 8, 2025
4ea293a
Bump sigs.k8s.io/controller-runtime from 0.19.3 to 0.19.4
dependabot[bot] Jan 13, 2025
96d7507
Merge pull request #45 from perses/dependabot/go_modules/github.com/o…
jgbernalp Jan 16, 2025
b1caf26
Merge pull request #51 from perses/dependabot/go_modules/sigs.k8s.io/…
jgbernalp Jan 16, 2025
121ed46
Bump github.com/perses/perses from 0.50.0-rc.0 to 0.50.0 (#52)
dependabot[bot] Jan 16, 2025
efba345
chore(local-setup) use podman only when it is running
ibakshay Jan 19, 2025
8c92f87
feat(local-setup) add container runtime check and fallback mechanism
ibakshay Jan 19, 2025
3f17c3d
feat(local-setup) enhance container runtime check output and formatting
ibakshay Jan 20, 2025
06346ee
add PVC, fix security defaults and add testing namespace
jgbernalp Jan 16, 2025
d703970
feat(local-setup) streamline container runtime detection and usage in…
ibakshay Jan 20, 2025
a472dca
Merge pull request #55 from ibakshay/improve-local-setup
jgbernalp Jan 20, 2025
23e4475
Bump golangci/golangci-lint-action from 6.1.1 to 6.2.0
dependabot[bot] Jan 20, 2025
9f79777
Merge pull request #54 from perses/jgbernalp/add-pvc
jgbernalp Jan 21, 2025
617783d
Merge pull request #56 from perses/dependabot/github_actions/golangci…
jgbernalp Jan 21, 2025
ed61e58
Bump the k8s-io group with 3 updates
dependabot[bot] Jan 21, 2025
252bfeb
Merge pull request #57 from perses/dependabot/go_modules/k8s-io-f0278…
jgbernalp Jan 21, 2025
0452ed3
Bump sigs.k8s.io/controller-runtime from 0.19.4 to 0.20.0
dependabot[bot] Jan 21, 2025
808b230
Merge pull request #58 from perses/dependabot/go_modules/sigs.k8s.io/…
jgbernalp Jan 22, 2025
11a129d
Bump github.com/perses/perses from 0.50.0 to 0.50.1
dependabot[bot] Jan 27, 2025
dc1a01e
Bump sigs.k8s.io/controller-runtime from 0.20.0 to 0.20.1
dependabot[bot] Jan 27, 2025
fe7ecd6
Merge pull request #59 from perses/dependabot/go_modules/github.com/p…
jgbernalp Feb 4, 2025
983d2ab
Merge pull request #60 from perses/dependabot/go_modules/sigs.k8s.io/…
jgbernalp Feb 4, 2025
0b3c878
small installation doc fix
jgbernalp Feb 6, 2025
dc6f909
Merge pull request #63 from perses/small-docs-fix
jgbernalp Feb 6, 2025
11bc04b
Add workload configurations to Perses CR
dougkirkley Feb 6, 2025
ff94e62
Merge pull request #64 from dougkirkley/feat/workload-configuration
jgbernalp Feb 11, 2025
dfcbe68
Bump golangci/golangci-lint-action from 6.2.0 to 6.3.2 (#69)
dependabot[bot] Feb 11, 2025
5c86542
Bump perses/github-actions from 0.8.0 to 0.9.0 (#68)
dependabot[bot] Feb 11, 2025
9c039f2
feat: Trigger instance updates when Perses CR changes
dougkirkley Feb 11, 2025
953cb99
Merge pull request #67 from dougkirkley/feat/trigger-reconciliaton-on…
jgbernalp Feb 12, 2025
dc433d2
Bump golangci/golangci-lint-action from 6.3.2 to 6.5.0
dependabot[bot] Feb 17, 2025
21503f3
Bump sigs.k8s.io/controller-runtime from 0.20.1 to 0.20.2
dependabot[bot] Feb 17, 2025
f193eb1
Merge pull request #72 from perses/dependabot/go_modules/sigs.k8s.io/…
jgbernalp Feb 18, 2025
c74e912
Merge pull request #70 from perses/dependabot/github_actions/golangci…
jgbernalp Feb 18, 2025
a9e8de9
Bump the k8s-io group with 3 updates
dependabot[bot] Feb 18, 2025
40a8651
Merge pull request #71 from perses/dependabot/go_modules/k8s-io-d8aff…
jgbernalp Feb 18, 2025
8f14e5b
use numeric user to avoid security errors, bump to 0.1.1 in preparati…
jgbernalp Feb 19, 2025
5ab97f0
Merge pull request #73 from perses/jgbernalp/fix-numeric-user-on-image
jgbernalp Feb 19, 2025
2a6e2e3
[feature] allow to define a custom perses image
jgbernalp Feb 24, 2025
2e5f5b2
Merge pull request #74 from perses/jgbernalp/allow-custom-perses-image
jgbernalp Feb 24, 2025
5cbf8d9
Add a `make bin` command for Konflux CI Pipeline to build binary files
zhuje Feb 24, 2025
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
!bin/manager
testbin/
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
open-pull-requests-limit: 10
schedule:
interval: "weekly"
groups:
k8s.io:
patterns:
- "k8s.io/*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: perses/github-actions@v0.7.1
- uses: perses/github-actions@v0.9.0
- uses: ./.github/perses-ci/actions/setup_environment
with:
enable_go: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
- uses: perses/github-actions@v0.7.1
- uses: perses/github-actions@v0.9.0
- uses: ./.github/perses-ci/actions/setup_environment
with:
enable_go: true
Expand All @@ -34,7 +34,7 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
- uses: perses/github-actions@v0.7.1
- uses: perses/github-actions@v0.9.0
- uses: ./.github/perses-ci/actions/setup_environment
with:
enable_go: true
Expand All @@ -46,7 +46,7 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
- uses: perses/github-actions@v0.7.1
- uses: perses/github-actions@v0.9.0
- uses: ./.github/perses-ci/actions/setup_environment
with:
enable_go: true
Expand All @@ -55,7 +55,7 @@ jobs:
- name: generate files
run: make generate
- name: golangci-lint
uses: golangci/golangci-lint-action@v6.1.0
uses: golangci/golangci-lint-action@v6.5.0
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.61.0
Expand Down
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Perses Community Code of Conduct

Perses follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md).
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ FROM gcr.io/distroless/static-debian12

LABEL maintainer="The Perses Authors <perses-team@googlegroups.com>"

USER nobody
USER 65532:65532

COPY --chown=nobody:nobody operator /bin/operator
COPY --chown=nobody:nobody LICENSE /LICENSE
COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types
COPY --chown=65532:65532 bin/manager /bin/manager
COPY --chown=65532:65532 LICENSE /LICENSE
COPY --from=build-env --chown=65532:65532 /etc/mime.types /etc/mime.types

EXPOSE 8080
ENTRYPOINT [ "/bin/operator" ]
ENTRYPOINT [ "/bin/manager" ]
21 changes: 21 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM golang:1.23-alpine AS build-env

RUN apk add --update --no-cache make bash mailcap

WORKDIR /app
COPY . .

RUN make build

FROM gcr.io/distroless/static-debian12

LABEL maintainer="The Perses Authors <perses-team@googlegroups.com>"

USER 65532:65532

COPY --from=build-env --chown=65532:65532 /app/bin/manager /bin/manager
COPY --chown=65532:65532 LICENSE /LICENSE
COPY --from=build-env --chown=65532:65532 /etc/mime.types /etc/mime.types

EXPOSE 8080
ENTRYPOINT [ "/bin/manager" ]
47 changes: 40 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,35 @@
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= 0.1.0
VERSION ?= 0.1.1

# DATE defines the building date. It is used mainly for goreleaser when generating the GitHub release.
DATE := $(shell date +%Y-%m-%d)
export DATE


.PHONY: check-container-runtime
check-container-runtime:
@if podman ps >/dev/null 2>&1; then \
echo ""; \
echo "============================================"; \
echo " ✅ Using Podman the container runtime"; \
echo "============================================"; \
elif docker ps >/dev/null 2>&1; then \
echo ""; \
echo "============================================"; \
echo " ✅ Using Docker the container runtime"; \
echo "============================================"; \
else \
echo ""; \
echo "============================================"; \
echo " ❌ Neither Podman nor Docker daemon is running"; \
echo "============================================"; \
exit 1; \
fi

# CONTAINER_RUNTIME defines the container runtime to use for building the bundle image.
CONTAINER_RUNTIME := $(shell command -v podman 2> /dev/null || echo docker)
CONTAINER_RUNTIME := $(shell if podman ps >/dev/null 2>&1; then echo podman; elif docker ps >/dev/null 2>&1; then echo docker; fi)

# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
Expand Down Expand Up @@ -150,8 +171,12 @@ run: manifests generate fmt vet ## Run a controller from your host.
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: image-build
image-build: test ## Build docker image with the manager.
${CONTAINER_RUNTIME} build -t ${IMG} .
image-build: check-container-runtime build test ## Build docker image with the manager.
${CONTAINER_RUNTIME} build -f Dockerfile -t ${IMG} .

.PHONY: test-image-build
test-image-build: check-container-runtime test ## Build a testing docker image with the manager.
${CONTAINER_RUNTIME} build -f Dockerfile.dev -t ${IMG} .

.PHONY: image-push
image-push: ## Push docker image with the manager.
Expand All @@ -174,7 +199,11 @@ docker-buildx: test ## Build and push docker image for the manager for cross-pla
- docker buildx rm project-v3-builder
rm Dockerfile.cross

##@ Deployment
.PHONY: podman-cross-build
podman-cross-build: test
podman manifest create ${IMG}
podman build --platform $(PLATFORMS) --manifest ${IMG} -f Dockerfile.dev
podman manifest push ${IMG}

ifndef ignore-not-found
ignore-not-found = false
Expand Down Expand Up @@ -300,7 +329,7 @@ endif
# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-build
catalog-build: opm ## Build a catalog image.
catalog-build: check-container-runtime opm ## Build a catalog image.
$(OPM) index add --container-tool $(CONTAINER_RUNTIME) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)

# Push the catalog image.
Expand All @@ -326,11 +355,15 @@ endef
generate-goreleaser:
go run ./scripts/generate-goreleaser/generate-goreleaser.go

## Cross build binaries for all platforms (Use "make build" in development)
## Cross build binaries for all platforms (Use "make image-build" in development)
.PHONY: cross-build
cross-build: generate-goreleaser manifests generate fmt vet ## Cross build binaries for all platforms (Use "make build" in development)
goreleaser release --snapshot --clean

.PHONY: cross-release
cross-release: generate-goreleaser manifests generate fmt vet
goreleaser release --clean

.PHONY: bin
bin:
go build -mod=readonly -o bin/manager main.go
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ An operator to install [Perses](https://github.com/perses/perses) in a k8s clust

## Getting Started

You’ll need a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.
You’ll need:
- a Kubernetes cluster to run against. You can use [KIND](https://sigs.k8s.io/kind) to get a local cluster for testing, or run against a remote cluster.
**Note:** Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster `kubectl cluster-info` shows).
- [kubectl](https://kubernetes.io/docs/tasks/tools/#kubectl) installed and configured to use your cluster.

### Running on the cluster

Expand All @@ -14,22 +16,30 @@ You’ll need a Kubernetes cluster to run against. You can use [KIND](https://si
make install
```

2. Install custom resources:
2. Create a namespace for the resources:
```sh
kubectl create namespace perses-dev
```

3. Install custom resources:

```sh
kubectl apply -k config/samples
```

3. Build and push your image to the location specified by `IMG`:
4. Using the the location specified by `IMG`, build a testing image and push it to the registry, then deploy the controller to the cluster:
> **Note:** Make sure the image is accessible either publicly or from the cluster internal registry.

```sh
make docker-build docker-push IMG=<some-registry>/perses-operator:tag
IMG=<some-registry>/perses-operator:tag make test-image-build image-push deploy
```

4. Deploy the controller to the cluster with the image specified by `IMG`:
> **Note:** If you already have an image built, you can deploy it to the cluster using `IMG=<some-registry>/perses-operator:tag make deploy`.

5. Port forward the service so you can access the Perses UI at `http://localhost:8080`:

```sh
make deploy IMG=<some-registry>/perses-operator:tag
kubectl -n perses-dev port-forward svc/perses-sample 8080:8080
```

### Uninstall CRDs
Expand Down Expand Up @@ -100,7 +110,7 @@ More information can be found via the [Kubebuilder Documentation](https://book.k

## License

Copyright 2023 The Perses Authors.
Copyright 2025 The Perses Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
19 changes: 19 additions & 0 deletions api/v1alpha1/perses_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,34 @@ limitations under the License.
package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// PersesSpec defines the desired state of Perses
type PersesSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
Metadata *Metadata `json:"metadata,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
Config PersesConfig `json:"config,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
ContainerPort int32 `json:"containerPort,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
Replicas *int32 `json:"replicas,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
Affinity *corev1.Affinity `json:"affinity,omitempty"`
// +operator-sdk:csv:customresourcedefinitions:type=spec
Image *string `json:"image,omitempty"`
}

// Metadata to add to deployed pods
type Metadata struct {
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}

// PersesStatus defines the observed state of Perses
Expand Down
Loading