Skip to content

Commit cdab4a2

Browse files
authored
General cleanup (#27)
Removed unused functions and constants plus some grammar fixes. Causes CRD updates because of documentation fixes. fixes #28
1 parent c529cda commit cdab4a2

File tree

35 files changed

+126
-365
lines changed

35 files changed

+126
-365
lines changed

.golangci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Our default golangci-lint configuration
2-
# If these linters fail then it should fail the build.
2+
# If these linters fail, then it should fail the build.
33
run:
44
timeout: 5m
55
linters:

README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ It effectively deals with the issues mentioned by creating special versions just
2323

2424
This section describes how to create a working environment for developing _Dynamic Environment_.
2525
While it's not mandatory to follow these instructions or use the same tools, it's highly recommended
26-
to keep the versions and some install procedures (e.g, _Istio_ installation into kubernetes) to make
27-
sure everything passes the tests correctly.
26+
to keep the versions and some installation procedures (e.g., _Istio_ installation into kubernetes)
27+
to make sure everything passes the tests correctly.
2828

2929
### Tool Versions
3030

@@ -50,7 +50,7 @@ asdf install
5050
You should now have the right versions of the tools installed. As long as you installed _asdf_
5151
correctly, and you're running from within the repository root you'll be using the right versions.
5252

53-
Here are other tools, that while not required, can make life easier:
53+
Here are other tools that while not required, can make life easier:
5454

5555
* `kubectl`: Make sure it's a version that matches our cluster version according to the [version
5656
skew policy][skew] (if you don't want to mess with multiple versions, and you're using minikube
@@ -80,15 +80,15 @@ similar to the _CI_ as possible).
8080
We will use [minikube][] as our development cluster. Feel free to use whichever cluster suits you
8181
best, but try to preserve the kubernetes version.
8282

83-
After installing minikube we need to start a new
83+
After installing minikube, we need to start a new
8484
cluster. You can play a little with the _memory_ and the _cpus_ but since we're going to run
8585
resources on it, it's better to give it more resources than the default:
8686

8787
```shell
8888
minikube start --kubernetes-version v1.26.3 --memory 8g --cpus 4
8989
```
9090

91-
For the rest of the command make sure your _kubectl_ is operating on the minikube context:
91+
For the rest of the commands, make sure your _kubectl_ is operating on the minikube context:
9292

9393
```shell
9494
kubectx -c # should return 'minikube'
@@ -122,7 +122,7 @@ It's better to stop minikube when you're done working for the day_.
122122
Some tests should run against a dedicated cluster. It is recommended that you'll have a
123123
default named _Kind_ cluster for testing.
124124

125-
A prerequisite for running _Kind_ is a docker service. Make sure you have one installed (e.g,
125+
A prerequisite for running _Kind_ is a docker service. Make sure you have one installed (e.g.,
126126
_Rancher Desktop_). Assuming you followed the instructions above you should have the right version
127127
of _Kind_ installed.
128128

@@ -140,7 +140,7 @@ Install required dependencies and controller docker image:
140140

141141
`
142142

143-
**From now on make sure your k8s context points to the test cluster.**
143+
**From now on, make sure your k8s context points to the test cluster.**
144144

145145
Deploy the controller to the cluster (this step should be repeated every time you update the
146146
controller code):
@@ -149,7 +149,7 @@ controller code):
149149
./e2e-testing/scripts/setup.sh deploy
150150
````
151151

152-
If you want to clean up the test cluster you can run one of the following commands:
152+
If you want to clean up the test cluster, you can run one of the following commands:
153153

154154
```shell
155155
# Undeploy the controller and dependencies
@@ -204,7 +204,7 @@ sure you follow the rules for creating tests:
204204

205205
* Your first test manifest should create a new namespace (preferably named like your test directory)
206206
and all test resources (deployments, destination rules, virtual services, etc.) should be deployed
207-
to that namespace. If required create more than one namespace. This will prevent collisions
207+
to that namespace. If required, create more than one namespace. This will prevent collisions
208208
between test cases.
209209
* Every namespace added (per the previous step) should contain an _Istio_ namespace:
210210
```yaml
@@ -237,7 +237,7 @@ kuttl test --start-kind=false -n default --timeout 20 ./e2e-testing/kuttl --test
237237
238238
While we run default linters during our _test_ stage, it's advisable to occasionally run other
239239
linters. These should not break the build (and not included in our configuration) and might contain
240-
a lot of false positives, however you should occasionally run them to manually search for errors:
240+
a lot of false positives, however, you should occasionally run them to manually search for errors:
241241

