Skip to content

Commit

Permalink
Part 2 - The rest of the minder renaming (#1457)
Browse files Browse the repository at this point in the history
* Rename mediator to minder

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* Rename env vars from MEDIATOR to MINDER

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* Rename docs, comments and vars usage to Minder

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* Rename Minder in proto/buf.yaml

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* Delete legacy proto/mediator

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

* Small capitalisation fixes for Minder

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>

---------

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
  • Loading branch information
rdimitrov authored Nov 4, 2023
1 parent af332c6 commit 3a8fcf1
Show file tree
Hide file tree
Showing 85 changed files with 227 additions and 9,948 deletions.
2 changes: 0 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
/docs/docs/ref/schema.md linguist-generated=true
/docs/docs/ref/proto.md linguist-generated=true
/pkg/api/openapi/** linguist-generated=true
/pkg/api/protobuf/go/mediator/v1/*.pb.go linguist-generated=true
/pkg/api/protobuf/go/mediator/v1/*.gw.go linguist-generated=true
/pkg/api/protobuf/go/minder/v1/*.pb.go linguist-generated=true
/pkg/api/protobuf/go/minder/v1/*.gw.go linguist-generated=true
/internal/db/db.go linguist-generated=true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/chart-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
packages: write

env:
BASE_REPO: "ghcr.io/stacklok/mediator"
BASE_REPO: "ghcr.io/stacklok/minder"


steps:
Expand Down Expand Up @@ -63,5 +63,5 @@ jobs:
- name: Push Helm Chart
run: |
cd deployment/helm
helm push mediator-*.tgz oci://$BASE_REPO/helm
helm push minder-*.tgz oci://$BASE_REPO/helm
2 changes: 1 addition & 1 deletion .github/workflows/compose-migrate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
tables=$(grep -Ri 'CREATE TABLE' database/migrations | sed -E 's/.*CREATE TABLE (IF NOT EXISTS )?(.*) \(/\2/i')
for table in $tables; do
docker exec $(docker ps -a | grep postgres | awk '{print $1}') psql -U postgres -d mediator -c "SELECT * FROM $table"
docker exec $(docker ps -a | grep postgres | awk '{print $1}') psql -U postgres -d minder -c "SELECT * FROM $table"
done
2 changes: 1 addition & 1 deletion .github/workflows/deploy-doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./docs/build
cname: mediator-docs.stacklok.dev
cname: minder-docs.stacklok.dev
2 changes: 1 addition & 1 deletion .github/workflows/image-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

- run: |
ko build --platform=linux/amd64,linux/arm64 --push=false ./cmd/server \
--image-label=org.opencontainers.image.source=https://github.com/stacklok/minder,org.opencontainers.image.title="Stacklok Mediator",org.opencontainers.image.licenses=Apache-2.0,org.opencontainers.image.vendor=Stacklok
--image-label=org.opencontainers.image.source=https://github.com/stacklok/minder,org.opencontainers.image.title="Stacklok Minder",org.opencontainers.image.licenses=Apache-2.0,org.opencontainers.image.vendor=Stacklok
env:
KO_DOCKER_REPO: "ko.local"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Thumbs.db
# asdf
.tool-versions

# Mediator-specific files
# Minder-specific files
.ssh/
cmd/server/__debug_bin
.resolved-compose.yaml
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Contributing to Mediator
# Contributing to Minder
First off, thank you for taking the time to contribute to Minder! :+1: :tada: Minder is released under the Apache 2.0 license. If you would like to contribute something or want to hack on the code, this document should help you get started. You can find some hints for starting development in Minder's [README](https://github.com/stacklok/minder/blob/main/README.md).

### Table of contents
Expand Down Expand Up @@ -33,12 +33,12 @@ PRs to resolve existing issues are greatly appreciated and issues labeled as ["g

#### Pull Request Process
* Create an issue outlining the fix or feature.
* Fork the mediator repository to your own github account and clone it locally.
* Fork the Minder repository to your own github account and clone it locally.
* Hack on your changes.
* Correctly format your commit messages, see [Commit Message Guidelines](#Commit-Message-Guidelines) below.
* Open a PR by ensuring the title and its description reflect the content of the PR.
* Ensure that CI passes, if it fails, fix the failures.
* Every pull request requires a review from the core Mediator team before merging.
* Every pull request requires a review from the core Minder team before merging.
* Once approved, all of your commits will be squashed into a single commit with your PR title.

#### Commit Message Guidelines
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ RUN go mod download
# Add source code
ADD ./ $APP_ROOT/src/

RUN CGO_ENABLED=0 go build -trimpath -o mediator-server ./cmd/server
RUN CGO_ENABLED=0 go build -trimpath -o minder-server ./cmd/server

# Create a "nobody" non-root user for the next image by crafting an /etc/passwd
# file that the next image can copy in. This is necessary since the next image
Expand All @@ -43,7 +43,7 @@ WORKDIR /app
ADD --chown=65534:65534 ./cmd/server/kodata/config.yaml /app
ADD --chown=65534:65534 ./cmd/server/kodata/database/migrations /app/database/migrations

COPY --from=builder /opt/app-root/src/mediator-server /usr/bin/mediator-server
COPY --from=builder /opt/app-root/src/minder-server /usr/bin/minder-server

# Copy the certs from the builder stage
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
Expand All @@ -56,4 +56,4 @@ COPY --from=builder /etc_passwd /etc/passwd
USER nobody

# Set the binary as the entrypoint of the container
ENTRYPOINT ["/usr/bin/mediator-server"]
ENTRYPOINT ["/usr/bin/minder-server"]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

projectname?=mediator
projectname?=minder

# Unfortunately, we need OS detection for docker-compose
OS := $(shell uname -s)
Expand Down Expand Up @@ -73,7 +73,7 @@ run-docker: ## run the app under docker.
# podman (at least) doesn't seem to like multi-arch images, and sometimes picks the wrong one (e.g. amd64 on arm64)
# We also need to remove the build: directives to use ko builds
# ko resolve will fill in the image: field in the compose file, but it adds a yaml document separator
sed -e '/^ *build:/d' -e 's| image: mediator:latest| image: ko://github.com/stacklok/minder/cmd/server|' docker-compose.yaml | ko resolve --base-import-paths --platform linux/$(DOCKERARCH) -f - | sed 's/^--*$$//' > .resolved-compose.yaml
sed -e '/^ *build:/d' -e 's| image: minder:latest| image: ko://github.com/stacklok/minder/cmd/server|' docker-compose.yaml | ko resolve --base-import-paths --platform linux/$(DOCKERARCH) -f - | sed 's/^--*$$//' > .resolved-compose.yaml
@echo "Running docker-compose up $(services)"
$(COMPOSE) -f .resolved-compose.yaml down && $(COMPOSE) -f .resolved-compose.yaml up $(COMPOSE_ARGS) $(services)
rm .resolved-compose.yaml*
Expand Down Expand Up @@ -139,7 +139,7 @@ dbschema: ## generate database schema with schema spy, monitor file until doc is
mkdir -p database/schema/output && chmod a+w database/schema/output
cd database/schema && $(COMPOSE) run -u 1001:1001 --rm schemaspy -configFile /config/schemaspy.properties -imageformat png
sleep 10
cp database/schema/output/diagrams/summary/relationships.real.large.png docs/static/img/mediator/schema.png
cp database/schema/output/diagrams/summary/relationships.real.large.png docs/static/img/minder/schema.png
cd database/schema && $(COMPOSE) down -v && rm -rf output

mock: ## generate mocks
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,5 @@ Now that you've granted the GitHub app permissions to access your repositories,
go run ./cmd/cli/main.go repo register -n github
```

Once you've registered the repositories, the minder server will listen for events from GitHub and will
Once you've registered the repositories, the Minder server will listen for events from GitHub and will
automatically create the necessary webhooks for you.
2 changes: 1 addition & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ plugins:
# https://github.com/pseudomuto/protoc-gen-doc/issues/513
# buf.build/community/pseudomuto-doc:v1.5.1
out: docs/docs/ref
opt: "docs/proto_template.tmpl,proto.md:mediator/v1/*"
opt: "docs/proto_template.tmpl,proto.md"
2 changes: 1 addition & 1 deletion cmd/server/app/migrate_up.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package app provides the entrypoint for the mediator migrations
// Package app provides the entrypoint for the minder migrations
package app

import (
Expand Down
6 changes: 3 additions & 3 deletions cmd/server/app/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package app provides the cli subcommands for managing a mediator control plane
// Package app provides the cli subcommands for managing a minder control plane
package app

import (
Expand All @@ -32,8 +32,8 @@ var (
cfgFile string // config file (default is $PWD/config.yaml)
// RootCmd represents the base command when called without any subcommands
RootCmd = &cobra.Command{
Use: "mediator-server",
Short: "Mediator control plane server",
Use: "minder-server",
Short: "Minder control plane server",
Long: ``,
}
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/server/app/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import (

var serveCmd = &cobra.Command{
Use: "serve",
Short: "Start the mediator platform",
Long: `Starts the mediator platform, which includes the gRPC server and the HTTP gateway.`,
Short: "Start the minder platform",
Long: `Starts the minder platform, which includes the gRPC server and the HTTP gateway.`,
RunE: func(cmd *cobra.Command, args []string) error {

ctx, cancel := signal.NotifyContext(cmd.Context(), os.Interrupt)
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package main provides the entrypoint for the mediator server
// Package main provides the entrypoint for the minder server
package main

import "github.com/stacklok/minder/cmd/server/app"
Expand Down
6 changes: 3 additions & 3 deletions config/config.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ metric_server:
logging:
level: "debug"
format: "json"
#logFile: "/var/log/mediator.log"
#logFile: "/var/log/minder.log"

tracing:
enabled: false
Expand All @@ -41,7 +41,7 @@ database:
dbport: 5432
dbuser: postgres
dbpass: postgres
dbname: mediator
dbname: minder
sslmode: disable

identity:
Expand Down Expand Up @@ -82,7 +82,7 @@ salt:
# Webhook Configuration
# change example.com to an exposed IP / domain
# webhook_secret is set withing the webhook sent to github. Github then signs
# the payload sent to mediator and mediator verifies.
# the payload sent to minder and minder verifies.
webhook-config:
external_webhook_url: "https://example.com/api/v1/webhook/github"
external_ping_url: "https://example.com/api/v1/health"
Expand Down
6 changes: 3 additions & 3 deletions database/migrations/000001_init.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ CREATE TABLE artifact_versions (
version BIGINT NOT NULL,
tags TEXT,
sha TEXT NOT NULL,
signature_verification JSONB, -- see /proto/mediator/v1/mediator.proto#L82
github_workflow JSONB, -- see /proto/mediator/v1/mediator.proto#L75
signature_verification JSONB, -- see /proto/minder/v1/minder.proto#L82
github_workflow JSONB, -- see /proto/minder/v1/minder.proto#L75
created_at TIMESTAMP NOT NULL DEFAULT NOW()
);

Expand Down Expand Up @@ -356,4 +356,4 @@ CREATE TRIGGER update_profile_status
EXECUTE PROCEDURE update_profile_status();

-- Create default root organization and get id so we can create the root project
INSERT INTO projects (name, is_organization) VALUES ('Mediator Root', TRUE);
INSERT INTO projects (name, is_organization) VALUES ('Minder Root', TRUE);
4 changes: 2 additions & 2 deletions deployment/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

apiVersion: v2
name: mediator
description: Deploy Mediator on Kubernetes
name: minder
description: Deploy Minder on Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
Expand Down
26 changes: 13 additions & 13 deletions deployment/helm/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Helm charts for mediator server
# Helm charts for Minder server

(These are a work in progress)

Stacklok runs mediator on Kubernetes, using these helm charts. In order to use
Stacklok runs Minder on Kubernetes, using these helm charts. In order to use
these helm charts, you will need the following:

- Postgres running in your cluster. In particular, you need a `postgres` Service
Expand All @@ -12,33 +12,33 @@ these helm charts, you will need the following:

- The following Kubernetes secrets:

- `mediator-auth-secrets`: Needs to contain public and private keys for access
- `minder-auth-secrets`: Needs to contain public and private keys for access
and refresh tokens. The keys must be named as follows:

- `access_token_rsa`, `access_token_rsa.pub`
- `refresh_token_rsa`, `refresh_token_rsa.pub`

- `mediator-github-secrets`: Needs to contain API credentials for a GitHub
- `minder-github-secrets`: Needs to contain API credentials for a GitHub
app. In particular, the following keys are required:
- `client_id`: The GitHub client ID to be used by Mediator
- `client_secret`: The GitHub client secret to be used by Mediator
- `client_id`: The GitHub client ID to be used by Minder
- `client_secret`: The GitHub client secret to be used by Minder

- `mediator-identity-secrets`: Needs to contain the OAuth 2 client secret for mediator
- `minder-identity-secrets`: Needs to contain the OAuth 2 client secret for Minder
server when authenticating with Keycloak. In particular, the following keys are required:
- `identity_client_secret`: The Keycloak client secret to be used by Mediator server
- `identity_client_secret`: The Keycloak client secret to be used by Minder server

- In addition, if you are using Mediator images which require authentication,
- In addition, if you are using Minder images which require authentication,
you will want to create a `docker-registry` type credential with the name
`mediator-pull-secret`
`minder-pull-secret`

## Building and running

You can build a (local) helm chart with `make helm` at the top-level of the
Mediator repository. You can then run it with:
Minder repository. You can then run it with:

```helm
helm install mediator config/helm/mediator-0.1.0.tgz
helm install minder config/helm/minder-0.1.0.tgz
```

Note that the helm chart does not specify a namespace, so mediator will be
Note that the helm chart does not specify a namespace, so Minder will be
installed in the namespace specified by your current Kubernetes context.
2 changes: 1 addition & 1 deletion deployment/helm/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Common labels
*/}}
{{- define "common.labels" -}}
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
app.kubernetes.io/name: mediator
app.kubernetes.io/name: minder
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
Expand Down
2 changes: 1 addition & 1 deletion deployment/helm/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: mediator-config
name: minder-config
labels:
{{ include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
data:
Expand Down
20 changes: 10 additions & 10 deletions deployment/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mediator
name: minder
labels:
{{ include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
spec:
Expand All @@ -30,9 +30,9 @@ spec:
annotations:
{{ include "common.annotations.pods" (dict "customAnnotationsPods" .Values.commonAnnotationsPods "context" $ ) | nindent 8 }}
spec:
serviceAccountName: {{ .Values.serviceAccounts.server | default "mediator" }}
serviceAccountName: {{ .Values.serviceAccounts.server | default "minder" }}
containers:
- name: mediator
- name: minder
# restricted security context:
# https://kubernetes.io/docs/concepts/security/pod-security-standards/
securityContext:
Expand All @@ -58,11 +58,11 @@ spec:
- "--github-client-id-file=/secrets/app/client_id"
- "--github-client-secret-file=/secrets/app/client_secret"
env:
- name: "MEDIATOR_AUTH_TOKEN_KEY"
- name: "MINDER_AUTH_TOKEN_KEY"
value: "/secrets/auth/token_key_passphrase"
- name: "MEDIATOR_IDENTITY_SERVER_CLIENT_SECRET_FILE"
- name: "MINDER_IDENTITY_SERVER_CLIENT_SECRET_FILE"
value: "/secrets/identity/identity_client_secret"
- name: "MEDIATOR_UNSTABLE_TRUSTY_ENDPOINT"
- name: "MINDER_UNSTABLE_TRUSTY_ENDPOINT"
value: "{{ .Values.trusty.endpoint }}"

# ko will always specify a digest, so we don't need to worry about
Expand Down Expand Up @@ -103,21 +103,21 @@ spec:
volumes:
- name: config
configMap:
name: mediator-config
name: minder-config
items:
- key: config.yaml
path: config.yaml
- key: overrides.yaml
path: overrides.yaml
- name: auth-secrets
secret:
secretName: mediator-auth-secrets
secretName: minder-auth-secrets
- name: app-secrets
secret:
secretName: mediator-github-secrets
secretName: minder-github-secrets
- name: identity-secrets
secret:
secretName: mediator-identity-secrets
secretName: minder-identity-secrets
{{- if .Values.deploymentSettings.extraVolumes }}
{{- toYaml .Values.deploymentSettings.extraVolumes | nindent 6 }}
{{- end }}
4 changes: 2 additions & 2 deletions deployment/helm/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: mediator
name: minder
labels:
{{ include "common.labels.standard" (dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: mediator
name: minder
minReplicas: {{ .Values.hpaSettings.minReplicas }}
maxReplicas: {{ .Values.hpaSettings.maxReplicas }}
metrics:
Expand Down
Loading

0 comments on commit 3a8fcf1

Please sign in to comment.