Skip to content

Commit

Permalink
Fix runtime (#11)
Browse files Browse the repository at this point in the history
* change to Autorization

* fix runtime install

* bump
  • Loading branch information
oren-codefresh authored Jun 21, 2021
1 parent 625f9d5 commit 8290bc1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=v0.0.14
VERSION=v0.0.15
OUT_DIR=dist
YEAR?=$(shell date +"%Y")

Expand Down
24 changes: 14 additions & 10 deletions cmd/commands/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,12 @@ func updateProject(repofs fs.FS, runtimeName string) error {
if appset.Spec.Template.Labels == nil {
appset.Spec.Template.Labels = make(map[string]string)
}
if appset.Labels == nil {
appset.Labels = make(map[string]string)
}

appset.Spec.Template.Labels[store.Get().CFComponentKey] = "{{ appName }}"
appset.Spec.Template.Labels[store.Get().CFType] = store.Get().CFComponentType
appset.Labels[store.Get().CFType] = store.Get().CFRuntimeType
return repofs.WriteYamls(projPath, project, appset)
}

Expand Down Expand Up @@ -356,9 +360,9 @@ func createEventSource(repofs fs.FS, path, runtimeName string) error {
AfterStart: false,
Labels: []eventsourcev1alpha1.Selector{
{
Key: store.Get().CFComponentKey,
Operation: "!=",
Value: "",
Key: store.Get().CFType,
Operation: "==",
Value: store.Get().CFComponentType,
},
},
},
Expand All @@ -376,12 +380,12 @@ func createEventSource(repofs fs.FS, path, runtimeName string) error {
},
Namespace: runtimeName,
Filter: &eventsourcev1alpha1.ResourceFilter{
AfterStart: true,
AfterStart: false,
Labels: []eventsourcev1alpha1.Selector{
{
Key: store.Get().CFComponentKey,
Operation: "!=",
Value: "",
Key: store.Get().CFType,
Operation: "==",
Value: store.Get().CFRuntimeType,
},
},
},
Expand Down Expand Up @@ -430,7 +434,7 @@ func createSensor(repofs fs.FS, path, namespace string) error {
},
SecureHeaders: []*apicommon.SecureHeader{
{
Name: "Autorization",
Name: "Authorization",
ValueFrom: &apicommon.ValueFromSource{
SecretKeyRef: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Expand Down Expand Up @@ -471,7 +475,7 @@ func createSensor(repofs fs.FS, path, namespace string) error {
},
SecureHeaders: []*apicommon.SecureHeader{
{
Name: "Autorization",
Name: "Authorization",
ValueFrom: &apicommon.ValueFromSource{
SecretKeyRef: &v1.SecretKeySelector{
LocalObjectReference: v1.LocalObjectReference{
Expand Down
8 changes: 6 additions & 2 deletions pkg/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ type Store struct {
ArgoWorkflowsManifestsURL string
CFTokenSecret string
CFTokenSecretKey string
CFComponentKey string
CFType string
EventReportingEndpoint string
EventBusName string
ComponentsReporterName string
ComponentsReporterSA string
CFComponentType string
CFRuntimeType string
}

// Get returns the global store
Expand All @@ -72,11 +74,13 @@ func init() {
s.ArgoWorkflowsManifestsURL = ArgoWorkflowsManifestsURL
s.CFTokenSecret = "codefresh-token"
s.CFTokenSecretKey = "token"
s.CFComponentKey = "codefresh.io/component"
s.CFType = "codefresh.io/type"
s.EventReportingEndpoint = "/argo/api/events"
s.EventBusName = "codefresh-eventbus"
s.ComponentsReporterName = "components-reporter"
s.ComponentsReporterSA = "components-reporter-sa"
s.CFComponentType = "component"
s.CFRuntimeType = "runtime"
initVersion()
}

Expand Down

0 comments on commit 8290bc1

Please sign in to comment.