Skip to content

Create the service before waiting for serving certs #84

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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions pkg/operator2/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ func (c *authOperator) handleSync(operatorConfig *operatorv1.Authentication) err
// we get resource versions so that if either changes, we redeploy our payload
resourceVersions := []string{operatorConfig.GetResourceVersion()}

// The BLOCK sections are highly order dependent

// ==================================
// BLOCK 1: Metadata
// ==================================

route, err := c.handleRoute()
if err != nil {
return err
Expand All @@ -195,17 +201,26 @@ func (c *authOperator) handleSync(operatorConfig *operatorv1.Authentication) err
}
resourceVersions = append(resourceVersions, authConfig.GetResourceVersion())

serviceCA, servingCert, err := c.handleServiceCA()
// ==================================
// BLOCK 2: service and service-ca data
// ==================================

// make sure we create the service before we start asking about service certs
service, _, err := resourceapply.ApplyService(c.services, c.recorder, defaultService())
if err != nil {
return err
}
resourceVersions = append(resourceVersions, serviceCA.GetResourceVersion(), servingCert.GetResourceVersion())
resourceVersions = append(resourceVersions, service.GetResourceVersion())

service, _, err := resourceapply.ApplyService(c.services, c.recorder, defaultService())
serviceCA, servingCert, err := c.handleServiceCA()
if err != nil {
return err
}
resourceVersions = append(resourceVersions, service.GetResourceVersion())
resourceVersions = append(resourceVersions, serviceCA.GetResourceVersion(), servingCert.GetResourceVersion())

// ==================================
// BLOCK 3: build cli config
// ==================================

expectedSessionSecret, err := c.expectedSessionSecret()
if err != nil {
Expand Down Expand Up @@ -238,6 +253,10 @@ func (c *authOperator) handleSync(operatorConfig *operatorv1.Authentication) err
}
resourceVersions = append(resourceVersions, cliConfig.GetResourceVersion())

// ==================================
// BLOCK 4: deployment
// ==================================

operatorDeployment, err := c.deployments.Deployments(targetNameOperator).Get(targetNameOperator, metav1.GetOptions{})
if err != nil {
return err
Expand Down