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

ROX-19820: Address feedback from gitops meeting #1294

Merged
merged 9 commits into from
Sep 28, 2023

Conversation

ludydoo
Copy link
Collaborator

@ludydoo ludydoo commented Sep 21, 2023

Description

ROX-19820

Addressing issues and feedback from the gitops meeting

  • Do not use templating for specifying the CRD base url.Directly specify as such. Simpler than using a template.
  • Add flags disableCentralReconciler and disableSecuredClusterReconciler on the operator
  • Drop Git References. Necessary to accommodate the Dogfood instance. The gitRef abstraction is not sufficient/flexible enough.
  • align the gitops operator config with the helm values

Checklist (Definition of Done)

  • Unit and integration tests added
  • Added test description under Test manual
  • Documentation added if necessary (i.e. changes to dev setup, test execution, ...)
  • CI and all relevant tests are passing
  • Add the ticket number to the PR title if available, i.e. ROX-12345: ...
  • Discussed security and business related topics privately. Will move any security and business related topics that arise to private communication channel.
  • Add secret to app-interface Vault or Secrets Manager if necessary
  • RDS changes were e2e tested manually
  • Check AWS limits are reasonable for changes provisioning new resources

Test manual

TODO: Add manual testing efforts

# To run tests locally run:
make db/teardown db/setup db/migrate
make ocm/setup OCM_OFFLINE_TOKEN=<ocm-offline-token> OCM_ENV=development
make verify lint binary test test/integration

@ludydoo ludydoo requested a review from kurlov September 21, 2023 14:53
@ludydoo ludydoo temporarily deployed to development September 21, 2023 14:53 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 14:53 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 14:53 — with GitHub Actions Inactive
Expect(err).To(BeNil())

It("should deploy operator with label selector 4.1.1", func() {
Eventually(validateOperatorDeployment(ctx, "4.1.1", "quay.io/rhacs-eng/stackrox-operator:4.1.1")).
It("should contain only two operator deployments", func() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved checking that 2 operators were deployed before asserting their properties

WithTimeout(waitTimeout).
WithPolling(defaultPolling).
Should(Succeed())
})
It("should contain only one operator deployments", func() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved checking that only 1 operator deployment is present before asserting its properties

Expect(err).To(BeNil())

It("should contain one operator deployment", func() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an assertion to check the presence of 1 operator deployment

@@ -82,9 +82,21 @@ spec:
containerName: manager
resource: limits.memory
divisor: '0'
{{- if .labelSelector }}
{{- if .centralLabelSelector }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there will be both a centralLabelSelector and securedClusterLabelSelector hence the renaming

@@ -16,82 +24,82 @@ func parseConfig(content []byte) (OperatorConfigs, error) {
return out, nil
}

// Validate validates the operator configuration and can be used in different life-cycle stages like runtime and deploy time.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to validation.go with all validation methods

Image string `json:"image"`
GitRef string `json:"gitRef"`
HelmValues string `json:"helmValues,omitempty"`
type OperatorConfig map[string]interface{}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to map[string]interface{} so that it is compatible with helm values

type OperatorConfig map[string]interface{}

// GetDeploymentName returns the deployment name of the operator.
func (o OperatorConfig) GetDeploymentName() string {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added getters to simplify accessing properties of the map[string]interface{} with known keys

@ludydoo ludydoo temporarily deployed to development September 21, 2023 14:59 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 14:59 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 14:59 — with GitHub Actions Inactive
@@ -6,22 +6,31 @@ metadata:
data:
config.yaml: |
rhacsOperators:
crd:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per feedback that raw urls were preferrable


// CRDConfig represents the crd to be installed in the data-plane cluster. The CRD is downloaded automatically
// from the base URL. It takes a GitRef to resolve a GitHub link to the CRD definition.
type CRDConfig struct {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed as this is now a []string

assert.Equal(t, "quay.io/rhacs-eng/stackrox-operator:4.1.1", conf.Configs[0].Image)
}

func TestGetOperatorConfigFailsValidation(t *testing.T) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to validation_test.go

)

func parseOperatorConfigs(operators OperatorConfigs) ([]chartutil.Values, error) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved validation logic to validation.go

Copy link
Member

@kurlov kurlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice!

image: "quay.io/rhacs-eng/stackrox-operator:4.1.1"
- gitRef: 4.1.0

- deploymentName: "rhacs-operator-4-2-0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: dots are allowed in deployment name if they are not in the end

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waaat?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant that rhacs-operator-4.2.0 is a valid deployment name but rhacs-operator-4.2.0. is not

e2e/e2e_canary_upgrade_test.go Outdated Show resolved Hide resolved
// OperatorConfigs represents all operators and the CRD which should be installed in a data-plane cluster.
type OperatorConfigs struct {
CRD CRDConfig `json:"crd"`
CRDURLs []string `json:"crdUrls"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought: Should we replace list of URLs with two values? CentralCRDURL and SecuredClusterCRDURL

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind either way

Copy link
Collaborator Author

@ludydoo ludydoo Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though, this will get passed to helm directly. Its function is not to install CRDs per se, but it can install any yaml resource.

  • Rename to additionalResources, and allow any yaml to be specified there.
  • Either keep CrdUrls or split into CentralCRDUrl or SecuredClusterCRDUrl, and validate that these files actually contain only 1 valid kind: CustomResourceDefinition

@ludydoo ludydoo temporarily deployed to development September 21, 2023 15:25 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 15:25 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 15:25 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 15:30 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 15:30 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 15:30 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 15:33 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 15:33 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 16:10 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 16:10 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 21, 2023 16:11 — with GitHub Actions Inactive
@ludydoo ludydoo requested a review from kurlov September 21, 2023 17:05
Copy link
Member

@SimonBaeumer SimonBaeumer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job here @ludydoo and @kurlov 👊

image: "quay.io/rhacs-eng/stackrox-operator:4.1.0"
centralLabelSelector: "rhacs.redhat.com/version-selector=4.1.0"
disableSecuredClusterReconciler: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: instead of disableSecuredClusterReconciler it should be securedClusterReconcilerEnabled: false. Double-negations are often done wrong.
Fred and me had it yesterday where we wanted to enable delegated scanning but disabled it:
ROX_DELEGATED_SCANNING_DISABLED=true.

@openshift-ci openshift-ci bot removed the lgtm label Sep 22, 2023
@ludydoo ludydoo temporarily deployed to development September 22, 2023 11:54 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 22, 2023 11:54 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 22, 2023 11:54 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 22, 2023 12:05 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 22, 2023 12:06 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 22, 2023 12:06 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 22, 2023 13:14 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 22, 2023 13:14 — with GitHub Actions Inactive
@ludydoo ludydoo temporarily deployed to development September 22, 2023 13:14 — with GitHub Actions Inactive
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 22, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kurlov, ludydoo, SimonBaeumer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [SimonBaeumer,kurlov]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ludydoo ludydoo merged commit 479d887 into main Sep 28, 2023
@ludydoo ludydoo deleted the ROX-19820-gitops-feedback branch September 28, 2023 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants