Skip to content

Commit 19e83f8

Browse files
authored
Merge pull request #242 from goern/ocp-to-4.13
ocp to 4.13
2 parents 2ecc123 + f34d48c commit 19e83f8

File tree

3 files changed

+124
-7
lines changed

3 files changed

+124
-7
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
repos:
33
- repo: https://github.com/Lucas-C/pre-commit-hooks
4-
rev: v1.1.11
4+
rev: v1.5.1
55
hooks:
66
- id: remove-tabs
77
exclude: Makefile
88

99
- repo: https://github.com/pre-commit/mirrors-eslint
10-
rev: v8.13.0
10+
rev: v8.41.0
1111
hooks:
1212
- id: eslint
1313
args:
@@ -26,13 +26,13 @@ repos:
2626
- prettier
2727

2828
- repo: https://github.com/pre-commit/mirrors-prettier
29-
rev: v2.6.2
29+
rev: v3.0.0-alpha.9-for-vscode
3030
hooks:
3131
- id: prettier
3232
files: \.(js|ts|tsx)$
3333

3434
- repo: https://github.com/pre-commit/pre-commit-hooks
35-
rev: v4.1.0
35+
rev: v4.4.0
3636
hooks:
3737
- id: trailing-whitespace
3838
- id: check-merge-conflict
@@ -45,7 +45,7 @@ repos:
4545
args: [--allow-multiple-documents]
4646

4747
- repo: https://github.com/adrienverge/yamllint.git
48-
rev: v1.26.2
48+
rev: v1.31.0
4949
hooks:
5050
- id: yamllint
5151
files: \.(yaml|yml)$

