From 2918878e4c025805ec43d28046c0080275445c12 Mon Sep 17 00:00:00 2001 From: Mengyi Wang Date: Tue, 13 Dec 2022 10:08:44 +0100 Subject: [PATCH] build(snap): Remove deprecated kuiper and ASC from edgexfoundry snap (#4250) BREAKING CHANGE: Remove deprecated kuiper and app-service-configurable apps from the edgexfoundry snap since they are now available as standalone snaps. Signed-off-by: Mengyi Wang --- .../build-helpers/bin/minimal-snap-build.sh | 9 +- snap/local/helper-go/configure.go | 34 ------- snap/local/helper-go/const.go | 4 - snap/local/helper-go/install.go | 28 ------ snap/local/helper-go/options.go | 1 - snap/snapcraft.yaml | 99 ------------------- 6 files changed, 3 insertions(+), 172 deletions(-) diff --git a/snap/local/build-helpers/bin/minimal-snap-build.sh b/snap/local/build-helpers/bin/minimal-snap-build.sh index e35d930d8c..169e9d69d3 100755 --- a/snap/local/build-helpers/bin/minimal-snap-build.sh +++ b/snap/local/build-helpers/bin/minimal-snap-build.sh @@ -25,15 +25,12 @@ SNAPCRAFT_YAML="$CURRDIR/snap/snapcraft.yaml" $CURRDIR/yq e -P -i 'del(.apps.consul,.apps.redis,.apps.postgres,.apps.kong-daemon,.apps.vault,.apps.vault-cli)' "$SNAPCRAFT_YAML" # remove second chunk of apps -$CURRDIR/yq e -P -i 'del(.apps.app-service-configurable)' "$SNAPCRAFT_YAML" - -# remove third chunk of apps $CURRDIR/yq e -P -i 'del(.apps.redis-cli,.apps.consul-cli)' "$SNAPCRAFT_YAML" -# remove fourth chunk of apps -$CURRDIR/yq e -P -i 'del(.apps.kong,.apps.psql,.apps.psql-any,.apps.createdb,.apps.kuiper,.apps.kuiper-cli)' "$SNAPCRAFT_YAML" +# remove third chunk of apps +$CURRDIR/yq e -P -i 'del(.apps.kong,.apps.psql,.apps.psql-any,.apps.createdb)' "$SNAPCRAFT_YAML" # remove unwanted parts -$CURRDIR/yq e -P -i 'del(.parts.snapcraft-preload,.parts.postgres,.parts.consul,.parts.redis,.parts.kong,.parts.vault,.parts.kuiper,.parts.app-service-config)' "$SNAPCRAFT_YAML" +$CURRDIR/yq e -P -i 'del(.parts.snapcraft-preload,.parts.postgres,.parts.consul,.parts.redis,.parts.kong,.parts.vault)' "$SNAPCRAFT_YAML" diff --git a/snap/local/helper-go/configure.go b/snap/local/helper-go/configure.go index 1f8b102d47..0d66e41886 100644 --- a/snap/local/helper-go/configure.go +++ b/snap/local/helper-go/configure.go @@ -37,10 +37,6 @@ const ( ) var ( - rulesEngineServices = []string{ - appServiceConfigurable, - eKuiper, - } proxyServices = []string{ kong, postgres, @@ -72,8 +68,6 @@ var ( optionalServices = []string{ supportNotifications, supportScheduler, - eKuiper, - appServiceConfigurable, systemManagementAgent, } ) @@ -193,15 +187,6 @@ func disableSecretStoreAndRestart() error { } } - // stop Kuiper-related services - // TODO - kuiper will be stopped, but not restarted because - // additional re-configuration may be needed. - for _, s := range rulesEngineServices { - if err := snapctl.Stop(snapService(s)).Run(); err != nil { - return err - } - } - // stop redis if err := snapctl.Stop(snapService(redis)).Run(); err != nil { return err @@ -282,9 +267,6 @@ func handleAllServices(deferStartup bool) error { // support services supportNotifications, supportScheduler, - eKuiper, - // app-services - appServiceConfigurable, // security services securitySecretStore, securityProxy, @@ -326,18 +308,6 @@ func handleAllServices(deferStartup bool) error { // sType := serviceType(s) switch s { - case eKuiper: - switch status { - case ON, OFF: - serviceList = rulesEngineServices - case UNSET: - // this is the default status of all services if no - // configuration has been specified; no-op - continue - default: - return fmt.Errorf("invalid value for kuiper: %s", status) - } - case securityProxy: switch status { case ON: @@ -534,10 +504,6 @@ func configure() { log.Fatalf("security service config error: %v", err) } - // TODO: don't support kuiper until it's possible to share - // kuiper & app-services-configurable (rules-engine) config - // via content interface - // check core services startServices, err = checkCoreConfig(startServices) if err != nil { diff --git a/snap/local/helper-go/const.go b/snap/local/helper-go/const.go index c8a1f51cef..5c37430bee 100644 --- a/snap/local/helper-go/const.go +++ b/snap/local/helper-go/const.go @@ -13,8 +13,6 @@ const ( // support services supportNotifications = "support-notifications" supportScheduler = "support-scheduler" - eKuiper = "kuiper" - rulesEngine = eKuiper // security services securitySecretStore = "security-secret-store" securitySecretStoreSetup = "security-secretstore-setup" @@ -28,8 +26,6 @@ const ( kong = "kong-daemon" postgres = "postgres" vault = "vault" - // app services - appServiceConfigurable = "app-service-configurable" // management services systemManagementAgent = "sys-mgmt-agent" ) diff --git a/snap/local/helper-go/install.go b/snap/local/helper-go/install.go index 7c6c336d9f..8bae48e4d2 100644 --- a/snap/local/helper-go/install.go +++ b/snap/local/helper-go/install.go @@ -110,7 +110,6 @@ func installConfFiles() error { supportNotifications, supportScheduler, systemManagementAgent, - appServiceConfigurable, } for _, v := range servicesWithConfig { @@ -121,9 +120,6 @@ func installConfFiles() error { if v == securityBootstrapperRedis { destDir = destDir + "security-bootstrapper/res-bootstrap-redis" srcDir = srcDir + "security-bootstrapper/res-bootstrap-redis" - } else if v == appServiceConfigurable { - destDir = destDir + v + "/res/rules-engine" - srcDir = srcDir + "/res/rules-engine" } else { destDir = destDir + v + "/res" srcDir = srcDir + v + "/res" @@ -154,26 +150,6 @@ func installConfFiles() error { return nil } -// installKuiper execs a shell script to install Kuiper's file into $SNAP_DATA -func installKuiper() error { - // install files using edgex-ekuiper install hook - filePath := env.Snap + "/snap.edgex-ekuiper/hooks/install" - - cmdSetupKuiper := exec.Cmd{ - Path: filePath, - Env: append(os.Environ(), "KUIPER_BASE_KEY="+env.SnapData+"/kuiper"), - Stdout: os.Stdout, - Stderr: os.Stderr, - } - - err := cmdSetupKuiper.Run() - if err != nil { - return err - } - - return nil -} - // installSecretStore: Steps 5, 8, 6, 11 func installSecretStore() error { var err error @@ -333,10 +309,6 @@ func install() { log.Fatalf("Error installing config files: %v", err) } - if err = installKuiper(); err != nil { - log.Fatalf("Error installing eKuiper: %v", err) - } - if err = installSecretStore(); err != nil { log.Fatalf("Error installing secret store: %v", err) } diff --git a/snap/local/helper-go/options.go b/snap/local/helper-go/options.go index 8d3c12fad5..5526946028 100644 --- a/snap/local/helper-go/options.go +++ b/snap/local/helper-go/options.go @@ -74,7 +74,6 @@ func processAppOptions(deferStartup bool) error { coreCommand, supportNotifications, supportScheduler, - appServiceConfigurable, securitySecretStoreSetup, securityBootstrapper, // local executable securityProxySetup, diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 14fef58eef..9acb741250 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -344,25 +344,6 @@ apps: SECRETSTORE_TOKENFILE: $SNAP_DATA/secrets/sys-mgmt-agent/secrets-token.json daemon: simple plugs: [network, network-bind] - # Deprecated - # Use standalone edgex-app-service-configurable snap - app-service-configurable: - adapter: full - after: - # This generates the consul role for this service before the service starts - - security-consul-bootstrapper - command: >- - bin/app-service-configurable -cp -r -s - -confdir $SNAP_DATA/config/app-service-configurable/res - -profile rules-engine - command-chain: - - bin/security-secret-store-env-var.sh - - bin/service-config-overrides.sh - daemon: simple - environment: - BINDING_PUBLISHTOPIC: events - SECRETSTORE_TOKENFILE: $SNAP_DATA/secrets/app-rules-engine/secrets-token.json - plugs: [network, network-bind] # helper commands the snap exposes security-proxy-setup-cmd: adapter: none @@ -444,32 +425,6 @@ apps: # who is initially created as a role with postgres - bin/drop-snap-daemon.sh plugs: [home, removable-media, network] - # Deprecated - # Use standalone edgex-ekuiper snap - kuiper: - adapter: full - after: - - security-bootstrapper-redis - command: bin/kuiperd - command-chain: - # this script is original staged from edgex-ekuiper stage-snap, - # and has been renamed - - bin/kuiper-setup-redis-credentials.sh - daemon: simple - environment: - KuiperBaseKey: $SNAP_DATA/kuiper - VAULT_TOKEN_FILE: $SNAP_DATA/secrets/edgex-ekuiper/secrets-token.json - SOURCE_FILE: $SNAP_DATA/kuiper/etc/sources/edgex.yaml - CONNECTION_FILE: $SNAP_DATA/kuiper/etc/connections/connection.yaml - plugs: [network, network-bind] - # Deprecated - # Use standalone edgex-ekuiper snap - kuiper-cli: - adapter: full - command: bin/kuiper - environment: - KuiperBaseKey: $SNAP_DATA/kuiper - plugs: [home, network, network-bind] parts: static-packages: @@ -771,60 +726,6 @@ parts: organize: vault: bin/vault - # Deprecated - app-service-configurable: - plugin: nil - stage-snaps: - - edgex-app-service-configurable/latest/stable - stage: - # Exclude every profile other than the "rules-engine": - - -res/external-mqtt-trigger/configuration.toml - - -res/functional-tests/configuration.toml - - -res/http-export/configuration.toml - - -res/mqtt-export/configuration.toml - - -res/push-to-core/configuration.toml - - -res/sample/configuration.toml - # Exclude files in usr folder other than the "Attribution.txt" and "LICENSE": - - -usr/lib/* - - -usr/share/doc/libnorm1/* - - -usr/share/doc/libpgm-5.2-0/* - # Exclude snap extras - - -bin/helper-go - - -bin/source-env-file.sh - - -bin/service-wrapper.sh - - # Deprecated - kuiper: - plugin: nil - stage-snaps: - - edgex-ekuiper/1/stable - organize: - bin/setup-redis-credentials.sh: bin/kuiper-setup-redis-credentials.sh - stage: - # Exclude redundant dependencies - - -usr/bin/curl - - -usr/lib/*/libcurl* - - -usr/lib/*/liblber* - - -usr/lib/*/libldap* - - -usr/lib/*/libnorm* - - -usr/lib/*/libpgm* - - -usr/lib/*/libasn1* - - -usr/lib/*/libgssapi* - - -usr/lib/*/libhcrypto* - - -usr/lib/*/libheimbase* - - -usr/lib/*/libheimntlm* - - -usr/lib/*/libhx509* - - -usr/lib/*/libkrb5* - - -usr/lib/*/libroken* - - -usr/lib/*/libwind* - - -usr/share/doc/libcurl* - - -usr/share/doc/curl - - -usr/share/doc/libldap* - - -usr/share/doc/libnorm* - - -usr/share/doc/libpgm* - - -usr/share/doc/libheimbase1-heimdal - - -usr/share/doc/libroken18-heimdal - metadata: plugin: nil source: https://github.com/canonical/edgex-snap-metadata.git