Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove duplicate workflow installation and deletion #99

Closed
wants to merge 34 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
61c1bea
refactor load-test
Feb 12, 2022
07a82b0
refactor load-tests
Feb 12, 2022
b2e6286
Update go modules also
Feb 12, 2022
e259f63
replace using script template workflow
Feb 15, 2022
a2c927f
fix: controller performance optimization
Feb 15, 2022
853d8ae
fix: cleanup
Feb 15, 2022
112a508
fix: cleanup
Feb 15, 2022
b9ec0cc
fix: remove waitgroup what wait for itself
Feb 15, 2022
899c8bc
fix: remove duplicate runWorkflow call even after workflow has been c…
Feb 15, 2022
cea2530
Improve: decouple addon prereq and install installation
Feb 16, 2022
e695cdf
Fix: remove duplicate addon exec and install
Feb 16, 2022
490f2e4
Fix: remove duplicate deletion call
Feb 16, 2022
92e9356
remove load-test code from the PR
Feb 16, 2022
786b2e3
remove test-load code
Feb 16, 2022
6941ad8
Add clientset comment marker generating clientset code
Feb 16, 2022
4d1f5d3
Update Makefile with code-generator
Feb 16, 2022
68f2cd2
fix: generate clientset for addon APIGroups
Feb 16, 2022
6f1150a
fix: update api
Feb 16, 2022
24fdfbc
fix: refer to API new location
Feb 16, 2022
52b3401
Fix: use addon api clientset update addon cr status
Feb 17, 2022
ec84cb4
Fix: remove memory cache
Feb 17, 2022
5a400a8
Fix: list addons from cluster
Feb 17, 2022
523521e
revert wrong commands
Feb 17, 2022
9d87f7f
Fix: workflow installation only once
Feb 18, 2022
729b1ab
Fix controller test setup
Feb 28, 2022
d753ce3
Revert "Fix controller test setup"
Feb 28, 2022
0e56d06
Revert "Revert "Fix controller test setup""
Feb 28, 2022
a5f2ba7
Revert merge errors
Feb 28, 2022
f32f5fe
revert merge mistakes
Feb 28, 2022
84e39b2
Revert merge errors
Feb 28, 2022
f878267
Fix controller tests
Feb 28, 2022
36160c3
Fix controller checksum bug based on unit tests
Feb 28, 2022
ff1b032
Merge branch 'master' into tests-and-perf
Feb 28, 2022
2355b35
Fix: controller unit test cases
Feb 28, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

70 changes: 0 additions & 70 deletions .github/workflows/pr-gate.yml

This file was deleted.

133 changes: 0 additions & 133 deletions .goreleaser.yml

This file was deleted.

1 change: 0 additions & 1 deletion .tool-versions

This file was deleted.

46 changes: 44 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,20 @@ all: test manager addonctl

# Run tests
test: generate fmt vet manifests
go test ./api/... ./controllers/... ./pkg/... ./cmd/... -coverprofile cover.out
go test ./api/... ./controllers/... ./pkg/... ./cmd/... -v -coverprofile cover.out

# tests both controllers and api
.PHONY: test.controllers
test.controllers:
go test -v -race ./controllers/... -coverprofile cover.out

.PHONY: test.pkg
test.pkg:
go test -v -race ./pkg/... -coverprofile cover.out

.PHONY: test.cmd
test.cmd:
go test -v -race ./cmd/... -coverprofile cover.out

# Run E2E tests
bdd: fmt vet deploy
Expand Down Expand Up @@ -95,9 +108,22 @@ vet:
go vet ./...

# Generate code
generate: controller-gen
generate: controller-gen types
$(CONTROLLER_GEN) object:headerFile=./hack/boilerplate.go.txt paths=./api/...

# generates many other files (listers, informers, client etc).
api/addon/v1alpha1/zz_generated.deepcopy.go: $(TYPES)
ln -s . v1
$(CODE_GENERATOR_GEN)/generate-groups.sh \
"deepcopy,client,informer,lister" \
github.com/keikoproj/addon-manager/pkg/client github.com/keikoproj/addon-manager/api\
addon:v1alpha1 \
--go-header-file ./hack/custom-boilerplate.go.txt
rm -rf v1

.PHONY: types
types: api/addon/v1alpha1/zz_generated.deepcopy.go

# Build the docker image
docker-build: manager
docker build --build-arg COMMIT=${GIT_COMMIT} --build-arg DATE=${BUILD_DATE} -t ${IMG} .
Expand Down Expand Up @@ -130,3 +156,19 @@ CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif

code-generator:
ifeq (, $(shell which code-generator))
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
curl -L -o code-generator.zip https://github.com/kubernetes/code-generator/archive/refs/tags/v0.21.5.zip ;\
unzip code-generator.zip ;\
mv code-generator-0.21.5 $(GOPATH)/bin/ ;\
rm -rf code-generator.zip ;\
}
CODE_GENERATOR_GEN=$(GOBIN)/code-generator-0.21.5
else
CODE_GENERATOR_GEN=$(shell which code-generator)
endif
28 changes: 28 additions & 0 deletions api/addon/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package addon

import "time"

// Addon constants
const (
Group string = "addonmgr.keikoproj.io"
Version string = "v1alpha1"
APIVersion string = Group + "/" + Version
AddonKind string = "Addon"
AddonSingular string = "addon"
AddonPlural string = "addons"
AddonShortName string = "addon"
AddonFullName string = AddonPlural + "." + Group

ManagedNameSpace string = "addon-manager-system"

AddonResyncPeriod = 20 * time.Minute

FinalizerName = "delete.addonmgr.keikoproj.io"

ResourceDefaultManageByLabel = "app.kubernetes.io/managed-by"
ResourceDefaultManageByValue = "addonmgr.keikoproj.io"
ResourceDefaultOwnLabel = "app.kubernetes.io/name"
ResourceDefaultPartLabel = "app.kubernetes.io/part-of"

TTL = time.Duration(3) * time.Hour // 1 hour
)
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ const (
CnabPkg PackageType = "cnab"
// CompositePkg is a package type representing a composite package structure, just yamls
CompositePkg PackageType = "composite"
// Error used to indicate system error
Error ApplicationAssemblyPhase = "error"
)

// CmdType represents a function that can be performed with arguments
Expand Down Expand Up @@ -292,6 +294,8 @@ type AddonStatus struct {
// +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.lifecycle.installed"
// +kubebuilder:printcolumn:name="REASON",type="string",JSONPath=".status.reason"
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type Addon struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -301,18 +305,14 @@ type Addon struct {
}

// +kubebuilder:object:root=true

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// AddonList contains a list of Addon
type AddonList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Addon `json:"items"`
}

func init() {
SchemeBuilder.Register(&Addon{}, &AddonList{})
}

// GetPackageSpec returns the addon package details from addon spec
func (a *Addon) GetPackageSpec() PackageSpec {
return PackageSpec{
Expand Down Expand Up @@ -383,3 +383,21 @@ func (a *Addon) CalculateChecksum() string {
func (a *Addon) GetInstallStatus() ApplicationAssemblyPhase {
return a.Status.Lifecycle.Installed
}

func (p ApplicationAssemblyPhase) Succeeded() bool {
switch p {
case Succeeded:
return true
default:
return false
}
}

func (p ApplicationAssemblyPhase) Completed() bool {
switch p {
case Succeeded, Failed, Error:
return true
default:
return false
}
}
3 changes: 3 additions & 0 deletions api/addon/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// +k8s:deepcopy-gen=package
// +groupName=addonmgr.keikoproj.io
package v1alpha1
Loading