-
Notifications
You must be signed in to change notification settings - Fork 4
Keptn executor #12
base: main
Are you sure you want to change the base?
Keptn executor #12
Conversation
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
…m/nitishm/orkestra-workflow-executor into nitishm/feat/3/add-keptn-executor
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitishm@Nitishs-MacBook-Pro.local>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
463317a
to
dd74a2f
Compare
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
dd74a2f
to
82464c0
Compare
executors/keptn/go.mod
Outdated
replace ( | ||
github.com/docker/distribution => github.com/docker/distribution v0.0.0-20191216044856-a8371794149d | ||
github.com/docker/docker => github.com/moby/moby v1.4.2-0.20200203170920-46ec8731fbce | ||
// k8s.io/api => k8s.io/api v0.20.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this left here commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possibly cruft from some experiments I was performing with keptn
executors/keptn/main.go
Outdated
@@ -0,0 +1,122 @@ | |||
package main | |||
|
|||
// https://socialsign.in/spot?nbiIP=100.124.9.55&loc=4176656e74696e65&client_mac=38:F9:D3:B5:DD:FB&domain_name=San+Diego&reason=Un-Auth-Captive&lid=network%3Dsd02&wlanName=WeWorkGuest&dn=scg.ruckuswireless.com&ssid=WeWorkGuest&mac=44:1e:98:39:aa:b0&url=http%3A%2F%2F10.239.22.1%2F&proxy=0&vlan=22&wlan=19&sip=scg.ruckuswireless.com&zoneName=tS-IA_qoXMRjSxWeD6KI8A_1627936773232&apip=10.239.12.175&sshTunnelStatus=1&uip=10.239.22.176&StartURL=https%3A%2F%2Fsocialsign.in%2Fspot%2Fsuccess |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆 I think I was trying to keep a link that I kept loosing and added it as a comment on the first editor screen I had open. Will remove
"sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
const ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be put into a common pkg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose so - maybe once we break out each executors into their own repos we can leverage the pkg/utils repo as we discussed earlier in the Orkestra PR?
var intervalStr string | ||
|
||
// Default executor params | ||
flag.StringVar(&spec, "spec", "", "Spec of the helmrelease object to apply") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Maybe some flagparse helpers that are availble to all executors if there is crossover
|
||
// Poll retries the poller function, sleeping for the given backoffDuration | ||
// If the poller times out it will return an error | ||
func Poll(ctx context.Context, poller func(chan<- bool), backoffDuration time.Duration) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, let's create a common directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will move into the pkg/utils repo since each executor will now get its own repository.
return err | ||
} | ||
|
||
for k, v := range data { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use more specific names than k
and v
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Convention in Go states use single char variables but if it helps I can expand it to give more context (I will do that)
executors/keptn/pkg/keptn/keptn.go
Outdated
|
||
func (k *Keptn) AddResourceToStage(service, project, stage, resourceURI, resourceContent string) error { | ||
// encodedResourceContent := base64.StdEncoding.EncodeToString([]byte(resourceContent)) | ||
encodedResourceContent := resourceContent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why rename? This looks like it could be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea I think it was cruft left from the comment above. Will remove.
return fmt.Errorf("expected to see one event of type %s", filter.EventType) | ||
} | ||
|
||
if dataMap, ok := eventsCtx[0].Data.(map[string]interface{}); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does keptn have a struct format of this so we don't have to use interface{}
and type-casting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unfortunately, the data is an opaque blob of data 😞 .
return "", err | ||
} | ||
|
||
stage := stages[0].StageName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why just the first stage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only ever use one stage. In the future we might support this but today we do not plan to do so
@@ -0,0 +1,13 @@ | |||
apiVersion: helm.fluxcd.io/v2beta1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's all the testwith
code doing this deep? Also, would help to have an understanding of what exactly this is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was mostly for reference - its more docs like that testwith. Let me move it into the executors/keptn
dir instead as a documentation dir.
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
Closes #3