Skip to content

Commit a3c983e

Browse files
committed
Setup atom Reconcile
1 parent eaa63ee commit a3c983e

File tree

10 files changed

+687
-32
lines changed

10 files changed

+687
-32
lines changed

api/v3/atom_types.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ SOFTWARE.
2525
package v3
2626

2727
import (
28+
"fmt"
29+
2830
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2931
)
3032

@@ -181,3 +183,24 @@ func SetAtomBaseURLHost(atomBaseURLHost string) {
181183
func GetAtomBaseURLHost() string {
182184
return baseURLHost
183185
}
186+
187+
func (r *Atom) GetURI() (URI string) {
188+
datasetOwner := "unknown"
189+
if v, ok := r.ObjectMeta.Labels["dataset-owner"]; ok {
190+
datasetOwner = v
191+
}
192+
dataset := "unknown"
193+
if v, ok := r.ObjectMeta.Labels["dataset"]; ok {
194+
dataset = v
195+
}
196+
URI = fmt.Sprintf("%s/%s", datasetOwner, dataset)
197+
198+
if v, ok := r.ObjectMeta.Labels["theme"]; ok {
199+
URI += fmt.Sprintf("/%s", v)
200+
}
201+
URI += "/atom"
202+
if v, ok := r.ObjectMeta.Labels["service-version"]; ok {
203+
URI += fmt.Sprintf("/%s", v)
204+
}
205+
return
206+
}

cmd/main.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
// to ensure that exec-entrypoint and run can make use of them.
2727
_ "k8s.io/client-go/plugin/pkg/client/auth"
2828

29+
operatorcommonsv1 "github.com/pdok/operator-commons/api/v1"
2930
traefikiov1alpha1 "github.com/traefik/traefik/v2/pkg/provider/kubernetes/crd/traefikio/v1alpha1"
3031
"k8s.io/apimachinery/pkg/runtime"
3132
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
@@ -57,6 +58,7 @@ func init() {
5758
utilruntime.Must(pdoknlv3.AddToScheme(scheme))
5859
utilruntime.Must(pdoknlv2beta1.AddToScheme(scheme))
5960
utilruntime.Must(traefikiov1alpha1.AddToScheme(scheme))
61+
utilruntime.Must(operatorcommonsv1.AddToScheme(scheme))
6062

6163
// +kubebuilder:scaffold:scheme
6264
}

config/rbac/role.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ rules:
77
- apiGroups:
88
- ""
99
resources:
10+
- configmaps
1011
- services
1112
verbs:
1213
- create
@@ -52,10 +53,33 @@ rules:
5253
- get
5354
- patch
5455
- update
56+
- apiGroups:
57+
- policy
58+
resources:
59+
- poddisruptionbudgets
60+
verbs:
61+
- create
62+
- delete
63+
- list
64+
- update
65+
- apiGroups:
66+
- policy
67+
resources:
68+
- poddisruptionbudgets/finalizers
69+
verbs:
70+
- update
71+
- apiGroups:
72+
- policy
73+
resources:
74+
- poddisruptionbudgets/status
75+
verbs:
76+
- get
77+
- update
5578
- apiGroups:
5679
- traefik.io
5780
resources:
5881
- ingressroutes
82+
- middlewares
5983
verbs:
6084
- create
6185
- delete

go.mod

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ require (
99
github.com/onsi/gomega v1.35.1
1010
github.com/pdok/atom-generator v0.6.0
1111
github.com/traefik/traefik/v2 v2.11.20
12+
golang.org/x/tools v0.28.0
1213
k8s.io/api v0.32.0
1314
k8s.io/apimachinery v0.32.0
1415
k8s.io/client-go v0.32.0
@@ -25,7 +26,6 @@ require (
2526
github.com/blang/semver/v4 v4.0.0 // indirect
2627
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
2728
github.com/cespare/xxhash/v2 v2.3.0 // indirect
28-
github.com/cpuguy83/go-md2man/v2 v2.0.5 // indirect
2929
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3030
github.com/emicklei/go-restful/v3 v3.12.0 // indirect
3131
github.com/evanphx/json-patch/v5 v5.9.0 // indirect
@@ -62,21 +62,19 @@ require (
6262
github.com/modern-go/reflect2 v1.0.2 // indirect
6363
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6464
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
65+
github.com/pdok/operator-commons v0.0.0-20250218142904-70e45698e139 // indirect
6566
github.com/pkg/errors v0.9.1 // indirect
6667
github.com/prometheus/client_golang v1.19.1 // indirect
6768
github.com/prometheus/client_model v0.6.1 // indirect
6869
github.com/prometheus/common v0.55.0 // indirect
6970
github.com/prometheus/procfs v0.15.1 // indirect
7071
github.com/rogpeppe/go-internal v1.13.1 // indirect
71-
github.com/russross/blackfriday/v2 v2.1.0 // indirect
7272
github.com/sirupsen/logrus v1.9.3 // indirect
7373
github.com/spf13/cobra v1.8.1 // indirect
7474
github.com/spf13/pflag v1.0.5 // indirect
7575
github.com/stoewer/go-strcase v1.3.0 // indirect
7676
github.com/traefik/paerser v0.2.1 // indirect
77-
github.com/urfave/cli/v2 v2.27.5 // indirect
7877
github.com/x448/float16 v0.8.4 // indirect
79-
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
8078
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
8179
go.opentelemetry.io/otel v1.32.0 // indirect
8280
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
@@ -97,7 +95,6 @@ require (
9795
golang.org/x/term v0.27.0 // indirect
9896
golang.org/x/text v0.21.0 // indirect
9997
golang.org/x/time v0.8.0 // indirect
100-
golang.org/x/tools v0.28.0 // indirect
10198
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
10299
google.golang.org/genproto/googleapis/api v0.0.0-20241118233622-e639e219e697 // indirect
103100
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect

go.sum

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY
1515
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
1616
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
1717
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
18-
github.com/cpuguy83/go-md2man/v2 v2.0.5 h1:ZtcqGrnekaHpVLArFSe4HK5DoKx1T0rq2DwVB0alcyc=
19-
github.com/cpuguy83/go-md2man/v2 v2.0.5/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
2018
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2119
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2220
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
@@ -107,10 +105,10 @@ github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
107105
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
108106
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
109107
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
110-
github.com/pdok/atom-generator v0.0.0-20241003082215-84430ecd16d1 h1:FiEShEG+b/UKtBDwid3p1MIjamaHuc++RBYz1+3V1xc=
111-
github.com/pdok/atom-generator v0.0.0-20241003082215-84430ecd16d1/go.mod h1:+tW5rgSjcPZeLkIBeKAkCKMeQNHVl/2moqf3uvv7LTI=
112108
github.com/pdok/atom-generator v0.6.0 h1:7VbGn98Js2kJwhLRqbeX8D+byW5DfovTgJ09bMYg3Ew=
113109
github.com/pdok/atom-generator v0.6.0/go.mod h1:+tW5rgSjcPZeLkIBeKAkCKMeQNHVl/2moqf3uvv7LTI=
110+
github.com/pdok/operator-commons v0.0.0-20250218142904-70e45698e139 h1:Oi81ttMQJp7P+lv+Z7cJw4JjYcpyAzNEsSs0H35udbU=
111+
github.com/pdok/operator-commons v0.0.0-20250218142904-70e45698e139/go.mod h1:kHMOWvdS/PiIdaZcmywA7g3xTZNT3dybMlCD/omHNbU=
114112
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
115113
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
116114
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -126,7 +124,6 @@ github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0leargg
126124
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
127125
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
128126
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
129-
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
130127
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
131128
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
132129
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
@@ -150,12 +147,8 @@ github.com/traefik/paerser v0.2.1 h1:LFgeak1NmjEHF53c9ENdXdL1UMkF/lD5t+7Evsz4hH4
150147
github.com/traefik/paerser v0.2.1/go.mod h1:7BBDd4FANoVgaTZG+yh26jI6CA2nds7D/4VTEdIsh24=
151148
github.com/traefik/traefik/v2 v2.11.20 h1:22xF9h9/X6V4753ICTNHS6UnkwfHMy8+I9Swb4nEBt4=
152149
github.com/traefik/traefik/v2 v2.11.20/go.mod h1:MnIv8lbvljiRR3NIrF4F/RfkUtHovQ8C9nHhKRFnA6U=
153-
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
154-
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
155150
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
156151
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
157-
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
158-
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
159152
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
160153
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
161154
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk=

0 commit comments

Comments
 (0)