Skip to content

Commit

Permalink
Remove Shared Application Metadata
Browse files Browse the repository at this point in the history
It transpires this is buggy and just doesn't work in real life.
  • Loading branch information
spjmurray committed Apr 22, 2024
1 parent c3ff159 commit 39650f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 35 deletions.
4 changes: 2 additions & 2 deletions charts/core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Helm chart for deploying Unikorn Core

type: application

version: v0.1.28
appVersion: v0.1.28
version: v0.1.29
appVersion: v0.1.29

icon: https://assets.unikorn-cloud.org/images/logos/dark-on-light/icon.svg
30 changes: 0 additions & 30 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,39 +18,9 @@ limitations under the License.
package constants

import (
"fmt"
"os"
"path"
"time"
)

var (
// Application is the application name.
//nolint:gochecknoglobals
Application = path.Base(os.Args[0])

// Version is the application version set via the Makefile.
//nolint:gochecknoglobals
Version string

// Revision is the git revision set via the Makefile.
//nolint:gochecknoglobals
Revision string
)

// VersionString returns a canonical version string. It's based on
// HTTP's User-Agent so can be used to set that too, if this ever has to
// call out ot other micro services.
func VersionString() string {
return fmt.Sprintf("%s/%s (revision/%s)", Application, Version, Revision)
}

// IsProduction tells us whether we need to check for silly assumptions that
// don't exist or are mostly irrelevant in development land.
func IsProduction() bool {
return Version != DeveloperVersion
}

const (
// This is the default version in the Makefile.
DeveloperVersion = "0.0.0"
Expand Down
9 changes: 6 additions & 3 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/spf13/pflag"

coreclient "github.com/unikorn-cloud/core/pkg/client"
"github.com/unikorn-cloud/core/pkg/constants"
"github.com/unikorn-cloud/core/pkg/manager/options"

klog "k8s.io/klog/v2"
Expand Down Expand Up @@ -76,10 +75,12 @@ func getManager(f ControllerFactory) (manager.Manager, error) {
return nil, err
}

application, _, _ := f.Metadata()

options := manager.Options{
Scheme: scheme,
LeaderElection: true,
LeaderElectionID: constants.Application,
LeaderElectionID: application,
}

manager, err := manager.New(config, options)
Expand All @@ -102,7 +103,9 @@ func getController(o *options.Options, manager manager.Manager, f ControllerFact
Reconciler: f.Reconciler(o, manager),
}

c, err := controller.New(constants.Application, manager, controllerOptions)
application, _, _ := f.Metadata()

c, err := controller.New(application, manager, controllerOptions)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 39650f3

Please sign in to comment.