Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

Keptn executor #12

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

nitishm
Copy link
Contributor

@nitishm nitishm commented Aug 27, 2021

Closes #3

nitishm and others added 15 commits July 13, 2021 15:09
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>
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 <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>
@nitishm nitishm force-pushed the nitishm/feat/3/add-keptn-executor branch from 463317a to dd74a2f Compare August 27, 2021 18:46
Signed-off-by: Nitish Malhotra <nitish.malhotra@gmail.com>
@nitishm nitishm force-pushed the nitishm/feat/3/add-keptn-executor branch from dd74a2f to 82464c0 Compare August 30, 2021 16:51
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
Copy link
Contributor

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?

Copy link
Contributor Author

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

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this for?

Copy link
Contributor Author

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 (
Copy link
Contributor

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?

Copy link
Contributor Author

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")
Copy link
Contributor

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 {
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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)


func (k *Keptn) AddResourceToStage(service, project, stage, resourceURI, resourceContent string) error {
// encodedResourceContent := base64.StdEncoding.EncodeToString([]byte(resourceContent))
encodedResourceContent := resourceContent
Copy link
Contributor

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

Copy link
Contributor Author

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create keptn executor
2 participants