Skip to content
This repository was archived by the owner on Nov 18, 2020. It is now read-only.

dex Operator Example #24

Closed
wants to merge 7 commits into from

Conversation

theishshah
Copy link
Member

@theishshah theishshah commented Aug 13, 2018

This operator is designed to run a dex service. Currently is defaults to the mock connector and the user can control the number of replicas of the dex pods. Future work involves allowing for configurable identity connectors in the CRD.

Tested by running the operator and changing the size field in the CRD to ensure that the correct number of replicas is deployed at any given time.

@hasbro17
Copy link
Contributor

@theishshah Can you add a README for this to explain what this operator is and possibly a walkthrough of how to deploy it and use it(i.e create a CR and verify Dex is running).
I can see its mostly just deploying Dex and then ensuring the deployment size is correct.

@rithujohn191 Can you review this as well since you're more familiar with Dex.

@hasbro17 hasbro17 requested a review from rithujohn191 August 14, 2018 19:07
@rithujohn191
Copy link

@theishshah could you please update the description of this PR with the operator details

!.vscode/launch.json
!.vscode/extensions.json
.history

Choose a reason for hiding this comment

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

Please scrape this down to the bare bones. A lot of this is Visual Studio specific and we dont want to check that into the repo.

# Dex Operator

## Overview
This Dex operator is an operator built with the [Operator SDK][operator_sdk]. Currently the operator supports scaling the numbers of pods on the mock connector and future work involves allowing the connectors to be configured using the operator CRD.

Choose a reason for hiding this comment

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

You are essentially scaling the Dex pods not the connector. This statement is a little misleading. Please clarify that the Dex pod is essentially the server.

$ export IMAGE=quay.io/example-inc/dex-operator:v0.0.1
$ operator-sdk build $IMAGE
$ docker push $IMAGE
```

Choose a reason for hiding this comment

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

After you build it please add a section describing what the operator will do or a workflow of its operations.

kind := "Dex"
namespace, err := k8sutil.GetWatchNamespace()
if err != nil {
logrus.Fatalf("Failed to get watch namespace: %v", err)

Choose a reason for hiding this comment

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

This doesn't seem like the right way to used structures logging. You need to first initialize a logger with a config. See: https://github.com/coreos/dex/blob/6ef8cd512fb9e075bf7d70ec3fe74a8397eadde4/cmd/dex/serve.go#L66

dep := newDexPod(o)
err := sdk.Create(dep)
if err != nil && !errors.IsAlreadyExists(err) {
logrus.Errorf("Failed to create dex pod : %v", err)

Choose a reason for hiding this comment

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

This also needs a logger to be initialized first.

@@ -0,0 +1 @@

Choose a reason for hiding this comment

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

What is the purpose of this file?

Copy link
Contributor

Choose a reason for hiding this comment

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

@rithujohn191 this is generated by the sdk. I believe it is used by the k8s codegen to prepend license to the generated code.

Choose a reason for hiding this comment

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

Oh I see. Thanks.

}

type DexSpec struct {
// Size is the size of the memcached deployment
Copy link
Member

Choose a reason for hiding this comment

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

s/\[Mm\]emcached/\[Dd\]ex/g

logrus.Errorf("Failed to create dex pod : %v", err)
return err
}
err = sdk.Create(newDexPod(o))
Copy link
Member

Choose a reason for hiding this comment

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

Done above, remove one or the other.

@theishshah
Copy link
Member Author

Save for auto-gen issues (which I will fix once we have a patch in the sdk) this operator should be ready to go

@camilamacedo86
Copy link
Contributor

Closing this one as outdated since we decided to move forward just with the Memcached ones.
However, please feel free to re-open if you think that would be required.

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.

6 participants