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

HOSTEDCP-2033: Add ARO HCP environment vars to CSI deployment #517

Merged
merged 1 commit into from
Oct 23, 2024

Conversation

bryan-cox
Copy link
Member

@bryan-cox bryan-cox commented Oct 7, 2024

This commit adds environment variables needed by a CSI deployment for ARO HCP.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 7, 2024
Copy link
Contributor

openshift-ci bot commented Oct 7, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@bryan-cox bryan-cox marked this pull request as ready for review October 9, 2024 23:52
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 9, 2024
@bryan-cox
Copy link
Member Author

/retest

This commit adds environment variables needed by a CSI deployment for
ARO HCP.

Signed-off-by: Bryan Cox <[email protected]>
@bryan-cox
Copy link
Member Author

/test hypershift-aws-e2e-external

@bryan-cox bryan-cox changed the title Add ARO HCP environment vars to CSI deployment HOSTEDCP-2033: Add ARO HCP environment vars to CSI deployment Oct 19, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Oct 19, 2024

@bryan-cox: This pull request references HOSTEDCP-2033 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target only the "4.18.0" version, but multiple target versions were set.

In response to this:

This commit adds environment variables needed by a CSI deployment for ARO HCP.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Oct 19, 2024
@bryan-cox
Copy link
Member Author

/retest

Comment on lines +135 to +146
// The existence of the environment variable, ARO_HCP_SECRET_PROVIDER_CLASS_FOR_FILE, means this is an ARO HCP
// deployment. We need to pass along additional environment variables for ARO HCP in order to mount the backing
// certificates, related to the client IDs, in a volume on the azure-disk-csi-controller and
// azure-file-csi-controller deployments.
if os.Getenv("ARO_HCP_SECRET_PROVIDER_CLASS_FOR_FILE") != "" {
envVars := []corev1.EnvVar{
{Name: "ARO_HCP_SECRET_PROVIDER_CLASS_FOR_FILE", Value: os.Getenv("ARO_HCP_SECRET_PROVIDER_CLASS_FOR_FILE")},
{Name: "ARO_HCP_SECRET_PROVIDER_CLASS_FOR_DISK", Value: os.Getenv("ARO_HCP_SECRET_PROVIDER_CLASS_FOR_DISK")},
}

required.Spec.Template.Spec.Containers[0].Env = append(required.Spec.Template.Spec.Containers[0].Env, envVars...)
}
Copy link
Contributor

@jsafrane jsafrane Oct 23, 2024

Choose a reason for hiding this comment

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

I would prefer a new Azure specific hook in the operator config.

  • When creating the operator config here, add a new DeploymentHook on HyperShift.
cfg.DeploymentHooks = append(cfg.DeploymentHooks, withAROSecretEnvVars())
  • And then put the hook func somewhere
func withAROSecretEnvVars() dc.DeploymentHookFunc {
	hook := func(_ *opv1.OperatorSpec, deployment *appsV1.Deployment) error {
          if os.Getenv("ARO_HCP_SECRET_PROVIDER_CLASS_FOR_FILE") != "" {
            envVars := []corev1.EnvVar{
			{Name: "ARO_HCP_SECRET_PROVIDER_CLASS_FOR_FILE", Value: os.Getenv("ARO_HCP_SECRET_PROVIDER_CLASS_FOR_FILE")},
			{Name: "ARO_HCP_SECRET_PROVIDER_CLASS_FOR_DISK", Value: os.Getenv("ARO_HCP_SECRET_PROVIDER_CLASS_FOR_DISK")},
		}

		deployment.Spec.Template.Spec.Containers[0].Env = append(deployment.Spec.Template.Spec.Containers[0].Env, envVars...)
        }
	return hook
}

And use the same hook in azure_file.go

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, I thought it's CSI driver operator PR
This is OK for CSO

/lgtm
/approve
/label px-approved
/label docs-approved
/label qe-approved
There will be another PR in azure CSI driver operators to use these env. vars. We should test those.

Copy link
Member Author

Choose a reason for hiding this comment

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

Discussed offline, this PR is just to pass the HyperShift environment variables on to the CSI operator. Updating the azure-file and azure-disk-csi-operators in the CSI operator repo will be done in a follow up PR.

@openshift-ci openshift-ci bot added px-approved Signifies that Product Support has signed off on this PR docs-approved Signifies that Docs has signed off on this PR qe-approved Signifies that QE has signed off on this PR labels Oct 23, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Oct 23, 2024

@bryan-cox: This pull request references HOSTEDCP-2033 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target only the "4.18.0" version, but multiple target versions were set.

In response to this:

This commit adds environment variables needed by a CSI deployment for ARO HCP.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2024
Copy link
Contributor

openshift-ci bot commented Oct 23, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox, jsafrane

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:

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 23, 2024
@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 595d468 and 2 for PR HEAD 759166b in total

Copy link
Contributor

openshift-ci bot commented Oct 23, 2024

@bryan-cox: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-ibmcloud-csi 759166b link false /test e2e-ibmcloud-csi

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@bryan-cox
Copy link
Member Author

/test e2e-azure-csi

@openshift-merge-bot openshift-merge-bot bot merged commit 3dfadbf into openshift:master Oct 23, 2024
17 of 18 checks passed
@openshift-bot
Copy link
Contributor

[ART PR BUILD NOTIFIER]

Distgit: cluster-storage-operator
This PR has been included in build ose-cluster-storage-operator-container-v4.18.0-202410232239.p0.g3dfadbf.assembly.stream.el9.
All builds following this will include this PR.

@bryan-cox bryan-cox deleted the HOSTEDCP-1994 branch October 24, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants