Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

Add API manager deployment#274

Merged
darkowlzz merged 7 commits intostorageos:masterfrom
darkowlzz:api-controller-deployment
Oct 5, 2020
Merged

Add API manager deployment#274
darkowlzz merged 7 commits intostorageos:masterfrom
darkowlzz:api-controller-deployment

Conversation

@darkowlzz
Copy link
Contributor

No description provided.

@darkowlzz darkowlzz added the do-not-merge/wip The PR is still work in progress or not ready to be merged label Sep 10, 2020
@croomes croomes force-pushed the api-controller-deployment branch from 828ed67 to 7dba0c6 Compare September 11, 2020 08:44
@croomes croomes changed the title Add API controller deployment Add API manager deployment Sep 24, 2020
@croomes croomes force-pushed the api-controller-deployment branch 4 times, most recently from d2bf2d5 to ef20876 Compare October 5, 2020 11:04
@croomes croomes removed the do-not-merge/wip The PR is still work in progress or not ready to be merged label Oct 5, 2020
@croomes croomes force-pushed the api-controller-deployment branch from ef20876 to 57f3c85 Compare October 5, 2020 11:14
Copy link
Contributor Author

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

Looks great. Left a few comments.

configmapName = "storageos-node-config"
csiHelperName = "storageos-csi-helper"
apiManagerName = "storageos-api-manager"
apiManagerMetricsName = "storageos-api-manager-metrics"
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'll be useful to move these names above, along with the other exported variables and use them in the test, avoiding writing raw string names of these components in the tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Moved to api-manager.go and exported, tests updated.

func APIManagerDeploymentTest(t *testing.T, ns string, retryInterval, timeout time.Duration) {
f := framework.Global
var deployment *appsv1.Deployment
err := wait.Poll(retryInterval, timeout, func() (done bool, err error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's e2eutil.WaitForDeployment() from the operator-sdk test framework for waiting for Deployment to be ready with a given number of replicas. Can that be used here instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

if err != nil {
return false, err
}
// TODO: wait for available? It's timing out waiting atm.
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 this is failing because there's no storageos/api-manager:v0.1.0 published yet. Maybe we should publish a develop image in these tests by setting it in the ClusterConfiguration of the test cluster.


// check label needed for metrics service.
for _, pod := range pods.Items {
label := "app.kubernetes.io/component"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can be replaced with AppComponent from pkg/util/k8s.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

// getServiceMonitor returns a generic ServiceMonitor object.
func getServiceMonitor(name, namespace string, labels map[string]string, annotations map[string]string, svc *corev1.Service) *monitoringv1.ServiceMonitor {
boolTrue := true
ownerRef := metav1.OwnerReference{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we should have a comment here explaining that this helps in cleanup, we want the SM to be deleted when the associated Service is deleted.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

client := fake.NewFakeClient()
s := scheme.Scheme
for _, f := range []func(*runtime.Scheme) error{
monitoringv1.AddToScheme,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should be able to make the above CSIDriver test case pass by importing

storagev1beta1 "k8s.io/api/storage/v1beta1"

and adding storagev1beta1.AddToScheme here.

I don't remember why it wasn't done before 😄
thanks.

Copy link
Contributor

Choose a reason for hiding this comment

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

Added & confirmed it fixed the CSI test.


// Check the pod template component label (required for service).
label := "app.kubernetes.io/component"
want := "storageos-api-manager"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These can be replaced with constants from other packages.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done

t.Errorf("expected svc label %q not set", label)
}
if ok && got != want {
t.Errorf("expected svc label %q set to %q, want %q", label, got, want)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

expected -> got

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed

CSIv0ExternalProvisionerContainerImage = "storageos/csi-provisioner:v0.4.3"
CSIv0ExternalAttacherContainerImage = "quay.io/k8scsi/csi-attacher:v0.4.2"
DefaultNFSContainerImage = "storageos/nfs:1.0.0"
DefaultAPIManagerImage = "storageos/api-manager:v0.1.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe set it to develop tag for now, until we have a versioned release. We can update this along with the node container before release.

Copy link
Contributor

@croomes croomes Oct 5, 2020

Choose a reason for hiding this comment

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

Pushed storageos/api-manager:develop and changed the default.

Copy link
Contributor Author

@darkowlzz darkowlzz left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks.

@darkowlzz darkowlzz merged commit 21c1b02 into storageos:master Oct 5, 2020
@darkowlzz darkowlzz deleted the api-controller-deployment branch October 5, 2020 18:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants