Skip to content

Commit 0eae21c

Browse files
Fix: Typos and Erros and improve grammar in graph, metadata and runtime (#485)
* Fix: Typos and Erros and improve grammar in graph, metadata and runtime
1 parent eb5941e commit 0eae21c

14 files changed

+70
-62
lines changed

Diff for: CONTRIBUTING.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing Guidelines
22

3-
Thank you for your interest in contributing the project. Whether it's a bug report, new feature, correction, or additional documentation, we greatly value feedback and contributions from our community.
3+
Thank you for your interest in contributing to the project. Whether it's a bug report, new feature, correction, or additional documentation, we greatly value feedback and contributions from our community.
44

55
Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution.
66

@@ -19,7 +19,7 @@ Please try to include detailed descriptions in issues. Details like these are in
1919

2020
Note to keep things tidy and moving along, the maintainers may close issues that appear to be duplicates, are incomplete, or have no discussion for a period of time.
2121

22-
If an issue is closed and you feel like it needs to be open, we are always open to discussion.
22+
If an issue is closed, and you feel like it needs to be open, we are always open to discussion.
2323

2424

2525
## Contributing via Pull Requests
@@ -47,12 +47,12 @@ GitHub provides nice documentation on [forking a repository](https://help.github
4747

4848
As with issues above, to keep things tidy and moving along, the maintainers may close PRs that appear to be duplicates, are incomplete and have no discussion for a period of time, or that don't follow the process in spirit.
4949

50-
If a PR is closed and you feel like it needs to be open, we are always open to discussion.
50+
If a PR is closed, and you feel like it needs to be open, we are always open to discussion.
5151

5252

5353
## Development setup
5454

55-
Setup the [local enviroment](docs/developer-getting-started.md) to build and test the code locally.
55+
Setup the [local environment](docs/developer-getting-started.md) to build and test the code locally.
5656

5757
## Finding contributions to work on
5858
Looking at the existing issues is a great way to find something to work on. As the project uses the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
@@ -65,7 +65,7 @@ This project has adopted the [CNCF Code of Conduct](https://github.com/cncf/foun
6565

6666
## Security
6767

68-
If you discover a potential security issue in this project we ask that you notify project maintainers via email at [email protected]. _Please do not create a public GitHub issue._
68+
If you discover a potential security issue in this project, we ask that you notify project maintainers via email at [email protected]. _Please do not create a public GitHub issue._
6969

7070
## Licensing
7171

Diff for: pkg/graph/builder.go

+26-20
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ func NewBuilder(
6060
return rgBuilder, nil
6161
}
6262

63-
// Builder is an object that is responsible of constructing and managing
64-
// resourceGraphDefinitions. It is responsible of transforming the resourceGraphDefinition CRD
63+
// Builder is an object that is responsible for constructing and managing
64+
// resourceGraphDefinitions. It is responsible for transforming the resourceGraphDefinition CRD
6565
// into a runtime representation that can be used to create the resources in
6666
// the cluster.
6767
//
@@ -78,7 +78,7 @@ func NewBuilder(
7878
//
7979
// If any of the above steps fail, the Builder will return an error.
8080
//
81-
// The resulting ResourceGraphDefinition object is a fulyl processed and validated
81+
// The resulting ResourceGraphDefinition object is a fully processed and validated
8282
// representation of a resource graph definition CR, it's underlying resources, and the
8383
// relationships between the resources. This object can be used to instantiate
8484
// a "runtime" data structure that can be used to create the resources in the
@@ -208,8 +208,10 @@ func (b *Builder) NewResourceGraphDefinition(originalCR *v1alpha1.ResourceGraphD
208208
}
209209

210210
// Before getting into the dependency graph, we need to validate the CEL expressions
211-
// in the instance resource. In order to do that, we need to isolate each resource
212-
// and evaluate the CEL expressions in the context of the resource graph definition. This is done
211+
// in the instance resource.
212+
// To do that, we need to isolate each resource
213+
// and evaluate the CEL expressions in the context of the resource graph definition.
214+
//This is done
213215
// by dry-running the CEL expressions against the emulated resources.
214216
err = validateResourceCELExpressions(resources, instance)
215217
if err != nil {
@@ -220,7 +222,7 @@ func (b *Builder) NewResourceGraphDefinition(originalCR *v1alpha1.ResourceGraphD
220222
// building the resource graph definition. Understanding the relationships between the
221223
// resources in the resource graph definition a.k.a the dependency graph.
222224
//
223-
// The dependency graph is an directed acyclic graph that represents the
225+
// The dependency graph is a directed acyclic graph that represents the
224226
// relationships between the resources in the resource graph definition. The graph is
225227
// used to determine the order in which the resources should be created in the
226228
// cluster.
@@ -307,7 +309,7 @@ func (b *Builder) buildRGResource(rgResource *v1alpha1.Resource, namespacedResou
307309
}
308310
for _, fieldDescriptor := range fieldDescriptors {
309311
resourceVariables = append(resourceVariables, &variable.ResourceField{
310-
// Assume variables are static, we'll validate them later
312+
// Assume variables are static; we'll validate them later
311313
Kind: variable.ResourceVariableKindStatic,
312314
FieldDescriptor: fieldDescriptor,
313315
})
@@ -344,12 +346,16 @@ func (b *Builder) buildRGResource(rgResource *v1alpha1.Resource, namespacedResou
344346
}
345347

346348
// buildDependencyGraph builds the dependency graph between the resources in the
347-
// resource graph definition. The dependency graph is an directed acyclic graph that represents
348-
// the relationships between the resources in the resource graph definition. The graph is used
349+
// resource graph definition.
350+
// The dependency graph is a directed acyclic graph that represents
351+
// the relationships between the resources in the resource graph definition.
352+
// The graph is used
349353
// to determine the order in which the resources should be created in the cluster.
350354
//
351-
// This function returns the DAG, and a map of runtime variables per resource. later
352-
// on we'll use this map to resolve the runtime variables.
355+
// This function returns the DAG, and a map of runtime variables per resource.
356+
// Later
357+
//
358+
// on, we'll use this map to resolve the runtime variables.
353359
func (b *Builder) buildDependencyGraph(
354360
resources map[string]*Resource,
355361
) (
@@ -428,7 +434,7 @@ func (b *Builder) buildInstanceResource(
428434
// to request the creation of the resources defined in the resource graph definition.
429435
//
430436
// The instance resource is a Kubernetes resource, differently from typical
431-
// CRDs, it doesn't have an OpenAPI schema. Instead, it has a schema defined
437+
// CRDs; it doesn't have an OpenAPI schema. Instead, it has a schema defined
432438
// using the "SimpleSchema" format, a new standard we created to simplify
433439
// CRD declarations.
434440

@@ -486,7 +492,7 @@ func (b *Builder) buildInstanceResource(
486492

487493
instanceStatusVariables := []*variable.ResourceField{}
488494
for _, statusVariable := range statusVariables {
489-
// These variables needs to be injected into the status field of the instance.
495+
// These variables need to be injected into the status field of the instance.
490496
path := "status." + statusVariable.Path
491497
statusVariable.Path = path
492498

@@ -565,7 +571,7 @@ func buildStatusSchema(
565571
// statusStructureParts := make([]schema.FieldDescriptor, 0, len(extracted))
566572
statusDryRunResults := make(map[string][]ref.Val, len(fieldDescriptors))
567573
for _, found := range fieldDescriptors {
568-
// For each expression in the extracted ExpressionField we need to dry-run
574+
// For each expression in the extracted `ExpressionField` we need to dry-run
569575
// the expression to infer the type of the status field.
570576
evals := []ref.Val{}
571577
for _, expr := range found.Expressions {
@@ -615,8 +621,8 @@ func validateCELExpressionContext(env *cel.Env, expression string, resources []s
615621
}
616622

617623
// dryRunExpression executes the given CEL expression in the context of a set
618-
// of emulated resources. We could've called this function evaluateExpression
619-
// but we chose to call it dryRunExpression to indicate that we are not actually
624+
// of emulated resources. We could've called this function evaluateExpression,
625+
// but we chose to call it dryRunExpression to indicate that we are not
620626
// used for anything other than validating the expression and inspecting it
621627
func dryRunExpression(env *cel.Env, expression string, resources map[string]*Resource) (ref.Val, error) {
622628
ast, issues := env.Compile(expression)
@@ -645,7 +651,7 @@ func dryRunExpression(env *cel.Env, expression string, resources map[string]*Res
645651
}
646652

647653
// extractDependencies extracts the dependencies from the given CEL expression.
648-
// It returns a list of dependencies and a boolea indicating if the expression
654+
// It returns a list of dependencies and a boolean indicating if the expression
649655
// is static or not.
650656
func extractDependencies(env *cel.Env, expression string, resourceNames []string) ([]string, bool, error) {
651657
// We also want to allow users to refer to the instance spec in their expressions.
@@ -680,7 +686,7 @@ func extractDependencies(env *cel.Env, expression string, resourceNames []string
680686
//
681687
// In this process, we pin a resource and evaluate the CEL expressions in the
682688
// context of emulated resources. Meaning that given 3 resources A, B, and C,
683-
// we evalute A's CEL expressions against 2 emulated resources B and C. Then
689+
// we evaluate A's CEL expressions against 2 emulated resources B and C. Then
684690
// we evaluate B's CEL expressions against 2 emulated resources A and C, and so
685691
// on.
686692
func validateResourceCELExpressions(resources map[string]*Resource, instance *Resource) error {
@@ -701,8 +707,8 @@ func validateResourceCELExpressions(resources map[string]*Resource, instance *Re
701707

702708
// create includeWhenContext
703709
includeWhenContext := map[string]*Resource{}
704-
// for now we will only support the instance context for includeWhen expressions.
705-
// With this decision we will decide in creation time, and update time
710+
// For now, we will only support the instance context for includeWhen expressions.
711+
// With this decision, we will decide on creation time and update time
706712
// If we'll be creating resources or not
707713
includeWhenContext["schema"] = &Resource{
708714
emulatedObject: &unstructured.Unstructured{

Diff for: pkg/graph/graph.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ import (
2020
"github.com/kro-run/kro/pkg/runtime"
2121
)
2222

23-
// Graph represents a processed resourcegraphdefinition. It contains the DAG representation
24-
// and everything needed to "manage" the resources defined in the resource graph definition.
23+
// The Graph represents a processed resourcegraphdefinition.
24+
// It contains the DAG representation and everything needed to "manage"
25+
// the resources defined in the resource graph definition.
2526
type Graph struct {
2627
// DAG is the directed acyclic graph representation of the resource graph definition.
2728
DAG *dag.DirectedAcyclicGraph[string]

Diff for: pkg/graph/resource.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ import (
2727
// Resource represents a resource in a resource graph definition, it hholds
2828
// information about the resource, its schema, and its variables.
2929
//
30-
// This object can only be created by the GraphBuilder and it should
31-
// not be created manually. Also this object isn't designed to be
30+
// This object can only be created by the GraphBuilder, and it should
31+
// not be created manually. Also, this object isn't designed to be
3232
// modified after creation.
3333
type Resource struct {
34-
// id is the unique identifier of the resource. It's the name of the
35-
// resource in the resource graph definition.
34+
// `id` is the unique identifier of the resource.
35+
// It's the name of the resource in the resource graph definition.
3636
// An id is unique within a resource graph definition, and adheres to the naming
3737
// conventions.
3838
id string
@@ -113,7 +113,7 @@ func (r *Resource) GetOrder() int {
113113
return r.order
114114
}
115115

116-
// GetGroupVersionKind returns the GVK of the resource.
116+
// GetGroupVersionResource GetGroupVersionKind returns the GVK of the resource.
117117
func (r *Resource) GetGroupVersionResource() schema.GroupVersionResource {
118118
return r.gvr
119119
}

Diff for: pkg/graph/validation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func validateResourceGraphDefinitionNamingConventions(rgd *v1alpha1.ResourceGrap
104104
// The KRO naming convention is as follows:
105105
// - The id should start with a lowercase letter.
106106
// - The id should only contain alphanumeric characters.
107-
// - does not contain any special characters, underscores, or hyphens.
107+
// - Does not contain any special characters, underscores, or hyphens.
108108
func validateResourceIDs(rgd *v1alpha1.ResourceGraphDefinition) error {
109109
seen := make(map[string]struct{})
110110
for _, res := range rgd.Spec.Resources {

Diff for: pkg/graph/variable/variable.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type FieldDescriptor struct {
4343
StandaloneExpression bool
4444
}
4545

46-
// ResourceVariable represents a variable in a resource. Variables are any
46+
// ResourceField ResourceVariable represents a variable in a resource. Variables are any
4747
// field in a resource (under resources[*].definition) that is not a constant
4848
// value a.k.a contains one or multiple expressions. For example
4949
//
@@ -55,10 +55,10 @@ type FieldDescriptor struct {
5555
// execution and their value is constant. Dynamic variables are resolved at
5656
// runtime and their value can change during the execution.
5757
//
58-
// ResourceVariables are an extension of CELField and they contain additional
58+
// ResourceVariables are an extension of CELField, and they contain additional
5959
// information about the variable kind.
6060
type ResourceField struct {
61-
// CELField is the object that contains the expression, the path, and the
61+
// CELField is the object that contains the expression, the path, and
6262
// the expected type (OpenAPI schema).
6363
FieldDescriptor
6464
// ResourceVariableKind is the kind of the variable (static or dynamic).
@@ -81,13 +81,13 @@ func (rv *ResourceField) AddDependencies(dep ...string) {
8181
}
8282
}
8383

84-
// ResourceVariableKind represents the kind of a resource variable.
84+
// ResourceVariableKind represents the kind of resource variable.
8585
type ResourceVariableKind string
8686

8787
const (
8888
// ResourceVariableKindStatic represents a static variable. Static variables
8989
// are resolved at the beginning of the execution and their value is constant.
90-
// Static variables are easy to find, they always start with 'spec'. Refereing
90+
// Static variables are easy to find, they always start with 'spec'. Referring
9191
// to the instance spec.
9292
//
9393
// For example:

Diff for: pkg/metadata/owner_reference.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var (
2626
KRORGOwnerReferenceAPIVersion = v1alpha1.GroupVersion.String()
2727
)
2828

29-
// stamped on the CRD and RGIs
29+
// NewResourceGraphDefinitionOwnerReference stamped on the CRD and RGIs
3030
func NewResourceGraphDefinitionOwnerReference(name string, uid types.UID) metav1.OwnerReference {
3131
return metav1.OwnerReference{
3232
Name: name,
@@ -37,7 +37,7 @@ func NewResourceGraphDefinitionOwnerReference(name string, uid types.UID) metav1
3737
}
3838
}
3939

40-
// stamped on the RGI child resources
40+
// NewInstanceOwnerReference stamped on the RGI child resources
4141
func NewInstanceOwnerReference(gvk schema.GroupVersionKind, name string, uid types.UID) metav1.OwnerReference {
4242
return metav1.OwnerReference{
4343
Name: name,

Diff for: pkg/metadata/selectors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func NewResourceGraphDefinitionSelector(resourceGraphDefinition metav1.Object) m
3333
return metav1.LabelSelector{
3434
MatchLabels: map[string]string{
3535
ResourceGraphDefinitionIDLabel: string(resourceGraphDefinition.GetUID()),
36-
// ResourceGraphDefinitionNameLabel: resourceGraphDefinition.GetName(),
36+
// ResourceGraphDefinitionNameLabel: resourceGraphDefinition.GetName(),
3737
// ResourceGraphDefinitionNamespaceLabel: resourceGraphDefinition.GetNamespace(),
3838
},
3939
}

Diff for: pkg/requeue/requeue.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ func (e *RequeueNeeded) Unwrap() error {
103103
var _ error = &RequeueNeeded{}
104104

105105
// RequeueNeededAfter instructs the ACK runtime to requeue the processing item
106-
// after specified duration without been logged as error. This should be used
107-
// when a "error condition" occurrence is sort of expected and can be resolved
108-
// by retry. e.g. a dependency haven't been fulfilled yet, and expected it to
106+
// after specified duration without been logged as error. This should be used
107+
// when an "error condition" occurrence is sort of expected and can be resolved
108+
// by retry. E.g., a dependency hasn't been fulfilled yet, and expected it to
109109
// be fulfilled after duration. Note: use this with care, a simple wait might
110110
// suit your use case better.
111111
type RequeueNeededAfter struct {

Diff for: pkg/runtime/interfaces.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ type Interface interface {
8080
// 1. The runtime package depends on how resources are defined in the graph
8181
// package.
8282
//
83-
// 2. the graph package needs to instantiate the a runtime instance to during
83+
// 2. The graph package needs to instantiate a runtime instance during
8484
// the reconciliation process.
8585
//
86-
// 3. the graph package needs to classify the variables and dependencies of
86+
// 3. The graph package needs to classify the variables and dependencies of
8787
// a resource to build the graph. The runtime package needs to know about
8888
// these variables and dependencies to resolve the resources.
89-
// This utility is moved to the types package. (Thinking about moving it
89+
// This utility is moved to the `types` package. (Thinking about moving it
9090
// to a new package called "internal/typesystem/variables")
9191
type ResourceDescriptor interface {
9292
// GetGroupVersionResource returns the k8s GVR for this resource. Note that

Diff for: pkg/runtime/resolver/resolver.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@ func (r *Resolver) resolveField(field variable.FieldDescriptor) ResolutionResult
9595

9696
value, err := r.getValueFromPath(field.Path)
9797
if err != nil {
98-
// Not sure if these kind of errors should be fatal, these paths are produced
99-
// by the parser, so they should be valid. Maybe we should log them instead....
98+
// Not sure if these kinds of errors should be fatal, these paths are produced
99+
// by the parser, so they should be valid.
100+
// Maybe we should log them instead…
100101
result.Error = fmt.Errorf("error getting value: %v", err)
101102
return result
102103
}

0 commit comments

Comments
 (0)