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

Update Makefile #151

Closed
Closed
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
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
body: |
# Fence Agents Remediation ${{ github.ref_name }}
# Fence Agents Remediation v${{ inputs.version }}

## Notable Changes

Expand All @@ -77,9 +77,9 @@ jobs:
## Release Artifacts

### Images
* Operator: quay.io/medik8s/fence-agents-remediation-operator:${{ github.ref_name }}
* Bundle: quay.io/medik8s/fence-agents-remediation-operator-bundle:${{ github.ref_name }}
* Catalog aka Index: quay.io/medik8s/fence-agents-remediation-operator-catalog:${{ github.ref_name }}
* Operator: quay.io/medik8s/fence-agents-remediation-operator:v${{ inputs.version }}
* Bundle: quay.io/medik8s/fence-agents-remediation-operator-bundle:v${{ inputs.version }}
* Catalog aka Index: quay.io/medik8s/fence-agents-remediation-operator-catalog:v${{ inputs.version }}

### Source code and OLM manifests
Please find the source code and the OLM manifests in the `Assets` section below.
Expand All @@ -103,4 +103,4 @@ jobs:
previous_version: ${{ inputs.previous_version }}
ocp_version: ${{ inputs.ocp_version }}
community: 'OKD'
make_targets: "bundle-community-rh"
make_targets: "bundle-community-okd"
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM quay.io/centos/centos:stream8 AS builder
FROM quay.io/centos/centos:stream9 AS builder
RUN dnf install -y jq git \
&& dnf clean all -y

Expand Down Expand Up @@ -39,14 +39,14 @@ COPY .git/ .git/
# Build
RUN ./hack/build.sh

FROM quay.io/centos/centos:stream8
FROM quay.io/centos/centos:stream9

WORKDIR /
COPY --from=builder /workspace/manager .

# Add Fence Agents and fence-agents-aws packages
RUN dnf install -y dnf-plugins-core \
&& dnf config-manager --set-enabled ha \
&& dnf config-manager --set-enabled highavailability \
&& dnf install -y fence-agents-all fence-agents-aws fence-agents-azure-arm fence-agents-gce \
&& dnf clean all -y

Expand Down
61 changes: 42 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
## Tool Versions

# See https://github.com/kubernetes-sigs/kustomize for the last version
KUSTOMIZE_VERSION ?= [email protected]
KUSTOMIZE_VERSION ?= [email protected]
# https://github.com/kubernetes-sigs/controller-tools/releases for the last version
CONTROLLER_GEN_VERSION ?= v0.14.0
CONTROLLER_GEN_VERSION ?= v0.15.0
# See for the last version
# Why to use the git commit sha? https://github.com/kubernetes-sigs/controller-runtime/issues/1670
ENVTEST_VERSION ?= v0.0.0-20240112123317-48d9a7b44e54
ENVTEST_VERSION ?= v0.0.0-20240717190548-1ed345090869
# See https://github.com/onsi/ginkgo/releases for the last version
GINKGO_VERSION ?= v2.14.0
GINKGO_VERSION ?= v2.19.0
# See https://pkg.go.dev/golang.org/x/tools/cmd/goimports?tab=versions for the last version
GOIMPORTS_VERSION ?= v0.17.0
GOIMPORTS_VERSION ?= v0.23.0
# See https://github.com/slintes/sort-imports/releases for the last version
SORT_IMPORTS_VERSION = v0.2.1
SORT_IMPORTS_VERSION = v0.3.0
# See https://github.com/operator-framework/operator-registry/releases for the last version
OPM_VERSION ?= v1.35.0
OPM_VERSION ?= v1.45.0
# See https://github.com/operator-framework/operator-sdk/releases for the last version
OPERATOR_SDK_VERSION ?= v1.32.0
OPERATOR_SDK_VERSION ?= v1.35.0
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.28
ENVTEST_K8S_VERSION = 1.30

# OCP Version: for OKD bundle community
OCP_VERSION = 4.12

# update for major version updates to YQ_VERSION! see https://github.com/mikefarah/yq
YQ_API_VERSION = v4
YQ_VERSION = v4.44.2

