-
Notifications
You must be signed in to change notification settings - Fork 33
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
ConsolePlugin resource #879
Conversation
4fa003e
to
2f5f64d
Compare
Signed-off-by: Jason Madigan <[email protected]>
2f5f64d
to
5d71285
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet, very cool stuff.
Left some comments we can use for further discussion
@@ -0,0 +1,133 @@ | |||
apiVersion: v1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The source of truth of the bundle content (99% of it actually), is hosted in ${PROJECT}/config
folder. It should be there
spec: | ||
containers: | ||
- name: kuadrant-console | ||
image: quay.io/kuadrant/console-plugin:latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be parametrized as a variable at operator build time, same like Wasm-shim image. Kuadrant console plugin is a new dep for the kuadrant operator.
@@ -167,6 +179,17 @@ func (r *KuadrantReconciler) Reconcile(eventCtx context.Context, req ctrl.Reques | |||
return statusResult, nil | |||
} | |||
|
|||
if r.isConsolePluginAvailable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementing this on the kuadrant controller makes sense as long as the deployment has something to do with the Kuadrant CR. If not, I would suggest a new controller dedicated to this.
kind: Deployment | ||
metadata: | ||
name: kuadrant-console | ||
namespace: kuadrant-console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this namespace is quite arbitrary. I would try to make it configurable at operator build time (or runtime.. let's discuss about this). One candidate for the default value would be the namespace where the operator is installed. But it is ok as well to be in kuadrant-console
.
@@ -167,6 +179,17 @@ func (r *KuadrantReconciler) Reconcile(eventCtx context.Context, req ctrl.Reques | |||
return statusResult, nil | |||
} | |||
|
|||
if r.isConsolePluginAvailable() { | |||
logger.Info("ConsolePlugin API is available, proceeding to apply manifest") | |||
if err := r.applyManifest(ctx, "bundle/manifests/kuadrant-console-plugin.yaml", r.Client()); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid, this is not gonna work
I see four approaches:
- The kuadrant operator binary has embedded the manifests. (we use this approach for the grafana dashboards on the 3scale operator)
- The kuadrant operator reads from a configmap
- The kuadrant operator has the manifests available in the docker image, so the container can read the file from local filesystem as you try there.
- The kuadrant operator creates deployment, service, nginx configmap... So all those resources are encoded in golang code. Pretty much like the limitador operator does with limitador.
Each approach has pro's & con's. Maybe a combination of some of them. IDK. I would go first with the fourth approach. But let's discuss.
@@ -479,3 +502,58 @@ func (r *KuadrantReconciler) SetupWithManager(mgr ctrl.Manager) error { | |||
Owns(&authorinov1beta1.Authorino{}). | |||
Complete(r) | |||
} | |||
|
|||
func (r *KuadrantReconciler) isConsolePluginAvailable() bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already implemented in kuadrantgatewayapi.IsCRDInstalled
I patched it and the outcome is:
diff --git a/controllers/kuadrant_controller.go b/controllers/kuadrant_controller.go
index b7c89dd..7d7589f 100644
--- a/controllers/kuadrant_controller.go
+++ b/controllers/kuadrant_controller.go
@@ -177,7 +177,13 @@ func (r *KuadrantReconciler) Reconcile(eventCtx context.Context, req ctrl.Reques
return statusResult, nil
}
- if r.isConsolePluginAvailable() {
+ consolePluginGVK := consolev1.GroupVersion.WithKind("ConsolePlugin")
+ isConsolePluginAvailable, err := kuadrantgatewayapi.IsCRDInstalled(r.RestMapper, consolePluginGVK.Group, consolePluginGVK.Kind, consolePluginGVK.Version)
+ if err != nil {
+ return ctrl.Result{}, err
+ }
+
+ if isConsolePluginAvailable {
logger.Info("ConsolePlugin API is available, proceeding to apply manifest")
if err := r.applyManifest(ctx, "bundle/manifests/kuadrant-console-plugin.yaml", r.Client()); err != nil {
logger.Error(err, "failed to apply manifest")
@@ -501,17 +507,6 @@ func (r *KuadrantReconciler) SetupWithManager(mgr ctrl.Manager) error {
Complete(r)
}
-func (r *KuadrantReconciler) isConsolePluginAvailable() bool {
- gvk := consolev1.GroupVersion.WithKind("ConsolePlugin")
- mapping, err := r.RestMapper.RESTMapping(gvk.GroupKind(), gvk.Version)
- if err != nil || mapping == nil {
- log.Log.Info("ConsolePlugin API is not available")
- return false
- }
- log.Log.Info("ConsolePlugin API is available")
- return true
-}
-
func (r *KuadrantReconciler) applyManifest(ctx context.Context, filePath string, k8sClient client.Client) error {
logger := logr.FromContextOrDiscard(ctx)
superseded by #884 |
WIP
Ref: Kuadrant/kuadrant-console-plugin#46
On OCP/OKD, apply a
ConsolePlugin
resource and associated deployment, to deploy https://github.com/Kuadrant/console-plugin alongside the rest of our components.