Skip to content

Commit

Permalink
Update Operator CRDs and add a Lint check to prevent drifts (#29554)
Browse files Browse the repository at this point in the history
This PR fixes the operator's CRDs drift between the CRD and the proto
stubs they are derived from.

It also adds a check to prevent future drifts by forcing the manifest
generation and requiring an empty diff.

Fixes #29438
  • Loading branch information
tigrato committed Jul 26, 2023
1 parent 89910e9 commit b1bd951
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
# We have to add the current directory as a safe directory or else git commands will not work as expected.
run: git config --global --add safe.directory $(realpath .) && make protos-up-to-date/host

- name: Check if Operator CRDs are up to date
# We have to add the current directory as a safe directory or else git commands will not work as expected.
run: git config --global --add safe.directory $(realpath .) && make crds-up-to-date

# The `buf breaking` check is twofold: we always check for compatibility
# breaks against the base of the PR, and in backports we check for
# compatibility breaks _from_ the tip of master. It's possible to add
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,15 @@ must-start-clean/host:
exit 1; \
fi

# crds-up-to-date checks if the generated CRDs from the protobuf stubs are up to date.
.PHONY: crds-up-to-date
crds-up-to-date: must-start-clean/host
$(MAKE) -C integrations/operator manifests
@if ! $(GIT) diff --quiet; then \
echo 'Please run make -C integrations/operator manifests.'; \
exit 1; \
fi

print/env:
env

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ spec:
description: AddLabels specifies which labels to add if any
of the previous matches match.
nullable: true
additionalProperties:
type: string
properties:
key:
type: string
value:
type: string
type: object
match:
description: Match is a set of matching rules for this mapping.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,11 @@ spec:
description: CreateHostUser allows users to be automatically created
on a host
type: boolean
create_host_user_mode:
description: CreateHostUserMode allows users to be automatically
created on a host when not set to off
format: int32
type: integer
desktop_clipboard:
description: DesktopClipboard indicates whether clipboard sharing
is allowed between the user's workstation and the remote desktop.
Expand Down Expand Up @@ -1082,7 +1087,7 @@ spec:
type: string
request_prompt:
description: RequestPrompt is an optional message which tells
users what they aught to request.
users what they aught to
type: string
require_session_mfa:
description: RequireMFAType is the type of MFA requirement enforced
Expand Down Expand Up @@ -2143,6 +2148,11 @@ spec:
description: CreateHostUser allows users to be automatically created
on a host
type: boolean
create_host_user_mode:
description: CreateHostUserMode allows users to be automatically
created on a host when not set to off
format: int32
type: integer
desktop_clipboard:
description: DesktopClipboard indicates whether clipboard sharing
is allowed between the user's workstation and the remote desktop.
Expand Down Expand Up @@ -2248,7 +2258,7 @@ spec:
type: string
request_prompt:
description: RequestPrompt is an optional message which tells
users what they aught to request.
users what they aught to
type: string
require_session_mfa:
description: RequireMFAType is the type of MFA requirement enforced
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,11 @@ spec:
description: CreateHostUser allows users to be automatically created
on a host
type: boolean
create_host_user_mode:
description: CreateHostUserMode allows users to be automatically
created on a host when not set to off
format: int32
type: integer
desktop_clipboard:
description: DesktopClipboard indicates whether clipboard sharing
is allowed between the user's workstation and the remote desktop.
Expand Down Expand Up @@ -1082,7 +1087,7 @@ spec:
type: string
request_prompt:
description: RequestPrompt is an optional message which tells
users what they aught to request.
users what they aught to
type: string
require_session_mfa:
description: RequireMFAType is the type of MFA requirement enforced
Expand Down Expand Up @@ -2143,6 +2148,11 @@ spec:
description: CreateHostUser allows users to be automatically created
on a host
type: boolean
create_host_user_mode:
description: CreateHostUserMode allows users to be automatically
created on a host when not set to off
format: int32
type: integer
desktop_clipboard:
description: DesktopClipboard indicates whether clipboard sharing
is allowed between the user's workstation and the remote desktop.
Expand Down Expand Up @@ -2248,7 +2258,7 @@ spec:
type: string
request_prompt:
description: RequestPrompt is an optional message which tells
users what they aught to request.
users what they aught to
type: string
require_session_mfa:
description: RequireMFAType is the type of MFA requirement enforced
Expand Down

0 comments on commit b1bd951

Please sign in to comment.