content/posts/no-app-of-apps-anymore/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 'is app-of-apps the right pattern for you?'
3-
date: 2023-05-17
4-
author: 'Christoph [GNU:] Görn'
3+
date: 2023-05-17
4+
author: 'Christoph [GNU:] Görn'
55
description: 'The app-of-apps pattern, while a useful concept, does have its pitfalls. The most significant is the complexity it introduces into application management.'
66
tags:
77
- OperateFirst
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title: 'Planning an OpenShift upgrade, and look out for deprecated APIs'
3+
date: 2023-05-21
4+
author: 'Christoph [GNU:] Görn'
5+
description: 'Learn about the implications of upgrading from OpenShift 4.12 to 4.13, including the deprecation of certain Kubernetes APIs, and follow a comprehensive plan that includes understanding the changes, planning the migration, testing, monitoring, and reporting to ensure a successful and efficient upgrade process.'
6+
tags:
7+
- OperateFirst
8+
- Operations
9+
- OpenShift
10+
- Kubernetes
11+
- upgrade
12+
---
13+
14+
## Introduction
15+
16+
The continuous evolution of technology systems and standards requires regular updates and migrations to ensure optimal performance, security, and functionality. As we look to the impending upgrade from OpenShift 4.12 to 4.13, it's essential to understand the implications of this change, particularly regarding the deprecation of certain Kubernetes APIs. This report seeks to provide a comprehensive overview of the main changes accompanying the upgrade, focusing specifically on deprecated APIs and their impact on current applications.
17+
18+
## Understanding our role and objectives
19+
20+
As an Operate First Platform Engineer and SRE (Site Reliability Engineer), we are in a unique position that involves a blend of software engineering and system administration. We are responsible for creating reliable and highly scalable software systems, maintaining and improving the performance of existing systems, and ensuring that these systems are operational at all times.
21+
22+
Our work involves managing the infrastructure that supports these systems, ensuring that they are always available and performing optimally. This includes monitoring system health, automating routine tasks, responding to system incidents, and planning for system upgrades and migrations, such as the transition from OpenShift 4.12 to 4.13.
23+
24+
## TBD: upgrade OpenShift to 4.13
25+
26+
In the context of this OpenShift/Kubernetes API deprecation scenario, our role as an Operate First Platform Engineer and SRE involves the following key responsibilities:
27+
28+
1. **Understanding the Changes**: We need to have a deep understanding of the changes involved in the upgrade from OpenShift 4.12 to 4.13, particularly with regard to deprecated Kubernetes APIs.
29+
2. **Planning the Migration**: We have to create a detailed plan for the migration, identifying which deprecated APIs are currently in use and planning their replacement with the new API versions.
30+
3. **Testing**: Before implementing any changes, it is crucial that we thoroughly test these in a non-production environment. This helps us to anticipate any issues that may arise during the actual upgrade and mitigate them in advance.
31+
4. **Monitoring and Reporting**: We are responsible for monitoring the health of the system both during and after the migration. We also need to provide clear and detailed reports to other stakeholders regarding the upgrade process and its impact on the system.
32+
33+
In all of these tasks, we leverage our skills in coding, system administration, problem-solving, and communication. The goal is to ensure that our platform remains reliable, efficient, and up-to-date with the latest technological advancements.
34+
35+
Based on the OpenShift 4.13 release notes and the [Kubernetes deprecated API migration guide](https://kubernetes.io/docs/reference/using-api/deprecation-guide/), here's a high-level plan for migrating (some of the) deprecated APIs:
36+
37+
**Storage APIs**: [migration.k8s.io/v1alpha1]​8​: The Kubernetes API migration guide suggests migrating from the storage.k8s.io/v1beta1 API version of CSIStorageCapacity to the storage.k8s.io/v1 API version​9​. However, it's not clear if this is applicable to all APIs listed in the Storage APIs section of the release notes.
38+
39+
**Workloads APIs**: [apps.openshift.io/v1]​12​: The Kubernetes API migration guide provides migration steps for CronJob from batch/v1beta1 to batch/v1​13​, and for HorizontalPodAutoscaler from autoscaling/v2beta2 to autoscaling/v2​14​. These might be relevant for some of the APIs listed in the Workloads APIs section of the release notes.
40+
41+
Please note that for each deprecated API, it's recommended to migrate manifests and API clients to use the new API versions. All existing persisted objects are accessible via the new API versions.
42+
43+
However, this plan does not cover all deprecated APIs listed in the [OpenShift 4.13 release notes](https://docs.openshift.com/container-platform/4.13/release_notes/ocp-4-13-release-notes.html), as not all migration guides for these APIs could be found in my research. For APIs without a clear migration guide, it's recommended to consult with the respective API documentation, OpenShift support, or community forums for guidance. Also, as with any migration, ensure that you have a robust testing and rollback plan in place.
44+
45+
Based on your provided script and the considerations for deprecated APIs, here's an updated migration plan:
46+
47+
### Preparation: Evaluate API Usage
48+
49+
Execute the provided bash script to identify the usage of deprecated APIs in the past 24 hours. This script will list the endpoints that are deprecated, along with the number of calls made to them in the last hour and the last 24 hours. If an API hasn't been used in the past 24 hours, it's safe to assume that all applications using it can safely migrate.
50+
51+
Here is the script for reference:
52+
53+
```shell
54+
#!/bin/env bash
55+
56+
indent_arrow() { sed 's/^/ -> /'; }
57+
indent() { sed 's/^/ /'; }
58+
59+
oc get apirequestcounts -o jsonpath='{range .items[?(@.status.removedInRelease!="")]}{.status.removedInRelease}{"\t"}{.metadata.name}{"\t"}{.status.currentHour.requestCount}{"\t"}{.status.requestCount}{"\n"}{end}' | sort |
60+
while read version endpoint count1h count24h; do
61+
echo "endpoint '$endpoint' is deprecated in version '$version'" | indent_arrow
62+
if [ $count24h -ne 0 ]; then
63+
echo "# of calls: $count1h (last 1h), $count24h (last 24h)" | indent_arrow | indent
64+
echo "it was called by the following callers in last 24h:" | indent_arrow | indent
65+
oc get apirequestcounts $endpoint -o jsonpath='{range ..username}{$}{"\n"}{end}' | sort -u | indent_arrow | indent | indent
66+
else
67+
echo "it was not called in last 24h" | indent_arrow | indent
68+
fi
69+
done
70+
```
71+
72+
The output of the script is as follows, and the output is very positive: no deprecated APIs have been used in the past
73+
24 hours! We are good to migrate...
74+
75+
```shell
76+
❯ oc version
77+
Client Version: 4.9.0-202303281553.p0.g88cfeb4.assembly.stream-88cfeb4
78+
Server Version: 4.12.17
79+
Kubernetes Version: v1.25.8+37a9a08
80+
❯ ./scripts/deprecatedAPIsStillInUse.sh
81+
-> endpoint 'ingresses.v1beta1.extensions' is deprecated in version '1.22'
82+
-> it was not called in last 24h
83+
-> endpoint 'cronjobs.v1beta1.batch' is deprecated in version '1.25'
84+
-> it was not called in last 24h
85+
-> endpoint 'horizontalpodautoscalers.v2beta1.autoscaling' is deprecated in version '1.25'
86+
-> it was not called in last 24h
87+
-> endpoint 'poddisruptionbudgets.v1beta1.policy' is deprecated in version '1.25'
88+
-> it was not called in last 24h
89+
-> endpoint 'horizontalpodautoscalers.v2beta2.autoscaling' is deprecated in version '1.26'
90+
-> it was not called in last 24h
91+
```
92+
93+
This script is available at [https://github.com/b4mad/op1st-emea-b4mad/blob/8a46e0b5e923b785618cd4ffa8ea5d065c53fb84/scripts/deprecatedAPIsStillInUse.sh](https://github.com/b4mad/op1st-emea-b4mad/blob/8a46e0b5e923b785618cd4ffa8ea5d065c53fb84/scripts/deprecatedAPIsStillInUse.sh)
94+
95+
### Plan the Migration
96+
97+
Based on the output of the script, plan the migration of the APIs that are being used. The migration plan should include details on the new API versions to use, the applications affected, and the order of migration. For APIs without a clear migration guide, it's recommended to consult with the respective API documentation, OpenShift support, or community forums for guidance.
98+
99+
### Communicate the Plan
100+
101+
Share the plan with the team, and clearly communicate the changes and their implications to ensure a smooth transition. Encourage questions and feedback to ensure everyone understands the plan and its potential impact.
102+
103+
### Test the Migration
104+
105+
Before implementing the migration in a production environment, it's recommended to test the migration in a non-production environment if possible. This will help identify potential issues and mitigation strategies.
106+
107+
### Execute the Migration
108+
109+
Begin the migration as per the plan. Monitor the process closely to identify and address any issues promptly.
110+
111+
### Post-Migration Review
112+
113+
After the migration, review the process and identify any lessons learned. This can help improve future migrations. Also, consider rerunning the script to confirm that the deprecated APIs are no longer in use.
114+
115+
## Conclusion
116+
117+
In the ever-evolving world of technology, staying up to date with the latest standards and practices is crucial. The upgrade from OpenShift 4.12 to 4.13 represents an essential step in maintaining a robust, efficient, and secure platform. The transition involves some complexity due to the deprecation of certain Kubernetes APIs, but with careful planning, thorough testing, and efficient use of tools like the provided bash script, the upgrade process can be managed successfully. The focus should be on minimizing disruption while maximizing the benefits of the new features and improvements in OpenShift 4.13.

0 commit comments

Comments
 (0)