Skip to content

Commit

Permalink
Fix malformed manager.yaml in helm testdata
Browse files Browse the repository at this point in the history
* Fix malformerd manager.yaml in helm testdata.
* Use patches instead of patchesJson6902.

Signed-off-by: Neo2308 <pradha.krishna.cse17@itbhu.ac.in>
  • Loading branch information
Neo2308 committed Oct 29, 2024
1 parent 3db0ef8 commit a619489
Show file tree
Hide file tree
Showing 16 changed files with 555 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (mh *Memcached) uncommentManifestsKustomizationv4() {
log.Info("uncommenting config/manifests/kustomization.yaml to enable webhooks in OLM")

err = kbutil.UncommentCode(kustomization,
`#patchesJson6902:
`#patches:
#- target:
# group: apps
# version: v1
Expand Down
2 changes: 1 addition & 1 deletion internal/plugins/helm/v1/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func addInitCustomizations(projectName string) error {

err := util.InsertCode(managerFile,
"--leader-elect",
fmt.Sprintf("\n - --leader-election-id=%s", projectName))
fmt.Sprintf("\n - --leader-election-id=%s", projectName))
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ resources:
# [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix.
# Do NOT uncomment sections with prefix [CERTMANAGER], as OLM does not support cert-manager.
# These patches remove the unnecessary "cert" volume and its manager container volumeMount.
#patchesJson6902:
#patches:
#- target:
# group: apps
# version: v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resources:
# [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix.
# Do NOT uncomment sections with prefix [CERTMANAGER], as OLM does not support cert-manager.
# These patches remove the unnecessary "cert" volume and its manager container volumeMount.
patchesJson6902:
patches:
- target:
group: apps
version: v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resources:
# [WEBHOOK] To enable webhooks, uncomment all the sections with [WEBHOOK] prefix.
# Do NOT uncomment sections with prefix [CERTMANAGER], as OLM does not support cert-manager.
# These patches remove the unnecessary "cert" volume and its manager container volumeMount.
patchesJson6902:
patches:
- target:
group: apps
version: v1
Expand Down
5 changes: 5 additions & 0 deletions testdata/helm/memcached-operator/bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=memcached-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# Copy files to locations specified by labels.
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: memcacheds.cache.example.com
spec:
group: cache.example.com
names:
kind: Memcached
listKind: MemcachedList
plural: memcacheds
singular: memcached
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Memcached is the Schema for the memcacheds API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec defines the desired state of Memcached
type: object
x-kubernetes-preserve-unknown-fields: true
status:
description: Status defines the observed state of Memcached
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: memcached-operator
control-plane: controller-manager
name: memcached-operator-controller-manager-metrics-monitor
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
path: /metrics
port: https
scheme: https
tlsConfig:
insecureSkipVerify: true
selector:
matchLabels:
control-plane: controller-manager
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: memcached-operator
control-plane: controller-manager
name: memcached-operator-controller-manager-metrics-service
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: 8443
selector:
control-plane: controller-manager
status:
loadBalancer: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: memcached-operator
name: memcached-operator-memcached-editor-role
rules:
- apiGroups:
- cache.example.com
resources:
- memcacheds
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- cache.example.com
resources:
- memcacheds/status
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: memcached-operator
name: memcached-operator-memcached-viewer-role
rules:
- apiGroups:
- cache.example.com
resources:
- memcacheds
verbs:
- get
- list
- watch
- apiGroups:
- cache.example.com
resources:
- memcacheds/status
verbs:
- get
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: memcached-operator-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
Loading

0 comments on commit a619489

Please sign in to comment.