From b89784840094d534ae4ab85717dbdfedb3b03bce Mon Sep 17 00:00:00 2001 From: Bryce Palmer Date: Wed, 26 Jul 2023 15:09:44 -0400 Subject: [PATCH] initial poc of ansible external plugin Signed-off-by: Bryce Palmer --- go.mod | 3 +++ go.sum | 2 ++ internal/cmd/operator-sdk/cli/cli.go | 4 ++-- testdata/ansible/memcached-operator/Dockerfile | 2 +- testdata/ansible/memcached-operator/Makefile | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 6ab836a097..b9bf58a1d3 100644 --- a/go.mod +++ b/go.mod @@ -169,6 +169,7 @@ require ( github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b // indirect + github.com/operator-framework/ansible-operator-plugins v0.0.0-20230725204444-54d3e49c4338 // indirect github.com/otiai10/copy v1.2.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect @@ -244,4 +245,6 @@ replace ( // latest tag resolves to a very old version. this is only used for spinning up local test registries github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d github.com/mattn/go-sqlite3 => github.com/mattn/go-sqlite3 v1.10.0 + + github.com/operator-framework/ansible-operator-plugins => ../ansible-operator-plugins ) diff --git a/go.sum b/go.sum index 116e776818..486306c106 100644 --- a/go.sum +++ b/go.sum @@ -763,6 +763,8 @@ github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/ github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 h1:3snG66yBm59tKhhSPQrQ/0bCrv1LQbKt40LnUPiUxdc= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= +github.com/operator-framework/ansible-operator-plugins v0.0.0-20230725204444-54d3e49c4338 h1:xy3XSxagtBDtFh5t1qjA9AtaYMh+zFV7an5mU5XEguY= +github.com/operator-framework/ansible-operator-plugins v0.0.0-20230725204444-54d3e49c4338/go.mod h1:JIKQVJNMD91hn6DH8w0FqhvNe3aOA5YhbB6gaFnyCe4= github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42 h1:d/Pnr19TnmIq3zQ6ebewC+5jt5zqYbRkvYd37YZENQY= github.com/operator-framework/api v0.17.4-0.20230223191600-0131a6301e42/go.mod h1:l/cuwtPxkVUY7fzYgdust2m9tlmb8I4pOvbsUufRb24= github.com/operator-framework/helm-operator-plugins v0.0.12-0.20230413193425-4632388adc61 h1:FPO2hS4HNIU2pzWeX2KusKxqDFeGIURRMkxRtn/i570= diff --git a/internal/cmd/operator-sdk/cli/cli.go b/internal/cmd/operator-sdk/cli/cli.go index 7c14aa786e..f9f18f0469 100644 --- a/internal/cmd/operator-sdk/cli/cli.go +++ b/internal/cmd/operator-sdk/cli/cli.go @@ -35,6 +35,7 @@ import ( golangv4 "sigs.k8s.io/kubebuilder/v3/pkg/plugins/golang/v4" grafanav1alpha "sigs.k8s.io/kubebuilder/v3/pkg/plugins/optional/grafana/v1alpha" + externalansible "github.com/operator-framework/ansible-operator-plugins/pkg/plugins/ansible/v1" "github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/alpha/config3alphato3" "github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/bundle" "github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/cleanup" @@ -45,7 +46,6 @@ import ( "github.com/operator-framework/operator-sdk/internal/cmd/operator-sdk/scorecard" "github.com/operator-framework/operator-sdk/internal/flags" "github.com/operator-framework/operator-sdk/internal/plugins" - ansiblev1 "github.com/operator-framework/operator-sdk/internal/plugins/ansible/v1" envtestv1 "github.com/operator-framework/operator-sdk/internal/plugins/envtest/v1" helmv1 "github.com/operator-framework/operator-sdk/internal/plugins/helm/v1" manifestsv2 "github.com/operator-framework/operator-sdk/internal/plugins/manifests/v2" @@ -99,7 +99,7 @@ func GetPluginsCLIAndRoot() (*cli.CLI, *cobra.Command) { ) ansibleBundle, _ := plugin.NewBundle("ansible"+plugins.DefaultNameQualifier, plugin.Version{Number: 1}, kustomizev2Alpha.Plugin{}, - ansiblev1.Plugin{}, + externalansible.Plugin{}, manifestsv2.Plugin{}, scorecardv2.Plugin{}, ) diff --git a/testdata/ansible/memcached-operator/Dockerfile b/testdata/ansible/memcached-operator/Dockerfile index 4fb6c381da..16f375a9ff 100644 --- a/testdata/ansible/memcached-operator/Dockerfile +++ b/testdata/ansible/memcached-operator/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/operator-framework/ansible-operator:v1.30.0 +FROM quay.io/operator-framework/ansible-operator:unknown COPY requirements.yml ${HOME}/requirements.yml RUN ansible-galaxy collection install -r ${HOME}/requirements.yml \ diff --git a/testdata/ansible/memcached-operator/Makefile b/testdata/ansible/memcached-operator/Makefile index e7aee606fb..6ab2b0809a 100644 --- a/testdata/ansible/memcached-operator/Makefile +++ b/testdata/ansible/memcached-operator/Makefile @@ -151,7 +151,7 @@ ifeq (,$(shell which ansible-operator 2>/dev/null)) @{ \ set -e ;\ mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\ - curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.30.0/ansible-operator_$(OS)_$(ARCH) ;\ + curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/ansible-operator-plugins/releases/download/unknown/ansible-operator_$(OS)_$(ARCH) ;\ chmod +x $(ANSIBLE_OPERATOR) ;\ } else