Skip to content

Commit 957e108

Browse files
author
John Doe
committed
chore: Rename
1 parent 48412a6 commit 957e108

30 files changed

+191
-191
lines changed

Dockerfile

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
FROM alpine:3.14 AS build
22

3-
ADD .build/git-clone-controller /git-clone-operator
4-
RUN chmod +x /git-clone-operator
3+
ADD .build/git-clone-controller /git-clone-controller
4+
RUN chmod +x /git-clone-controller
55

66
# ---
77
FROM gcr.io/distroless/static-debian11
88

9-
COPY --from=build /git-clone-operator /usr/bin/git-clone-operator
10-
RUN ["/usr/bin/git-clone-operator", "check-binary"]
9+
COPY --from=build /git-clone-controller /usr/bin/git-clone-controller
10+
RUN ["/usr/bin/git-clone-controller", "check-binary"]
1111

12-
ENTRYPOINT ["/usr/bin/git-clone-operator"]
12+
ENTRYPOINT ["/usr/bin/git-clone-controller"]

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ coverage:
1919
.PHONY: minikube-build
2020
k3d-build:
2121
@echo "\n📦 Building simple-kubernetes-webhook Docker image..."
22-
docker build -t ${REGISTRY}:${REGISTRY_PORT}/git-clone-operator:master .
23-
docker push ${REGISTRY}:${REGISTRY_PORT}/git-clone-operator:master
22+
docker build -t ${REGISTRY}:${REGISTRY_PORT}/git-clone-controller:master .
23+
docker push ${REGISTRY}:${REGISTRY_PORT}/git-clone-controller:master
2424

2525
.PHONY: minikube-promote
2626
k3d-promote: build k3d-build
27-
helm uninstall gitc -n git-clone-operator --wait || true
28-
cd helm/git-clone-operator && helm upgrade --install gitc . -n git-clone-operator --create-namespace --set image.repository=k3d-${REGISTRY}:${REGISTRY_PORT}/git-clone-operator --set image.tag=master
27+
helm uninstall gitc -n git-clone-controller --wait || true
28+
cd helm/git-clone-controller && helm upgrade --install gitc . -n git-clone-controller --create-namespace --set image.repository=k3d-${REGISTRY}:${REGISTRY_PORT}/git-clone-controller --set image.tag=master
2929

3030
.PHONY: k3d
3131
k3d:

README.md

+29-29
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@ Simply clone your scripts repository in your pod workspace, execute script and e
1818

1919
### Git clone inside CI job
2020

21-
`git-clone-operator checkout` is a CLI command that could be a replacement of `git clone` and `git checkout`.
21+
`git-clone-controller checkout` is a CLI command that could be a replacement of `git clone` and `git checkout`.
2222
Its advantage is that it is designed to be running automatic: When repository does not exist, it gets cloned, when exists, then updated with remote.
2323

2424

2525
Setting up
2626
----------
2727

