Skip to content

Commit e3c34fc

Browse files
committed
Refine the other operator related names
1 parent 0830531 commit e3c34fc

File tree

14 files changed

+71
-64
lines changed

14 files changed

+71
-64
lines changed

Makefile

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SHELL := /bin/bash
33
# output directory, where all artifacts will be created and managed
44
OUTPUT_DIR ?= build/_output
55
# relative path to controller binary
6-
OPERATOR = $(OUTPUT_DIR)/bin/shipwright-build-controller
6+
CONTROLLER = $(OUTPUT_DIR)/bin/shipwright-build-controller
77

88
# golang cache directory path
99
GOCACHE ?= $(shell echo ${PWD})/$(OUTPUT_DIR)/gocache
@@ -62,7 +62,7 @@ TEST_SOURCE_SECRET ?=
6262

6363
# Image settings for building and pushing images
6464
IMAGE_HOST ?= quay.io
65-
IMAGE ?= shipwright/shipwright-operator
65+
IMAGE ?= shipwright/shipwright-build-controller
6666
TAG ?= latest
6767

6868
# options for generating crds with controller-gen
@@ -78,14 +78,14 @@ vendor: go.mod go.sum
7878
go mod vendor
7979

8080
.PHONY: build
81-
build: $(OPERATOR)
81+
build: $(CONTROLLER)
8282

83-
$(OPERATOR): vendor
84-
go build -trimpath $(GO_FLAGS) -o $(OPERATOR) cmd/manager/main.go
83+
$(CONTROLLER): vendor
84+
go build -trimpath $(GO_FLAGS) -o $(CONTROLLER) cmd/manager/main.go
8585

8686
.PHONY: build-plain
8787
build-plain:
88-
go build -trimpath $(GO_FLAGS) -o $(OPERATOR) cmd/manager/main.go
88+
go build -trimpath $(GO_FLAGS) -o $(CONTROLLER) cmd/manager/main.go
8989

9090
.PHONY: build-image
9191
build-image:
@@ -219,7 +219,7 @@ test-e2e: install-strategies test-e2e-plain
219219
.PHONY: test-e2e-plain
220220
test-e2e-plain: ginkgo
221221
GO111MODULE=on \
222-
TEST_OPERATOR_NAMESPACE=${TEST_NAMESPACE} \
222+
TEST_CONTROLLER_NAMESPACE=${TEST_NAMESPACE} \
223223
TEST_WATCH_NAMESPACE=${TEST_NAMESPACE} \
224224
TEST_E2E_SERVICEACCOUNT_NAME=${TEST_E2E_SERVICEACCOUNT_NAME} \
225225
TEST_E2E_TIMEOUT_MULTIPLIER=${TEST_E2E_TIMEOUT_MULTIPLIER} \
@@ -252,11 +252,11 @@ install-strategies: install-apis
252252
kubectl apply -R -f samples/buildstrategy/
253253

254254
local: vendor install-strategies
255-
OPERATOR_NAME=shipwright-build-controller \
255+
CONTROLLER_NAME=shipwright-build-controller \
256256
operator-sdk run local --operator-flags="$(ZAP_FLAGS)"
257257

258258
local-plain: vendor
259-
OPERATOR_NAME=shipwright-build-controller \
259+
CONTROLLER_NAME=shipwright-build-controller \
260260
operator-sdk run local --operator-flags="$(ZAP_FLAGS)"
261261

262262
clean:

build/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
66

7-
ENV OPERATOR=/usr/local/bin/shipwright-build-controller \
7+
ENV CONTROLLER=/usr/local/bin/shipwright-build-controller \
88
USER_UID=1001 \
99
USER_NAME=shipwright-build-controller
1010

1111
# install controller binary
12-
COPY build/_output/bin/shipwright-build-controller ${OPERATOR}
12+
COPY build/_output/bin/shipwright-build-controller ${CONTROLLER}
1313

1414
COPY build/bin /usr/local/bin
1515
RUN /usr/local/bin/user_setup

build/bin/entrypoint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ if ! whoami &>/dev/null; then
1414
fi
1515
fi
1616

17-
exec ${OPERATOR} $@
17+
exec ${CONTROLLER} $@

