Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.
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
6 changes: 6 additions & 0 deletions head
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: {{ include "actions-runner-controller.managerRoleName" . }}
rules:
14 changes: 14 additions & 0 deletions simple-arc-operator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~
2 changes: 1 addition & 1 deletion simple-arc-operator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM quay.io/operator-framework/helm-operator:v1.23.0
FROM quay.io/operator-framework/helm-operator:v1.26.0

ENV HOME=/opt/helm
COPY watches.yaml ${HOME}/watches.yaml
Expand Down
35 changes: 24 additions & 11 deletions simple-arc-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
# This variable is used to construct full image tags for bundle and catalog images.
#
# For example, running 'make bundle-build bundle-push catalog-build catalog-push' will build and push both
# example.com/simple-arc-operator-bundle:$VERSION and example.com/simple-arc-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= ghcr.io/boxboat-github-practice/simple-arc-operator
# boxboat.com/simple-arc-operator-bundle:$VERSION and boxboat.com/simple-arc-operator-catalog:$VERSION.
IMAGE_TAG_BASE ?= boxboat.com/simple-arc-operator

# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
Expand All @@ -52,10 +52,6 @@ IMG ?= controller:latest
.PHONY: all
all: docker-build

.PHONY: tag-test
tag-test:
echo $(IMG)

##@ General

# The help target prints out all targets with their descriptions organized
Expand Down Expand Up @@ -87,6 +83,23 @@ docker-build: ## Build docker image with the manager.
docker-push: ## Push docker image with the manager.
docker push ${IMG}

# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
# - be able to push the image for your registry (i.e. if you do not inform a valid value via IMG=<myregistry/image:<tag>> than the export will fail)
# To properly provided solutions that supports more than one platform you should use this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: test ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder
docker buildx use project-v3-builder
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
- docker buildx rm project-v3-builder
rm Dockerfile.cross

##@ Deployment

.PHONY: install
Expand All @@ -107,7 +120,7 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
$(KUSTOMIZE) build config/default | kubectl delete -f -

