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

refactor: addon refactored to an opeator #12

Merged
merged 1 commit into from
Jan 25, 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
7 changes: 2 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@ insert_final_newline = true
max_line_length = 120
tab_width = 4

[{*.yaml,*.yml}]
indent_size = 2

[*.json]
indent_size = 2
[Makefile*]
indent_style = tab
11 changes: 7 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ on:
branches:
- main
paths:
- 'multicluster-resiliency-addon/**'
- templates/**
- Chart.yaml
- values.schema.json
- values.yaml
pull_request:
branches:
- main
Expand All @@ -23,7 +26,7 @@ jobs:
- name: Get Helm version
id: helm
run: |
version=$(cat Makefile | grep "HELM_VERSION :=" | cut -d'=' -f2 | xargs)
version=$(cat Makefile | grep "VERSION_HELM =" | cut -d'=' -f2 | xargs)
echo "version=$version" >> $GITHUB_OUTPUT

- name: Install helm
Expand All @@ -32,7 +35,7 @@ jobs:
version: ${{ steps.helm.outputs.version }}

- name: Lint chart
run: helm lint multicluster-resiliency-addon
run: helm lint .

- name: Test templates
run: helm template multicluster-resiliency-addon > /dev/null
run: helm template . > /dev/null
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
bin
*.tgz
operator_tmp
regional-dr-trigger-operator*
6 changes: 6 additions & 0 deletions .helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.*
*.tgz
regional-dr-trigger-operator*
bin
opeartor_tmp
Makefile
15 changes: 15 additions & 0 deletions Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (c) 2023 Red Hat, Inc.

apiVersion: v2
name: regional-dr-trigger-operator
description: This Operator will use ODF's Regional DR API for triggering a Failover process for all Applications affiliated with a cluster which is reported as not available by ACM's Managed Cluster API.
version: 1.0.0
appVersion: "0.1.0"
home: https://github.com/RHEcosystemAppEng/regional-dr-trigger-operator
keywords:
- acm
- odf
- openshift
- regional dr
- disaster recovery
icon: https://raw.githubusercontent.com/RHEcosystemAppEng/regional-dr-trigger-operator/main/hack/logo-rh-icon-standard-rgb.png
37 changes: 0 additions & 37 deletions DCO

This file was deleted.

53 changes: 38 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,50 @@
# Copyright (c) 2023 Red Hat, Inc.

################################################
###### Regional DR Trigger Operator Chart ######
################################################
LOCALBIN = $(shell pwd)/bin
OS_ARCH = $(shell go env GOOS)-$(shell go env GOARCH)
$(LOCALBIN):
mkdir -p $(LOCALBIN)

OS=$(shell go env GOOS)
ARCH=$(shell go env GOARCH)

BIN_CURL ?= curl
BIN_YQ ?= yq

BIN_HELM ?= $(LOCALBIN)/helm
HELM_VERSION := v3.13.0
HELM_URL := https://get.helm.sh/helm-$(HELM_VERSION)-$(OS_ARCH).tar.gz
VERSION_HELM = v3.14.0

OPERATOR_REPO ?= https://github.com/RHEcosystemAppEng/regional-dr-trigger-operator
OPERATOR_BRANCH =? main

CHART_VERSION ?= $(shell $(BIN_YQ) '.version' Chart.yaml)

TEMP_FOLDER = operator_tmp # ignored by git

.PHONY: lint
lint: $(LOCALBIN) $(BIN_HELM)
@$(BIN_HELM) lint multicluster-resiliency-addon
lint: $(BIN_HELM)
$(BIN_HELM) lint .

.PHONY: package
package: $(LOCALBIN) $(BIN_HELM)
@$(BIN_HELM) package multicluster-resiliency-addon
package: $(BIN_HELM)
$(BIN_HELM) package .

.PHONY: test
test: $(LOCALBIN) $(BIN_HELM)
@$(BIN_HELM) template multicluster-resiliency-addon > /dev/null
test: $(BIN_HELM)
$(BIN_HELM) template . > /dev/null

.PHONY: install
install: $(LOCALBIN) $(BIN_HELM)
@$(BIN_HELM) install --generate-name multicluster-resiliency-addon
install: $(BIN_HELM)
$(BIN_HELM) install --generate-name .

$(BIN_HELM):
curl -sSL "$(HELM_URL)" | tar xzf - -C $(LOCALBIN) --strip-components=1 --wildcards '*/helm'
.PHONY: generate
generate:
rm -rf $(TEMP_FOLDER)
git clone --branch $(OPERATOR_BRANCH) $(OPERATOR_REPO) $(TEMP_FOLDER)
cd $(TEMP_FOLDER) && $(MAKE) generate/chart CHART_VERSION=$(CHART_VERSION) CHART_TARGET=$(PWD)
rm -rf $(TEMP_FOLDER)

$(LOCALBIN):
mkdir -p $(LOCALBIN)
$(BIN_HELM): $(LOCALBIN)
$(BIN_CURL) -sSL https://get.helm.sh/helm-$(VERSION_HELM)-$(OS)-$(ARCH).tar.gz | tar xzf - -C $(LOCALBIN) --strip-components=1 --wildcards '*/helm'
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# MultiCluster Resiliency Addon Chart
# Regional DR Trigger Operator Helm Chart

_Helm Chart_ for the [MultiCluster Resiliency Addon][mcra] for [ACM][acm].
This chart is generated automatically, see [Makefile](Makefile). Please do not attempt to contribute to the chart
elements directly. Instead, check the [Regional DR Operator repository](https://github.com/RHEcosystemAppEng/regional-dr-trigger-operator)
for the scripts used to generate this chart.


<!--LINKS-->
[acm]: https://www.redhat.com/en/technologies/management/advanced-cluster-management
[mcra]: https://github.com/RHEcosystemAppEng/multicluster-resiliency-addon
This chart is used as part of the [Regional Resiliency Pattern](https://github.com/RHEcosystemAppEng/regional-resiliency-pattern).
23 changes: 0 additions & 23 deletions multicluster-resiliency-addon/.helmignore

This file was deleted.

12 changes: 0 additions & 12 deletions multicluster-resiliency-addon/Chart.yaml

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions multicluster-resiliency-addon/templates/_helpers.tpl

This file was deleted.

13 changes: 0 additions & 13 deletions multicluster-resiliency-addon/templates/addondeploymentconfig.yaml

This file was deleted.

This file was deleted.

Loading
Loading