-
Notifications
You must be signed in to change notification settings - Fork 131
Conversation
@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). @rithujohn191 Can you review this as well since you're more familiar with Dex. |
@theishshah could you please update the description of this PR with the operator details |
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
.history | ||
|
There was a problem hiding this comment.
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/README.md
Outdated
# 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. |
There was a problem hiding this comment.
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 | ||
``` |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 @@ | |||
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
dex-operator/pkg/stub/handler.go
Outdated
logrus.Errorf("Failed to create dex pod : %v", err) | ||
return err | ||
} | ||
err = sdk.Create(newDexPod(o)) |
There was a problem hiding this comment.
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.
Save for auto-gen issues (which I will fix once we have a patch in the sdk) this operator should be ready to go |
Closing this one as outdated since we decided to move forward just with the Memcached ones. |
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.