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

Test authn-k8s on Conjur-OSS deployed via Helm chart on OpenShift #131

Merged
merged 3 commits into from
Mar 22, 2021

Conversation

doodlesbykumbi
Copy link
Contributor

@doodlesbykumbi doodlesbykumbi commented Mar 15, 2021

What does this PR do ?

  1. Adds a logical branch for deploying Conjur OSS via Helm on OpenShift, instead of using kubernetes-conjur-deploy.
    TODO: it's probably better to move this functionality to kubernetes-conjur-deploy.
    TODO: there really needs to be a better way of passing along conjur config to kubernetes-conjur-demo (fortunately we're working on this). At present kubernetes-conjur-demo seems too tightly coupled with kubernetes-conjur-deploy and knows too much about it, this makes it more difficult to make updates to either.
  2. Adds flows to Jenkinsfile for test authn-k8s on Conjur-OSS deployed via Helm chart on OpenShift (using both host-ID-based and annotation-based identity.)

Resolves #110

@doodlesbykumbi doodlesbykumbi force-pushed the test-oss branch 5 times, most recently from e2341f8 to 49577ca Compare March 16, 2021 22:03
Jenkinsfile Outdated
}
}

stage('OpenShift v4.5, v5 Conjur OSS, Postgres, Annotation-based Authn') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this test be grouped with the other Annotation-based below?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for the Host-ID-based Authn stage above this one?
Or, if these Conjur OSS tests can't be merged below, the comment on line 16 should be changed or moved.

@izgeri
Copy link
Contributor

izgeri commented Mar 18, 2021

@doodlesbykumbi I've been talking with @BradleyBoutcher about adding quick start flows (draft content here) to conjurdemos/dap-intro - this way we'd have a single repo to clone to get a basic Conjur OSS or Enterprise up and running on Jenkins. Maybe what you're highlighting here is also an argument for adding a similar super simple flow for Conjur OSS on Kubernetes to dap-intro that we can also use on tests?

The end goal of centralizing all of this content is that we can start to provide super simple patterns for running different Conjur editions in test automation, so that new projects have an easy way to get started writing integration tests.

ETA: not for this PR, obviously - just wanted to raise this as a future-thinking option.

Copy link
Contributor

@diverdane diverdane left a comment

Choose a reason for hiding this comment

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

Looks good so far!!! I have a little bit more to review.

Jenkinsfile Outdated
}
}

stage('OpenShift v4.5, v5 Conjur OSS, Postgres, Annotation-based Authn') {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same for the Host-ID-based Authn stage above this one?
Or, if these Conjur OSS tests can't be merged below, the comment on line 16 should be changed or moved.

ci/test Outdated
runDockerCommand "
./stop
helm --namespace '$CONJUR_NAMESPACE_NAME' delete '${CONJUR_OSS_HELM_RELEASE_NAME}'
kubectl delete namespace $CONJUR_NAMESPACE_NAME
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably use a "$cli" here instead of kubectl to switch between oc and kubectl.

We can also consider adding a comment timeout since we're deleting a namespace. Namespace deletion can involve deleting many objectss, including some objects like LoadBalancers that use finalizers, and sometimes there are bugs whereby finalizers aren't getting cleared. Granted, this only came into play for OC 4.3 so far, but maybe good to add a timeout?

I don't know if it makes sense to go this deeply, but in the stop script, we're also describing residual objects in the namespace:

  "$cli" delete --timeout="$KUBE_CLI_DELETE_TIMEOUT" \
      namespace "$TEST_APP_NAMESPACE_NAME" || \
      (echo "ERROR: Delete of namespace $TEST_APP_NAMESPACE_NAME failed" && \
      echo "Showing residual resources in namespace:" && \
      "$cli" describe all -n "$TEST_APP_NAMESPACE_NAME")

Might be enough just to display an error, without the residual objects?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think both are good ideas. The residual objects will be great for debugging.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about the $cli and realised there's no loss in generality by using only kubectl, especially since all the changes in this PR are for testing only but also because

  1. kubectl is available in the test container
  2. Both OpenShift and Kubernetes respect the Kubernetes API

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I think this makes sense, and would keep things more KISS.

Copy link
Contributor

@diverdane diverdane left a comment

Choose a reason for hiding this comment

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

Looks good, just a few minor questions/suggestions.

--set service.external.enabled=false \
--set postgres.persistentVolume.create=false \
--set rbac.create=true \
--set 'dataKey=To7gsAFQOm7NlVnBWA3gFYlZIHC25pGwm/pMxlcHLUY=' \
Copy link
Contributor

Choose a reason for hiding this comment

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

Peripheral comment: It will be nice to have the Helm chart automatically generate a dataKey (cyberark/conjur-oss-helm-chart#136)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would! I also realised that we tend to generate certain things (like the datakey) that can be static for the sake of testing.


cd '${workdir}'

kubectl create namespace '${CONJUR_NAMESPACE_NAME}'
Copy link
Contributor

Choose a reason for hiding this comment

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

kubectl here should be oc? Same for other instances of kubectl below.

@rpothier rpothier force-pushed the test-oss branch 5 times, most recently from 2f1da19 to 5cbdd00 Compare March 19, 2021 21:39
Namespace deletion can fail or hang indefinitely for a variety of reasons. A timeout helps to prevent against this.
Copy link
Contributor

@diverdane diverdane left a comment

Choose a reason for hiding this comment

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

LGTM! It's so great to get this in!

@rpothier
Copy link
Contributor

LGTM

@izgeri izgeri merged commit 21de8d1 into master Mar 22, 2021
@izgeri izgeri deleted the test-oss branch March 22, 2021 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test authn-k8s on Conjur-OSS deployed via Helm chart on OpenShift
4 participants