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

Run framework tests on OCM PRs #125

Merged
merged 2 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions .github/workflows/framework-kind.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Framework

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
pull_request:
branches:
- main

jobs:
fw-kind-tests:
name: KinD
uses: stolostron/governance-policy-framework/.github/workflows/kind.yml@main
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,23 @@ kind-bootstrap-cluster: kind-bootstrap-cluster-dev kind-deploy-controller
.PHONY: kind-bootstrap-cluster-dev
kind-bootstrap-cluster-dev: kind-create-all-clusters install-crds kind-controller-all-kubeconfigs


HOSTED ?= none

.PHONY: kind-deploy-controller-dev
kind-deploy-controller-dev:
if [ "$(HOSTED)" = "hosted" ]; then\
$(MAKE) kind-deploy-controller-dev-addon ;\
else\
$(MAKE) kind-deploy-controller-dev-normal ;\
fi

.PHONY: kind-deploy-controller
kind-deploy-controller: generate-operator-yaml install-resources deploy
-kubectl create secret -n $(KIND_NAMESPACE) generic hub-kubeconfig --from-file=kubeconfig=$(HUB_CONFIG_INTERNAL) --kubeconfig=$(MANAGED_CONFIG)_e2e

.PHONY: kind-deploy-controller-dev
kind-deploy-controller-dev: kind-deploy-controller
.PHONY: kind-deploy-controller-dev-normal
kind-deploy-controller-dev-normal: kind-deploy-controller
@echo Pushing image to KinD cluster
kind load docker-image $(REGISTRY)/$(IMG):$(TAG) --name $(KIND_NAME)
@echo "Patch deployment image"
Expand All @@ -187,6 +198,13 @@ kind-controller-all-kubeconfigs:
CLUSTER_NAME=$(HUB_CLUSTER_NAME) KIND_NAME=$(KIND_HUB_NAME) KIND_CLUSTER_NAME=$(KIND_HUB_CLUSTER_NAME) $(MAKE) kind-controller-kubeconfig
yq e '.clusters[0].cluster.server = "https://$(KIND_HUB_NAME)-control-plane:6443"' $(HUB_CONFIG) > $(HUB_CONFIG_INTERNAL)

.PHONY: kind-deploy-controller-dev-addon
kind-deploy-controller-dev-addon:
@echo Hosted mode test
kind load docker-image $(REGISTRY)/$(IMG):$(TAG) --name $(KIND_NAME)
kubectl annotate -n $(subst -hosted,,$(KIND_NAMESPACE)) --overwrite managedclusteraddon governance-policy-framework\
addon.open-cluster-management.io/values='{"global":{"imagePullPolicy": "Never", "imageOverrides":{"governance_policy_framework_addon": "$(REGISTRY)/$(IMG):$(TAG)"}}}'
Comment on lines +201 to +206
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 cherry-picked this commit from stolostron in order to fix the hosted mode tests. Is there a reason we would use governance_policy_framework over the framework_addon?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I checked addon-controller governance_policy_framework_addon should be right I should change framework-test! Good!


Copy link
Contributor

Choose a reason for hiding this comment

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

oh why? imagePullPolicy": "Never"

.PHONY: kind-delete-cluster
kind-delete-cluster:
kind delete cluster --name $(KIND_HUB_NAME)
Expand Down