OS := $(shell uname -s | tr '[:upper:]' '[:lower:]')
ARCH := $(shell uname -m | sed 's/x86_64/amd64/')
ARCH := $(shell uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')

.PHONY: kustomize
KUSTOMIZE = $(shell pwd)/bin/kustomize
Expand All @@ -117,7 +130,7 @@ ifeq (,$(shell which kustomize 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(KUSTOMIZE)) ;\
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.5/kustomize_v4.5.5_$(OS)_$(ARCH).tar.gz | \
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.7/kustomize_v4.5.7_$(OS)_$(ARCH).tar.gz | \
tar xzf - -C bin/ ;\
}
else
Expand All @@ -133,7 +146,7 @@ ifeq (,$(shell which helm-operator 2>/dev/null))
@{ \
set -e ;\
mkdir -p $(dir $(HELM_OPERATOR)) ;\
curl -sSLo $(HELM_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.23.0/helm-operator_$(OS)_$(ARCH) ;\
curl -sSLo $(HELM_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.26.0/helm-operator_$(OS)_$(ARCH) ;\
chmod +x $(HELM_OPERATOR) ;\
}
else
Expand All @@ -143,9 +156,9 @@ endif

.PHONY: bundle
bundle: kustomize ## Generate bundle manifests and metadata, then validate generated files.
operator-sdk generate kustomize manifests -q --interactive=false
operator-sdk generate kustomize manifests -q
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle $(BUNDLE_GEN_FLAGS)
operator-sdk bundle validate ./bundle

.PHONY: bundle-build
Expand Down
6 changes: 3 additions & 3 deletions simple-arc-operator/PROJECT
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
domain: example.com
domain: boxboat.com
layout:
- helm.sdk.operatorframework.io/v1
plugins:
Expand All @@ -9,8 +9,8 @@ resources:
- api:
crdVersion: v1
namespaced: true
domain: example.com
group: charts
domain: boxboat.com
group: github-practice
kind: ActionsRunnerController
version: v1alpha1
version: "3"
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: actionsrunnercontrollers.charts.example.com
name: actionsrunnercontrollers.github-practice.boxboat.com
spec:
group: charts.example.com
group: github-practice.boxboat.com
names:
kind: ActionsRunnerController
listKind: ActionsRunnerControllerList
Expand Down
2 changes: 1 addition & 1 deletion simple-arc-operator/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# since it depends on service name and namespace that are out of this kustomize package.
# It should be run by config/default
resources:
- bases/charts.example.com_actionsrunnercontrollers.yaml
- bases/github-practice.boxboat.com_actionsrunnercontrollers.yaml
#+kubebuilder:scaffold:crdkustomizeresource
4 changes: 1 addition & 3 deletions simple-arc-operator/config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,4 @@ patchesStrategicMerge:
# endpoint w/o any authn/z, please comment the following line.
- manager_auth_proxy_patch.yaml

# Mount the controller config file for loading manager configurations
# through a ComponentConfig type
#- manager_config_patch.yaml

16 changes: 16 additions & 0 deletions simple-arc-operator/config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ metadata:
spec:
template:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
- ppc64le
- s390x
- key: kubernetes.io/os
operator: In
values:
- linux
containers:
- name: kube-rbac-proxy
securityContext:
Expand Down
10 changes: 0 additions & 10 deletions simple-arc-operator/config/default/manager_config_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,3 @@ spec:
spec:
containers:
- name: manager
args:
- "--config=controller_manager_config.yaml"
volumeMounts:
- name: manager-config
mountPath: /controller_manager_config.yaml
subPath: controller_manager_config.yaml
volumes:
- name: manager-config
configMap:
name: manager-config
20 changes: 0 additions & 20 deletions simple-arc-operator/config/manager/controller_manager_config.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions simple-arc-operator/config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
resources:
- manager.yaml

generatorOptions:
disableNameSuffixHash: true

configMapGenerator:
- files:
- controller_manager_config.yaml
name: manager-config
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: ghcr.io/boxboat-github-practice/simple-arc-operator
newTag: "20230103.2"

patchesJson6902:
- target:
kind: Deployment
Expand Down
32 changes: 32 additions & 0 deletions simple-arc-operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ kind: Namespace
metadata:
labels:
control-plane: controller-manager
app.kubernetes.io/name: namespace
app.kubernetes.io/instance: system
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: simple-arc-operator
app.kubernetes.io/part-of: simple-arc-operator
app.kubernetes.io/managed-by: kustomize
name: system
---
apiVersion: apps/v1
Expand All @@ -12,6 +18,12 @@ metadata:
namespace: system
labels:
control-plane: controller-manager
app.kubernetes.io/name: deployment
app.kubernetes.io/instance: controller-manager
app.kubernetes.io/component: manager
app.kubernetes.io/created-by: simple-arc-operator
app.kubernetes.io/part-of: simple-arc-operator
app.kubernetes.io/managed-by: kustomize
spec:
selector:
matchLabels:
Expand All @@ -24,6 +36,26 @@ spec:
labels:
control-plane: controller-manager
spec:
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
# according to the platforms which are supported by your solution.
# It is considered best practice to support multiple architectures. You can
# build your manager image using the makefile target docker-buildx.
# affinity:
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: kubernetes.io/arch
# operator: In
# values:
# - amd64
# - arm64
# - ppc64le
# - s390x
# - key: kubernetes.io/os
# operator: In
# values:
# - linux
securityContext:
runAsNonRoot: true
# TODO(user): For common cases that do not require escalating privileges
Expand Down
6 changes: 6 additions & 0 deletions simple-arc-operator/config/prometheus/monitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ kind: ServiceMonitor
metadata:
labels:
control-plane: controller-manager
app.kubernets.io/name: servicemonitor
app.kubernetes.io/instance: controller-manager-metrics-monitor
app.kubernetes.io/component: metrics
app.kubernetes.io/created-by: simple-arc-operator
app.kubernetes.io/part-of: simple-arc-operator
app.kubernetes.io/managed-by: kustomize
name: controller-manager-metrics-monitor
namespace: system
spec:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: actionsrunnercontroller-editor-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: simple-arc-operator
app.kubernetes.io/part-of: simple-arc-operator
app.kubernetes.io/managed-by: kustomize
name: actionsrunnercontroller-editor-role
rules:
- apiGroups:
- charts.example.com
- github-practice.boxboat.com
resources:
- actionsrunnercontrollers
verbs:
Expand All @@ -17,7 +24,7 @@ rules:
- update
- watch
- apiGroups:
- charts.example.com
- github-practice.boxboat.com
resources:
- actionsrunnercontrollers/status
verbs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,25 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: actionsrunnercontroller-viewer-role
app.kubernetes.io/component: rbac
app.kubernetes.io/created-by: simple-arc-operator
app.kubernetes.io/part-of: simple-arc-operator
app.kubernetes.io/managed-by: kustomize
name: actionsrunnercontroller-viewer-role
rules:
- apiGroups:
- charts.example.com
- github-practice.boxboat.com
resources:
- actionsrunnercontrollers
verbs:
- get
- list
- watch
- apiGroups:
- charts.example.com
- github-practice.boxboat.com
resources:
- actionsrunnercontrollers/status
verbs:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: metrics-reader
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: simple-arc-operator
app.kubernetes.io/part-of: simple-arc-operator
app.kubernetes.io/managed-by: kustomize
name: metrics-reader
rules:
- nonResourceURLs:
Expand Down
7 changes: 7 additions & 0 deletions simple-arc-operator/config/rbac/auth_proxy_role.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/name: clusterrole
app.kubernetes.io/instance: proxy-role
app.kubernetes.io/component: kube-rbac-proxy
app.kubernetes.io/created-by: simple-arc-operator
app.kubernetes.io/part-of: simple-arc-operator
app.kubernetes.io/managed-by: kustomize
name: proxy-role
rules:
- apiGroups:
Expand Down
Loading