cmd/manager/main.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ import (
3030

3131
// Change below variables to serve metrics on different host or port.
3232
var (
33-
metricsHost = "0.0.0.0"
34-
metricsPort int32 = 8383
33+
metricsHost = "0.0.0.0"
34+
metricsPort int32 = 8383
35+
versionGiven = flag.String("version", "devel", "Version of Shipwright build controller running")
3536
)
3637

3738
func printVersion(ctx context.Context) {
38-
ctxlog.Info(ctx, fmt.Sprintf("Operator Version: %s", version.Version))
39+
ctxlog.Info(ctx, fmt.Sprintf("Shipwright Build Controller Version: %s", version.Version))
3940
ctxlog.Info(ctx, fmt.Sprintf("Go Version: %s", runtime.Version()))
4041
ctxlog.Info(ctx, fmt.Sprintf("Go OS/Arch: %s/%s", runtime.GOOS, runtime.GOARCH))
4142
}
@@ -57,13 +58,14 @@ func main() {
5758
//
5859
// The logger instantiated here can be changed to any logger
5960
// implementing the logr.Logger interface. This logger will
60-
// be propagated through the whole operator, generating
61+
// be propagated through the whole Shipwright build controller, generating
6162
// uniform and structured logs.
6263

6364
l := ctxlog.NewLogger("build")
6465

6566
ctx := ctxlog.NewParentContext(l)
6667

68+
version.SetVersion(*versionGiven)
6769
printVersion(ctx)
6870

6971
// Get a config to talk to the apiserver

docs/buildstrategies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ To install the cluster scope strategy, use:
154154
kubectl apply -f samples/buildstrategy/ko/buildstrategy_ko_cr.yaml
155155
```
156156

157-
**Note**: The build strategy currently uses the `spec.contextDir` of the Build in a different way than this property is designed for: the Git repository must be a Go module with the go.mod file at the root. The `contextDir` specifies the path to the main package. You can check the [example](../samples/build/build_ko_cr.yaml) which is set up to build the Shipwright Build operator. This behavior will eventually be corrected once [Exhaustive list of generalized Build API/CRD attributes #184](https://github.com/shipwright-io/build/issues/184) / [Custom attributes from the Build CR could be used as parameters while defining a BuildStrategy #537](https://github.com/shipwright-io/build/issues/537) are done.
157+
**Note**: The build strategy currently uses the `spec.contextDir` of the Build in a different way than this property is designed for: the Git repository must be a Go module with the go.mod file at the root. The `contextDir` specifies the path to the main package. You can check the [example](../samples/build/build_ko_cr.yaml) which is set up to build the Shipwright Build controller. This behavior will eventually be corrected once [Exhaustive list of generalized Build API/CRD attributes #184](https://github.com/shipwright-io/build/issues/184) / [Custom attributes from the Build CR could be used as parameters while defining a BuildStrategy #537](https://github.com/shipwright-io/build/issues/537) are done.
158158

159159
## Source to Image
160160

docs/proposals/dedicated-shipwright-operator.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ This would be useful if Project Shipwright produces additional components and cl
160160

161161
**Risk**: Manifests uses to deploy Shipwright Builds in the `shipwright-io/operator` are not synchronized with content in `shipwright-io/build`.
162162

163-
*Mitigation*: The operator's CI should include a test suite that runs the e2e tests in `shipwright-io/build`.
164-
Project maintainers should also ensure that deployment changes to `shipwright-io/build` carry across to the operator.
163+
*Mitigation*: The Shipwright build controller's CI should include a test suite that runs the e2e tests in `shipwright-io/build`.
164+
Project maintainers should also ensure that deployment changes to `shipwright-io/build` carry across to the Shipwright build controller.
165165

166166
**Risk**: Operator will require permissions cluster admins will reject (ex - modify CRDs)
167167

@@ -177,7 +177,7 @@ Test suites will need to ensure the following:
177177

178178
1. When a `ShipwrightBuild` object is created, the corresponding build controllers are deployed and the Build APIs are added as custom resource definitions.
179179
2. Changes to the `ShipwrightBuild` spec are correctly reflected in the subsequent deployment.
180-
3. CI for the operator should include the e2e suite for `shipwright-io/build`, run against the controllers deployed by the operator.
180+
3. CI for the Shipwright build controller should include the e2e suite for `shipwright-io/build`, run against the controllers deployed by the operator.
181181

182182
### Graduation Criteria
183183

@@ -190,13 +190,13 @@ Test suites will need to ensure the following:
190190
##### Tech Preview -> GA
191191

192192
- Configuration API for `ShipwrightBuild` reaches v1 stability.
193-
- Support for over the air upgrades of the operator _and_ the build controllers.
194-
- [optional] allow version skews between the operator and deployed version of Shipwright Build.
195-
- [optional] operator manages the Build API CRDs.
193+
- Support for over the air upgrades of the Shipwright build controller.
194+
- [optional] allow version skews between the Shipwright build controller and deployed version of Shipwright Build.
195+
- [optional] Shipwright build controller manages the Build API CRDs.
196196

197197
### Upgrade / Downgrade Strategy
198198

199-
The operator should use leader election to ensure that when a new version of the operator is installed, it does not conflict with the existing installation.
199+
The Shipwright build controller should use leader election to ensure that when a new version of the operator is installed, it does not conflict with the existing installation.
200200
This is only required for Tech Preview - Dev Preview releases can assume that the operator is uninstalled before the new version is installed.
201201

202202
## Implementation History

hack/release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ echo "$REGISTRY_PASSWORD" | ko login -u "$REGISTRY_USERNAME" --password-stdin "$
1212
echo "Building container image"
1313

1414
# Using defaults, this pushes to:
15-
# quay.io/shipwright/shipwright-operator:latest
15+
# quay.io/shipwright/shipwright-build-controller:latest
1616
KO_DOCKER_REPO="$IMAGE_HOST/$IMAGE" GOFLAGS="${GO_FLAGS}" ko resolve -t "$TAG" --bare -R -f deploy/ > release.yaml
1717
KO_DOCKER_REPO="$IMAGE_HOST/$IMAGE" GOFLAGS="${GO_FLAGS} -tags=pprof_enabled" ko resolve -t "$TAG-debug" --bare -R -f deploy/ > release-debug.yaml

pkg/config/config.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ type PrometheusConfig struct {
6969
EnabledLabels []string
7070
}
7171

72-
// ManagerOptions contains configurable options for the build operator manager
72+
// ManagerOptions contains configurable options for the Shipwright build controller manager
7373
type ManagerOptions struct {
7474
LeaderElectionNamespace string
7575
LeaseDuration *time.Duration
@@ -152,15 +152,15 @@ func (c *Config) SetConfigFromEnv() error {
152152
c.ManagerOptions.LeaderElectionNamespace = leaderElectionNamespace
153153
}
154154

155-
if err := updateBuildOperatorDurationOption(&c.ManagerOptions.LeaseDuration, leaseDurationEnvVar); err != nil {
155+
if err := updateBuildControllerDurationOption(&c.ManagerOptions.LeaseDuration, leaseDurationEnvVar); err != nil {
156156
return err
157157
}
158158

159-
if err := updateBuildOperatorDurationOption(&c.ManagerOptions.RenewDeadline, renewDeadlineEnvVar); err != nil {
159+
if err := updateBuildControllerDurationOption(&c.ManagerOptions.RenewDeadline, renewDeadlineEnvVar); err != nil {
160160
return err
161161
}
162162

163-
if err := updateBuildOperatorDurationOption(&c.ManagerOptions.RetryPeriod, retryPeriodEnvVar); err != nil {
163+
if err := updateBuildControllerDurationOption(&c.ManagerOptions.RetryPeriod, retryPeriodEnvVar); err != nil {
164164
return err
165165
}
166166

@@ -207,7 +207,7 @@ func updateBucketsConfig(buckets *[]float64, envVarName string) error {
207207
return nil
208208
}
209209

210-
func updateBuildOperatorDurationOption(d **time.Duration, envVarName string) error {
210+
func updateBuildControllerDurationOption(d **time.Duration, envVarName string) error {
211211
if value := os.Getenv(envVarName); value != "" {
212212
valueDuration, err := time.ParseDuration(value)
213213
if err != nil {

pkg/config/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ var _ = Describe("Config", func() {
5656
})
5757
})
5858

59-
It("should allow for an override of the operator leader election namespace using an environment variable", func() {
59+
It("should allow for an override of the Shipwright build controller leader election namespace using an environment variable", func() {
6060
var overrides = map[string]string{"BUILD_CONTROLLER_LEADER_ELECTION_NAMESPACE": "shipwright-build"}
6161
configWithEnvVariableOverrides(overrides, func(config *Config) {
6262
Expect(config.ManagerOptions.LeaderElectionNamespace).To(Equal("shipwright-build"))
6363
})
6464
})
6565

66-
It("should allow for an override of the operator leader election times using environment variables", func() {
66+
It("should allow for an override of the Shipwright build controller leader election times using environment variables", func() {
6767
var overrides = map[string]string{
6868
"BUILD_CONTROLLER_LEASE_DURATION": "42s",
6969
"BUILD_CONTROLLER_RENEW_DEADLINE": "32s",

pkg/reconciler/buildrun/resources/runtime_image.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ func runtimeDockerfileStep(b *buildv1alpha1.Build) (*v1beta1.Step, error) {
158158
if err != nil {
159159
return nil, err
160160
}
161-
// appling known transformation to dockerfile payload, therefore operator variables are
161+
// appling known transformation to dockerfile payload, therefore the Shipwright build controller variables are
162162
// applicable to all parts of the runtime Dockerfile as well
163163
dockerfileTransformed := runtimeDockerfileTransformations(b, dockerfile.String())
164164

0 commit comments

Comments
 (0)