242242
```shell
243243
# get a list of linters (at the end of the output there are some convenient presets)

api/v1alpha1/condition_types.go

-49
This file was deleted.

api/v1alpha1/dynamicenv_types.go

+12-11
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const (
4646
Ready GlobalReadyStatus = "ready"
4747
Processing GlobalReadyStatus = "processing"
4848

49-
// Whether it's consumer or subset.
49+
// Whether it's a consumer or subset.
5050
SUBSET SubsetOrConsumer = iota
5151
CONSUMER SubsetOrConsumer = iota
5252
)
@@ -179,8 +179,8 @@ type DynamicEnvSpec struct {
179179
Subsets []Subset `json:"subsets"`
180180

181181
// Consumers are like subsets but for deployments that do not open a service but connect to external resources for
182-
// their work (e.g, offline workers). They are equivalent to subsets in the sense that they launch overriding
183-
// deployments with custom image and/or settings. However, since they are only consumers no virtual service or
182+
// their work (e.g., offline workers). They are equivalent to subsets in the sense that they launch overriding
183+
// deployments with custom image and/or settings. However, since they are only consumers, no virtual service or
184184
// destination route will be pointing to them.
185185
Consumers []Subset `json:"consumers,omitempty"`
186186
}
@@ -207,7 +207,7 @@ type StringMatch struct {
207207
Regex string `json:"regex,omitempty"`
208208
}
209209

210-
// Subsets defines how to generate subsets from existing Deployments
210+
// Subsets define how to generate subsets from existing Deployments
211211
type Subset struct {
212212
// Deployment name (without namespace)
213213
Name string `json:"name"`
@@ -237,7 +237,7 @@ type Subset struct {
237237
// and the relevant overrides
238238
type ContainerOverrides struct {
239239
// Container name to override in multiple containers' environment. If not
240-
// specified we will use the first container.
240+
// specified, we will use the first container.
241241
ContainerName string `json:"containerName"`
242242

243243
// Docker image name overridden to the desired subset
@@ -257,9 +257,9 @@ type ContainerOverrides struct {
257257

258258
// DynamicEnvStatus defines the observed state of DynamicEnv
259259
type DynamicEnvStatus struct {
260-
// Represents the latest available observations of a deployment's current state.
261-
Conditions []Condition `json:"conditions,omitempty"`
262-
SubsetsStatus map[string]SubsetStatus `json:"subsetsStatus"`
260+
// A detailed status of each subset
261+
SubsetsStatus map[string]SubsetStatus `json:"subsetsStatus"`
262+
// A detailed status of each consumer
263263
ConsumersStatus map[string]ConsumerStatus `json:"consumersStatus,omitempty"`
264264
State GlobalReadyStatus `json:"state,omitempty"`
265265
// desired subsets and consumers count
@@ -277,7 +277,7 @@ type DynamicEnvList struct {
277277
Items []DynamicEnv `json:"items"`
278278
}
279279

280-
// SubsetStatus Contains aggregation of all resources status connected to set subset.
280+
// SubsetStatus Contains aggregation of all resource status connected to set subset.
281281
type SubsetStatus struct {
282282
// Status of the deployment that belongs to the subset
283283
Deployment ResourceStatus `json:"deployment,omitempty"`
@@ -327,7 +327,8 @@ func (rs ResourceStatus) IsEqual(other ResourceStatus) bool {
327327

328328
// StatusError shows an error we want to display in the status with the last time it happened. This
329329
// *does not* have to be the only time it happened. The idea is that a list of errors should only
330-
// contain single occurrence of an error (just the last).
330+
//
331+
// contain a single occurrence of an error (just the last).
331332
type StatusError struct {
332333
// The error message
333334
Error string `json:"error"`
@@ -336,7 +337,7 @@ type StatusError struct {
336337
}
337338

338339
// SubsetMessages contains a list of messages (errors) that occurred during Reconcile loop. At the
339-
// end of each loop these messages should be synced to the matching subset status.
340+
// end of each loop, these messages should be synced to the matching subset status.
340341
type SubsetMessages struct {
341342
Deployment []string
342343
DestinationRule []string

api/v1alpha1/dynamicenv_webhook.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func (de *DynamicEnv) validateIstioMatchAnyOf() error {
122122
return nil
123123
}
124124

125-
// Validates certain aspects of the subset. Should be used both on create and update.
125+
// Validates certain aspects of the subset. Should be used both on creation and update.
126126
func (de *DynamicEnv) validateSubsetsProperties() error {
127127
subsets := append(de.Spec.Subsets, de.Spec.Consumers...)
128128
for _, s := range subsets {
@@ -164,7 +164,7 @@ func (de *DynamicEnv) validateIstioMatchImmutable(old runtime.Object) error {
164164
}
165165

166166
// validatePartialUpdateSubsets verifies that update only occurs within a subset. The name/namespace
167-
// of the subsets should not be updated (e.g. should not delete or create new subsets).
167+
// of the subsets should not be updated (e.g., should not delete or create new subsets).
168168
func (de *DynamicEnv) validatePartialUpdateSubsets(old runtime.Object) error {
169169
oldSubsets := append(old.(*DynamicEnv).Spec.Subsets, old.(*DynamicEnv).Spec.Consumers...)
170170
newSubsets := append(de.Spec.Subsets, de.Spec.Consumers...)

api/v1alpha1/groupversion_info.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
)
2626

2727
var (
28-
// GroupVersion is group version used to register these objects
28+
// GroupVersion is a group version used to register these objects
2929
GroupVersion = schema.GroupVersion{Group: "riskified.com", Version: "v1alpha1"}
3030

3131
// SchemeBuilder is used to add go types to the GroupVersionKind scheme

api/v1alpha1/zz_generated.deepcopy.go

-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)