Skip to content

Commit

Permalink
chore: Merge main into deletion modes feature (#1678)
Browse files Browse the repository at this point in the history
* chore(dependabot): bump golang from 1.22.4-alpine to 1.22.5-alpine (#1664)

Bumps golang from 1.22.4-alpine to 1.22.5-alpine.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: Bump k8s version for e2e to 1.29.6 (#1665)

* chore: Bump k8s version for e2e to 1.29.6

* add wait for main build and bump smoke test version

* feat: Avoid Redundant SSA for Manifest Patching (#1620)

* feat: avoid redundant ssa for manifest patching

* refactor: linting issue

* test: add unit test

* fix: integration tests

* refactor: unwrapped error

* fix: state flickering

* chore: add linter exception

* chore: remove linter exception

* fix: null pointer ref in case of mandatory module

* chore: Add helpful comment

Co-authored-by: Christoph Schwägerl <[email protected]>

* feat: add additional diff check in NeedToUpdate()

* test: diff check in unit test

* refactor: lint

* refactor: remove manifest diff check

* fix: module template integration test

* test: add unit test

* Revert "test: add unit test"

This reverts commit a5a9102.

* Revert "fix: module template integration test"

This reverts commit 9ed7e26.

* fix integration test

* chore: retrigger

* refactor: gofunmpt

* docs: Apply suggestions from code review

Co-authored-by: Małgorzata Świeca <[email protected]>

---------

Co-authored-by: Christoph Schwägerl <[email protected]>
Co-authored-by: Christoph Schwägerl <[email protected]>
Co-authored-by: Małgorzata Świeca <[email protected]>

* chore(dependabot): bump github.com/google/go-containerregistry from 0.19.2 to 0.20.0 (#1670)

chore(dependabot): bump github.com/google/go-containerregistry

Bumps [github.com/google/go-containerregistry](https://github.com/google/go-containerregistry) from 0.19.2 to 0.20.0.
- [Release notes](https://github.com/google/go-containerregistry/releases)
- [Changelog](https://github.com/google/go-containerregistry/blob/main/.goreleaser.yml)
- [Commits](google/go-containerregistry@v0.19.2...v0.20.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-containerregistry
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(dependabot): bump google.golang.org/grpc from 1.64.0 to 1.64.1 in the go_modules group (#1671)

chore(dependabot): bump google.golang.org/grpc in the go_modules group

Bumps the go_modules group with 1 update: [google.golang.org/grpc](https://github.com/grpc/grpc-go).


Updates `google.golang.org/grpc` from 1.64.0 to 1.64.1
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.64.0...v1.64.1)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: indirect
  dependency-group: go_modules
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: Remove diff manifest diff checker (#1674)

* chore: Remove diff manifest diff checker

* retrigger jobs

* refactor: Simplify declarative reconciler (#1676)

* extract default finalizer from opts

* extract field owner and namespace

* extract skip label funx

* replace obj with manifest for manifest reconcile loop

* add skip reconcile check as method. internalize cr deletion check

* simplify SpecResolver

* fix integration test setup

* linting

* linting

* remove generace cache key

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Lindner <[email protected]>
Co-authored-by: Raj <[email protected]>
Co-authored-by: Christoph Schwägerl <[email protected]>
Co-authored-by: Christoph Schwägerl <[email protected]>
Co-authored-by: Małgorzata Świeca <[email protected]>
  • Loading branch information
7 people authored Jul 11, 2024
1 parent 9101a3e commit 91f14c1
Show file tree
Hide file tree
Showing 25 changed files with 444 additions and 632 deletions.
2 changes: 1 addition & 1 deletion .github/actions/get-configuration/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ runs:
id: define-variables
shell: bash
run: |
echo "k8s_version=${{ github.event.inputs.k8s_version || '1.28.7' }}" >> $GITHUB_OUTPUT
echo "k8s_version=${{ github.event.inputs.k8s_version || '1.29.6' }}" >> $GITHUB_OUTPUT
echo "istio_version=1.20.3" >> $GITHUB_OUTPUT
echo "k3d_version=5.6.0" >> $GITHUB_OUTPUT
echo "cert_manager_version=1.15.0" >> $GITHUB_OUTPUT
Expand Down
99 changes: 0 additions & 99 deletions .github/workflows/check-manifest-diffs.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: ./.github/actions/wait-for-image-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
statusName: pull-lifecycle-mgr-build
statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }}
e2e-integration:
name: E2E
needs: wait-for-image-build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
env:
LIFECYCLE_MANAGER: ${{ github.repository }}
K3D_VERSION: v5.6.0
K8S_VERSION: v1.28.7
K8S_VERSION: v1.29.6
KUSTOMIZE_VERSION: 5.3.0
ISTIO_VERSION: 1.20.3
GOSUMDB: off
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22.4-alpine as builder
FROM golang:1.22.5-alpine as builder

WORKDIR /lifecycle-manager
# Copy the Go Modules manifests
Expand Down
6 changes: 6 additions & 0 deletions api/v1beta2/manifest_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package v1beta2

import (
"strconv"

apimetav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
machineryruntime "k8s.io/apimachinery/pkg/runtime"
Expand Down Expand Up @@ -135,3 +137,7 @@ type ManifestList struct {
func init() {
SchemeBuilder.Register(&Manifest{}, &ManifestList{})
}

func (manifest *Manifest) SkipReconciliation() bool {
return manifest.GetLabels() != nil && manifest.GetLabels()[shared.SkipReconcileLabel] == strconv.FormatBool(true)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: operator.kyma-project.io/v1beta2
kind: ModuleTemplate
metadata:
name: moduletemplate-template-operator
namespace: default
labels:
"operator.kyma-project.io/module-name": "template-operator"
spec:
channel: regular
data:
apiVersion: operator.kyma-project.io/v1alpha1
kind: Sample
metadata:
name: sample-yaml
spec:
initKey: valueUpdated
resourceFilePath: "./module-data/yaml"
descriptor:
component:
componentReferences: []
name: kyma-project.io/template-operator
provider: internal
repositoryContexts:
- baseUrl: registry.docker.io/kyma-project/sap-kyma-jellyfish-dev/template-operator
componentNameMapping: urlPath
type: ociRegistry
resources:
- access:
digest: sha256:db86408caca4c94250d8291aa79655b84146f9cc45e0da49f05a52b3722d74a0
type: localOciBlob
name: config
relation: local
type: yaml
version: v1.7.2
- access:
digest: sha256:1735cfa45bf07b63427c8e11717278f8847e352a66af7633611db902386d18ed
type: localOciBlob
name: raw-manifest
relation: local
type: yaml
version: v1.7.2
sources:
- access:
commit: 4e4b9d47cb655ca23e5c706462485ff7605e8d71
repoUrl: github.com/kyma-project/template-operator
type: gitHub
labels:
- name: git.kyma-project.io/ref
value: refs/heads/main
version: v1
name: module-sources
type: git
version: v1.7.2
version: v1.7.2
meta:
schemaVersion: v2
11 changes: 11 additions & 0 deletions docs/technical-reference/api/manifest-cr.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

The [Manifest custom resource (CR)](../../../api/v1beta2/manifest_types.go) is our internal representation of what results from the resolution of a ModuleTemplate CR in the context of a single cluster represented by a Kyma CR. Thus, a lot of configuration elements are similar or entirely equivalent to the data layer found in a ModuleTemplate CR.

## Patching

The [Runner](../../../pkg/module/sync/runner.go) is responsible for creating and updating Manifest CRs using Server Side Apply (SSA). An update is only performed when one of the following conditions is met:

1. The Manifest CR version differs from the Kyma CR's module status version.
2. The Manifest CR channel differs from the Kyma CR's module status channel.
3. The Manifest CR state differs from the Kyma CR's module status state.

>[!NOTE]
>The module status is not present in the Kyma CR for mandatory modules, hence their Manifest CR is updated using SSA in every reconcile loop.
## Configuration

### **.spec.remote**
Expand Down
4 changes: 2 additions & 2 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.19.2
github.com/google/go-containerregistry v0.20.0
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 Down Expand Up @@ -310,7 +310,7 @@ require (
google.golang.org/api v0.181.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240515191416-fc5f0ca64291 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/grpc v1.64.1 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect
Expand Down
8 changes: 4 additions & 4 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.19.2 h1:TannFKE1QSajsP6hPWb5oJNgKe1IKjHukIKDUmvsV6w=
github.com/google/go-containerregistry v0.19.2/go.mod h1:YCMFNQeeXeLF+dnhhWkqDItx/JSkH01j1Kis4PsjzFI=
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/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 @@ -1157,8 +1157,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak=
google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc=
google.golang.org/grpc v1.64.0 h1:KH3VH9y/MgNQg1dE7b3XfVK0GsPSIzJwdF617gUSbvY=
google.golang.org/grpc v1.64.0/go.mod h1:oxjF8E3FBnjp+/gVFYdWacaLDx9na1aqy9oovLpxQYg=
google.golang.org/grpc v1.64.1 h1:LKtvyfbX3UGVPFcGqJ9ItpVWW6oN/2XqTxfAnwRRXiA=
google.golang.org/grpc v1.64.1/go.mod h1:hiQF4LFZelK2WKaP6W0L92zGHtiQdZxk8CrSdvyjeP0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
8 changes: 2 additions & 6 deletions internal/controller/manifest/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package manifest
import (
"sigs.k8s.io/controller-runtime/pkg/manager"

"github.com/kyma-project/lifecycle-manager/api/v1beta2"
declarativev2 "github.com/kyma-project/lifecycle-manager/internal/declarative/v2"
"github.com/kyma-project/lifecycle-manager/internal/manifest"
"github.com/kyma-project/lifecycle-manager/internal/pkg/metrics"
Expand All @@ -22,15 +21,12 @@ func NewReconciler(mgr manager.Manager,
extractor := manifest.NewPathExtractor(nil)
lookup := &manifest.RemoteClusterLookup{KCP: kcp}
return declarativev2.NewFromManager(
mgr, &v1beta2.Manifest{}, requeueIntervals, manifestMetrics, mandatoryModulesMetrics,
declarativev2.WithSpecResolver(
manifest.NewSpecResolver(kcp, extractor),
),
mgr, requeueIntervals, manifestMetrics, mandatoryModulesMetrics,
manifest.NewSpecResolver(kcp.Client, extractor),
declarativev2.WithCustomReadyCheck(manifest.NewDeploymentReadyCheck()),
declarativev2.WithRemoteTargetCluster(lookup.ConfigResolver),
manifest.WithClientCacheKey(),
declarativev2.WithPostRun{manifest.PostRunCreateCR},
declarativev2.WithPreDelete{manifest.PreDeleteDeleteCR},
declarativev2.WithModuleCRDeletionCheck(manifest.NewModuleCRDeletionCheck()),
)
}
3 changes: 1 addition & 2 deletions internal/declarative/v2/inmemory_rendered.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,5 @@ func (c *InMemoryManifestCache) Parse(spec *Spec,
}

func generateCacheKey(spec *Spec) string {
file := filepath.Join(ManifestFilePrefix, spec.Path, spec.ManifestName)
return fmt.Sprintf("%s-%s", file, spec.Mode)
return filepath.Join(ManifestFilePrefix, spec.Path, spec.ManifestName)
}
22 changes: 0 additions & 22 deletions internal/declarative/v2/moduleCR_deletion_check.go

This file was deleted.

Loading

0 comments on commit 91f14c1

Please sign in to comment.