Skip to content

Commit

Permalink
chore: Sync main to feature branch (#1718)
Browse files Browse the repository at this point in the history
* chore: Refactor NewCachedDescriptorProvider (#1695)

* remove parameter for NewCachedDescriptorProvider

* fix dead link

* adjust unit test coverage

* fix flaky test

* docs: Update KLM Local Test Setup Guide (#1680)

fix errors in local test setup documentation
add version info

* feat: Drop multiple ways to reference modules in Kyma CR (#1672)

* remove module reference by namespace/name

* remove module reference by objectmeta name

* remove module reference by FQDN

* add initial test structure

* add test cases for different module reference scenarios

* fix tests

* update documentation

* address review comments

* address more review comments

* fix linting issues

* rearrange imports

* adjust documentation

* chore: Configure different requeue intervals for Manifest reconciliation (#1690)

* Add different requeue intervals for Manifest reconciliation

* Empty-Commit

* code review comments

* chore: Bump k8s deps (#1703)

* chore: Bump k8s deps

* retrigger jobs

* bump api folder as well

---------

Co-authored-by: Nesma Badr <[email protected]>

* fix: Manifest CR should update by moduletemplate generation changes (#1702)

* when moduletemplate generation updated, then manifest CR should also updated.

* refactor regular_test.go

---------

Co-authored-by: Benjamin Lindner <[email protected]>

* fix bug due to modified ModuleName

---------

Co-authored-by: Amritanshu Sikdar <[email protected]>
Co-authored-by: Amritanshu Sikdar <[email protected]>
Co-authored-by: Nesma Badr <[email protected]>
Co-authored-by: Benjamin Lindner <[email protected]>
  • Loading branch information
5 people authored Jul 25, 2024
1 parent a538607 commit 2a4eb7a
Show file tree
Hide file tree
Showing 25 changed files with 785 additions and 290 deletions.
2 changes: 1 addition & 1 deletion api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.4
require (
github.com/Masterminds/semver/v3 v3.2.1
github.com/open-component-model/ocm v0.11.0
k8s.io/apimachinery v0.30.2
k8s.io/apimachinery v0.30.3
sigs.k8s.io/controller-runtime v0.18.4
)

Expand Down
4 changes: 2 additions & 2 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,8 @@ k8s.io/api v0.30.1 h1:kCm/6mADMdbAxmIh0LBjS54nQBE+U4KmbCfIkF5CpJY=
k8s.io/api v0.30.1/go.mod h1:ddbN2C0+0DIiPntan/bye3SW3PdwLa11/0yqwvuRrJM=
k8s.io/apiextensions-apiserver v0.30.1 h1:4fAJZ9985BmpJG6PkoxVRpXv9vmPUOVzl614xarePws=
k8s.io/apiextensions-apiserver v0.30.1/go.mod h1:R4GuSrlhgq43oRY9sF2IToFh7PVlF1JjfWdoG3pixk4=
k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg=
k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc=
k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/client-go v0.30.1 h1:uC/Ir6A3R46wdkgCV3vbLyNOYyCJ8oZnjtJGKfytl/Q=
k8s.io/client-go v0.30.1/go.mod h1:wrAqLNs2trwiCH/wxxmT/x3hKVH9PuV0GGW0oDoHVqc=
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
Expand Down
5 changes: 1 addition & 4 deletions api/v1beta2/kyma_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ type Module struct {
// Name is a unique identifier of the module.
// It is used to resolve a ModuleTemplate for creating a set of resources on the cluster.
//
// Name can be one of 3 kinds:
// - The ModuleName label value of the module-template, e.g. operator.kyma-project.io/module-name=my-module
// - The Name or Namespace/Name of a ModuleTemplate, e.g. my-moduletemplate or kyma-system/my-moduletemplate
// - The FQDN, e.g. kyma-project.io/module/my-module as located in .spec.descriptor.component.name
// Name can only be the ModuleName label value of the module-template, e.g. operator.kyma-project.io/module-name=my-module
Name string `json:"name"`

// ControllerName is able to set the controller used for reconciliation of the module. It can be used
Expand Down
4 changes: 3 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,9 @@ func setupManifestReconciler(mgr ctrl.Manager, flagVar *flags.FlagVar, options c
if err := manifest.SetupWithManager(
mgr, options, queue.RequeueIntervals{
Success: flagVar.ManifestRequeueSuccessInterval,
Busy: flagVar.KymaRequeueBusyInterval,
Busy: flagVar.ManifestRequeueBusyInterval,
Error: flagVar.ManifestRequeueErrInterval,
Warning: flagVar.ManifestRequeueWarningInterval,
}, manifest.SetupOptions{
ListenerAddr: flagVar.ManifestListenerAddr,
EnableDomainNameVerification: flagVar.EnableDomainNameVerification,
Expand Down
10 changes: 2 additions & 8 deletions config/crd/bases/operator.kyma-project.io_kymas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ spec:
It is used to resolve a ModuleTemplate for creating a set of resources on the cluster.
Name can be one of 3 kinds:
- The ModuleName label value of the module-template, e.g. operator.kyma-project.io/module-name=my-module
- The Name or Namespace/Name of a ModuleTemplate, e.g. my-moduletemplate or kyma-system/my-moduletemplate
- The FQDN, e.g. kyma-project.io/module/my-module as located in .spec.descriptor.component.name
Name can only be the ModuleName label value of the module-template, e.g. operator.kyma-project.io/module-name=my-module
type: string
remoteModuleTemplateRef:
description: |-
Expand Down Expand Up @@ -526,10 +523,7 @@ spec:
It is used to resolve a ModuleTemplate for creating a set of resources on the cluster.
Name can be one of 3 kinds:
- The ModuleName label value of the module-template, e.g. operator.kyma-project.io/module-name=my-module
- The Name or Namespace/Name of a ModuleTemplate, e.g. my-moduletemplate or kyma-system/my-moduletemplate
- The FQDN, e.g. kyma-project.io/module/my-module as located in .spec.descriptor.component.name
Name can only be the ModuleName label value of the module-template, e.g. operator.kyma-project.io/module-name=my-module
type: string
remoteModuleTemplateRef:
description: |-
Expand Down
63 changes: 36 additions & 27 deletions docs/developer-tutorials/local-test-setup.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Local test Setup in the control-plane Mode Using k3d

> ### Supported Versions
> * Golang: `v1.22.5`
> * k3d: `v5.6.0`
> * k3s: `v1.27.4-k3s1 (default)`
> * kubectl:
> * Client Version: `v1.30.2`
> * Server Version: `v1.27.4+k3s1`
> * docker:
> * Client Version: `v26.1.4`
> * Server: `Docker Desktop v4.31.0`
> * Engine Version: `v26.1.4`
## Context

This tutorial shows how to configure a fully working e2e test setup including the following components:
Expand Down Expand Up @@ -184,36 +196,33 @@ k3d cluster create skr-local
<summary>Running Lifecycle Manager on a local machine and not on a cluster</summary>
If you are running Lifecycle Manager on your local machine and not as a deployment on a cluster, use the following to create a Kyma CR and Secret:
```shell
cat << EOF | kubectl apply -f -
---
apiVersion: v1
kind: Secret
metadata:
name: kyma-sample
namespace: kcp-system
labels:
```shell
cat << EOF | kubectl apply -f -
---
apiVersion: v1
kind: Secret
metadata:
name: kyma-sample
namespace: kcp-system
labels:
"operator.kyma-project.io/kyma-name": "kyma-sample"
"operator.kyma-project.io/managed-by": "lifecycle-manager"
data:
config: $(k3d kubeconfig get skr-local | base64 | tr -d '\n')
---
apiVersion: operator.kyma-project.io/v1beta2
kind: Kyma
metadata:
annotations:
skr-domain: "example.domain.com"
name: kyma-sample
namespace: kcp-system
spec:
channel: regular
sync:
enabled: true
modules:
- name: template-operator
EOF
data:
config: $(k3d kubeconfig get skr-local | base64 | tr -d '\n')
---
apiVersion: operator.kyma-project.io/v1beta2
kind: Kyma
metadata:
annotations:
skr-domain: "example.domain.com"
name: kyma-sample
namespace: kcp-system
spec:
channel: regular
modules:
- name: template-operator
EOF
```
</details>
### Watcher and Module Installation Verification
Expand Down
47 changes: 10 additions & 37 deletions docs/technical-reference/api/kyma-cr.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,43 +62,16 @@ spec:
name: kyma-project.io/module/sample
```

The module mentioned above can be referenced in one of the following ways:

* The label value of `operator.kyma-project.io/module-name`:

```yaml
spec:
channel: regular
modules:
- name: module-name-from-label
```

* The name or namespace/name of a ModuleTemplate CR:

```yaml
spec:
channel: regular
modules:
- name: moduletemplate-sample
```

or

```yaml
spec:
channel: regular
modules:
- name: default/moduletemplate-sample
```

* The fully qualified name of the descriptor as located in **.spec.descriptor.component.name**:

```yaml
spec:
channel: regular
modules:
- name: kyma-project.io/module/sample
```
The module mentioned above can *only* be referenced using the label value of `operator.kyma-project.io/module-name`:
```yaml
spec:
channel: regular
modules:
- name: module-name-from-label
```

> **CAUTION:**
> Module referencing using NamespacedName and FQDN (Fully Qualified Domain Name) has been deprecated.

### **.spec.modules[].customResourcePolicy**

Expand Down
20 changes: 10 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/go-logr/logr v1.4.2
github.com/go-logr/zapr v1.3.0
github.com/golang/mock v1.6.0
github.com/google/go-containerregistry v0.20.0
github.com/google/go-containerregistry v0.20.1
github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20231202142526-55ffb0092afd
github.com/jellydator/ttlcache/v3 v3.2.0
github.com/kyma-project/lifecycle-manager/api v0.0.0-00010101000000-000000000000
Expand All @@ -29,20 +29,20 @@ require (
)

require (
istio.io/api v1.22.2
istio.io/client-go v1.22.2
istio.io/api v1.22.3
istio.io/client-go v1.22.3
)

require (
github.com/go-co-op/gocron v1.37.0
github.com/kyma-project/template-operator/api v0.0.0-20240404131948-52c84f14e73c
github.com/prometheus/client_model v0.6.1
k8s.io/api v0.30.2
k8s.io/apiextensions-apiserver v0.30.2
k8s.io/apimachinery v0.30.2
k8s.io/cli-runtime v0.30.2
k8s.io/client-go v0.30.2
k8s.io/kubectl v0.30.2
k8s.io/api v0.30.3
k8s.io/apiextensions-apiserver v0.30.3
k8s.io/apimachinery v0.30.3
k8s.io/cli-runtime v0.30.3
k8s.io/client-go v0.30.3
k8s.io/kubectl v0.30.3
)

require (
Expand Down Expand Up @@ -319,7 +319,7 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
helm.sh/helm/v3 v3.15.1 // indirect
k8s.io/component-base v0.30.2 // indirect
k8s.io/component-base v0.30.3 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect
oras.land/oras-go v1.2.5 // indirect
Expand Down
40 changes: 20 additions & 20 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-containerregistry v0.20.0 h1:wRqHpOeVh3DnenOrPy9xDOLdnLatiGuuNRVelR2gSbg=
github.com/google/go-containerregistry v0.20.0/go.mod h1:YCMFNQeeXeLF+dnhhWkqDItx/JSkH01j1Kis4PsjzFI=
github.com/google/go-containerregistry v0.20.1 h1:eTgx9QNYugV4DN5mz4U8hiAGTi1ybXn0TPi4Smd8du0=
github.com/google/go-containerregistry v0.20.1/go.mod h1:YCMFNQeeXeLF+dnhhWkqDItx/JSkH01j1Kis4PsjzFI=
github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20231202142526-55ffb0092afd h1:RkbnRtHTdBpYmp0Simm3fDUTYNVbmX4aVwdgflHLfdg=
github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20231202142526-55ffb0092afd/go.mod h1:5sSbf/SbGGvjWIlMlt2bkEqOq+ufOIBYrBevLuxbfSs=
github.com/google/go-github/v45 v45.2.0 h1:5oRLszbrkvxDDqBCNj2hjDZMKmvexaZ1xw/FCD+K3FI=
Expand Down Expand Up @@ -1214,28 +1214,28 @@ helm.sh/helm/v3 v3.15.1 h1:22ztacHz4gMqhXNqCQ9NAg6BFWoRUryNLvnkz6OVyw0=
helm.sh/helm/v3 v3.15.1/go.mod h1:fvfoRcB8UKRUV5jrIfOTaN/pG1TPhuqSb56fjYdTKXg=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
istio.io/api v1.22.2 h1:b02rTNfbnsEK2HMH/kfuXHTzovSmqcL5cAj2TSklPcQ=
istio.io/api v1.22.2/go.mod h1:S3l8LWqNYS9yT+d4bH+jqzH2lMencPkW7SKM1Cu9EyM=
istio.io/client-go v1.22.2 h1:BiE7itlXFTHpZwOv0t2aZQGga7oCox8lYOdaYbyWNEo=
istio.io/client-go v1.22.2/go.mod h1:Fxt0tVZLXQRKyrBv7uwm4zCZE0qayejG0bSwZy9K6Hg=
k8s.io/api v0.30.2 h1:+ZhRj+28QT4UOH+BKznu4CBgPWgkXO7XAvMcMl0qKvI=
k8s.io/api v0.30.2/go.mod h1:ULg5g9JvOev2dG0u2hig4Z7tQ2hHIuS+m8MNZ+X6EmI=
k8s.io/apiextensions-apiserver v0.30.2 h1:l7Eue2t6QiLHErfn2vwK4KgF4NeDgjQkCXtEbOocKIE=
k8s.io/apiextensions-apiserver v0.30.2/go.mod h1:lsJFLYyK40iguuinsb3nt+Sj6CmodSI4ACDLep1rgjw=
k8s.io/apimachinery v0.30.2 h1:fEMcnBj6qkzzPGSVsAZtQThU62SmQ4ZymlXRC5yFSCg=
k8s.io/apimachinery v0.30.2/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/cli-runtime v0.30.2 h1:ooM40eEJusbgHNEqnHziN9ZpLN5U4WcQGsdLKVxpkKE=
k8s.io/cli-runtime v0.30.2/go.mod h1:Y4g/2XezFyTATQUbvV5WaChoUGhojv/jZAtdp5Zkm0A=
k8s.io/client-go v0.30.2 h1:sBIVJdojUNPDU/jObC+18tXWcTJVcwyqS9diGdWHk50=
k8s.io/client-go v0.30.2/go.mod h1:JglKSWULm9xlJLx4KCkfLLQ7XwtlbflV6uFFSHTMgVs=
k8s.io/component-base v0.30.2 h1:pqGBczYoW1sno8q9ObExUqrYSKhtE5rW3y6gX88GZII=
k8s.io/component-base v0.30.2/go.mod h1:yQLkQDrkK8J6NtP+MGJOws+/PPeEXNpwFixsUI7h/OE=
istio.io/api v1.22.3 h1:V59wgcCm2fK2r137QBsddCDHNg0efg/DauIWEB9DFz8=
istio.io/api v1.22.3/go.mod h1:S3l8LWqNYS9yT+d4bH+jqzH2lMencPkW7SKM1Cu9EyM=
istio.io/client-go v1.22.3 h1:4WocGQYVTASpfn7tj1yGE8f0sgxzbxOkg56HX1LJQ5U=
istio.io/client-go v1.22.3/go.mod h1:D/vNne1n5586423NgGXMnPgshE/99mQgnjnxK/Vw2yM=
k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ=
k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04=
k8s.io/apiextensions-apiserver v0.30.3 h1:oChu5li2vsZHx2IvnGP3ah8Nj3KyqG3kRSaKmijhB9U=
k8s.io/apiextensions-apiserver v0.30.3/go.mod h1:uhXxYDkMAvl6CJw4lrDN4CPbONkF3+XL9cacCT44kV4=
k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc=
k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc=
k8s.io/cli-runtime v0.30.3 h1:aG69oRzJuP2Q4o8dm+f5WJIX4ZBEwrvdID0+MXyUY6k=
k8s.io/cli-runtime v0.30.3/go.mod h1:hwrrRdd9P84CXSKzhHxrOivAR9BRnkMt0OeP5mj7X30=
k8s.io/client-go v0.30.3 h1:bHrJu3xQZNXIi8/MoxYtZBBWQQXwy16zqJwloXXfD3k=
k8s.io/client-go v0.30.3/go.mod h1:8d4pf8vYu665/kUbsxWAQ/JDBNWqfFeZnvFiVdmx89U=
k8s.io/component-base v0.30.3 h1:Ci0UqKWf4oiwy8hr1+E3dsnliKnkMLZMVbWzeorlk7s=
k8s.io/component-base v0.30.3/go.mod h1:C1SshT3rGPCuNtBs14RmVD2xW0EhRSeLvBh7AGk1quA=
k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw=
k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE=
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f h1:0LQagt0gDpKqvIkAMPaRGcXawNMouPECM1+F9BVxEaM=
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f/go.mod h1:S9tOR0FxgyusSNR+MboCuiDpVWkAifZvaYI1Q2ubgro=
k8s.io/kubectl v0.30.2 h1:cgKNIvsOiufgcs4yjvgkK0+aPCfa8pUwzXdJtkbhsH8=
k8s.io/kubectl v0.30.2/go.mod h1:rz7GHXaxwnigrqob0lJsiA07Df8RE3n1TSaC2CTeuB4=
k8s.io/kubectl v0.30.3 h1:YIBBvMdTW0xcDpmrOBzcpUVsn+zOgjMYIu7kAq+yqiI=
k8s.io/kubectl v0.30.3/go.mod h1:IcR0I9RN2+zzTRUa1BzZCm4oM0NLOawE6RzlDvd1Fpo=
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0 h1:jgGTlFYnhF1PM1Ax/lAlxUPE+KfCIXHaathvJg1C3ak=
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
oras.land/oras-go v1.2.5 h1:XpYuAwAb0DfQsunIyMfeET92emK8km3W4yEzZvUbsTo=
Expand Down
41 changes: 17 additions & 24 deletions internal/declarative/v2/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
return r.finishReconcile(ctx, manifest, metrics.ManifestRenderResources, manifestStatus, err)
}

if err := r.pruneDiff(ctx, skrClient, manifest, current, target, spec); errors.Is(err, resources.ErrDeletionNotFinished) {
if err := r.pruneDiff(ctx, skrClient, manifest, current, target, spec); errors.Is(err,
resources.ErrDeletionNotFinished) {
r.ManifestMetrics.RecordRequeueReason(metrics.ManifestPruneDiffNotFinished, queue.IntendedRequeue)
return ctrl.Result{Requeue: true}, nil
} else if err != nil {
Expand Down Expand Up @@ -219,8 +220,8 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
return r.finishReconcile(ctx, manifest, metrics.ManifestReconcileFinished, manifestStatus, nil)
}

func (r *Reconciler) cleanupManifest(ctx context.Context, req ctrl.Request, manifest *v1beta2.Manifest, manifestStatus shared.Status,
requeueReason metrics.ManifestRequeueReason, originalErr error,
func (r *Reconciler) cleanupManifest(ctx context.Context, req ctrl.Request, manifest *v1beta2.Manifest,
manifestStatus shared.Status, requeueReason metrics.ManifestRequeueReason, originalErr error,
) (ctrl.Result, error) {
r.ManifestMetrics.RemoveManifestDuration(req.Name)
r.cleanUpMandatoryModuleMetrics(manifest)
Expand Down Expand Up @@ -299,10 +300,7 @@ func (r *Reconciler) initialize(manifest *v1beta2.Manifest) error {
return nil
}

func (r *Reconciler) renderResources(
ctx context.Context,
skrClient Client,
manifest *v1beta2.Manifest,
func (r *Reconciler) renderResources(ctx context.Context, skrClient Client, manifest *v1beta2.Manifest,
spec *Spec,
) ([]*resource.Info, []*resource.Info, error) {
resourceCondition := newResourcesCondition(manifest)
Expand Down Expand Up @@ -392,9 +390,9 @@ func hasDiff(oldResources []shared.Resource, newResources []shared.Resource) boo
return false
}

func (r *Reconciler) checkDeploymentState(
ctx context.Context, clnt Client, target []*resource.Info,
) (shared.State, error) {
func (r *Reconciler) checkDeploymentState(ctx context.Context, clnt Client, target []*resource.Info) (shared.State,
error,
) {
resourceReadyCheck := r.CustomReadyCheck

deploymentState, err := resourceReadyCheck.Run(ctx, clnt, target)
Expand Down Expand Up @@ -448,12 +446,8 @@ func (r *Reconciler) removeModuleCR(ctx context.Context, clnt Client, manifest *
return nil
}

func (r *Reconciler) renderTargetResources(
ctx context.Context,
skrClient client.Client,
converter ResourceToInfoConverter,
manifest *v1beta2.Manifest,
spec *Spec,
func (r *Reconciler) renderTargetResources(ctx context.Context, skrClient client.Client,
converter ResourceToInfoConverter, manifest *v1beta2.Manifest, spec *Spec,
) ([]*resource.Info, error) {
if !manifest.GetDeletionTimestamp().IsZero() {
deleted, err := checkCRDeletion(ctx, skrClient, manifest)
Expand Down Expand Up @@ -515,12 +509,8 @@ func checkCRDeletion(ctx context.Context, skrClient client.Client, manifest *v1b
return false, nil
}

func (r *Reconciler) pruneDiff(
ctx context.Context,
clnt Client,
manifest *v1beta2.Manifest,
current, target []*resource.Info,
spec *Spec,
func (r *Reconciler) pruneDiff(ctx context.Context, clnt Client, manifest *v1beta2.Manifest,
current, target []*resource.Info, spec *Spec,
) error {
diff, err := pruneResource(ResourceList(current).Difference(target), "Namespace", namespaceNotBeRemoved)
if err != nil {
Expand Down Expand Up @@ -652,10 +642,13 @@ func (r *Reconciler) finishReconcile(ctx context.Context, manifest *v1beta2.Mani
return ctrl.Result{}, originalErr
}
r.ManifestMetrics.RecordRequeueReason(requeueReason, queue.IntendedRequeue)
return ctrl.Result{RequeueAfter: r.Success}, nil
requeueAfter := queue.DetermineRequeueInterval(manifest.GetStatus().State, r.RequeueIntervals)
return ctrl.Result{RequeueAfter: requeueAfter}, nil
}

func (r *Reconciler) patchStatusIfDiffExist(ctx context.Context, manifest *v1beta2.Manifest, previousStatus shared.Status) error {
func (r *Reconciler) patchStatusIfDiffExist(ctx context.Context, manifest *v1beta2.Manifest,
previousStatus shared.Status,
) error {
if hasStatusDiff(manifest.GetStatus(), previousStatus) {
resetNonPatchableField(manifest)
if err := r.Status().Patch(ctx, manifest, client.Apply, client.ForceOwnership, defaultFieldOwner); err != nil {
Expand Down
Loading

0 comments on commit 2a4eb7a

Please sign in to comment.