Skip to content

Commit

Permalink
fix!: remove flagdResourceEnabled (#652)
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
  • Loading branch information
toddbaert authored May 29, 2024
1 parent 1ea457f commit 640ff10
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 225 deletions.
2 changes: 0 additions & 2 deletions chart/open-feature-operator/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ templates/crds/*.yaml
# the following files are not generated, they are special cases
!templates/namespace.yaml
!templates/admissionregistration.k8s.io_v1_validatingwebhookconfiguration_open-feature-operator-validating-webhook-configuration.yaml
!templates/rbac.authorization.k8s.io_v1_clusterrole_open-feature-operator-manager-role.yaml
!templates/rbac.authorization.k8s.io_v1_clusterrolebinding_open-feature-operator-manager-rolebinding.yaml
39 changes: 19 additions & 20 deletions chart/open-feature-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,22 @@ The command removes all the Kubernetes components associated with the chart and

### Operator resource configuration

| Name | Description | Value |
| ------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
| `controllerManager.kubeRbacProxy.image.repository` | Sets the image for the kube-rbac-proxy. | `gcr.io/kubebuilder/kube-rbac-proxy` |
| `controllerManager.kubeRbacProxy.image.tag` | Sets the version tag for the kube-rbac-proxy. | `v0.14.1` |
| `controllerManager.kubeRbacProxy.resources.limits.cpu` | Sets cpu resource limits for kube-rbac-proxy. | `500m` |
| `controllerManager.kubeRbacProxy.resources.limits.memory` | Sets memory resource limits for kube-rbac-proxy. | `128Mi` |
| `controllerManager.kubeRbacProxy.resources.requests.cpu` | Sets cpu resource requests for kube-rbac-proxy. | `5m` |
| `controllerManager.kubeRbacProxy.resources.requests.memory` | Sets memory resource requests for kube-rbac-proxy. | `64Mi` |
| `controllerManager.manager.image.repository` | Sets the image for the operator. | `ghcr.io/open-feature/open-feature-operator` |
| `controllerManager.manager.image.tag` | Sets the version tag for the operator. | `v0.5.6` |
| `controllerManager.manager.resources.limits.cpu` | Sets cpu resource limits for operator. | `500m` |
| `controllerManager.manager.resources.limits.memory` | Sets memory resource limits for operator. | `128Mi` |
| `controllerManager.manager.resources.requests.cpu` | Sets cpu resource requests for operator. | `10m` |
| `controllerManager.manager.resources.requests.memory` | Sets memory resource requests for operator. | `64Mi` |
| `controllerManager.replicas` | Sets number of replicas of the OpenFeature operator pod. | `1` |
| `managerConfig.flagsValidatonEnabled` | Enables the validating webhook for FeatureFlag CR. | `true` |
| `managerConfig.flagdResourceEnabled` | Enables the controller for the Flagd CR and adds the required permissions to automatically manage the exposure of flagd via Service and Ingress resources. | `true` |
| `managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress` | Sets the bind address for health probes. | `:8081` |
| `managerConfig.controllerManagerConfigYaml.metrics.bindAddress` | Sets the bind address for metrics. | `127.0.0.1:8080` |
| `managerConfig.controllerManagerConfigYaml.webhook.port` | Sets the bind address for webhook. | `9443` |
| Name | Description | Value |
| ------------------------------------------------------------------------- | -------------------------------------------------------- | -------------------------------------------- |
| `controllerManager.kubeRbacProxy.image.repository` | Sets the image for the kube-rbac-proxy. | `gcr.io/kubebuilder/kube-rbac-proxy` |
| `controllerManager.kubeRbacProxy.image.tag` | Sets the version tag for the kube-rbac-proxy. | `v0.14.1` |
| `controllerManager.kubeRbacProxy.resources.limits.cpu` | Sets cpu resource limits for kube-rbac-proxy. | `500m` |
| `controllerManager.kubeRbacProxy.resources.limits.memory` | Sets memory resource limits for kube-rbac-proxy. | `128Mi` |
| `controllerManager.kubeRbacProxy.resources.requests.cpu` | Sets cpu resource requests for kube-rbac-proxy. | `5m` |
| `controllerManager.kubeRbacProxy.resources.requests.memory` | Sets memory resource requests for kube-rbac-proxy. | `64Mi` |
| `controllerManager.manager.image.repository` | Sets the image for the operator. | `ghcr.io/open-feature/open-feature-operator` |
| `controllerManager.manager.image.tag` | Sets the version tag for the operator. | `v0.5.7` |
| `controllerManager.manager.resources.limits.cpu` | Sets cpu resource limits for operator. | `500m` |
| `controllerManager.manager.resources.limits.memory` | Sets memory resource limits for operator. | `128Mi` |
| `controllerManager.manager.resources.requests.cpu` | Sets cpu resource requests for operator. | `10m` |
| `controllerManager.manager.resources.requests.memory` | Sets memory resource requests for operator. | `64Mi` |
| `controllerManager.replicas` | Sets number of replicas of the OpenFeature operator pod. | `1` |
| `managerConfig.flagsValidatonEnabled` | Enables the validating webhook for FeatureFlag CR. | `true` |
| `managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress` | Sets the bind address for health probes. | `:8081` |
| `managerConfig.controllerManagerConfigYaml.metrics.bindAddress` | Sets the bind address for metrics. | `127.0.0.1:8080` |
| `managerConfig.controllerManagerConfigYaml.webhook.port` | Sets the bind address for webhook. | `9443` |

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions chart/open-feature-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ controllerManager:
managerConfig:
## @param managerConfig.flagsValidatonEnabled Enables the validating webhook for FeatureFlag CR.
flagsValidatonEnabled: "true"
## @param managerConfig.flagdResourceEnabled Enables the controller for the Flagd CR and adds the required permissions to automatically manage the exposure of flagd via Service and Ingress resources.
flagdResourceEnabled: "true"
controllerManagerConfigYaml:
health:
## @param managerConfig.controllerManagerConfigYaml.health.healthProbeBindAddress Sets the bind address for health probes.
Expand Down
1 change: 0 additions & 1 deletion common/types/envconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ type EnvConfig struct {
SidecarSyncProvider string `envconfig:"SIDECAR_SYNC_PROVIDER" default:"kubernetes"`
SidecarLogFormat string `envconfig:"SIDECAR_LOG_FORMAT" default:"json"`
SidecarProbesEnabled bool `envconfig:"SIDECAR_PROBES_ENABLED" default:"true"`
FlagdResourceEnabled bool `envconfig:"FLAGD_RESOURCE_ENABLED" default:"true"`
// in-process configuration
InProcessPort int `envconfig:"IN_PROCESS_PORT" default:"8015"`
InProcessSocketPath string `envconfig:"IN_PROCESS_SOCKET_PATH" default:""`
Expand Down
5 changes: 0 additions & 5 deletions config/overlays/helm/exclude-role.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions config/overlays/helm/exclude-rolebinding.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/overlays/helm/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ patchesStrategicMerge:
- exclude-ns.yaml
- manager.yaml
- exclude-validatingwebhook.yaml
- exclude-role.yaml
- exclude-rolebinding.yaml

configMapGenerator:
- name: manager-config
Expand Down
2 changes: 0 additions & 2 deletions config/overlays/helm/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ spec:
value: "{{ .Values.flagdConfiguration.debugLogging }}"
- name: FLAGS_VALIDATION_ENABLED
value: "{{ .Values.managerConfig.flagsValidatonEnabled }}"
- name: FLAGD_RESOURCE_ENABLED
value: "{{ .Values.managerConfig.flagdResourceEnabled }}"
- name: IN_PROCESS_PORT
value: "{{ .Values.inProcessConfiguration.port }}"
- name: IN_PROCESS_HOST
Expand Down
3 changes: 0 additions & 3 deletions docs/flagd.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ The CRD `Flagd` at version `v1beta1` is used to create a standalone flagd deploy
accompanied by a `Service` and an optional `Ingress` to expose its API
endpoint to clients outside the cluster.

The handling of this resource can be enabled/disabled by setting `managerConfig.flagdResourceEnabled` Helm value of the operator
chart to `true` or `false` respectively.

Below is an example of a `Flagd` resource:

```yaml
Expand Down
3 changes: 0 additions & 3 deletions docs/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ The `ConfigMap` permissions are needed to allow the mounting of `FeatureFlag` re
| `core.openfeature.dev` | `InProcessConfiguration` | create, delete, get, list, patch, update, watch |
| `rbac.authorization.k8s.io` | `ClusterRoleBinding` | get, list, update, watch |

*(\*) Permissions for `Service` and `networking.k8s.ioIngress` are only granted if the `core.openfeature.dev.Flagd`
CRD has been enabled via the `managerConfig.flagdResourceEnabled` helm value.*

### Proxy Role

The `proxy-role` definition can be found [here](../config/rbac/auth_proxy_role.yaml)
Expand Down
56 changes: 27 additions & 29 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,36 +203,34 @@ func main() {
Tag: env.SidecarTag,
}

if env.FlagdResourceEnabled {
flagdControllerLogger := ctrl.Log.WithName("Flagd Controller")
flagdControllerLogger := ctrl.Log.WithName("Flagd Controller")

flagdResourceReconciler := &flagd.ResourceReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Log: flagdControllerLogger,
}
flagdConfig := flagd.NewFlagdConfiguration(env)

if err = (&flagd.FlagdReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
ResourceReconciler: flagdResourceReconciler,
FlagdDeployment: &flagdresources.FlagdDeployment{
Client: mgr.GetClient(),
Log: flagdControllerLogger,
FlagdInjector: flagdContainerInjector,
FlagdConfig: flagdConfig,
},
FlagdService: &flagdresources.FlagdService{
FlagdConfig: flagdConfig,
},
FlagdIngress: &flagdresources.FlagdIngress{
FlagdConfig: flagdConfig,
},
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Flagd")
os.Exit(1)
}
flagdResourceReconciler := &flagd.ResourceReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Log: flagdControllerLogger,
}
flagdConfig := flagd.NewFlagdConfiguration(env)

if err = (&flagd.FlagdReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
ResourceReconciler: flagdResourceReconciler,
FlagdDeployment: &flagdresources.FlagdDeployment{
Client: mgr.GetClient(),
Log: flagdControllerLogger,
FlagdInjector: flagdContainerInjector,
FlagdConfig: flagdConfig,
},
FlagdService: &flagdresources.FlagdService{
FlagdConfig: flagdConfig,
},
FlagdIngress: &flagdresources.FlagdIngress{
FlagdConfig: flagdConfig,
},
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Flagd")
os.Exit(1)
}

if env.FlagsValidationEnabled {
Expand Down

0 comments on commit 640ff10

Please sign in to comment.