28-
Use helm to install git-clone-operator. For helm values please take a look at [values reference](https://github.com/riotkit-org/git-clone-operator/blob/main/helm/git-clone-operator/values.yaml).
28+
Use helm to install git-clone-controller. For helm values please take a look at [values reference](https://github.com/riotkit-org/git-clone-controller/blob/main/helm/git-clone-controller/values.yaml).
2929

3030
```bash
3131
helm repo add riotkit-org https://riotkit-org.github.io/helm-of-revolution/
32-
helm install my-git-clone-operator riotkit-org/git-clone-operator
32+
helm install my-git-clone-controller riotkit-org/git-clone-controller
3333
```
3434

3535
Example usage
3636
-------------
3737

38-
Every `Pod` labelled with `riotkit.org/git-clone-operator: "true"` will be processed by `git-clone-operator`.
38+
Every `Pod` labelled with `riotkit.org/git-clone-controller: "true"` will be processed by `git-clone-controller`.
3939

40-
`Pod` annotations are the place, where `git-clone-operator` short specification is kept.
40+
`Pod` annotations are the place, where `git-clone-controller` short specification is kept.
4141

4242
```yaml
4343
apiVersion: v1
@@ -46,25 +46,25 @@ metadata:
4646
name: "tagged-pod"
4747
labels:
4848
# required: only labelled Pods are processed
49-
riotkit.org/git-clone-operator: "true"
49+
riotkit.org/git-clone-controller: "true"
5050
annotations:
5151
# required: commit/tag/branch
52-
git-clone-operator/revision: main
52+
git-clone-controller/revision: main
5353
# required: http/https url
54-
git-clone-operator/url: "https://github.com/jenkins-x/go-scm"
54+
git-clone-controller/url: "https://github.com/jenkins-x/go-scm"
5555
# required: target path, where the repository should be cloned, should be placed on a shared Volume mount point with other containers in same Pod
56-
git-clone-operator/path: /workspace/source
56+
git-clone-controller/path: /workspace/source
5757
# optional: user id (will result in adding `securityContext`), in effect: running `git` as selected user and creating files as selected user
58-
git-clone-operator/owner: "1000"
59-
# optional: group id (will result in adding `securityContext`), same behavior as in "git-clone-operator/owner"
60-
git-clone-operator/group: "1000"
58+
git-clone-controller/owner: "1000"
59+
# optional: group id (will result in adding `securityContext`), same behavior as in "git-clone-controller/owner"
60+
git-clone-controller/group: "1000"
6161
# optional: `kind: Secret` name from same namespace as Pod is (if not specified, then global defaults from operator will be taken, or no authorization would be used)
62-
git-clone-operator/secretName: git-secrets
62+
git-clone-controller/secretName: git-secrets
6363
# optional: entry name in `.data` section of selected `kind: Secret`
64-
git-clone-operator/secretTokenKey: jenkins-x
64+
git-clone-controller/secretTokenKey: jenkins-x
6565

6666
# optional: entry name in `.data` section, describes the GIT username, defaults to __token__ if not specified
67-
#git-clone-operator/secretUsernameKey: username
67+
#git-clone-controller/secretUsernameKey: username
6868
spec:
6969
restartPolicy: Never
7070
automountServiceAccountToken: false
@@ -83,7 +83,7 @@ spec:
8383
emptyDir: {}
8484

8585
# PERMISSIONS:
86-
# If `git-clone-operator/owner` and `git-clone-operator/group` specified, then `fsGroup` should have same value there
86+
# If `git-clone-controller/owner` and `git-clone-controller/group` specified, then `fsGroup` should have same value there
8787
# so the mounted volume would have proper permissions
8888
securityContext:
8989
fsGroup: 1000
@@ -104,17 +104,17 @@ kubectl logs -f tagged-pod
104104
Behavior
105105
--------
106106

107-
| Circumstances | Behavior |
108-
|-------------------------------------------------------------------|---------------------------------------------------------------------|
109-
| Pods NOT marked with `riotkit.org/git-clone-operator: "true"` | Do Nothing |
110-
| Pods MARKED with `riotkit.org/git-clone-operator: "true"` | Process |
111-
| Missing required annotation | Do not schedule that `Pod` |
112-
| `kind: Secret` was specified, but is invalid | Do not schedule that `Pod` |
113-
| Unknown error while processing labelled `Pod` | Do not schedule that `Pod` |
114-
| GIT credentials are invalid | Fail inside initContainer and don't let Pod's containers to execute |
115-
| Revision is invalid | Fail inside initContainer and don't let Pod's containers to execute |
116-
| Volume permissions are invalid | Fail inside initContainer and don't let Pod's containers to execute |
117-
| Unknown error while trying to checkout/clone inside initContainer | Fail inside initContainer and don't let Pod's containers to execute |
107+
| Circumstances | Behavior |
108+
|--------------------------------------------------------------------|---------------------------------------------------------------------|
109+
| Pods NOT marked with `riotkit.org/git-clone-controller: "true"` | Do Nothing |
110+
| Pods MARKED with `riotkit.org/git-clone-controller: "true"` | Process |
111+
| Missing required annotation | Do not schedule that `Pod` |
112+
| `kind: Secret` was specified, but is invalid | Do not schedule that `Pod` |
113+
| Unknown error while processing labelled `Pod` | Do not schedule that `Pod` |
114+
| GIT credentials are invalid | Fail inside initContainer and don't let Pod's containers to execute |
115+
| Revision is invalid | Fail inside initContainer and don't let Pod's containers to execute |
116+
| Volume permissions are invalid | Fail inside initContainer and don't let Pod's containers to execute |
117+
| Unknown error while trying to checkout/clone inside initContainer | Fail inside initContainer and don't let Pod's containers to execute |
118118

119119
Security and reliability
120120
------------------------
@@ -123,7 +123,7 @@ Security and reliability
123123
- Static golang binary, without dynamic libraries, no dependency on libc
124124
- No dependency on `git` binary, thanks to [go-git](https://github.com/go-git/go-git)
125125
- Namespaced `kind: Secret` are used close to `kind: Pod`
126-
- Admission Webhooks are [limited in scope on API level](./helm/git-clone-operator/templates/mutatingwebhookconfiguration.yaml) - **only labelled Pods are touched**
126+
- Admission Webhooks are [limited in scope on API level](./helm/git-clone-controller/templates/mutatingwebhookconfiguration.yaml) - **only labelled Pods are touched**
127127
- Default Pod's securityContext runs as non-root, with high uid/gid, should work on OpenShift
128128
- API is using internally mutual TLS to talk with Kubernetes
129129

@@ -135,7 +135,7 @@ Roadmap
135135
- [x] Injecting git-clone initContainers into labelled pods
136136
- [x] Support for Git over HTTPS
137137
- [x] Specifying user id (owner) of files in workspace
138-
- [x] CLI command `git-clone-operator clone ...` and single Dockerfile for both initContainer and operator
138+
- [x] CLI command `git-clone-controller clone ...` and single Dockerfile for both initContainer and operator
139139
- [x] Helm
140140
- [x] Add configurable security context - runAs and filesystem permissions
141141

cmd/checkout/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/go-git/go-git/v5/plumbing"
88
"github.com/moby/sys/mountinfo"
99
"github.com/pkg/errors"
10-
"github.com/riotkit-org/git-clone-operator/pkg/context"
10+
"github.com/riotkit-org/git-clone-controller/pkg/context"
1111
"github.com/sirupsen/logrus"
1212
"io/ioutil"
1313
"net/url"

cmd/checkout/main_priv_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ func TestGetUrlWithCredentials_GIT(t *testing.T) {
3737
Token: "psst",
3838
}
3939

40-
c.Url = "[email protected]:riotkit-org/git-clone-operator.git"
40+
c.Url = "[email protected]:riotkit-org/git-clone-controller.git"
4141

4242
url, err := c.getUrlWithCredentials()
4343
assert.Nil(t, err)
44-
assert.Equal(t, "[email protected]:riotkit-org/git-clone-operator.git", url)
44+
assert.Equal(t, "[email protected]:riotkit-org/git-clone-controller.git", url)
4545
}

cmd/checkout/main_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package checkout_test
22

33
import (
4-
"github.com/riotkit-org/git-clone-operator/cmd/checkout"
4+
"github.com/riotkit-org/git-clone-controller/cmd/checkout"
55
"github.com/sirupsen/logrus"
66
"github.com/stretchr/testify/assert"
77
"io/ioutil"
@@ -20,7 +20,7 @@ func TestCommand_Run(t *testing.T) {
2020
c := checkout.Command{
2121
LogLevel: "info",
2222
Path: dir,
23-
Url: "https://github.com/riotkit-org/git-clone-operator",
23+
Url: "https://github.com/riotkit-org/git-clone-controller",
2424
Username: "__token__",
2525
Token: "",
2626
Revision: "main",
@@ -38,7 +38,7 @@ func TestCommand_Run(t *testing.T) {
3838
c2 := checkout.Command{
3939
LogLevel: "info",
4040
Path: dir,
41-
Url: "https://github.com/riotkit-org/git-clone-operator",
41+
Url: "https://github.com/riotkit-org/git-clone-controller",
4242
Username: "__token__",
4343
Token: "",
4444
Revision: "69d09e37b8791d106d6c5a62f47e9db0359452ec", // initial commit, only LICENSE and README.md in repository
@@ -55,7 +55,7 @@ func TestCommand_Run(t *testing.T) {
5555
c3 := checkout.Command{
5656
LogLevel: "info",
5757
Path: dir,
58-
Url: "https://github.com/riotkit-org/git-clone-operator",
58+
Url: "https://github.com/riotkit-org/git-clone-controller",
5959
Username: "__token__",
6060
Token: "",
6161
Revision: "main", // initial commit, only LICENSE and README.md in repository

cmd/root.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package cmd
22

33
import (
4-
"github.com/riotkit-org/git-clone-operator/cmd/checkout"
5-
"github.com/riotkit-org/git-clone-operator/cmd/serve"
4+
"github.com/riotkit-org/git-clone-controller/cmd/checkout"
5+
"github.com/riotkit-org/git-clone-controller/cmd/serve"
66
"github.com/sirupsen/logrus"
77
"github.com/spf13/cobra"
88
)
@@ -21,7 +21,7 @@ func NewCheckCommand() *cobra.Command {
2121

2222
func Main() *cobra.Command {
2323
cmd := &cobra.Command{
24-
Use: "git-clone-operator",
24+
Use: "git-clone-controller",
2525
Short: "",
2626
Run: func(cmd *cobra.Command, args []string) {
2727
err := cmd.Help()

cmd/serve/command.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func NewServeCommand() *cobra.Command {
2424
command.Flags().StringVarP(&app.LogLevel, "log-level", "l", getEnvOrDefault("LOG_LEVEL", "info").(string), "Logging level: error, warn, info, debug")
2525
command.Flags().BoolVarP(&app.LogJSON, "log-json", "", getEnvOrDefault("LOG_JSON", false).(bool), "Log in JSON format")
2626
command.Flags().BoolVarP(&app.TLS, "tls", "t", getEnvOrDefault("USE_TLS", false).(bool), "Use TLS (requires certificates)")
27-
command.Flags().StringVarP(&app.DefaultImage, "default-image", "i", getEnvOrDefault("DEFAULT_IMAGE", "ghcr.io/riotkit-org/git-clone-operator:master").(string), "Default container image")
27+
command.Flags().StringVarP(&app.DefaultImage, "default-image", "i", getEnvOrDefault("DEFAULT_IMAGE", "ghcr.io/riotkit-org/git-clone-controller:master").(string), "Default container image")
2828
command.Flags().StringVarP(&app.DefaultGitUsername, "default-git-username", "U", getEnvOrDefault("DEFAULT_GIT_USERNAME", "__token__").(string), "Default GIT username for HTTPS auth")
2929
command.Flags().StringVarP(&app.DefaultGitToken, "default-git-token", "T", getEnvOrDefault("DEFAULT_GIT_TOKEN", "").(string), "Default GIT token/password for HTTPS auth")
3030

cmd/serve/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"github.com/pkg/errors"
8-
"github.com/riotkit-org/git-clone-operator/pkg/admission"
8+
"github.com/riotkit-org/git-clone-controller/pkg/admission"
99
"github.com/sirupsen/logrus"
1010
admissionv1 "k8s.io/api/admission/v1"
1111
"k8s.io/client-go/kubernetes"

docs/examples/pod-tagged.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ kind: Pod
33
metadata:
44
name: "tagged-pod"
55
labels:
6-
riotkit.org/git-clone-operator: "true"
6+
riotkit.org/git-clone-controller: "true"
77
annotations:
8-
git-clone-operator/revision: main
9-
git-clone-operator/url: "https://github.com/jenkins-x/go-scm"
10-
git-clone-operator/path: /workspace/source
11-
git-clone-operator/owner: "1000"
12-
git-clone-operator/group: "1000"
13-
git-clone-operator/secretName: git-secrets
14-
git-clone-operator/secretTokenKey: jenkins-x
8+
git-clone-controller/revision: main
9+
git-clone-controller/url: "https://github.com/jenkins-x/go-scm"
10+
git-clone-controller/path: /workspace/source
11+
git-clone-controller/owner: "1000"
12+
git-clone-controller/group: "1000"
13+
git-clone-controller/secretName: git-secrets
14+
git-clone-controller/secretTokenKey: jenkins-x
1515
spec:
1616
restartPolicy: Never
1717
automountServiceAccountToken: false

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/riotkit-org/git-clone-operator
1+
module github.com/riotkit-org/git-clone-controller
22

33
go 1.17
44

helm/git-clone-operator/Chart.yaml renamed to helm/git-clone-controller/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
2-
name: git-clone-operator
2+
name: git-clone-controller
33
description: "Simple Pod provisioner using GIT as source. Just label your Pods to get an additional initContainer that will clone your repo before Pod will start up."
44
type: application
55
version: 0.1.0

helm/git-clone-operator/README.md renamed to helm/git-clone-controller/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ Simply clone your scripts repository in your pod workspace, execute script and e
1818

1919
### Git clone inside CI job
2020

21-
`git-clone-operator checkout` is a CLI command that could be a replacement of `git clone` and `git checkout`.
21+
`git-clone-controller checkout` is a CLI command that could be a replacement of `git clone` and `git checkout`.
2222
It's advantage is that it is designed to be running automatic: When repository does not exists, it gets cloned, when exists, then updated with remote.
2323

2424

2525
Setting up
2626
----------
2727

28-
Use helm to install git-clone-operator. For helm values please take a look at [values reference](https://github.com/riotkit-org/git-clone-operator/blob/main/helm/git-clone-operator/values.yaml).
28+
Use helm to install git-clone-controller. For helm values please take a look at [values reference](https://github.com/riotkit-org/git-clone-controller/blob/main/helm/git-clone-controller/values.yaml).
2929

3030
```bash
3131
helm repo add riotkit-org https://riotkit-org.github.io/helm-of-revolution/
32-
helm install my-git-clone-operator riotkit-org/git-clone-operator
32+
helm install my-git-clone-controller riotkit-org/git-clone-controller
3333
```
3434

3535
Documentation
3636
-------------
3737

38-
### [For more documentation please take a look at Github page](https://github.com/riotkit-org/git-clone-operator)
38+
### [For more documentation please take a look at Github page](https://github.com/riotkit-org/git-clone-controller)
3939

helm/git-clone-operator/templates/_helpers.tpl renamed to helm/git-clone-controller/templates/_helpers.tpl

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{/*
22
Expand the name of the chart.
33
*/}}
4-
{{- define "git-clone-operator.name" -}}
4+
{{- define "git-clone-controller.name" -}}
55
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
66
{{- end }}
77

@@ -10,7 +10,7 @@ Create a default fully qualified app name.
1010
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
1111
If release name contains chart name it will be used as a full name.
1212
*/}}
13-
{{- define "git-clone-operator.fullname" -}}
13+
{{- define "git-clone-controller.fullname" -}}
1414
{{- if .Values.fullnameOverride }}
1515
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
1616
{{- else }}
@@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
2626
{{/*
2727
Create chart name and version as used by the chart label.
2828
*/}}
29-
{{- define "git-clone-operator.chart" -}}
29+
{{- define "git-clone-controller.chart" -}}
3030
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
3131
{{- end }}
3232

3333
{{/*
3434
Common labels
3535
*/}}
36-
{{- define "git-clone-operator.labels" -}}
37-
helm.sh/chart: {{ include "git-clone-operator.chart" . }}
38-
{{ include "git-clone-operator.selectorLabels" . }}
36+
{{- define "git-clone-controller.labels" -}}
37+
helm.sh/chart: {{ include "git-clone-controller.chart" . }}
38+
{{ include "git-clone-controller.selectorLabels" . }}
3939
{{- if .Chart.AppVersion }}
4040
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4141
{{- end }}
@@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
4545
{{/*
4646
Selector labels
4747
*/}}
48-
{{- define "git-clone-operator.selectorLabels" -}}
49-
app.kubernetes.io/name: {{ include "git-clone-operator.name" . }}
48+
{{- define "git-clone-controller.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "git-clone-controller.name" . }}
5050
app.kubernetes.io/instance: {{ .Release.Name }}
5151
{{- end }}
5252

5353
{{/*
5454
Create the name of the service account to use
5555
*/}}
56-
{{- define "git-clone-operator.serviceAccountName" -}}
56+
{{- define "git-clone-controller.serviceAccountName" -}}
5757
{{- if .Values.serviceAccount.create }}
58-
{{- default (include "git-clone-operator.fullname" .) .Values.serviceAccount.name }}
58+
{{- default (include "git-clone-controller.fullname" .) .Values.serviceAccount.name }}
5959
{{- else }}
6060
{{- default "default" .Values.serviceAccount.name }}
6161
{{- end }}

0 commit comments

Comments
 (0)