Skip to content

Commit

Permalink
fix install command
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Nov 8, 2023
1 parent a2f1c88 commit 73f7e3a
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 124 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ go install github.com/kuadrant/kuadrantctl@latest
## Commands
* [Install Kuadrant](doc/install.md)
* [Uninstall Kuadrant](doc/uninstall.md)
* [Generate Istio virtualservice objects](doc/generate-istio-virtualservice.md)
* [Generate Istio authenticationpolicy objects](doc/generate-istio-authorizationpolicy.md)
* [Generate kuadrat authconfig objects](doc/generate-kuadrant-authconfig.md)
* [Generate Gateway API HTTPRoute objects](doc/generate-gateway-api-httproute.md)

* [Generate Gateway API HTTPRoute objects from OpenAPI 3](doc/generate-gateway-api-httproute.md)

## Contributing
The [Development guide](doc/development.md) describes how to build the kuadrantctl CLI and how to test your changes before submitting a patch or opening a PR.
Expand Down
68 changes: 59 additions & 9 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const (
func installCommand() *cobra.Command {
installCmd := &cobra.Command{
Use: "install",
Short: "Applies a kuadrant manifest bundle, installing or reconfiguring kuadrant on a cluster",
Long: "The install command applies kuadrant manifest bundle and applies it to a cluster.",
Short: "Install Kuadrant",
Long: "The install command installs kuadrant in a OLM powered cluster",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// Required to have controller-runtim config package read the kubeconfig arg
err := flag.CommandLine.Parse([]string{"-kubeconfig", installKubeConfig})
Expand Down Expand Up @@ -88,11 +88,6 @@ func installRun(cmd *cobra.Command, args []string) error {
return err
}

err = waitForDeployments(k8sClient)
if err != nil {
return err
}

return nil
}

Expand All @@ -119,7 +114,7 @@ func waitForDeployments(k8sClient client.Client) error {
}

func deployKuadrantOperator(k8sClient client.Client) error {
logf.Log.Info("Deploying kuadrant operator", "version", KUADRANT_OPERATOR_VERSION)
logf.Log.Info("Installing kuadrant operator", "version", KUADRANT_OPERATOR_VERSION)

//apiVersion: operators.coreos.com/v1alpha1
//kind: Subscription
Expand Down Expand Up @@ -149,6 +144,61 @@ func deployKuadrantOperator(k8sClient client.Client) error {
return err
}

var installPlanKey client.ObjectKey

// Wait for the install process to be completed
logf.Log.Info("Waiting for the kuadrant operator installation")
err = wait.Poll(time.Second*2, time.Second*20, func() (bool, error) {
existingSubs := &operators.Subscription{}
err := k8sClient.Get(context.Background(), client.ObjectKeyFromObject(subs), existingSubs)
if err != nil {
if apierrors.IsNotFound(err) {
logf.Log.Info("Subscription not available", "name", client.ObjectKeyFromObject(subs))
return false, nil
}
return false, err
}

if existingSubs.Status.Install == nil || existingSubs.Status.Install.Name == "" {
return false, nil
}

installPlanKey = client.ObjectKey{
Name: existingSubs.Status.Install.Name,
Namespace: subs.Namespace,
}

return true, nil
})

if err != nil {
return err
}

logf.Log.Info("Waiting for the install plan", "name", installPlanKey)
err = wait.Poll(time.Second*5, time.Minute*2, func() (bool, error) {
ip := &operators.InstallPlan{}
err := k8sClient.Get(context.Background(), installPlanKey, ip)
if err != nil {
if apierrors.IsNotFound(err) {
logf.Log.Info("Install plan not available", "name", installPlanKey)
return false, nil
}
return false, err
}

if ip.Status.Phase != operators.InstallPlanPhaseComplete {
logf.Log.Info("Install plan not ready", "phase", ip.Status.Phase)
return false, nil
}

return true, nil
})

if err != nil {
return err
}

return nil
}

Expand All @@ -164,7 +214,7 @@ func deployKuadrant(k8sClient client.Client) error {
return err
}

return nil
return waitForDeployments(k8sClient)
}

func createNamespace(k8sClient client.Client) error {
Expand Down
4 changes: 2 additions & 2 deletions doc/generate-gateway-api-httproute.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Generate Gateway API HTTPRoute object
## Generate Gateway API HTTPRoute object from OpenAPI 3

The `kuadrantctl generate gatewayapi httproute` command generates an [Gateway API HTTPRoute](https://gateway-api.sigs.k8s.io/v1alpha2/guides/http-routing/)
from your [OpenAPI Specification (OAS) 3.x](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md) and kubernetes service information.
Expand Down Expand Up @@ -32,4 +32,4 @@ Global Flags:
-v, --verbose verbose output
```

> Under the example folder there are examples of OAS 3 that can be used to generate the resources
> Under the example folder there are examples of OAS 3 that can be used to generate the resources
30 changes: 0 additions & 30 deletions doc/generate-istio-authorizationpolicy.md

This file was deleted.

34 changes: 0 additions & 34 deletions doc/generate-istio-virtualservice.md

This file was deleted.

29 changes: 0 additions & 29 deletions doc/generate-kuadrant-authconfig.md

This file was deleted.

19 changes: 5 additions & 14 deletions doc/install.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
## Install Kuadrant

The install command applies kuadrant manifest bundle and applies it to a cluster.
The install command installs kuadrant in a OLM powered cluster.

Components being installed:

* `kuadrant-system` namespace
* [istio](https://istio.io/) 1.12.1
* Authentication/Authorization Service
* [Authorino Operator](https://github.com/kuadrant/authorino-operator) v0.1.0
* [Authorino](https://github.com/Kuadrant/authorino) v0.7.0
* Rate Limit Service
* [Limitador Operator](https://github.com/kuadrant/limitador-operator) v0.2.0
* [Limitador](https://github.com/kuadrant/limitador) v0.4.0
* [kuadrant controller](https://github.com/Kuadrant/kuadrant-controller) v0.2.0
Using [Kuadrant Operator v0.4.1](https://github.com/Kuadrant/kuadrant-operator/releases/tag/v0.4.1)
as the installation procedure.

### Usage :

```shell
$ kuadrantctl install --help
The install command applies kuadrant manifest bundle and applies it to a cluster.
The install command installs kuadrant in a OLM powered cluster

Usage:
kuadrantctl install [flags]
Expand All @@ -28,5 +19,5 @@ Flags:
--kubeconfig string Kubernetes configuration file

Global Flags:
--config string config file (default is $HOME/.kuadrantctl.yaml)
-v, --verbose verbose output
```
2 changes: 1 addition & 1 deletion doc/uninstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

```shell
$ kuadrantctl uninstall -h
The uninstall command removes kuadrant manifest bundle from the cluster.
The uninstall command removes kuadrant from the cluster.

Usage:
kuadrantctl uninstall [flags]
Expand Down

0 comments on commit 73f7e3a

Please sign in to comment.