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
OAuthAPIServerController #344
OAuthAPIServerController #344
Conversation
b171113
to
5e93a38
Compare
/assign @sttts |
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Show resolved
Hide resolved
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Outdated
Show resolved
Hide resolved
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Outdated
Show resolved
Hide resolved
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Outdated
Show resolved
Hide resolved
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Outdated
Show resolved
Hide resolved
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Outdated
Show resolved
Hide resolved
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Outdated
Show resolved
Hide resolved
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Outdated
Show resolved
Hide resolved
pkg/operator/oauthapiencryptioncontroller/oauthapiencryptioncontroller.go
Outdated
Show resolved
Hide resolved
/test e2e-aws |
804591b
to
4b1ed30
Compare
if apierrors.IsNotFound(err) { | ||
// case 1: create with annotation | ||
if _, exists := openshiftAPIServerEncryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey]; !exists { | ||
return fmt.Errorf("%s/%s doesn't contain the required key %q", openshiftAPIServerEncryptionCfg.Name, openshiftAPIServerEncryptionCfg.Namespace, encryptionconfig.EncryptionConfSecretKey) |
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.
swap ns and name
encryptionCfg.Annotations[encryptionstate.KubernetesDescriptionKey] = encryptionstate.KubernetesDescriptionScaryValue | ||
encryptionCfg.Data = map[string][]byte{} | ||
encryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey] = openshiftAPIServerEncryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey] | ||
encryptionCfg.Finalizers = []string{encryptionsecret.EncryptionSecretFinalizer} |
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.
encryptionCfg := &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{
Name: ...
Namespcae: ...
},
...
}
is easier to read IMO
encryptionCfg.Annotations[encryptionstate.KubernetesDescriptionKey] = encryptionstate.KubernetesDescriptionScaryValue | ||
encryptionCfg.Data = map[string][]byte{} | ||
encryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey] = openshiftAPIServerEncryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey] | ||
encryptionCfg.Finalizers = []string{encryptionsecret.EncryptionSecretFinalizer} |
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.
is there a controller doing finalizing? Or is it just there to block deletion?
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.
I added it to block deletion.
encryptionCfg.Annotations[encryptionConfigManagedBy] = encryptionConfigManagedByValue | ||
encryptionCfg.Annotations[encryptionstate.KubernetesDescriptionKey] = encryptionstate.KubernetesDescriptionScaryValue | ||
encryptionCfg.Data = map[string][]byte{} | ||
encryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey] = openshiftAPIServerEncryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey] |
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.
nit: why not whole Data?
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.
it's a map and someone else could have added entries we don't need.
oasEncryptionCfgData := openshiftAPIServerEncryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey] | ||
if !equality.Semantic.DeepEqual(oauthEncryptionCfgData, oasEncryptionCfgData) { | ||
encryptionCfg := oauthAPIServerEncryptionCfg.DeepCopy() | ||
encryptionCfg.Data[encryptionconfig.EncryptionConfSecretKey] = oasEncryptionCfgData |
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.
didn't we have any annotations that play a role? Or just for keys?
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.
we actually use https://github.com/openshift/library-go/blob/master/pkg/operator/encryption/encryptionconfig/secret.go#L71 but the content is the same :) (uff)
4b1ed30
to
736bfa9
Compare
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: p0lyn0mial, sttts The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
this PR adds
OAuthAPIServerController
that will manageencryption-config-openshift-oauth-apiserver
as described in https://github.com/openshift/enhancements/blob/master/enhancements/etcd/etcd-encryption-for-separate-oauth-apis.md