Skip to content

Commit

Permalink
fix: now use the last version release of kimup (#112)
Browse files Browse the repository at this point in the history
Co-authored-by: David MICHENEAU <david.micheneau@orange.com>
  • Loading branch information
dmicheneau and David MICHENEAU authored Nov 6, 2024
1 parent b4f498e commit dbc63fc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
6 changes: 5 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ release:
prerelease: auto

snapshot:
version_template: "{{ .Tag }}"
version_template: "{{ .Version }}"

checksum:
name_template: '{{ .ProjectName }}-{{ .Version }}-checksums.txt'
Expand All @@ -26,6 +26,8 @@ builds:
- arm64
env:
- CGO_ENABLED=0
ldflags:
- '-X github.com/orange-cloudavenue/kube-image-updater/internal/models.Version={{.Tag}}'
- id: "kimup-operator"
binary: kimup-operator
main: ./cmd/operator
Expand All @@ -37,6 +39,8 @@ builds:
- arm64
env:
- CGO_ENABLED=0
ldflags:
- '-X github.com/orange-cloudavenue/kube-image-updater/internal/models/models.Version={{.Tag}}'

dockers:
# * KIMUP
Expand Down
8 changes: 2 additions & 6 deletions cmd/kimup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ import (
"github.com/orange-cloudavenue/kube-image-updater/internal/triggers"
)

var (
version = "dev" // set by build script

c = make(chan os.Signal, 1)
)
var c = make(chan os.Signal, 1)

func init() {
// Initialize the metrics
Expand All @@ -40,7 +36,7 @@ func init() {
func main() {
signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)

log.WithField("version", version).Info("Starting kimup", version)
log.WithField("version", models.Version).Info("Starting kimup", models.Version)

// kubernetes golang library provide flag "kubeconfig" to specify the path to the kubeconfig file
k, err := kubeclient.New(flag.Lookup("kubeconfig").Value.String(), kubeclient.ComponentController)
Expand Down
6 changes: 0 additions & 6 deletions internal/controller/const.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package controller

var Version = "dev"

const (
BaseKimupImage = "ghcr.io/orange-cloudavenue/"

Expand All @@ -14,10 +12,6 @@ const (
KimupController = "controller"
KimupControllerName = KimupName + "-" + KimupController
KimupControllerImage = BaseKimupImage + KimupControllerName

KimupAdmissionController = "admission-controler"
KimupAdmissionControllerName = KimupName + "-" + KimupAdmissionController
KimupAdmissionControllerImage = BaseKimupImage + KimupAdmissionControllerName
)

const (
Expand Down
7 changes: 4 additions & 3 deletions internal/controller/resources_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/orange-cloudavenue/kube-image-updater/api/v1alpha1"
"github.com/orange-cloudavenue/kube-image-updater/internal/models"
"github.com/orange-cloudavenue/kube-image-updater/internal/utils"
)

Expand All @@ -23,7 +24,7 @@ func GetKimupControllerResources(ctx context.Context, ki v1alpha1.Kimup) []Objec
)

if image == "" {
image = fmt.Sprintf("%s:%s", KimupControllerImage, Version)
image = fmt.Sprintf("%s:%s", KimupControllerImage, models.Version)
}

// Create a deployment
Expand All @@ -48,7 +49,7 @@ func GetKimupControllerResources(ctx context.Context, ki v1alpha1.Kimup) []Objec
KubernetesAppComponentLabelKey: KimupControllerName,
KubernetesAppInstanceNameLabel: name,
KubernetesAppNameLabelKey: KimupControllerName,
KubernetesAppVersionLabelKey: Version,
KubernetesAppVersionLabelKey: models.Version,
KubernetesPartOfLabelKey: KimupControllerName,
KubernetesManagedByLabelKey: KimupOperatorName,
"app": name,
Expand Down Expand Up @@ -135,7 +136,7 @@ func GetKimupControllerResources(ctx context.Context, ki v1alpha1.Kimup) []Objec
KubernetesAppComponentLabelKey: KimupControllerName,
KubernetesAppInstanceNameLabel: name,
KubernetesAppNameLabelKey: KimupControllerName,
KubernetesAppVersionLabelKey: Version,
KubernetesAppVersionLabelKey: models.Version,
KubernetesPartOfLabelKey: KimupControllerName,
KubernetesManagedByLabelKey: KimupOperatorName,
"app": name,
Expand Down
3 changes: 3 additions & 0 deletions internal/models/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package models

var Version = "dev"

0 comments on commit dbc63fc

Please sign in to comment.