Skip to content
Merged
Show file tree
Hide file tree
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

This file was deleted.

2 changes: 2 additions & 0 deletions manifests/cluster-authentication-operator_05_deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ spec:
value: quay.io/openshift/origin-hypershift:v4.0
- name: OPERATOR_IMAGE_VERSION
value: "0.0.1-snapshot"
- name: OPERAND_IMAGE_VERSION
value: "0.0.1-snapshot_openshift"
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
3 changes: 1 addition & 2 deletions pkg/operator2/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"crypto/sha512"
"encoding/base64"
"fmt"
"os"
"strings"

operatorv1 "github.com/openshift/api/operator/v1"
Expand Down Expand Up @@ -106,7 +105,7 @@ func defaultDeployment(
SecurityContext: &corev1.PodSecurityContext{},
Containers: []corev1.Container{
{
Image: os.Getenv("IMAGE"),
Image: osinImage,
ImagePullPolicy: corev1.PullPolicy("IfNotPresent"),
Name: targetName,
Command: []string{
Expand Down
23 changes: 17 additions & 6 deletions pkg/operator2/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ const (
targetName = "openshift-authentication"
targetNameOperator = "openshift-authentication-operator"
globalConfigName = "cluster"
osinOperandName = "integrated-oauth-server"

operatorSelfName = "operator"
osinOperandName = "integrated-oauth-server"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we rename osin references while we're at it? It's probably not clear what it is for ppl coming to the codebase post 4.0. oauthServerDeploymentName or whatever would be more descriptive anyways.

operatorVersionEnvName = "OPERATOR_IMAGE_VERSION"
operandVersionEnvName = "OPERAND_IMAGE_VERSION"
operandImageEnvName = "IMAGE"
apiHostEnvName = "KUBERNETES_SERVICE_HOST"

machineConfigNamespace = "openshift-config-managed"
userConfigNamespace = "openshift-config"
Expand Down Expand Up @@ -113,6 +117,16 @@ const (
containerPort = 6443
)

// static environment variables from operator deployment
var (
osinImage = os.Getenv(operandImageEnvName)
osinVersion = os.Getenv(operandVersionEnvName)

operatorVersion = os.Getenv(operatorVersionEnvName)

apiserverURL = os.Getenv(apiHostEnvName)
Copy link
Contributor

Choose a reason for hiding this comment

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

These should be handled in the cmd package along with other configuration.

)

type authOperator struct {
authOperatorConfigClient OperatorClient

Expand Down Expand Up @@ -359,9 +373,8 @@ func (c *authOperator) handleSync(operatorConfig *operatorv1.Authentication) err

if ready {
// Set current version and available status
version := os.Getenv(operatorVersionEnvName)
if c.versionGetter.GetVersions()["operator"] != version {
c.versionGetter.SetVersion("operator", version)
if c.versionGetter.GetVersions()[operatorSelfName] != operatorVersion {
c.versionGetter.SetVersion(operatorSelfName, operatorVersion)
}
c.setAvailableStatus(operatorConfig)
}
Expand Down Expand Up @@ -390,7 +403,6 @@ func (c *authOperator) checkReady(
}

// when the deployment is ready, set its version for the operator
osinVersion := status.VersionForOperand(targetNameOperator, os.Getenv("IMAGE"), c.configMaps, c.recorder)
if c.versionGetter.GetVersions()[osinOperandName] != osinVersion {
c.versionGetter.SetVersion(osinOperandName, osinVersion)
}
Expand Down Expand Up @@ -497,7 +509,6 @@ func (c *authOperator) checkWellknownEndpointReady(authConfig *configv1.Authenti
return false, "", fmt.Errorf("failed to build transport for SA ca.crt: %v", err)
}

apiserverURL := os.Getenv("KUBERNETES_SERVICE_HOST")
wellKnown := "https://" + apiserverURL + oauthMetadataAPIEndpoint

req, err := http.NewRequest(http.MethodGet, wellKnown, nil)
Expand Down