# IMAGE_REGISTRY used to indicate the registery/group for the operator, bundle and catalog
IMAGE_REGISTRY ?= quay.io/medik8s
export IMAGE_REGISTRY
Expand Down Expand Up @@ -257,13 +261,13 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
## Some addition to bundle creation in the bundle
DEFAULT_ICON_BASE64 := $(shell base64 --wrap=0 ./config/assets/medik8s_blue_icon.png)
export ICON_BASE64 ?= ${DEFAULT_ICON_BASE64}
export BUNDLE_CSV ?="./bundle/manifests/$(OPERATOR_NAME).clusterserviceversion.yaml"
export CSV ?="./bundle/manifests/$(OPERATOR_NAME).clusterserviceversion.yaml"
razo7 marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: bundle-update
bundle-update: ## Update CSV fields and validate the bundle directory
sed -r -i "s|containerImage: .*|containerImage: $(IMG)|;" ${BUNDLE_CSV}
sed -r -i "s|createdAt: .*|createdAt: `date '+%Y-%m-%d %T'`|;" ${BUNDLE_CSV}
sed -r -i "s|base64data:.*|base64data: ${ICON_BASE64}|;" ${BUNDLE_CSV}
sed -r -i "s|containerImage: .*|containerImage: $(IMG)|;" ${CSV}
sed -r -i "s|createdAt: .*|createdAt: `date '+%Y-%m-%d %T'`|;" ${CSV}
sed -r -i "s|base64data:.*|base64data: ${ICON_BASE64}|;" ${CSV}
$(MAKE) bundle-validate

.PHONY: add-replaces-field
Expand All @@ -278,25 +282,38 @@ add-replaces-field: ## Add replaces field to the CSV
exit 1; \
else \
# preferring sed here, in order to have "replaces" near "version" \
sed -r -i "/ version: $(VERSION)/ a\ replaces: $(OPERATOR_NAME).v$(PREVIOUS_VERSION)" ${BUNDLE_CSV}; \
sed -r -i "/ version: $(VERSION)/ a\ replaces: $(OPERATOR_NAME).v$(PREVIOUS_VERSION)" ${CSV}; \
fi \
fi

.PHONY: bundle-reset-date
bundle-reset-date: ## Reset bundle's createdAt
sed -r -i "s|createdAt: .*|createdAt: \"\"|;" ${BUNDLE_CSV}
sed -r -i "s|createdAt: .*|createdAt: \"\"|;" ${CSV}

.PHONY: bundle-community-k8s
bundle-community-k8s: bundle-community ## Generate bundle manifests and metadata customized to Red Hat community release

.PHONY: bundle-community-rh
bundle-community-rh: bundle-community ## Generate bundle manifests and metadata customized to Red Hat community release
echo -e "\n # Annotations for OCP\n com.redhat.openshift.versions: \"v${OCP_VERSION}\"" >> bundle/metadata/annotations.yaml
.PHONY: bundle-community-okd
bundle-community-okd: bundle-community ## Generate bundle manifests and metadata customized to Red Hat community release
$(MAKE) add-replaces-field
$(MAKE) add-ocp-annotations
echo -e "\n # Annotations for OCP\n com.redhat.openshift.versions: \"v${OCP_VERSION}\"" >> bundle/metadata/annotations.yaml

.PHONY: add-ocp-annotations
add-ocp-annotations: yq ## Add OCP annotations
Comment on lines +302 to +303
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason to add it here (upstream) and not just downstream?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OKD is also verifying their existence.

medik8s/self-node-remediation#221

I will update the commit message

$(YQ) -i '.metadata.annotations."operators.openshift.io/valid-subscription" = "[\"OpenShift Kubernetes Engine\", \"OpenShift Container Platform\", \"OpenShift Platform Plus\"]"' ${CSV}
# new infrastructure annotations see https://docs.engineering.redhat.com/display/CFC/Best_Practices#Best_Practices-(New)RequiredInfrastructureAnnotations
$(YQ) -i '.metadata.annotations."features.operators.openshift.io/disconnected" = "true"' ${CSV}
$(YQ) -i '.metadata.annotations."features.operators.openshift.io/fips-compliant" = "false"' ${CSV}
$(YQ) -i '.metadata.annotations."features.operators.openshift.io/proxy-aware" = "false"' ${CSV}
$(YQ) -i '.metadata.annotations."features.operators.openshift.io/tls-profiles" = "false"' ${CSV}
$(YQ) -i '.metadata.annotations."features.operators.openshift.io/token-auth-aws" = "false"' ${CSV}
$(YQ) -i '.metadata.annotations."features.operators.openshift.io/token-auth-azure" = "false"' ${CSV}
$(YQ) -i '.metadata.annotations."features.operators.openshift.io/token-auth-gcp" = "false"' ${CSV}

.PHONY: bundle-community
bundle-community: bundle ## Update displayName field in the bundle's CSV
sed -r -i "s|displayName: Fence Agents Remediation Operator|displayName: Fence Agents Remediation Operator - Community Edition|;" ${BUNDLE_CSV}
sed -r -i "s|displayName: Fence Agents Remediation Operator|displayName: Fence Agents Remediation Operator - Community Edition|;" ${CSV}
$(MAKE) bundle-update

