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

Fix installation on new cluster and upgrade operator sdk #193

Merged
merged 2 commits into from
Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
147 changes: 93 additions & 54 deletions Gopkg.lock

Large diffs are not rendered by default.

27 changes: 11 additions & 16 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,27 @@ required = [

[[override]]
name = "k8s.io/code-generator"
# revision for tag "kubernetes-1.10.1"
revision = "7ead8f38b01cf8653249f5af80ce7b2c8aba12e2"
version = "kubernetes-1.11.2"

[[override]]
name = "k8s.io/api"
# revision for tag "kubernetes-1.10.1"
revision = "73d903622b7391f3312dcbac6483fed484e185f8"
version = "kubernetes-1.11.2"

[[override]]
name = "k8s.io/apiextensions-apiserver"
# revision for tag "kubernetes-1.10.1"
revision = "4347b330d0ff094db860f2f75fa725b4f4b53618"
version = "kubernetes-1.11.2"

[[override]]
name = "k8s.io/apimachinery"
# revision for tag "kubernetes-1.10.1"
revision = "302974c03f7e50f16561ba237db776ab93594ef6"
version = "kubernetes-1.11.2"

[[override]]
name = "k8s.io/client-go"
# revision for tag "kubernetes-1.10.1"
revision = "989be4278f353e42f26c416c53757d16fcff77db"
version = "kubernetes-1.11.2"

[[override]]
name = "sigs.k8s.io/controller-runtime"
revision = "60bb251ad86f9b313653618aad0c2c53f41a6625"
version = "v0.1.4"

[prune]
go-tests = true
Expand All @@ -53,9 +48,9 @@ required = [

[[constraint]]
name = "github.com/operator-framework/operator-sdk"
## Using fork to customize the Kubernetes rest config
#source = "https://github.com/nicolaferraro/operator-sdk.git"
#branch = "custom-init"
# The version rule is used for a specific release and the master branch for in between releases.
# Using fork to customize the Kubernetes rest config
source = "https://github.com/nicolaferraro/operator-sdk.git"
branch = "v0.0.7-custom"
## The version rule is used for a specific release and the master branch for in between releases.
#branch = "master"
version = "=v0.0.6"
#version = "=v0.0.7"
14 changes: 14 additions & 0 deletions pkg/apis/camel/v1alpha1/types_support.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,20 @@ func NewIntegrationPlatformList() IntegrationPlatformList {
}
}

// NewIntegrationPlatform --
func NewIntegrationPlatform(namespace string, name string) IntegrationPlatform {
return IntegrationPlatform{
TypeMeta: metav1.TypeMeta{
APIVersion: SchemeGroupVersion.String(),
Kind: IntegrationPlatformKind,
},
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: name,
},
}
}

// NewIntegrationList --
func NewIntegrationList() IntegrationList {
return IntegrationList{
Expand Down
8 changes: 6 additions & 2 deletions pkg/client/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ limitations under the License.
package cmd

import (
"os"

"context"
"github.com/operator-framework/operator-sdk/pkg/k8sclient"
"os"
"time"

"github.com/apache/camel-k/pkg/util/kubernetes"
"github.com/pkg/errors"
Expand Down Expand Up @@ -66,6 +67,9 @@ func NewKamelCommand(ctx context.Context) (*cobra.Command, error) {
cmd.Flag("namespace").Value.Set(current)
}

// Let's use a fast refresh period when running with the CLI
k8sclient.ResetCacheEvery(2 * time.Second)

// Initialize the Kubernetes client to allow using the operator-sdk
err := kubernetes.InitKubeClient(options.KubeConfig)
if err != nil {
Expand Down
20 changes: 20 additions & 0 deletions pkg/install/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import (
"github.com/apache/camel-k/pkg/util/kubernetes"
"github.com/apache/camel-k/pkg/util/minishift"
"github.com/apache/camel-k/pkg/util/openshift"
"github.com/operator-framework/operator-sdk/pkg/sdk"
"strconv"
"time"
)

// Operator --
Expand Down Expand Up @@ -61,6 +64,9 @@ func installKubernetes(namespace string) error {

// Platform installs the platform custom resource
func Platform(namespace string, registry string) error {
if err := waitForPlatformCRDAvailable(namespace, 15*time.Second); err != nil {
return err
}
isOpenshift, err := openshift.IsOpenShift()
if err != nil {
return err
Expand Down Expand Up @@ -92,6 +98,20 @@ func Platform(namespace string, registry string) error {
}
}

func waitForPlatformCRDAvailable(namespace string, timeout time.Duration) error {
deadline := time.Now().Add(timeout)
for {
pla := v1alpha1.NewIntegrationPlatformList()
if err := sdk.List(namespace, &pla); err == nil {
return nil
}
if time.Now().After(deadline) {
return errors.New("cannot list integration platforms after " + strconv.FormatInt(timeout.Nanoseconds()/1000000000, 10) + " seconds")
}
time.Sleep(2 * time.Second)
}
}

// Example --
func Example(namespace string) error {
return Resources(namespace,
Expand Down
26 changes: 15 additions & 11 deletions vendor/github.com/go-openapi/swag/convert.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions vendor/github.com/go-openapi/swag/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 6 additions & 9 deletions vendor/github.com/go-openapi/swag/json.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading