Skip to content

Commit

Permalink
Merge branch 'master' into bug/handle-DeletedFinalStateUnknown-type-f…
Browse files Browse the repository at this point in the history
…rom-cache
  • Loading branch information
martin-helmich authored Nov 6, 2024
2 parents 3d7bdfb + 018b323 commit ef1beb4
Show file tree
Hide file tree
Showing 11 changed files with 362 additions and 147 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,17 @@ data: {}
The replicator will then copy the `data` attribute of the referenced object into the annotated object and keep them in
sync.

By default, the replicator adds an annotation `replicator.v1.mittwald.de/replicated-from-version` to the target object.
This annotation contains the resource-version of the source object at the time of replication.

##### Sync by Content

When the target object is re-applied with an empty `data` attribute, the replicator will not automatically perform replication.
The reason is that the target already has the `replicated-from-version` annotation with a matching source resource-version.
For Secrets and ConfigMaps, there is the option to synchronize _based on the content_, ignoring the `replicated-from-version` annotation.

To activate this mode, start the replicator with the `--sync-by-content` flag.

#### Special case: TLS secrets

Secrets of type `kubernetes.io/tls` are treated in a special way and need to have a `data["tls.crt"]` and a
Expand Down
1 change: 1 addition & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ type flags struct {
ReplicateRoles bool
ReplicateRoleBindings bool
ReplicateServiceAccounts bool
SyncByContent bool
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ metadata:
name: {{ include "kubernetes-replicator.fullname" . }}
labels:
{{- include "kubernetes-replicator.labels" . | nindent 4 }}
{{- if .Values.labels }}
{{- toYaml .Values.labels | nindent 4 }}
{{- end }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: 1
{{- with .Values.updateStrategy }}
Expand Down
10 changes: 9 additions & 1 deletion deploy/helm-chart/kubernetes-replicator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,18 @@ tolerations: []

affinity: {}

podLabels: {}
# Deployment annotations
annotations: {}

# Deployment labels
labels: {}

# Pod annotations
podAnnotations: {}

# Pod labels
podLabels: {}

livenessProbe:
initialDelaySeconds: 60
periodSeconds: 10
Expand Down
44 changes: 24 additions & 20 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
module github.com/mittwald/kubernetes-replicator

go 1.22
go 1.22.0

toolchain go1.23.0

require (
github.com/hashicorp/go-multierror v1.1.1
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
k8s.io/api v0.29.4
k8s.io/apimachinery v0.29.4
k8s.io/client-go v0.29.4
k8s.io/api v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/client-go v0.31.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/imdario/mergo v0.3.7 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -33,23 +36,24 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
Loading

0 comments on commit ef1beb4

Please sign in to comment.