Skip to content

Commit 933cd94

Browse files
authored
feat: enables Kubernetes syncing for flagd (#82)
* enables kuberentes syncing for flagd Signed-off-by: Alex Jones <[email protected]> * Update kustomization.yaml Signed-off-by: Alex Jones <[email protected]> * Update manager.yaml Signed-off-by: Alex Jones <[email protected]> * using the new flagd v0.1.0 capabilities to leverage k8s provider Signed-off-by: Alex Jones <[email protected]> * reworked to default to the k8s sync provider and inject the right role bindings Signed-off-by: Alex Jones <[email protected]> * reverted maanger files Signed-off-by: Alex Jones <[email protected]> * Update flagd_kubernetes_sync_clusterrole.yaml Signed-off-by: Alex Jones <[email protected]> Signed-off-by: Alex Jones <[email protected]>
1 parent 7d099c7 commit 933cd94

File tree

11 files changed

+167
-54
lines changed

11 files changed

+167
-54
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Image URL to use all building/pushing image targets
33
IMG ?= controller:latest
44
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
5-
FLAGD_VERSION=v0.0.9
5+
FLAGD_VERSION=v0.1.0
66
ENVTEST_K8S_VERSION = 1.23
77

88
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)

apis/core/v1alpha1/featureflagconfiguration_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ type FlagDSpec struct {
4848
}
4949

5050
type FeatureFlagSyncProvider struct {
51-
// +kubebuilder:validation:Enum=filepath
5251
Name string `json:"name"`
5352
}
5453
type FeatureFlagServiceProvider struct {

config/crd/bases/core.openfeature.dev_featureflagconfigurations.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@ spec:
231231
nullable: true
232232
properties:
233233
name:
234-
enum:
235-
- filepath
236234
type: string
237235
required:
238236
- name
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRole
3+
metadata:
4+
# Prepends to open-feature-operator-flagd-kubernetes-sync
5+
name: flagd-kubernetes-sync
6+
rules:
7+
- apiGroups: ["core.openfeature.dev"]
8+
resources: ["*"]
9+
verbs: ["get", "watch", "list"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#This adds the default account to the cluster role but will also have deployments added
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: flagd-kubernetes-sync
6+
subjects:
7+
- kind: ServiceAccount
8+
name: open-feature-operator-controller-manager
9+
namespace: default
10+
apiGroup: ""
11+
roleRef:
12+
kind: ClusterRole
13+
name: open-feature-operator-flagd-kubernetes-sync
14+
apiGroup: ""

config/rbac/kustomization.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ resources:
1616
- auth_proxy_role.yaml
1717
- auth_proxy_role_binding.yaml
1818
- auth_proxy_client_clusterrole.yaml
19+
- flagd_kubernetes_sync_clusterrole.yaml
20+
- flagd_kubernetes_sync_clusterrolebinding.yaml

config/samples/end-to-end.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,8 @@ spec:
4747
}
4848
}
4949
}
50-
5150
---
5251
# Deployment of a demo-app using our custom resource
53-
5452
apiVersion: apps/v1
5553
kind: Deployment
5654
metadata:

go.mod

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ require (
2323
github.com/Azure/go-autorest/logger v0.2.1 // indirect
2424
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
2525
github.com/beorn7/perks v1.0.1 // indirect
26-
github.com/cespare/xxhash/v2 v2.1.1 // indirect
26+
github.com/cespare/xxhash/v2 v2.1.2 // indirect
2727
github.com/davecgh/go-spew v1.1.1 // indirect
2828
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
2929
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
@@ -32,9 +32,9 @@ require (
3232
github.com/gogo/protobuf v1.3.2 // indirect
3333
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3434
github.com/golang/protobuf v1.5.2 // indirect
35-
github.com/google/go-cmp v0.5.7 // indirect
35+
github.com/google/go-cmp v0.5.8 // indirect
3636
github.com/google/gofuzz v1.1.0 // indirect
37-
github.com/google/uuid v1.1.2 // indirect
37+
github.com/google/uuid v1.3.0 // indirect
3838
github.com/googleapis/gnostic v0.5.5 // indirect
3939
github.com/imdario/mergo v0.3.12 // indirect
4040
github.com/json-iterator/go v1.1.12 // indirect
@@ -43,32 +43,30 @@ require (
4343
github.com/modern-go/reflect2 v1.0.2 // indirect
4444
github.com/nxadm/tail v1.4.8 // indirect
4545
github.com/pkg/errors v0.9.1 // indirect
46-
github.com/prometheus/client_golang v1.11.0 // indirect
46+
github.com/prometheus/client_golang v1.13.0 // indirect
4747
github.com/prometheus/client_model v0.2.0 // indirect
48-
github.com/prometheus/common v0.28.0 // indirect
49-
github.com/prometheus/procfs v0.6.0 // indirect
48+
github.com/prometheus/common v0.37.0 // indirect
49+
github.com/prometheus/procfs v0.8.0 // indirect
5050
github.com/spf13/pflag v1.0.5 // indirect
51-
github.com/stretchr/testify v1.7.1 // indirect
5251
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
5352
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
54-
go.uber.org/atomic v1.7.0 // indirect
55-
go.uber.org/multierr v1.6.0 // indirect
56-
go.uber.org/zap v1.19.1 // indirect
57-
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
58-
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
53+
go.uber.org/atomic v1.10.0 // indirect
54+
go.uber.org/multierr v1.8.0 // indirect
55+
go.uber.org/zap v1.23.0 // indirect
56+
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
57+
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect
5958
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
60-
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
59+
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
6160
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
6261
golang.org/x/text v0.3.7 // indirect
63-
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
64-
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
62+
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
6563
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
6664
google.golang.org/appengine v1.6.7 // indirect
67-
google.golang.org/protobuf v1.28.0 // indirect
65+
google.golang.org/protobuf v1.28.1 // indirect
6866
gopkg.in/inf.v0 v0.9.1 // indirect
6967
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
7068
gopkg.in/yaml.v2 v2.4.0 // indirect
71-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
69+
gopkg.in/yaml.v3 v3.0.1 // indirect
7270
k8s.io/apiextensions-apiserver v0.23.0 // indirect
7371
k8s.io/component-base v0.23.0 // indirect
7472
k8s.io/klog/v2 v2.30.0 // indirect

0 commit comments

Comments
 (0)