Skip to content

Commit

Permalink
Remove applier deps from tests (#333)
Browse files Browse the repository at this point in the history
This is futher to remove deps on previous applier code

Signed-off-by: Jian Qiu <[email protected]>
  • Loading branch information
qiujian16 authored Apr 20, 2023
1 parent 0c5f93b commit 2a9f45f
Show file tree
Hide file tree
Showing 533 changed files with 139 additions and 50,577 deletions.
10 changes: 0 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.6.0
github.com/spf13/pflag v1.0.5
github.com/stolostron/applier v1.0.2-0.20220802003824-ca5e63261fa1
google.golang.org/grpc v1.49.0
k8s.io/api v0.26.1
k8s.io/apiextensions-apiserver v0.26.1
Expand All @@ -40,9 +39,6 @@ require k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand All @@ -60,15 +56,13 @@ require (
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.21.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
Expand All @@ -79,9 +73,7 @@ require (
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -97,7 +89,6 @@ require (
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xlab/treeprint v1.1.0 // indirect
go.starlark.net v0.0.0-20220302181546-5411bad688d1 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.5.0 // indirect
Expand All @@ -110,7 +101,6 @@ require (
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/kube-aggregator v0.26.1 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/kube-storage-version-migrator v0.0.5 // indirect
sigs.k8s.io/kustomize/api v0.12.1 // indirect
Expand Down
18 changes: 0 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
Expand Down Expand Up @@ -429,8 +423,6 @@ github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0m
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/imdario/mergo v0.3.7/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
Expand Down Expand Up @@ -507,8 +499,6 @@ github.com/matttproud/golang_protobuf_extensions v1.0.2 h1:hAHbPm5IJGijwng3PWk09
github.com/matttproud/golang_protobuf_extensions v1.0.2/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
Expand All @@ -518,8 +508,6 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo=
Expand Down Expand Up @@ -675,8 +663,6 @@ github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DM
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
github.com/stolostron/applier v1.0.2-0.20220802003824-ca5e63261fa1 h1:bUk1vh+Xh/S+I2tw/b1brK1Qc7uilZnA4OAlK7yHHb8=
github.com/stolostron/applier v1.0.2-0.20220802003824-ca5e63261fa1/go.mod h1:ivUpfrcdZcQL0TkcAiJ5t6kLh2LdHuVbxMWS54OfO10=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
Expand Down Expand Up @@ -779,8 +765,6 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU=
golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -1301,8 +1285,6 @@ k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-aggregator v0.18.0-beta.2/go.mod h1:O3Td9mheraINbLHH4pzoFP2gRzG0Wk1COqzdSL4rBPk=
k8s.io/kube-aggregator v0.21.0/go.mod h1:sIaa9L4QCBo9gjPyoGJns4cBjYVLq3s49FxF7m/1A0A=
k8s.io/kube-aggregator v0.22.1/go.mod h1:VbmI+8fUeCPkzSvarWTrlIGEgUGEGI/66SFajDQ0Pdc=
k8s.io/kube-aggregator v0.26.1 h1:TqDWwuaUJpyhWGWw4JrXR8ZAAaHa9qrsXxR41aR3igw=
k8s.io/kube-aggregator v0.26.1/go.mod h1:E6dnKoQ6f4eFl8QQXHxTASZKXBX6+XcjROWl7GRltl4=
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
Expand Down
10 changes: 5 additions & 5 deletions pkg/cmd/create/sampleapp/exec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ package sampleapp
import (
"context"
"fmt"
cmdutil "k8s.io/kubectl/pkg/cmd/util"
"open-cluster-management.io/clusteradm/pkg/helpers/reader"
"os"
"path/filepath"

Expand All @@ -16,7 +18,6 @@ import (
"k8s.io/apimachinery/pkg/util/rand"
"k8s.io/cli-runtime/pkg/genericclioptions"

"github.com/stolostron/applier/pkg/apply"
clusterapiv1 "open-cluster-management.io/api/cluster/v1"
"open-cluster-management.io/clusteradm/pkg/cmd/addon/enable"
installScenario "open-cluster-management.io/clusteradm/pkg/cmd/install/hubaddon/scenario"
Expand Down Expand Up @@ -132,9 +133,8 @@ var _ = ginkgo.Describe("deploy samepleapp to every managed cluster", func() {
_, err = kubeClient.CoreV1().Namespaces().Create(context.Background(), ns, metav1.CreateOptions{})
gomega.Expect(err).ToNot(gomega.HaveOccurred())

reader := installScenario.GetScenarioResourcesReader()
applierBuilder := apply.NewApplierBuilder()
applier := applierBuilder.WithClient(kubeClient, apiExtensionsClient, dynamicClient).Build()
f := cmdutil.NewFactory(TestClientGetter{cfg: restConfig})
r := reader.NewResourceReader(f.NewBuilder(), false, genericclioptions.IOStreams{Out: os.Stdout, ErrOut: os.Stderr})

mydir, err := os.Getwd()
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "install addon error")
Expand All @@ -143,7 +143,7 @@ var _ = ginkgo.Describe("deploy samepleapp to every managed cluster", func() {
files, err := addonPathWalkDir(appDir)
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "install addon error")

_, err = applier.ApplyCustomResources(reader, ao.values, false, "", files...)
err = r.Apply(installScenario.Files, ao.values, files...)
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "install addon error")

fmt.Fprintf(streams.Out, "Installing built-in %s add-on to namespace %s.\n", addon, addonNamespace)
Expand Down
30 changes: 30 additions & 0 deletions pkg/cmd/create/sampleapp/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
package sampleapp

import (
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/client-go/discovery"
"k8s.io/client-go/discovery/cached/memory"
"k8s.io/client-go/restmapper"
"k8s.io/client-go/tools/clientcmd"
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
"path/filepath"
"testing"

Expand Down Expand Up @@ -77,3 +83,27 @@ var _ = ginkgo.AfterSuite(func() {
err := testEnv.Stop()
gomega.Expect(err).ToNot(gomega.HaveOccurred())
})

type TestClientGetter struct {
cfg *rest.Config
}

func (t TestClientGetter) ToRESTConfig() (*rest.Config, error) {
return t.cfg, nil
}

func (t TestClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error) {
discoveryClient, _ := discovery.NewDiscoveryClientForConfig(t.cfg)
return memory.NewMemCacheClient(discoveryClient), nil
}

// ToRESTMapper returns a restmapper
func (t TestClientGetter) ToRESTMapper() (meta.RESTMapper, error) {
client, _ := t.ToDiscoveryClient()
return restmapper.NewDeferredDiscoveryRESTMapper(client), nil
}

// ToRawKubeConfigLoader return kubeconfig loader as-is
func (t TestClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig {
return clientcmd.NewDefaultClientConfig(clientcmdapi.Config{}, nil)
}
61 changes: 28 additions & 33 deletions pkg/cmd/install/hubaddon/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ package hubaddon

import (
"fmt"
"open-cluster-management.io/clusteradm/pkg/helpers/reader"
"os"
"strings"

"github.com/spf13/cobra"
"k8s.io/klog/v2"

"github.com/stolostron/applier/pkg/apply"
apiextensionsclient "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
"k8s.io/client-go/dynamic"
"k8s.io/client-go/kubernetes"
"open-cluster-management.io/clusteradm/pkg/cmd/install/hubaddon/scenario"
"open-cluster-management.io/clusteradm/pkg/helpers"
"open-cluster-management.io/clusteradm/pkg/helpers/version"
)

Expand All @@ -24,7 +21,8 @@ const (

func (o *Options) complete(cmd *cobra.Command, args []string) (err error) {
klog.V(1).InfoS("addon options:", "dry-run", o.ClusteradmFlags.DryRun, "names", o.names, "output-file", o.outputFile)

f := o.ClusteradmFlags.KubectlFactory
o.builder = f.NewBuilder()
return nil
}

Expand Down Expand Up @@ -79,24 +77,12 @@ func (o *Options) run() error {

klog.V(3).InfoS("values:", "addon", o.values.hubAddons)

kubeClient, apiExtensionsClient, dynamicClient, err := helpers.GetClients(o.ClusteradmFlags.KubectlFactory)
if err != nil {
return err
}

return o.runWithClient(kubeClient, apiExtensionsClient, dynamicClient, o.ClusteradmFlags.DryRun)
return o.runWithClient()
}

func (o *Options) runWithClient(kubeClient kubernetes.Interface,
apiExtensionsClient apiextensionsclient.Interface,
dynamicClient dynamic.Interface,
dryRun bool) error {

output := make([]string, 0)
reader := scenario.GetScenarioResourcesReader()
func (o *Options) runWithClient() error {

applierBuilder := apply.NewApplierBuilder()
applier := applierBuilder.WithClient(kubeClient, apiExtensionsClient, dynamicClient).Build()
r := reader.NewResourceReader(o.builder, o.ClusteradmFlags.DryRun, o.Streams)

for _, addon := range o.values.hubAddons {
switch addon {
Expand All @@ -118,26 +104,23 @@ func (o *Options) runWithClient(kubeClient kubernetes.Interface,
"addon/appmgr/service_operator.yaml",
}

out, err := applier.ApplyDirectly(reader, o.values, dryRun, "", files...)
err := r.Apply(scenario.Files, o.values, files...)
if err != nil {
return err
}
output = append(output, out...)

deployments := []string{
"addon/appmgr/deployment_channel.yaml",
"addon/appmgr/deployment_subscription.yaml",
"addon/appmgr/deployment_placementrule.yaml",
"addon/appmgr/deployment_appsubsummary.yaml",
}

out, err = applier.ApplyDeployments(reader, o.values, dryRun, "", deployments...)
err = r.Apply(scenario.Files, o.values, deployments...)
if err != nil {
return err
}
output = append(output, out...)

fmt.Printf("Installing built-in %s add-on to the Hub cluster...\n", appMgrAddonName)
fmt.Fprintf(o.Streams.Out, "Installing built-in %s add-on to the Hub cluster...\n", appMgrAddonName)

// Install the Policy Framework Addon
case policyFrameworkAddonName:
Expand All @@ -159,26 +142,38 @@ func (o *Options) runWithClient(kubeClient kubernetes.Interface,
"addon/appmgr/crd_placementrule.yaml",
}

out, err := applier.ApplyDirectly(reader, o.values, dryRun, "", files...)
err := r.Apply(scenario.Files, o.values, files...)
if err != nil {
return err
}
output = append(output, out...)

deployments := []string{
"addon/policy/addon-controller_deployment.yaml",
"addon/policy/propagator_deployment.yaml",
}

out, err = applier.ApplyDeployments(reader, o.values, dryRun, "", deployments...)
err = r.Apply(scenario.Files, o.values, deployments...)
if err != nil {
return err
}
output = append(output, out...)

fmt.Printf("Installing built-in %s add-on to the Hub cluster...\n", policyFrameworkAddonName)
fmt.Fprintf(o.Streams.Out, "Installing built-in %s add-on to the Hub cluster...\n", policyFrameworkAddonName)
}
}

return apply.WriteOutput(o.outputFile, output)
if len(o.outputFile) > 0 {
sh, err := os.OpenFile(o.outputFile, os.O_CREATE|os.O_WRONLY, 0755)
if err != nil {
return err
}
_, err = fmt.Fprintf(sh, "%s", string(r.RawAppliedResources()))
if err != nil {
return err
}
if err := sh.Close(); err != nil {
return err
}
}

return nil
}
Loading

0 comments on commit 2a9f45f

Please sign in to comment.