Open gabbler97 opened 5 months ago
This issue is stale because it has been open for 90 days with no
activity. It will automatically close after 30 more days of
inactivity. Reopen the issue with /reopen
. Mark the issue as
fresh by adding the comment /remove-lifecycle stale
.
@gabbler97 The content in the blog was using a hacky way. I am not sure how you change the helm chart to make it work. Would you mind sharing your approach?
Hello @houshengbo! Sure. in values.yaml
knative_operator:
knative_operator:
image: gcr.io/knative-releases/knative.dev/operator/cmd/operator
tag: v1.13.1
customCm: # Added this
enabled: false # And this
In templates/operator.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: knative-operator
namespace: "{{ .Release.Namespace }}"
labels:
app.kubernetes.io/name: knative-operator
app.kubernetes.io/version: "{{ .Chart.Version }}"
spec:
replicas: 1
selector:
matchLabels:
name: knative-operator
template:
metadata:
annotations:
sidecar.istio.io/inject: "false"
labels:
name: knative-operator
app.kubernetes.io/name: knative-operator
app.kubernetes.io/version: "{{ .Chart.Version }}"
spec:
serviceAccountName: knative-operator
{{ if .Values.knative_operator.knative_operator.customCm.enabled }}
volumes:
- configMap:
name: cm-config-network
name: cm-config-network
- configMap:
name: cm-config-domain
name: cm-config-domain
{{ end }}
containers:
- name: knative-operator
image: "{{ .Values.knative_operator.knative_operator.image }}:{{ .Values.knative_operator.knative_operator.tag }}"
imagePullPolicy: IfNotPresent
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: SYSTEM_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: METRICS_DOMAIN
value: knative.dev/operator
- name: CONFIG_LOGGING_NAME
value: config-logging
- name: CONFIG_OBSERVABILITY_NAME
value: config-observability
- name: KUBERNETES_MIN_VERSION
value: "{{ .Values.knative_operator.kubernetes_min_version }}"
ports:
- name: metrics
containerPort: 9090
# This block was added
{{ if .Values.knative_operator.knative_operator.customCm.enabled }}
volumeMounts:
- mountPath: /cm-config-domain
name: cm-config-domain
- mountPath: /cm-config-network
name: cm-config-network
{{ end }}
Finally in knative serving resource
spec:
additionalManifests:
- URL: /cm-ingress-gateway
- URL: /cm-config-domain
- URL: /cm-config-network
There are a lot of configmaps but this is a simple example how I would use it
domainconfig:
ovverrideenabled: <bool>
overrideconfigcontent: |
multilinecontent
multilinecontent
And the the content of this would go under a configmap k get cm config-domain -o yaml
apiVersion: v1
data:
multilinecontent
multilinecontent
kind: ConfigMap
And you would create that custom config cm only when override is enabled. It is just an idea of course.
Problem I have followed this page to override the default configmaps instead of modifying them manually. https://vincenthou.medium.com/how-to-customize-the-manifests-for-knative-operator-with-a-local-volume-c576b592d9d7 The problem is the following: I could not attach configmaps to the knative-operator through helm chart so I had to modify the Chart myself. It is working now, but I would have to do this at every new version.
Exit Criteria I can use the extra configmaps like this
Time Estimate (optional): 1-2 days