Skip to content

Commit

Permalink
format website
Browse files Browse the repository at this point in the history
  • Loading branch information
cbarbian-sap committed Jan 8, 2024
1 parent a18b06c commit c3ca9b9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion website/content/en/docs/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This repository provides a framework supporting the development of opinionated K
managing the lifecycle of arbitrary deployment components of Kubernetes clusters, with a special focus
on such components that are or contain Kubernetes operators themselves.

It can therefore serve as a starting point to develop [SAP Kyma module operators](https://github.com/kyma-project/template-operator),
It can therefore serve as a starting point to develop [SAP Kyma module operators](https://github.com/kyma-project/template-operator),
but can also be used independently of Kyma.

Regarding its mission statement, this project can be compared with the [Operator Lifecycle Manager (OLM)](https://olm.operatorframework.io/).
Expand Down
68 changes: 34 additions & 34 deletions website/content/en/docs/concepts/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ package component
// Besides being a conroller-runtime client.Object, the implementing type has to expose accessor
// methods for the components's spec and status, GetSpec() and GetStatus().
type Component interface {
client.Object
// Return a read-only accessor to the component's spec.
// The returned value has to implement the types.Unstructurable interface.
GetSpec() types.Unstructurable
// Return a read-write (usually a pointer) accessor to the component's status,
// resp. to the corresponding substruct if the status extends component.Status.
GetStatus() *Status
client.Object
// Return a read-only accessor to the component's spec.
// The returned value has to implement the types.Unstructurable interface.
GetSpec() types.Unstructurable
// Return a read-write (usually a pointer) accessor to the component's status,
// resp. to the corresponding substruct if the status extends component.Status.
GetStatus() *Status
}
```

Expand All @@ -54,13 +54,13 @@ package component

// Component Status. Components must include this into their status.
type Status struct {
ObservedGeneration int64 `json:"observedGeneration"`
AppliedGeneration int64 `json:"appliedGeneration,omitempty"`
LastObservedAt *metav1.Time `json:"lastObservedAt,omitempty"`
LastAppliedAt *metav1.Time `json:"lastAppliedAt,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
State State `json:"state,omitempty"`
Inventory []*InventoryItem `json:"inventory,omitempty"`
ObservedGeneration int64 `json:"observedGeneration"`
AppliedGeneration int64 `json:"appliedGeneration,omitempty"`
LastObservedAt *metav1.Time `json:"lastObservedAt,omitempty"`
LastAppliedAt *metav1.Time `json:"lastAppliedAt,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
State State `json:"state,omitempty"`
Inventory []*InventoryItem `json:"inventory,omitempty"`
}
```

Expand All @@ -76,28 +76,28 @@ package component
// to explicitly specify target namespace and name of the deployment (otherwise this will be defaulted as
// the namespace and name of the component object itself).
type PlacementConfiguration interface {
// Return target namespace for the component deployment.
// If the returned value is not the empty string, then this is the value that will be passed
// to Generator.Generate() as namespace and, in addition, rendered namespaced resources with
// unspecified namespace will be placed in this namespace.
GetDeploymentNamespace() string
// Return target name for the component deployment.
// If the returned value is not the empty string, then this is the value that will be passed
// to Generator.Generator() as name.
GetDeploymentName() string
// Return target namespace for the component deployment.
// If the returned value is not the empty string, then this is the value that will be passed
// to Generator.Generate() as namespace and, in addition, rendered namespaced resources with
// unspecified namespace will be placed in this namespace.
GetDeploymentNamespace() string
// Return target name for the component deployment.
// If the returned value is not the empty string, then this is the value that will be passed
// to Generator.Generator() as name.
GetDeploymentName() string
}
```

In addition, the component (or its spec) may implement

```go
package component
package component

// The ClientConfiguration interface is meant to be implemented by components (or their spec) which offer
// remote deployments.
type ClientConfiguration interface {
// Get kubeconfig content. Should return nil if default local client shall be used.
GetKubeConfig() []byte
// Get kubeconfig content. Should return nil if default local client shall be used.
GetKubeConfig() []byte
}
```

Expand All @@ -109,12 +109,12 @@ package component
// The ImpersonationConfiguration interface is meant to be implemented by components (or their spec) which offer
// impersonated deployments.
type ImpersonationConfiguration interface {
// Return impersonation user. Should return system:serviceaccount:<namespace>:<serviceaccount>
// if a service account is used for impersonation. Should return an empty string
// if user shall not be impersonated.
GetImpersonationUser() string
// Return impersonation groups. Should return nil if groups shall not be impersonated.
GetImpersonationGroups() []string
// Return impersonation user. Should return system:serviceaccount:<namespace>:<serviceaccount>
// if a service account is used for impersonation. Should return an empty string
// if user shall not be impersonated.
GetImpersonationUser() string
// Return impersonation groups. Should return nil if groups shall not be impersonated.
GetImpersonationGroups() []string
}
```

Expand All @@ -140,11 +140,11 @@ package manifests
// methods (if non-empty). The parameters argument will be assigned the return value
// of the component's GetSpec() method.
type Generator interface {
Generate(ctx context.Context, namespace string, name string, parameters types.Unstructurable) ([]client.Object, error)
Generate(ctx context.Context, namespace string, name string, parameters types.Unstructurable) ([]client.Object, error)
}
```

Component controllers can of course implement their own generator. In many cases (for example if there exists a
Component controllers can of course implement their own generator. In many cases (for example if there exists a
Helm chart or kustomization for the component), one of the [generators bundled with this repository](../../generators) can be used.

Generators may optionally implement
Expand Down
4 changes: 2 additions & 2 deletions website/content/en/docs/getting-started/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Now, after having the skeleton generated, we have to breathe life into the contr
The first step is to enhance the spec of the generated custom resource type `MyComponentSpec` in `api/v1alpha1/types.go`.
In principle, all the attributes parameterizing the deployment of the managed commponent should be modeled there.

Whenever you change the runtime type, you should invoke `make generate` and `make manifests` in order to
Whenever you change the runtime type, you should invoke `make generate` and `make manifests` in order to
update the generated code artifacts and the custom resource definition; afterwards you should re-apply the
custom resource definition to the cluster.

Expand All @@ -74,7 +74,7 @@ concrete manifests of the dependent objects, which will then be applied to the c

In some cases, the best option is to implement your own resource generator from scratch. When doing so, the returned resources `[]client.Object` either have to be of type `*unstructured.Unstructured`, or the according type must be known to the used scheme.

In many other cases however, it makes more sense to just reuse one of the [generic generators shipped with this
In many other cases however, it makes more sense to just reuse one of the [generic generators shipped with this
repository](../generators).


Expand Down
2 changes: 1 addition & 1 deletion website/content/en/docs/usage/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (c *MyComponent) GetStatus() *component.Status {
```

Now we are settled to replace the controller generated by kubebuilder with the component-operator-runtime reconciler in the scaffolded `main.go`:

```go
// Replace this by a real resource generator (e.g. manifests.HelmGenerator, or your own one).
resourceGenerator, err := manifests.NewDummyGenerator()
Expand Down

0 comments on commit c3ca9b9

Please sign in to comment.