Skip to content

Commit

Permalink
feat: enables Kubernetes syncing for flagd (#82)
Browse files Browse the repository at this point in the history
* enables kuberentes syncing for flagd

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* Update kustomization.yaml

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* Update manager.yaml

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* using the new flagd v0.1.0 capabilities to leverage k8s provider

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* reworked to default to the k8s sync provider and inject the right role bindings

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* reverted maanger files

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

* Update flagd_kubernetes_sync_clusterrole.yaml

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>

Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
  • Loading branch information
AlexsJones authored Sep 14, 2022
1 parent 7d099c7 commit 933cd94
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 54 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
FLAGD_VERSION=v0.0.9
FLAGD_VERSION=v0.1.0
ENVTEST_K8S_VERSION = 1.23

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
Expand Down
1 change: 0 additions & 1 deletion apis/core/v1alpha1/featureflagconfiguration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ type FlagDSpec struct {
}

type FeatureFlagSyncProvider struct {
// +kubebuilder:validation:Enum=filepath
Name string `json:"name"`
}
type FeatureFlagServiceProvider struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ spec:
nullable: true
properties:
name:
enum:
- filepath
type: string
required:
- name
Expand Down
9 changes: 9 additions & 0 deletions config/rbac/flagd_kubernetes_sync_clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
# Prepends to open-feature-operator-flagd-kubernetes-sync
name: flagd-kubernetes-sync
rules:
- apiGroups: ["core.openfeature.dev"]
resources: ["*"]
verbs: ["get", "watch", "list"]
14 changes: 14 additions & 0 deletions config/rbac/flagd_kubernetes_sync_clusterrolebinding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#This adds the default account to the cluster role but will also have deployments added
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: flagd-kubernetes-sync
subjects:
- kind: ServiceAccount
name: open-feature-operator-controller-manager
namespace: default
apiGroup: ""
roleRef:
kind: ClusterRole
name: open-feature-operator-flagd-kubernetes-sync
apiGroup: ""
2 changes: 2 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ resources:
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- auth_proxy_client_clusterrole.yaml
- flagd_kubernetes_sync_clusterrole.yaml
- flagd_kubernetes_sync_clusterrolebinding.yaml
2 changes: 0 additions & 2 deletions config/samples/end-to-end.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ spec:
}
}
}
---
# Deployment of a demo-app using our custom resource

apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
32 changes: 15 additions & 17 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect
Expand All @@ -32,9 +32,9 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/go-cmp v0.5.8 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/google/uuid v1.1.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/gnostic v0.5.5 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -43,32 +43,30 @@ require (
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.11.0 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.28.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/testify v1.7.1 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.19.1 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
golang.org/x/net v0.0.0-20220826154423-83b083e8dc8b // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
golang.org/x/time v0.0.0-20220722155302-e5dcc9cfc0b9 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.23.0 // indirect
k8s.io/component-base v0.23.0 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
Expand Down
Loading

0 comments on commit 933cd94

Please sign in to comment.