Skip to content

Commit 2d0ad26

Browse files
authored
Regenerate e2e sample (operator-framework#3)
Signed-off-by: Catherine Chan-Tse <[email protected]>
1 parent 6ca0511 commit 2d0ad26

File tree

76 files changed

+914
-227
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+914
-227
lines changed

test/ansible/advanced-molecule-operator/Makefile

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ IMAGE_TAG_BASE ?= example.com/advanced-molecule-operator
3535
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
3636
BUNDLE_IMG ?= $(IMAGE_TAG_BASE)-bundle:v$(VERSION)
3737

38+
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
39+
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
40+
41+
# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
42+
# You can enable this value if you would like to use SHA Based Digests
43+
# To enable set flag to true
44+
USE_IMAGE_DIGESTS ?= false
45+
ifeq ($(USE_IMAGE_DIGESTS), true)
46+
BUNDLE_GEN_FLAGS += --use-image-digests
47+
endif
48+
3849
# Image URL to use all building/pushing image targets
3950
IMG ?= controller:latest
4051

@@ -61,8 +72,9 @@ help: ## Display this help.
6172
##@ Build
6273

6374
.PHONY: run
75+
ANSIBLE_ROLES_PATH?="$(shell pwd)/roles"
6476
run: ansible-operator ## Run against the configured Kubernetes cluster in ~/.kube/config
65-
ANSIBLE_ROLES_PATH="$(ANSIBLE_ROLES_PATH):$(shell pwd)/roles" $(ANSIBLE_OPERATOR) run
77+
$(ANSIBLE_OPERATOR) run
6678

6779
.PHONY: docker-build
6880
docker-build: ## Build docker image with the manager.
@@ -72,6 +84,23 @@ docker-build: ## Build docker image with the manager.
7284
docker-push: ## Push docker image with the manager.
7385
docker push ${IMG}
7486

87+
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
88+
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
89+
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
90+
# - have enable BuildKit, More info: https://docs.docker.com/develop/develop-images/build_enhancements/
91+
# - 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)
92+
# To properly provided solutions that supports more than one platform you should use this option.
93+
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
94+
.PHONY: docker-buildx
95+
docker-buildx: test ## Build and push docker image for the manager for cross-platform support
96+
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
97+
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
98+
- docker buildx create --name project-v3-builder
99+
docker buildx use project-v3-builder
100+
- docker buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross .
101+
- docker buildx rm project-v3-builder
102+
rm Dockerfile.cross
103+
75104
##@ Deployment
76105

77106
.PHONY: install
@@ -102,7 +131,7 @@ ifeq (,$(shell which kustomize 2>/dev/null))
102131
@{ \
103132
set -e ;\
104133
mkdir -p $(dir $(KUSTOMIZE)) ;\
105-
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v3.8.7/kustomize_v3.8.7_$(OS)_$(ARCH).tar.gz | \
134+
curl -sSLo - https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.5.7/kustomize_v4.5.7_$(OS)_$(ARCH).tar.gz | \
106135
tar xzf - -C bin/ ;\
107136
}
108137
else
@@ -118,7 +147,7 @@ ifeq (,$(shell which ansible-operator 2>/dev/null))
118147
@{ \
119148
set -e ;\
120149
mkdir -p $(dir $(ANSIBLE_OPERATOR)) ;\
121-
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.16.0/ansible-operator_$(OS)_$(ARCH) ;\
150+
curl -sSLo $(ANSIBLE_OPERATOR) https://github.com/operator-framework/operator-sdk/releases/download/v1.27.0/ansible-operator_$(OS)_$(ARCH) ;\
122151
chmod +x $(ANSIBLE_OPERATOR) ;\
123152
}
124153
else
@@ -130,7 +159,7 @@ endif
130159
bundle: kustomize ## Generate bundle manifests and metadata, then validate generated files.
131160
operator-sdk generate kustomize manifests -q
132161
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
133-
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
162+
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle $(BUNDLE_GEN_FLAGS)
134163
operator-sdk bundle validate ./bundle
135164

136165
.PHONY: bundle-build
@@ -149,7 +178,7 @@ ifeq (,$(shell which opm 2>/dev/null))
149178
@{ \
150179
set -e ;\
151180
mkdir -p $(dir $(OPM)) ;\
152-
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.19.1/$(OS)-$(ARCH)-opm ;\
181+
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.0/$(OS)-$(ARCH)-opm ;\
153182
chmod +x $(OPM) ;\
154183
}
155184
else

test/ansible/advanced-molecule-operator/PROJECT

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ multigroup: true
55
plugins:
66
manifests.sdk.operatorframework.io/v2: {}
77
scorecard.sdk.operatorframework.io/v2: {}
8-
sdk.x-openshift.io/v1: {}
98
projectName: advanced-molecule-operator
109
resources:
1110
- api:
@@ -43,6 +42,13 @@ resources:
4342
group: test
4443
kind: ClusterAnnotationTest
4544
version: v1alpha1
45+
- api:
46+
crdVersion: v1
47+
namespaced: true
48+
domain: example.com
49+
group: test
50+
kind: FinalizerConcurrencyTest
51+
version: v1alpha1
4652
- api:
4753
crdVersion: v1
4854
namespaced: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
name: finalizerconcurrencytests.test.example.com
6+
spec:
7+
group: test.example.com
8+
names:
9+
kind: FinalizerConcurrencyTest
10+
listKind: FinalizerConcurrencyTestList
11+
plural: finalizerconcurrencytests
12+
singular: finalizerconcurrencytest
13+
scope: Namespaced
14+
versions:
15+
- name: v1alpha1
16+
schema:
17+
openAPIV3Schema:
18+
description: FinalizerConcurrencyTest is the Schema for the finalizerconcurrencytests API
19+
properties:
20+
apiVersion:
21+
description: 'APIVersion defines the versioned schema of this representation
22+
of an object. Servers should convert recognized schemas to the latest
23+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
24+
type: string
25+
kind:
26+
description: 'Kind is a string value representing the REST resource this
27+
object represents. Servers may infer this from the endpoint the client
28+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
29+
type: string
30+
metadata:
31+
type: object
32+
spec:
33+
description: Spec defines the desired state of FinalizerConcurrencyTest
34+
type: object
35+
x-kubernetes-preserve-unknown-fields: true
36+
status:
37+
description: Status defines the observed state of FinalizerConcurrencyTest
38+
type: object
39+
x-kubernetes-preserve-unknown-fields: true
40+
type: object
41+
served: true
42+
storage: true
43+
subresources:
44+
status: {}

test/ansible/advanced-molecule-operator/config/crd/kustomization.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ resources:
77
- bases/test.example.com_casetests.yaml
88
- bases/test.example.com_collectiontests.yaml
99
- bases/test.example.com_clusterannotationtests.yaml
10+
- bases/test.example.com_finalizerconcurrencytests.yaml
1011
- bases/test.example.com_reconciliationtests.yaml
1112
- bases/test.example.com_selectortests.yaml
1213
- bases/test.example.com_subresourcestests.yaml

test/ansible/advanced-molecule-operator/config/default/kustomization.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ namespace: advanced-molecule-operator-system
99
namePrefix: advanced-molecule-operator-
1010

1111
# Labels to add to all resources and selectors.
12-
#commonLabels:
13-
# someName: someValue
12+
#labels:
13+
#- includeSelectors: true
14+
# pairs:
15+
# someName: someValue
1416

15-
bases:
17+
resources:
1618
- ../crd
1719
- ../rbac
1820
- ../manager
@@ -25,6 +27,4 @@ patchesStrategicMerge:
2527
# endpoint w/o any authn/z, please comment the following line.
2628
- manager_auth_proxy_patch.yaml
2729

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

test/ansible/advanced-molecule-operator/config/default/manager_auth_proxy_patch.yaml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,50 @@ metadata:
88
spec:
99
template:
1010
spec:
11+
affinity:
12+
nodeAffinity:
13+
requiredDuringSchedulingIgnoredDuringExecution:
14+
nodeSelectorTerms:
15+
- matchExpressions:
16+
- key: kubernetes.io/arch
17+
operator: In
18+
values:
19+
- amd64
20+
- arm64
21+
- ppc64le
22+
- s390x
23+
- key: kubernetes.io/os
24+
operator: In
25+
values:
26+
- linux
1127
containers:
1228
- name: kube-rbac-proxy
13-
image: registry.redhat.io/openshift4/ose-kube-rbac-proxy:v4.10
29+
securityContext:
30+
allowPrivilegeEscalation: false
31+
capabilities:
32+
drop:
33+
- "ALL"
34+
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0
1435
args:
1536
- "--secure-listen-address=0.0.0.0:8443"
1637
- "--upstream=http://127.0.0.1:8080/"
1738
- "--logtostderr=true"
18-
- "--v=10"
39+
- "--v=0"
1940
ports:
2041
- containerPort: 8443
2142
protocol: TCP
2243
name: https
44+
resources:
45+
limits:
46+
cpu: 500m
47+
memory: 128Mi
48+
requests:
49+
cpu: 5m
50+
memory: 64Mi
2351
- name: manager
2452
args:
2553
- "--health-probe-bind-address=:6789"
2654
- "--metrics-bind-address=127.0.0.1:8080"
2755
- "--leader-elect"
28-
- "--ansible-args='--vault-password-file /opt/ansible/pwd.yml'"
2956
- "--leader-election-id=advanced-molecule-operator"
57+
- "--ansible-args='--vault-password-file /opt/ansible/pwd.yml'"

test/ansible/advanced-molecule-operator/config/default/manager_config_patch.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,3 @@ spec:
88
spec:
99
containers:
1010
- name: manager
11-
args:
12-
- "--config=controller_manager_config.yaml"
13-
volumeMounts:
14-
- name: manager-config
15-
mountPath: /controller_manager_config.yaml
16-
subPath: controller_manager_config.yaml
17-
volumes:
18-
- name: manager-config
19-
configMap:
20-
name: manager-config

test/ansible/advanced-molecule-operator/config/manager/controller_manager_config.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
11
resources:
22
- manager.yaml
3-
4-
generatorOptions:
5-
disableNameSuffixHash: true
6-
7-
configMapGenerator:
8-
- name: manager-config
9-
files:
10-
- controller_manager_config.yaml

test/ansible/advanced-molecule-operator/config/manager/manager.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ kind: Namespace
33
metadata:
44
labels:
55
control-plane: controller-manager
6+
app.kubernetes.io/name: namespace
7+
app.kubernetes.io/instance: system
8+
app.kubernetes.io/component: manager
9+
app.kubernetes.io/created-by: advanced-molecule-operator
10+
app.kubernetes.io/part-of: advanced-molecule-operator
11+
app.kubernetes.io/managed-by: kustomize
612
name: system
713
---
814
apiVersion: apps/v1
@@ -12,6 +18,12 @@ metadata:
1218
namespace: system
1319
labels:
1420
control-plane: controller-manager
21+
app.kubernetes.io/name: deployment
22+
app.kubernetes.io/instance: controller-manager
23+
app.kubernetes.io/component: manager
24+
app.kubernetes.io/created-by: advanced-molecule-operator
25+
app.kubernetes.io/part-of: advanced-molecule-operator
26+
app.kubernetes.io/managed-by: kustomize
1527
spec:
1628
selector:
1729
matchLabels:
@@ -24,8 +36,35 @@ spec:
2436
labels:
2537
control-plane: controller-manager
2638
spec:
39+
# TODO(user): Uncomment the following code to configure the nodeAffinity expression
40+
# according to the platforms which are supported by your solution.
41+
# It is considered best practice to support multiple architectures. You can
42+
# build your manager image using the makefile target docker-buildx.
43+
# affinity:
44+
# nodeAffinity:
45+
# requiredDuringSchedulingIgnoredDuringExecution:
46+
# nodeSelectorTerms:
47+
# - matchExpressions:
48+
# - key: kubernetes.io/arch
49+
# operator: In
50+
# values:
51+
# - amd64
52+
# - arm64
53+
# - ppc64le
54+
# - s390x
55+
# - key: kubernetes.io/os
56+
# operator: In
57+
# values:
58+
# - linux
2759
securityContext:
2860
runAsNonRoot: true
61+
# TODO(user): For common cases that do not require escalating privileges
62+
# it is recommended to ensure that all your Pods/Containers are restrictive.
63+
# More info: https://kubernetes.io/docs/concepts/security/pod-security-standards/#restricted
64+
# Please uncomment the following code if your project does NOT have to work on old Kubernetes
65+
# versions < 1.19 or on vendors versions which do NOT support this field by default (i.e. Openshift < 4.11 ).
66+
# seccompProfile:
67+
# type: RuntimeDefault
2968
containers:
3069
- args:
3170
- --leader-elect
@@ -42,6 +81,9 @@ spec:
4281
value: /opt/ansible/inventory
4382
securityContext:
4483
allowPrivilegeEscalation: false
84+
capabilities:
85+
drop:
86+
- "ALL"
4587
livenessProbe:
4688
httpGet:
4789
path: /healthz

test/ansible/advanced-molecule-operator/config/prometheus/monitor.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ kind: ServiceMonitor
55
metadata:
66
labels:
77
control-plane: controller-manager
8+
app.kubernets.io/name: servicemonitor
9+
app.kubernetes.io/instance: controller-manager-metrics-monitor
10+
app.kubernetes.io/component: metrics
11+
app.kubernetes.io/created-by: advanced-molecule-operator
12+
app.kubernetes.io/part-of: advanced-molecule-operator
13+
app.kubernetes.io/managed-by: kustomize
814
name: controller-manager-metrics-monitor
915
namespace: system
1016
spec:

test/ansible/advanced-molecule-operator/config/rbac/auth_proxy_client_clusterrole.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4+
labels:
5+
app.kubernetes.io/name: clusterrole
6+
app.kubernetes.io/instance: metrics-reader
7+
app.kubernetes.io/component: kube-rbac-proxy
8+
app.kubernetes.io/created-by: advanced-molecule-operator
9+
app.kubernetes.io/part-of: advanced-molecule-operator
10+
app.kubernetes.io/managed-by: kustomize
411
name: metrics-reader
512
rules:
613
- nonResourceURLs:

test/ansible/advanced-molecule-operator/config/rbac/auth_proxy_role.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRole
33
metadata:
4+
labels:
5+
app.kubernetes.io/name: clusterrole
6+
app.kubernetes.io/instance: proxy-role
7+
app.kubernetes.io/component: kube-rbac-proxy
8+
app.kubernetes.io/created-by: advanced-molecule-operator
9+
app.kubernetes.io/part-of: advanced-molecule-operator
10+
app.kubernetes.io/managed-by: kustomize
411
name: proxy-role
512
rules:
613
- apiGroups:

0 commit comments

Comments
 (0)