This is an automated email from the ASF dual-hosted git repository. astefanutti pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 1b4a32fcafd9dc8c5c3d97361c69d7fe18239a0f Author: Antonin Stefanutti <anto...@stefanutti.fr> AuthorDate: Thu Feb 20 16:00:17 2020 +0100 chore: Rename Minikube registry discovery package --- pkg/install/operator.go | 25 +++++++++------------- .../minishift.go => minikube/registry.go} | 4 ++-- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/pkg/install/operator.go b/pkg/install/operator.go index fb7cb17..df44050 100644 --- a/pkg/install/operator.go +++ b/pkg/install/operator.go @@ -35,7 +35,7 @@ import ( "github.com/apache/camel-k/pkg/util/envvar" "github.com/apache/camel-k/pkg/util/knative" "github.com/apache/camel-k/pkg/util/kubernetes" - "github.com/apache/camel-k/pkg/util/minishift" + "github.com/apache/camel-k/pkg/util/minikube" ) // OperatorConfiguration -- @@ -105,12 +105,12 @@ func OperatorOrCollect(ctx context.Context, c client.Client, cfg OperatorConfigu return o } - isOpenshift, err := isOpenShift(c, cfg.ClusterType) + isOpenShift, err := isOpenShift(c, cfg.ClusterType) if err != nil { return err } - if isOpenshift { - if err := installOpenshift(ctx, c, cfg.Namespace, customizer, collection, force); err != nil { + if isOpenShift { + if err := installOpenShift(ctx, c, cfg.Namespace, customizer, collection, force); err != nil { return err } } else { @@ -139,7 +139,7 @@ func OperatorOrCollect(ctx context.Context, c client.Client, cfg OperatorConfigu return nil } -func installOpenshift(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection, force bool) error { +func installOpenShift(ctx context.Context, c client.Client, namespace string, customizer ResourceCustomizer, collection *kubernetes.Collection, force bool) error { return ResourcesOrCollect(ctx, c, namespace, collection, force, customizer, "operator-service-account.yaml", "operator-role-openshift.yaml", @@ -180,7 +180,7 @@ func Platform(ctx context.Context, c client.Client, clusterType string, namespac // PlatformOrCollect -- // nolint: lll func PlatformOrCollect(ctx context.Context, c client.Client, clusterType string, namespace string, registry v1.IntegrationPlatformRegistrySpec, collection *kubernetes.Collection) (*v1.IntegrationPlatform, error) { - isOpenshift, err := isOpenShift(c, clusterType) + isOpenShift, err := isOpenShift(c, clusterType) if err != nil { return nil, err } @@ -190,22 +190,22 @@ func PlatformOrCollect(ctx context.Context, c client.Client, clusterType string, } pl := platformObject.(*v1.IntegrationPlatform) - if !isOpenshift { + if !isOpenShift { pl.Spec.Build.Registry = registry // Kubernetes only (Minikube) if registry.Address == "" { // This operation should be done here in the installer // because the operator is not allowed to look into the "kube-system" namespace - minikubeRegistry, err := minishift.FindRegistry(ctx, c) + address, err := minikube.FindRegistry(ctx, c) if err != nil { return nil, err } - if minikubeRegistry == nil { + if address == nil { return nil, errors.New("cannot find automatically a registry where to push images") } - pl.Spec.Build.Registry.Address = *minikubeRegistry + pl.Spec.Build.Registry.Address = *address pl.Spec.Build.Registry.Insecure = true } } @@ -213,11 +213,6 @@ func PlatformOrCollect(ctx context.Context, c client.Client, clusterType string, return pl, nil } -// Example -- -func Example(ctx context.Context, c client.Client, namespace string, force bool) error { - return ExampleOrCollect(ctx, c, namespace, nil, force) -} - // ExampleOrCollect -- func ExampleOrCollect(ctx context.Context, c client.Client, namespace string, collection *kubernetes.Collection, force bool) error { return ResourcesOrCollect(ctx, c, namespace, collection, force, IdentityResourceCustomizer, diff --git a/pkg/util/minishift/minishift.go b/pkg/util/minikube/registry.go similarity index 95% rename from pkg/util/minishift/minishift.go rename to pkg/util/minikube/registry.go index ae7b284..6ad5faa 100644 --- a/pkg/util/minishift/minishift.go +++ b/pkg/util/minikube/registry.go @@ -16,7 +16,7 @@ limitations under the License. */ // Package minishift contains utilities for Minishift deployments -package minishift +package minikube import ( "context" @@ -33,7 +33,7 @@ const ( registryNamespace = "kube-system" ) -// FindRegistry returns the Minishift registry location if any +// FindRegistry returns the Minikube addon registry location if any func FindRegistry(ctx context.Context, c client.Client) (*string, error) { svcs := corev1.ServiceList{ TypeMeta: metav1.TypeMeta{