##@ Build Dependencies
Expand All @@ -315,6 +332,7 @@ GOIMPORTS_DIR ?= $(LOCALBIN)/goimports
SORT_IMPORTS_DIR ?= $(LOCALBIN)/sort-imports
OPM_DIR = $(LOCALBIN)/opm
OPERATOR_SDK_DIR ?= $(LOCALBIN)/operator-sdk
YQ_DIR ?= $(LOCALBIN)/yq

## Specific Tool Binaries
KUSTOMIZE = $(KUSTOMIZE_DIR)/$(KUSTOMIZE_VERSION)/kustomize
Expand All @@ -325,6 +343,7 @@ GOIMPORTS = $(GOIMPORTS_DIR)/$(GOIMPORTS_VERSION)/goimports
SORT_IMPORTS = $(SORT_IMPORTS_DIR)/$(SORT_IMPORTS_VERSION)/sort-imports
OPM = $(OPM_DIR)/$(OPM_VERSION)/opm
OPERATOR_SDK = $(OPERATOR_SDK_DIR)/$(OPERATOR_SDK_VERSION)/operator-sdk
YQ = $(YQ_DIR)/$(YQ_API_VERSION)-$(YQ_VERSION)/yq

.PHONY: kustomize
kustomize: ## Download kustomize locally if necessary.
Expand Down Expand Up @@ -396,6 +415,10 @@ opm: ## Download opm locally if necessary.
operator-sdk: ## Download operator-sdk locally if necessary.
$(call url-install-tool, $(OPERATOR_SDK), $(OPERATOR_SDK_DIR),github.com/operator-framework/operator-sdk/releases/download/$(OPERATOR_SDK_VERSION)/operator-sdk_$${OS}_$${ARCH})

.PHONY: yq
yq: ## Download yq locally if necessary.
$(call go-install-tool,$(YQ),$(YQ_DIR), github.com/mikefarah/yq/$(YQ_API_VERSION)@$(YQ_VERSION))

# url-install-tool will delete old package $2, then download $3 to $1.
define url-install-tool
@[ -f $(1) ]|| { \
Expand Down
2 changes: 1 addition & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=fence-agents-remediation
LABEL operators.operatorframework.io.bundle.channels.v1=stable
LABEL operators.operatorframework.io.bundle.channel.default.v1=stable
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.32.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.35.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ metadata:
olm.skipRange: '>=0.0.1'
operatorframework.io/suggested-namespace: openshift-workload-availability
operatorframework.io/suggested-namespace-template: '{"kind":"Namespace","apiVersion":"v1","metadata":{"name":"openshift-workload-availability","annotations":{"openshift.io/node-selector":""}}}'
operators.operatorframework.io/builder: operator-sdk-v1.32.0
operators.operatorframework.io/builder: operator-sdk-v1.35.0
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/medik8s/fence-agents-remediation
support: Medik8s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
creationTimestamp: null
labels:
app.kubernetes.io/name: fence-agents-remediation-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
creationTimestamp: null
labels:
app.kubernetes.io/name: fence-agents-remediation-operator
Expand Down
2 changes: 1 addition & 1 deletion bundle/metadata/annotations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ annotations:
operators.operatorframework.io.bundle.package.v1: fence-agents-remediation
operators.operatorframework.io.bundle.channels.v1: stable
operators.operatorframework.io.bundle.channel.default.v1: stable
operators.operatorframework.io.metrics.builder: operator-sdk-v1.32.0
operators.operatorframework.io.metrics.builder: operator-sdk-v1.35.0
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
name: fenceagentsremediations.fence-agents-remediation.medik8s.io
spec:
group: fence-agents-remediation.medik8s.io
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
controller-gen.kubebuilder.io/version: v0.15.0
name: fenceagentsremediationtemplates.fence-agents-remediation.medik8s.io
spec:
group: fence-agents-remediation.medik8s.io
Expand Down
22 changes: 11 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module github.com/medik8s/fence-agents-remediation

go 1.20
go 1.22
Copy link
Member

Choose a reason for hiding this comment

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


require (
github.com/go-logr/logr v1.4.1
github.com/medik8s/common v1.17.0
github.com/onsi/ginkgo/v2 v2.14.0
github.com/onsi/gomega v1.30.0
github.com/onsi/ginkgo/v2 v2.19.0
github.com/onsi/gomega v1.33.1
github.com/openshift/api v0.0.0-20230621174358-ea40115b9fa6
github.com/openshift/client-go v0.0.0-20230626133714-296133fbf75e
github.com/pkg/errors v0.9.1
Expand All @@ -29,14 +29,14 @@ require (
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/pprof v0.0.0-20240722153945-304e4f0156b8 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
Expand All @@ -56,16 +56,16 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/term v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
golang.org/x/tools v0.23.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/protobuf v1.31.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
Loading