Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
Migrate to kyma 2.1.3 (#2545)
Browse files Browse the repository at this point in the history
* Migrate to kyma 2.1.3

* remove certificate component from kyma installation

* fix kyma components and overrides

* fix istio overrides

* update full installation config

* update envoy buffer extension name

* fix internal auth

* remove certificate component from kyma installation

* update docs

* add monitors patches

* remove monitoring-node-exporter service monitor

* return the certificate component

* return the certificate component for full installation
  • Loading branch information
PetarTodorovv authored Aug 29, 2022
1 parent cd8797a commit 7ce0863
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 94 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For more information about the Compass architecture, technical details, and comp
- [Docker](https://www.docker.com/get-started)
- [k3d](https://github.com/k3d-io/k3d) v5.2.2+
- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) 1.23.0+
- [Kyma CLI](https://github.com/kyma-project/cli) stable
- [Kyma CLI](https://github.com/kyma-project/cli) 2.1.3
- [helm](https://github.com/helm/helm) v3.8.0+
- [yq](https://github.com/mikefarah/yq) v4+

Expand Down
4 changes: 2 additions & 2 deletions chart/compass/templates/filters/request-limit-filter-2mb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ spec:
patch:
operation: INSERT_BEFORE
value:
name: envoy.buffer
name: envoy.filters.http.buffer
typed_config:
'@type': type.googleapis.com/udpa.type.v1.TypedStruct
value:
maxRequestBytes: {{ .Values.global.istio.ingressgateway.requestPayloadSizeLimit2MB }}
workloadSelector:
labels:
reqlimit: {{ .Values.global.istio.ingressgateway.requestPayloadSizeLimit2MBLabel }}
reqlimit: {{ .Values.global.istio.ingressgateway.requestPayloadSizeLimit2MBLabel }}
4 changes: 2 additions & 2 deletions chart/compass/templates/filters/request-limit-filter-5mb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ spec:
patch:
operation: INSERT_BEFORE
value:
name: envoy.buffer
name: envoy.filters.http.buffer
typed_config:
'@type': type.googleapis.com/udpa.type.v1.TypedStruct
value:
maxRequestBytes: {{ .Values.global.istio.ingressgateway.requestPayloadSizeLimit5MB }}
workloadSelector:
labels:
reqlimit: {{ .Values.global.istio.ingressgateway.requestPayloadSizeLimit5MBLabel }}
reqlimit: {{ .Values.global.istio.ingressgateway.requestPayloadSizeLimit5MBLabel }}
14 changes: 1 addition & 13 deletions chart/compass/templates/internal-communication-policies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ metadata:
namespace: {{ .Release.Namespace }}
spec:
jwtRules:
- issuer: kubernetes/serviceaccount
jwksUri: {{ .Values.global.kubernetes.serviceAccountTokenJWKS }}
forwardOriginalToken: true
fromHeaders:
- name: X-Authorization
prefix: "Bearer "
- issuer: {{ .Values.global.kubernetes.serviceAccountTokenIssuer }}
jwksUri: {{ .Values.global.kubernetes.serviceAccountTokenJWKS }}
forwardOriginalToken: true
Expand Down Expand Up @@ -90,12 +84,6 @@ spec:
matchLabels:
app.kubernetes.io/name: hydra
jwtRules:
- issuer: kubernetes/serviceaccount
jwksUri: {{ .Values.global.kubernetes.serviceAccountTokenJWKS }}
forwardOriginalToken: true
fromHeaders:
- name: X-Authorization
prefix: "Bearer "
- issuer: {{ .Values.global.kubernetes.serviceAccountTokenIssuer }}
jwksUri: {{ .Values.global.kubernetes.serviceAccountTokenJWKS }}
forwardOriginalToken: true
Expand Down Expand Up @@ -124,4 +112,4 @@ spec:
- /.well-known/*
- from: # or anything other only if the request is authenticated via RequestAuthentication
- source:
requestPrincipals: ['*']
requestPrincipals: ['*']
2 changes: 1 addition & 1 deletion chart/compass/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ global:
- "x-vcap-request-id"
- "x-broker-api-request-identity"
kubernetes:
serviceAccountTokenIssuer: kubernetes/serviceaccount
serviceAccountTokenIssuer: https://kubernetes.default.svc.cluster.local
serviceAccountTokenJWKS: https://kubernetes.default.svc.cluster.local/openid/v1/jwks
ingress:
domainName: "local.kyma.dev"
Expand Down
2 changes: 1 addition & 1 deletion components/schema-migrator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN wget https://github.com/golang-migrate/migrate/releases/download/v${MIGRATE_
RUN mv migrate /usr/local/bin/migrate

# kubectl is supported within one minor version (older or newer) of kube-apiserver
ENV CLUSTER_VERSION=1.20.14
ENV CLUSTER_VERSION=1.21.12

RUN apk add --update ca-certificates \
&& apk add -t deps \
Expand Down
8 changes: 4 additions & 4 deletions docs/compass/04-01-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ory:
config:
jwks_urls:
- ${IDP_JWKS_URL}
istio-configuration:
istio:
components:
ingressGateways:
config:
Expand Down Expand Up @@ -102,7 +102,7 @@ global:
pvc:
storageClass: ${ANY_SUPPORTED_STORAGE_CLASS}
kubernetes:
serviceAccountTokenIssuer: ${TOKEN_ISSUER} # Default is kubernetes/serviceaccount
serviceAccountTokenIssuer: ${TOKEN_ISSUER} # Default is https://kubernetes.default.svc.cluster.local
serviceAccountTokenJWKS: ${JWKS_ENDPOINT} # Default is https://kubernetes.default.svc.cluster.local/openid/v1/jwks
loadBalancerIP: ${LOAD_BALANCER_SERVICE_EXTERNAL_IP}
cockpit:
Expand Down Expand Up @@ -323,7 +323,7 @@ ory:
config:
jwks_urls:
- ${IDP_JWKS_URL}
istio-configuration:
istio:
components:
ingressGateways:
config:
Expand Down Expand Up @@ -364,7 +364,7 @@ global:
pvc:
storageClass: ${ANY_SUPPORTED_STORAGE_CLASS}
kubernetes:
serviceAccountTokenIssuer: ${TOKEN_ISSUER} # Default is kubernetes/serviceaccount
serviceAccountTokenIssuer: ${TOKEN_ISSUER} # Default is https://kubernetes.default.svc.cluster.local
serviceAccountTokenJWKS: ${JWKS_ENDPOINT} # Default is https://kubernetes.default.svc.cluster.local/openid/v1/jwks
loadBalancerIP: ${LOAD_BALANCER_SERVICE_EXTERNAL_IP}
cockpit:
Expand Down
2 changes: 1 addition & 1 deletion installation/cmd/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RESET_VALUES_YAML=true

K3D_MEMORY=8192MB
K3D_TIMEOUT=10m0s
APISERVER_VERSION=1.20.11
APISERVER_VERSION=1.21.12

POSITIONAL=()
while [[ $# -gt 0 ]]
Expand Down
2 changes: 1 addition & 1 deletion installation/resources/KYMA_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.4
2.1.3
3 changes: 2 additions & 1 deletion installation/resources/kyma/kyma-components-full.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
defaultNamespace: kyma-system
prerequisites:
- name: "cluster-essentials"
- name: "istio-configuration"
- name: "istio"
namespace: "istio-system"
- name: "certificates"
namespace: "istio-system"
components:
- name: "istio-resources"
- name: "logging"
- name: "tracing"
- name: "kiali"
Expand Down
5 changes: 3 additions & 2 deletions installation/resources/kyma/kyma-components-minimal.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
defaultNamespace: kyma-system
prerequisites:
- name: "cluster-essentials"
- name: "istio-configuration"
- name: "istio"
namespace: "istio-system"
- name: "certificates"
namespace: "istio-system"
components:
- name: "istio-resources"
- name: "ory"
- name: "logging"
- name: "tracing"
- name: "kiali"
- name: "monitoring"
- name: "ory"
5 changes: 2 additions & 3 deletions installation/resources/kyma/kyma-overrides-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cluster-essentials:
requests:
cpu: 25m
memory: 36Mi
istio-configuration:
istio:
components:
egressGateways:
enabled: false
Expand Down Expand Up @@ -102,7 +102,6 @@ istio-configuration:
enabled: true
helmValues:
global:
jwtPolicy: first-party-jwt
proxy:
holdApplicationUntilProxyStarts: true
resources:
Expand Down Expand Up @@ -341,4 +340,4 @@ tracing:
limits:
memory: 256Mi
requests:
memory: 32Mi
memory: 32Mi
5 changes: 2 additions & 3 deletions installation/resources/kyma/kyma-overrides-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ helm-broker:
resources:
limits:
memory: 256Mi
istio-configuration:
istio:
components:
egressGateways:
enabled: false
Expand Down Expand Up @@ -106,7 +106,6 @@ istio-configuration:
enabled: true
helmValues:
global:
jwtPolicy: first-party-jwt
proxy:
resources:
limits:
Expand Down Expand Up @@ -311,4 +310,4 @@ tracing:
limits:
memory: 256Mi
requests:
memory: 32Mi
memory: 32Mi
28 changes: 17 additions & 11 deletions installation/scripts/install-kyma.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ KYMA_OVERRIDES_MINIMAL="${ROOT_PATH}"/installation/resources/kyma/kyma-overrides
MINIMAL_OVERRIDES_TEMP=overrides-minimal.yaml
cp ${KYMA_OVERRIDES_MINIMAL} ${MINIMAL_OVERRIDES_TEMP}

yq -i ".istio-configuration.helmValues.pilot.jwksResolverExtraRootCA = \"$CERT\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio.helmValues.pilot.jwksResolverExtraRootCA = \"$CERT\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".ory.oathkeeper.oathkeeper.config.authenticators.jwt.config.jwks_urls |= . + [\"$JWKS_URL\"]" "${MINIMAL_OVERRIDES_TEMP}"

if [[ $(uname -m) == 'arm64' ]]; then
yq -i ".istio-configuration.global.containerRegistry.path = \"europe-west1-docker.pkg.dev\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio-configuration.global.images.istio.directory = \"sap-cp-cmp-dev\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio-configuration.global.images.istio.name = \"ucl-dev\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio-configuration.global.images.istio.version = \"1.11.4-distroless\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_proxyv2.containerRegistryPath = \"europe-west1-docker.pkg.dev\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_proxyv2.directory = \"sap-cp-cmp-dev/ucl-dev\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_proxyv2.version = \"1.12.3-distroless\"" "${MINIMAL_OVERRIDES_TEMP}"

yq -i ".istio.global.images.istio_pilot.containerRegistryPath = \"europe-west1-docker.pkg.dev\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_pilot.directory = \"sap-cp-cmp-dev/ucl-dev\"" "${MINIMAL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_pilot.version = \"1.12.3-distroless\"" "${MINIMAL_OVERRIDES_TEMP}"
fi

KYMA_COMPONENTS_FULL="${ROOT_PATH}"/installation/resources/kyma/kyma-components-full.yaml
Expand All @@ -75,14 +78,17 @@ KYMA_OVERRIDES_FULL="${ROOT_PATH}"/installation/resources/kyma/kyma-overrides-fu
FULL_OVERRIDES_TEMP=overrides-full.yaml
cp ${KYMA_OVERRIDES_FULL} ${FULL_OVERRIDES_TEMP}

yq -i ".istio-configuration.helmValues.pilot.jwksResolverExtraRootCA = \"$CERT\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio.helmValues.pilot.jwksResolverExtraRootCA = \"$CERT\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".ory.oathkeeper.oathkeeper.config.authenticators.jwt.config.jwks_urls |= . + [\"$JWKS_URL\"]" "${FULL_OVERRIDES_TEMP}"

if [[ $(uname -m) == 'arm64' ]]; then
yq -i ".istio-configuration.global.containerRegistry.path = \"europe-west1-docker.pkg.dev\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio-configuration.global.images.istio.directory = \"sap-cp-cmp-dev\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio-configuration.global.images.istio.name = \"ucl-dev\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio-configuration.global.images.istio.version = \"1.11.4-distroless\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_proxyv2.containerRegistryPath = \"europe-west1-docker.pkg.dev\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_proxyv2.directory = \"sap-cp-cmp-dev/ucl-dev\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_proxyv2.version = \"1.12.3-distroless\"" "${FULL_OVERRIDES_TEMP}"

yq -i ".istio.global.images.istio_pilot.containerRegistryPath = \"europe-west1-docker.pkg.dev\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_pilot.directory = \"sap-cp-cmp-dev/ucl-dev\"" "${FULL_OVERRIDES_TEMP}"
yq -i ".istio.global.images.istio_pilot.version = \"1.12.3-distroless\"" "${FULL_OVERRIDES_TEMP}"
fi

trap "rm -f ${MINIMAL_OVERRIDES_TEMP} ${FULL_OVERRIDES_TEMP}" EXIT INT TERM
Expand All @@ -97,4 +103,4 @@ if [[ $KYMA_INSTALLATION == *full* ]]; then
else
echo "Installing minimal Kyma"
kyma deploy --components-file $KYMA_COMPONENTS_MINIMAL --values-file $MINIMAL_OVERRIDES_TEMP --source $KYMA_SOURCE
fi
fi
51 changes: 3 additions & 48 deletions installation/scripts/prom-mtls-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,51 +100,6 @@ function patchDeploymentsToInjectSidecar() {
}

function enableNodeExporterMTLS() {
# Note: The two CRDs described in the two variables below are left as they are with all their properties
# since it's risky to omit some properties due to different strategic merge patch strategies.
# https://kubernetes.io/docs/tasks/manage-kubernetes-objects/update-api-object-kubectl-patch/#notes-on-the-strategic-merge-patch

monitor=$(cat <<"EOF"
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
annotations:
meta.helm.sh/release-name: monitoring
meta.helm.sh/release-namespace: kyma-system
labels:
app: monitoring-node-exporter
app.kubernetes.io/instance: monitoring
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: monitoring
chart: monitoring-1.0.0
helm.sh/chart: monitoring-1.0.0
release: monitoring
name: monitoring-node-exporter
namespace: kyma-system
spec:
endpoints:
- metricRelabelings:
- action: keep
regex: ^(go_goroutines|go_memstats_alloc_bytes|go_memstats_heap_alloc_bytes|go_memstats_heap_inuse_bytes|go_memstats_heap_sys_bytes|go_memstats_stack_inuse_bytes|node_.*|process_cpu_seconds_total|process_max_fds|process_open_fds|process_resident_memory_bytes|process_start_time_seconds|process_virtual_memory_bytes)$
sourceLabels:
- __name__
port: metrics
scheme: https
tlsConfig:
caFile: /etc/prometheus/secrets/istio.default/root-cert.pem
certFile: /etc/prometheus/secrets/istio.default/cert-chain.pem
keyFile: /etc/prometheus/secrets/istio.default/key.pem
insecureSkipVerify: true
jobLabel: jobLabel
selector:
matchLabels:
app: prometheus-node-exporter
release: monitoring
EOF
)
echo "$monitor" > monitor.yaml

# The patches around the DaemonSet involve an addition of two init containers that together setup certificates
# for the node-exporter application to use. There are also two new mounts - a shared directory (node-certs)
# and the Istio CA secret (istio-certs).
Expand Down Expand Up @@ -295,22 +250,23 @@ EOF

kubectl get secret istio-ca-secret --namespace=istio-system -o yaml | grep -v '^\s*namespace:\s' | kubectl replace --force --namespace=kyma-system -f -

kubectl apply -f monitor.yaml
kubectl apply -f daemonset.yaml

rm monitor.yaml
rm daemonset.yaml
}

function patchKymaServiceMonitorsForMTLS() {
kymaSvcMonitors=(
istio-component-monitor
monitoring-alertmanager
monitoring-kube-state-metrics
monitoring-operator
monitoring-prometheus
monitoring-prometheus-istio-server-server
monitoring-prometheus-node-exporter
monitoring-prometheus-pushgateway
tracing-metrics
ory-oathkeeper-maester
)

crd="servicemonitors.monitoring.coreos.com"
Expand Down Expand Up @@ -359,4 +315,3 @@ function removeKymaPeerAuthsForPrometheus() {
kubectl delete ${crd} -n ${namespace} "${pa}" || true
done
}

0 comments on commit 7ce0863

Please sign in to comment.