From d58ad65d8680232dc145deffc013e0f38098bf6b Mon Sep 17 00:00:00 2001 From: Farshid Tavakolizadeh Date: Wed, 12 Apr 2023 18:41:51 +0200 Subject: [PATCH] feat(snap)!: Remove secrets-config proxy snap options BREAKING CHANGE: Removing the support for the apps.secrets-config.proxy.* snap options Signed-off-by: Farshid Tavakolizadeh --- snap/local/helper-go/common.go | 2 -- snap/local/helper-go/configure.go | 10 ------- snap/local/helper-go/main.go | 2 -- snap/local/helper-go/options.go | 44 ------------------------------- snap/snapcraft.yaml | 9 ------- 5 files changed, 67 deletions(-) delete mode 100644 snap/local/helper-go/options.go diff --git a/snap/local/helper-go/common.go b/snap/local/helper-go/common.go index a0eb92439b..86bd1d75d0 100644 --- a/snap/local/helper-go/common.go +++ b/snap/local/helper-go/common.go @@ -30,9 +30,7 @@ const ( securityBootstrapperConsul = "security-consul-bootstrapper" securityBootstrapperNginx = "security-bootstrapper-nginx" securityFileTokenProvider = "security-file-token-provider" - secretsConfig = "secrets-config" vault = "vault" - secretsConfigProcessor = "secrets-config-processor" ) var ( diff --git a/snap/local/helper-go/configure.go b/snap/local/helper-go/configure.go index e4c08f5d9a..b9c042b943 100644 --- a/snap/local/helper-go/configure.go +++ b/snap/local/helper-go/configure.go @@ -169,15 +169,5 @@ func configure() { log.Fatalf("Error unsetting snap option: %v", err) } - if v, err := snapctl.Get("apps.secrets-config").Run(); err != nil { - log.Fatalf("Error reading snap option: %v", err) - } else if v != "" { - // Schedule the startup of the oneshot service to apply secrets config options - // once the depended services are ready (see snapcraft.yaml: apps.secrets-config-processor.after) - if err := snapctl.Start(snapService(secretsConfigProcessor)).Run(); err != nil { - log.Fatalf("Error starting service: %s", err) - } - } - log.Debug("End") } diff --git a/snap/local/helper-go/main.go b/snap/local/helper-go/main.go index 608ce1b68b..7dee43c25e 100644 --- a/snap/local/helper-go/main.go +++ b/snap/local/helper-go/main.go @@ -30,8 +30,6 @@ func main() { install() case "configure": // snap configure hook configure() - case "options": // apply snap options to apps - options() default: panic("Unknown subcommand: " + subCommand) } diff --git a/snap/local/helper-go/options.go b/snap/local/helper-go/options.go deleted file mode 100644 index 02d844edea..0000000000 --- a/snap/local/helper-go/options.go +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2022 Canonical Ltd - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -package main - -import ( - "flag" - "os" - - "github.com/canonical/edgex-snap-hooks/v3/log" - opt "github.com/canonical/edgex-snap-hooks/v3/options" -) - -// options is called by the main function to configure options -func options() { - flagset := flag.NewFlagSet("options", flag.ExitOnError) - app := flagset.String("app", "", "Name of the app") - flagset.Parse(os.Args[2:]) - - log.SetComponentName("options") - - if *app == "" { - log.Fatalf("Missing app name") - } - - log.Info("Processing snap options for " + *app) - if err := opt.ProcessAppCustomOptions(*app); err != nil { - log.Fatalf("Could not process custom options: %v", err) - } - -} diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index b70768667c..1511a88406 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -263,15 +263,6 @@ apps: install-mode: disable plugs: [network, network-bind] stop-timeout: 10s - # this service should be started for processing secrets-config snap options and executing corresponding commands - secrets-config-processor: - after: - - vault - command: bin/helper-go options --app secrets-config - daemon: oneshot - install-mode: disable - start-timeout: 1m - plugs: [network] # this service pushes common configuration source into Configuration Provider core-common-config-bootstrapper: after: