Files
fission-src/cmd/preupgradechecks/main.go
T
Shubham BansalandGitHub 6d117ad43a Allow empty namespace for fission function and builder (#2621)
Currently, we create Fission resources in the default namespace, function-related resources are created in the fission-function namespace, whereas builder resources are created in the fission-builder namespace. This causes confusion for a lot of users.
In this fix, we allow the user to set the function and builder namespace empty so that function and builder resources are created in the same namespace as the function resource always.

If the user desires older behaviour they can functionNamespace and builderNamespace the same previous before the upgrade.

* use default namespace for fission  function and builder
* support for existing fission namespaces
* Replace builder and function namespace with template
* Fix namespace creation template

Signed-off-by: Sanket Sudake <sanketsudake@gmail.com>
2022-11-16 22:16:05 +05:30

49 lines
1.3 KiB
Go

/*
Copyright 2016 The Fission Authors.
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.
*/
package main
import (
"go.uber.org/zap"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
"github.com/fission/fission/pkg/utils/loggerfactory"
)
func main() {
logger := loggerfactory.GetLogger()
defer logger.Sync()
crdBackedClient, err := makePreUpgradeTaskClient(logger)
if err != nil {
logger.Fatal("error creating a crd client, please retry helm upgrade",
zap.Error(err))
}
ctx := signals.SetupSignalHandler()
crd := crdBackedClient.GetFunctionCRD(ctx)
if crd == nil {
logger.Info("nothing to do since CRDs are not present on the cluster")
return
}
err = crdBackedClient.LatestSchemaApplied(ctx)
if err != nil {
logger.Fatal("New CRDs are not applied", zap.Error(err))
}
crdBackedClient.VerifyFunctionSpecReferences(ctx)
}