Skip to content

Add 'rm ca.srl' to kind-add-user workflow #34

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

Merged

Conversation

ChristianZaccaria
Copy link
Contributor

Issue link

Related to: #33

What changes have been made

Added rm ca.srl to the cleanup as I found it was generated when creating the user locally.

Verification steps

With a KinD cluster named kind, I ran the following locally, where the ca.srl is now removed on cleanup:

        # Get KinD certificates
        docker cp kind-control-plane:/etc/kubernetes/pki/ca.crt .
        docker cp kind-control-plane:/etc/kubernetes/pki/ca.key .

        # Generate certificates for new user
        openssl genrsa -out user.key 2048
        openssl req -new -key user.key -out user.csr -subj '/CN=sdk-user/O=tenant'
        openssl x509 -req -in user.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out user.crt -days 360

        # Add generated certificated to KinD context
        user_crt=$(base64 --wrap=0 user.crt)
        user_key=$(base64 --wrap=0 user.key)
        yq eval -i ".contexts += {\"context\": {\"cluster\": \"kind-kind\", \"user\": \"sdk-user\"}, \"name\": \"sdk-user\"}" $HOME/.kube/config
        yq eval -i ".users += {\"name\": \"sdk-user\", \"user\": {\"client-certificate-data\": \"$user_crt\", \"client-key-data\": \"$user_key\"}}" $HOME/.kube/config
        cat $HOME/.kube/config

        # Cleanup
        rm ca.crt
        rm ca.srl
        rm ca.key
        rm user.crt
        rm user.key
        rm user.csr

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

@astefanutti
Copy link
Collaborator

/lgtm

@astefanutti
Copy link
Collaborator

/approve

Copy link

openshift-ci bot commented Feb 7, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: astefanutti, ChristianZaccaria

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 label Feb 7, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit d7a2292 into project-codeflare:main Feb 7, 2024
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.

2 participants