Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Housekeeping: Kusk Services #956

Closed
jasmingacic opened this issue Nov 8, 2022 · 2 comments · Fixed by #978
Closed

Housekeeping: Kusk Services #956

jasmingacic opened this issue Nov 8, 2022 · 2 comments · Fixed by #978

Comments

@jasmingacic
Copy link
Contributor

jasmingacic commented Nov 8, 2022

The service created with each kusk installation should be done programmatically here.

Challenge: Since kusk-gateway-auth-service is only used when Cloudentity is configured we need to find a way of knowing when to remove the service if unused. Reconciler doesn't have any knowledge of the previous state of the cluster.

@aabedraba
Copy link

aabedraba commented Nov 8, 2022

Finding a way to deal with unused resources and automatically cleaning them up should be of big value regarding clunkiness of our installation.

Currently we have:

Absolutely necessary:

  • kusk-gateway-validator-service
  • kusk-gateway-webhooks-service
  • kusk-gateway-xds-service
  • kusk-gateway-envoy-fleet
  • kusk-gateway-manager-metrics-service

Only necessary with specific features:

  • kusk-gateway-api (for dashboard)
  • kusk-gateway-auth-service (for cloudentity)
  • kusk-gateway-dashboard (for dashboard)
  • kusk-gateway-private-envoy-fleet (for dashboard)

Soon we'll also probably have:

  • kusk-gateway-developer-portal (for developer portal)
  • kusk-gateway-mocking (potentially?? for gateway-level mocking)

The services/deployments marked in bold should only be in the cluster if the feature is in used, i.e. in the case of developer portal, it should only be there if the user adds the corresponding x-kusk policy to the OpenAPI definition.

Potential solutions:

  • Users run a CLI command kusk enable developer-portal kusk enable mocking to add remove these services from the cluster
  • Kusk manager/reconciler creates/deletes resources every time a new definition is applied
  • We continue bloating it as it is (maybe the pods aren't thaaaat big)... and tackle this later on

@jasmingacic
Copy link
Contributor Author

Solution:

Currently we have this sort of setup https://github.com/kubeshop/kusk-gateway/blob/main/config/manager/service.yaml
In short three services that are pointing to the same selector but on diferent paths. It should be extracted into something like this

apiVersion: v1
kind: Service
metadata:
  name: kusk-gateway-manager-service
  namespace: system
  labels:
    app.kubernetes.io/component: kusk-manager
spec:
  ports:
    - port: 18000
      name: xds
      targetPort: xds
    - port: 17000
      name: validator
      targetPort: validator
   - port: 19000
      name: auth
      targetPort: auth
      protocol: TCP
  selector:
    app.kubernetes.io/component: kusk-gateway-manager

@jasmingacic jasmingacic changed the title Housekeeping: Auth k8s service Housekeeping: Kusk Services Nov 9, 2022
jasmingacic added a commit that referenced this issue Nov 21, 2022
Fixes #956

Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>
mbana pushed a commit that referenced this issue Dec 1, 2022
Fixes #956

Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>
mbana added a commit that referenced this issue Dec 1, 2022
Issue and Discussion
====================

See #956.

Resolves #956.

Summary
=======

Rename `kusk-gateway-manager-service` to `kusk-gateway-manager`.

Remove `kusk-gateway-validator-service` and `kusk-gateway-auth-service` since they are now part of `kusk-gateway-manager`.

Changes
=======

`internal/services/services.go`
-------------------------------

Introduce `AuthServiceURL` and `ValidatorURL`, so we don't have to repeat service URLs in several places.

`config/manager/manager.yaml`
-----------------------------

Remove `command` from `containers` as we have `ENTRYPOINT ["/manager"]` in `build/manager/Dockerfile`, i.e., the block
below is not needed:

```yaml
        - command:
            - /manager
```

`internal/envoy/auth/parser.go`
-------------------------------

Fix possible null pointer exception when dereferencing `auth.Custom.Host.Path`.

`examples/auth/oauth2/static-route/**`
-------------------------------------

Remove `StaticRoute` example as `paths` is no longer applicable.

`SKAFFOLD.md`
-------------

Remove an item from `TODO` list section as it is no longer applicable.

---

Signed-off-by: Mohamed Bana <mohamed@bana.io>
mbana added a commit that referenced this issue Dec 1, 2022
Issue and Discussion
====================

See #956.

Resolves #956.

Summary
=======

Rename `kusk-gateway-manager-service` to `kusk-gateway-manager`.

Remove `kusk-gateway-validator-service` and `kusk-gateway-auth-service` since they are now part of `kusk-gateway-manager`.

Changes
=======

`internal/services/services.go`
-------------------------------

Introduce `AuthServiceURL` and `ValidatorURL`, so we don't have to repeat service URLs in several places.

`config/manager/manager.yaml`
-----------------------------

Remove `command` from `containers` as we have `ENTRYPOINT ["/manager"]` in `build/manager/Dockerfile`, i.e., the block
below is not needed:

```yaml
        - command:
            - /manager
```

`internal/envoy/auth/parser.go`
-------------------------------

Fix possible null pointer exception when dereferencing `auth.Custom.Host.Path`.

`examples/auth/oauth2/static-route/**`
-------------------------------------

Remove `StaticRoute` example as `paths` is no longer applicable.

`SKAFFOLD.md`
-------------

Remove an item from `TODO` list section as it is no longer applicable.

---

Signed-off-by: Mohamed Bana <mohamed@bana.io>
jasmingacic added a commit that referenced this issue Dec 1, 2022
…service (#978)

* Put all kusk k8s services in one service
Fixes #956

Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>

* Housekeeping: Kusk Services (#956)

Issue and Discussion
====================

See #956.

Resolves #956.

Summary
=======

Rename `kusk-gateway-manager-service` to `kusk-gateway-manager`.

Remove `kusk-gateway-validator-service` and `kusk-gateway-auth-service` since they are now part of `kusk-gateway-manager`.

Changes
=======

`internal/services/services.go`
-------------------------------

Introduce `AuthServiceURL` and `ValidatorURL`, so we don't have to repeat service URLs in several places.

`config/manager/manager.yaml`
-----------------------------

Remove `command` from `containers` as we have `ENTRYPOINT ["/manager"]` in `build/manager/Dockerfile`, i.e., the block
below is not needed:

```yaml
        - command:
            - /manager
```

`internal/envoy/auth/parser.go`
-------------------------------

Fix possible null pointer exception when dereferencing `auth.Custom.Host.Path`.

`examples/auth/oauth2/static-route/**`
-------------------------------------

Remove `StaticRoute` example as `paths` is no longer applicable.

`SKAFFOLD.md`
-------------

Remove an item from `TODO` list section as it is no longer applicable.

---

Signed-off-by: Mohamed Bana <mohamed@bana.io>

Signed-off-by: jasmingacic <jasmin.gacic@gmail.com>
Signed-off-by: Mohamed Bana <mohamed@bana.io>
Co-authored-by: Mohamed Bana <mohamed@bana.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants