Skip to content

Commit

Permalink
build(snap): Remove deprecated kuiper and ASC from edgexfoundry snap (#…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
MonicaisHer authored Dec 13, 2022
1 parent 8e5fb9d commit 2918878
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 172 deletions.
9 changes: 3 additions & 6 deletions snap/local/build-helpers/bin/minimal-snap-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"


34 changes: 0 additions & 34 deletions snap/local/helper-go/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ const (
)

var (
rulesEngineServices = []string{
appServiceConfigurable,
eKuiper,
}
proxyServices = []string{
kong,
postgres,
Expand Down Expand Up @@ -72,8 +68,6 @@ var (
optionalServices = []string{
supportNotifications,
supportScheduler,
eKuiper,
appServiceConfigurable,
systemManagementAgent,
}
)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -282,9 +267,6 @@ func handleAllServices(deferStartup bool) error {
// support services
supportNotifications,
supportScheduler,
eKuiper,
// app-services
appServiceConfigurable,
// security services
securitySecretStore,
securityProxy,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 0 additions & 4 deletions snap/local/helper-go/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -28,8 +26,6 @@ const (
kong = "kong-daemon"
postgres = "postgres"
vault = "vault"
// app services
appServiceConfigurable = "app-service-configurable"
// management services
systemManagementAgent = "sys-mgmt-agent"
)
28 changes: 0 additions & 28 deletions snap/local/helper-go/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ func installConfFiles() error {
supportNotifications,
supportScheduler,
systemManagementAgent,
appServiceConfigurable,
}

for _, v := range servicesWithConfig {
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
1 change: 0 additions & 1 deletion snap/local/helper-go/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ func processAppOptions(deferStartup bool) error {
coreCommand,
supportNotifications,
supportScheduler,
appServiceConfigurable,
securitySecretStoreSetup,
securityBootstrapper, // local executable
securityProxySetup,
Expand Down
99 changes: 0 additions & 99 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2918878

Please sign in to comment.