Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
fix: rename app (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis authored Mar 12, 2024
1 parent 3982731 commit 3a494cf
Show file tree
Hide file tree
Showing 45 changed files with 179 additions and 174 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/pr-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ jobs:
make docker-build
- name: Create image tarball
run: |
docker save --output prometheuspatch-controller-container.tar prometheuspatch-controller:latest
docker save --output prometheus-patch-controller-container.tar prometheus-patch-controller:latest
- name: Upload image
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce #v3.1.2
with:
name: prometheuspatch-controller-container
path: prometheuspatch-controller-container.tar
name: prometheus-patch-controller-container
path: prometheus-patch-controller-container.tar
- id: profiles
name: Determine test profiles
run: |
Expand Down Expand Up @@ -177,14 +177,14 @@ jobs:
uses: engineerd/setup-kind@aa272fe2a7309878ffc2a81c56cfe3ef108ae7d0 #v0.5.0
with:
version: v0.17.0
- name: Download prometheuspatch-controller container
- name: Download prometheus-patch-controller container
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a #v3.0.2
with:
name: prometheuspatch-controller-container
name: prometheus-patch-controller-container
path: /tmp
- name: Load images
run: |
docker load --input /tmp/prometheuspatch-controller-container.tar
docker load --input /tmp/prometheus-patch-controller-container.tar
docker image ls -a
- name: Setup Kustomize
uses: imranismail/setup-kustomize@6691bdeb1b0a3286fb7f70fd1423c10e81e5375f # v2.0.0
Expand All @@ -195,10 +195,10 @@ jobs:
if: failure()
run: |
kubectl -n kube-system describe pods
kubectl -n prometheuspatch-system describe pods
kubectl -n prometheuspatch-system get all
kubectl -n prometheuspatch-system logs deploy/prometheuspatch-controller
kubectl -n prometheuspatch-system get prometheuspatchrule -o yaml
kubectl -n prometheus-patch-system describe pods
kubectl -n prometheus-patch-system get all
kubectl -n prometheus-patch-system logs deploy/prometheus-patch-controller
kubectl -n prometheus-patch-system get prometheus-patchrule -o yaml
test-chart:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -228,17 +228,17 @@ jobs:
- name: Create kind cluster
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0

- name: Download prometheuspatch-controller container
- name: Download prometheus-patch-controller container
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: prometheuspatch-controller-container
name: prometheus-patch-controller-container
path: /tmp

- name: Load image
run: |
docker load --input /tmp/prometheuspatch-controller-container.tar
docker tag prometheuspatch-controller:latest ghcr.io/doodlescheduling/prometheuspatch-controller:v0.0.0
kind load docker-image ghcr.io/doodlescheduling/prometheuspatch-controller:v0.0.0 --name chart-testing
docker load --input /tmp/prometheus-patch-controller-container.tar
docker tag prometheus-patch-controller:latest ghcr.io/doodlescheduling/prometheus-patch-controller:v0.0.0
kind load docker-image ghcr.io/doodlescheduling/prometheus-patch-controller:v0.0.0 --name chart-testing
docker image ls -a
- name: Run chart-testing (install)
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ jobs:
- name: Package helm charts
run: |
packVersion=$(echo "${{ github.ref_name }}" | sed 's/^v//g')
helm package chart/prometheuspatch-controller -d chart --version=$packVersion --app-version=${{ github.ref_name }}
helm package chart/prometheus-patch-controller -d chart --version=$packVersion --app-version=${{ github.ref_name }}
- name: Publish helm charts to Github Container Registry
run: |
repository=$(echo "${{ github.repository_owner }}" | tr [:upper:] [:lower:])
helm push ${{ github.workspace }}/chart/prometheuspatch-controller-*.tgz oci://ghcr.io/$repository/charts |& tee .digest
helm push ${{ github.workspace }}/chart/prometheus-patch-controller-*.tgz oci://ghcr.io/$repository/charts |& tee .digest
cosign login --username ${GITHUB_ACTOR} --password ${{ secrets.GITHUB_TOKEN }} ghcr.io
cosign sign --yes ghcr.io/$repository/charts/prometheuspatch-controller@$(cat .digest | awk -F "[, ]+" '/Digest/{print $NF}')
cosign sign --yes ghcr.io/$repository/charts/prometheus-patch-controller@$(cat .digest | awk -F "[, ]+" '/Digest/{print $NF}')
2 changes: 1 addition & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project_name: prometheuspatch-controller
project_name: prometheus-patch-controller

builds:
- id: manager
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

# Image URL to use all building/pushing image targets
IMG ?= prometheuspatch-controller:latest
IMG ?= prometheus-patch-controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.27

Expand Down Expand Up @@ -111,7 +111,7 @@ uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified

.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/base/manager && $(KUSTOMIZE) edit set image ghcr.io/doodlescheduling/prometheuspatch-controller=${IMG}
cd config/base/manager && $(KUSTOMIZE) edit set image ghcr.io/doodlescheduling/prometheus-patch-controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -

.PHONY: undeploy
Expand All @@ -124,17 +124,17 @@ CLUSTER=kind
.PHONY: kind-test
kind-test: ## Deploy including test
kustomize build config/base/crd | kubectl --context kind-${CLUSTER} apply -f -
kubectl --context kind-${CLUSTER} -n prometheuspatch-system delete pods --all
kubectl --context kind-${CLUSTER} -n prometheus-patch-system delete pods --all
kind load docker-image ${IMG} --name ${CLUSTER}
kustomize build config/tests/cases/${TEST_PROFILE} --enable-helm | kubectl --context kind-${CLUSTER} apply -f -
kubectl --context kind-${CLUSTER} -n prometheuspatch-system wait --for=condition=Ready pods -l control-plane=controller-manager -l app.kubernetes.io/managed-by!=Helm,verify!=yes --timeout=3m
kubectl --context kind-${CLUSTER} -n prometheuspatch-system wait --for=jsonpath='{.status.conditions[1].reason}'=PodCompleted pods -l app.kubernetes.io/managed-by!=Helm,verify=yes --timeout=3m
kubectl --context kind-${CLUSTER} -n prometheus-patch-system wait --for=condition=Ready pods -l control-plane=controller-manager -l app.kubernetes.io/managed-by!=Helm,verify!=yes --timeout=3m
kubectl --context kind-${CLUSTER} -n prometheus-patch-system wait --for=jsonpath='{.status.conditions[1].reason}'=PodCompleted pods -l app.kubernetes.io/managed-by!=Helm,verify=yes --timeout=3m

CONTROLLER_GEN = $(GOBIN)/controller-gen
.PHONY: controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.10.0)
cp config/base/crd/bases/* chart/prometheuspatch-controller/crds/
cp config/base/crd/bases/* chart/prometheus-patch-controller/crds/

GOLANGCI_LINT = $(GOBIN)/golangci-lint
.PHONY: golangci-lint
Expand Down
6 changes: 3 additions & 3 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
domain: doodle.com
layout:
- go.kubebuilder.io/v3
projectName: prometheuspatch-controller
repo: github.com/doodlescheduling/prometheuspatch-controller
projectName: prometheus-patch-controller
repo: github.com/doodlescheduling/prometheus-patch-controller
resources:
- api:
crdVersion: v1
Expand All @@ -11,6 +11,6 @@ resources:
domain: doodle.com
group: metrics.infra.doodle.com
kind: PrometheusPatchRule
path: github.com/doodlescheduling/prometheuspatch-controller/api/v1beta1
path: github.com/doodlescheduling/prometheus-patch-controller/api/v1beta1
version: v1beta1
version: "3"
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Kubernetes resource patch controller using PromQL

[![release](https://img.shields.io/github/release/DoodleScheduling/prometheuspatch-controller/all.svg)](https://github.com/DoodleScheduling/prometheuspatch-controller/releases)
[![release](https://github.com/doodlescheduling/prometheuspatch-controller/actions/workflows/release.yaml/badge.svg)](https://github.com/doodlescheduling/prometheuspatch-controller/actions/workflows/release.yaml)
[![report](https://goreportcard.com/badge/github.com/DoodleScheduling/prometheuspatch-controller)](https://goreportcard.com/report/github.com/DoodleScheduling/prometheuspatch-controller)
[![Coverage Status](https://coveralls.io/repos/github/DoodleScheduling/prometheuspatch-controller/badge.svg?branch=master)](https://coveralls.io/github/DoodleScheduling/prometheuspatch-controller?branch=master)
[![license](https://img.shields.io/github/license/DoodleScheduling/prometheuspatch-controller.svg)](https://github.com/DoodleScheduling/prometheuspatch-controller/blob/master/LICENSE)
[![release](https://img.shields.io/github/release/DoodleScheduling/prometheus-patch-controller/all.svg)](https://github.com/DoodleScheduling/prometheus-patch-controller/releases)
[![release](https://github.com/doodlescheduling/prometheus-patch-controller/actions/workflows/release.yaml/badge.svg)](https://github.com/doodlescheduling/prometheus-patch-controller/actions/workflows/release.yaml)
[![report](https://goreportcard.com/badge/github.com/DoodleScheduling/prometheus-patch-controller)](https://goreportcard.com/report/github.com/DoodleScheduling/prometheus-patch-controller)
[![Coverage Status](https://coveralls.io/repos/github/DoodleScheduling/prometheus-patch-controller/badge.svg?branch=master)](https://coveralls.io/github/DoodleScheduling/prometheus-patch-controller?branch=master)
[![license](https://img.shields.io/github/license/DoodleScheduling/prometheus-patch-controller.svg)](https://github.com/DoodleScheduling/prometheus-patch-controller/blob/master/LICENSE)

Apply patches to kubernetes resources based on prometheus queries.

Expand Down Expand Up @@ -84,7 +84,7 @@ You may disable the binding and define fine grained cluster roles accordingly.

### Helm

Please see [chart/prometheuspatch-controller](https://github.com/DoodleScheduling/prometheuspatch-controller/tree/master/chart/prometheuspatch-controller) for the helm chart docs.
Please see [chart/prometheus-patch-controller](https://github.com/DoodleScheduling/prometheus-patch-controller/tree/master/chart/prometheus-patch-controller) for the helm chart docs.

### Manifests/kustomize

Expand All @@ -96,7 +96,7 @@ The controller can be configured using cmd args:
```
--concurrent int The number of concurrent Pod reconciles. (default 4)
--enable-leader-election Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.
--field-manager string The name of the field maanger used for server side apply https://kubernetes.io/docs/reference/using-api/server-side-apply/. (default "prometheuspatch-controller")
--field-manager string The name of the field maanger used for server side apply https://kubernetes.io/docs/reference/using-api/server-side-apply/. (default "prometheus-patch-controller")
--graceful-shutdown-timeout duration The duration given to the reconciler to finish before forcibly stopping. (default 10m0s)
--health-addr string The address the health endpoint binds to. (default ":9557")
--insecure-kubeconfig-exec Allow use of the user.exec section in kubeconfigs provided for remote apply.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
appVersion: v0.0.0
description: Patch kubernetes resources using prometheus rule evaluations
home: https://github.com/DoodleScheduling/prometheuspatch-controller
home: https://github.com/DoodleScheduling/prometheus-patch-controller
maintainers:
- name: devops
email: devops@doodle.com
Expand All @@ -11,7 +11,7 @@ keywords:
- kubernetes-patch
- prometheus-rules
- prometheus-expresions
name: prometheuspatch-controller
name: prometheus-patch-controller
sources:
- https://github.com/DoodleScheduling/prometheuspatch-controller
- https://github.com/DoodleScheduling/prometheus-patch-controller
version: 0.0.0
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# prometheuspatch-controller helm chart
# prometheus-patch-controller helm chart

Installs the [prometheuspatch-controller](https://github.com/DoodleScheduling/prometheuspatch-controller).
Installs the [prometheus-patch-controller](https://github.com/DoodleScheduling/prometheus-patch-controller).

## Installing the Chart

To install the chart with the release name `prometheuspatch-controller`:
To install the chart with the release name `prometheus-patch-controller`:

```console
helm upgrade --install prometheuspatch-controller oci://ghcr.io/doodlescheduling/charts/prometheuspatch-controller
helm upgrade --install prometheus-patch-controller oci://ghcr.io/doodlescheduling/charts/prometheus-patch-controller
```

This command deploys prometheuspatch-controller with the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
This command deploys prometheus-patch-controller with the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.

## Using the Chart

Expand All @@ -30,5 +30,5 @@ podAnnotations:
See Customizing the Chart Before Installing. To see all configurable options with detailed comments, visit the chart's values.yaml, or run the configuration command:
```sh
$ helm show values oci://ghcr.io/doodlescheduling/charts/prometheuspatch-controller
$ helm show values oci://ghcr.io/doodlescheduling/charts/prometheus-patch-controller
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.12.0
name: prometheuspatchrules.metrics.infra.doodle.com
name: prometheus-patchrules.metrics.infra.doodle.com
spec:
group: metrics.infra.doodle.com
names:
kind: PrometheusPatchRule
listKind: PrometheusPatchRuleList
plural: prometheuspatchrules
singular: prometheuspatchrule
plural: prometheus-patchrules
singular: prometheus-patchrule
scope: Namespaced
versions:
- additionalPrinterColumns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "prometheuspatch-controller.name" -}}
{{- define "prometheus-patch-controller.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Expand All @@ -11,7 +11,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "prometheuspatch-controller.fullname" -}}
{{- define "prometheus-patch-controller.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
Expand All @@ -27,16 +27,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "prometheuspatch-controller.chart" -}}
{{- define "prometheus-patch-controller.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "prometheuspatch-controller.serviceAccountName" -}}
{{- define "prometheus-patch-controller.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "prometheuspatch-controller.fullname" .) .Values.serviceAccount.name }}
{{ default (include "prometheus-patch-controller.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "prometheuspatch-controller.fullname" . }}-edit
name: {{ template "prometheus-patch-controller.fullname" . }}-edit
labels:
app.kubernetes.io/name: {{ include "prometheuspatch-controller.name" . }}
app.kubernetes.io/name: {{ include "prometheus-patch-controller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "prometheuspatch-controller.chart" . }}
helm.sh/chart: {{ include "prometheus-patch-controller.chart" . }}
rbac.authorization.k8s.io/aggregate-to-edit: "true"
rbac.authorization.k8s.io/aggregate-to-admin: "true"
annotations:
Expand All @@ -16,7 +16,7 @@ rules:
- apiGroups:
- metrics.infra.doodle.com
resources:
- prometheuspatchrules
- prometheus-patchrules
verbs:
- create
- delete
Expand All @@ -28,7 +28,7 @@ rules:
- apiGroups:
- metrics.infra.doodle.com
resources:
- prometheuspatchrules/status
- prometheus-patchrules/status
verbs:
- get
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "prometheuspatch-controller.fullname" . }}-view
name: {{ template "prometheus-patch-controller.fullname" . }}-view
labels:
app.kubernetes.io/name: {{ include "prometheuspatch-controller.name" . }}
app.kubernetes.io/name: {{ include "prometheus-patch-controller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "prometheuspatch-controller.chart" . }}
helm.sh/chart: {{ include "prometheus-patch-controller.chart" . }}
rbac.authorization.k8s.io/aggregate-to-view: "true"
annotations:
{{- toYaml .Values.annotations | nindent 4 }}
rules:
- apiGroups:
- metrics.infra.doodle.com
resources:
- prometheuspatchrules
- prometheus-patchrules
verbs:
- get
- list
- watch
- apiGroups:
- metrics.infra.doodle.com
resources:
- prometheuspatchrules/status
- prometheus-patchrules/status
verbs:
- get
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ template "prometheuspatch-controller.fullname" . }}
name: {{ template "prometheus-patch-controller.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "prometheuspatch-controller.name" . }}
app.kubernetes.io/name: {{ include "prometheus-patch-controller.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "prometheuspatch-controller.chart" . }}
helm.sh/chart: {{ include "prometheus-patch-controller.chart" . }}
annotations:
{{- toYaml .Values.annotations | nindent 4 }}
rules:
- apiGroups:
- metrics.infra.doodle.com
resources:
- prometheuspatchrules
- prometheus-patchrules
verbs:
- create
- delete
Expand All @@ -26,13 +26,13 @@ rules:
- apiGroups:
- metrics.infra.doodle.com
resources:
- prometheuspatchrules/finalizers
- prometheus-patchrules/finalizers
verbs:
- update
- apiGroups:
- metrics.infra.doodle.com
resources:
- prometheuspatchrules/status
- prometheus-patchrules/status
verbs:
- get
- patch
Expand Down
Loading

0 comments on commit 3a494cf

Please sign in to comment.