Skip to content
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

create_security_context_constraint doesn't work #367

Closed
cben opened this issue Nov 23, 2018 · 1 comment · Fixed by #366
Closed

create_security_context_constraint doesn't work #367

cben opened this issue Nov 23, 2018 · 1 comment · Fixed by #366
Assignees
Labels

Comments

@cben
Copy link
Collaborator

cben commented Nov 23, 2018

This results from same mess as #307 but distinct problem. We had a workaround for this for create_endpoint but create_security_context_constraint is broken. It's an openshift resource, available both in 'v1' core api and a separate api group, neither works:

testing_scc = Kubeclient::Resource.new(
  metadata: {
    name: 'teleportation'
  },
  runAsUser: {
    type: 'MustRunAs'
  },
  seLinuxContext: {
    type: 'MustRunAs'
  }
)      

client = Kubeclient::Client.new(context.api_endpoint, context.api_version, ssl_options: context.ssl_options, auth_options: context.auth_options)

pry(main)> client = Kubeclient::Client.new(context.api_endpoint, 'v1', ssl_options: context.ssl_options, auth_options: context.auth_options)
pry(main)> client.create_security_context_constraint(testing_scc)
Kubeclient::HttpError: SecurityContextConstraint in version "v1" cannot be handled as a SecurityContextConstraints: no kind "SecurityContextConstraint" is registered for version "v1"
from /home/bpaskinc/kubeclient/lib/kubeclient/common.rb:125:in `rescue in handle_exception'
Caused by RestClient::BadRequest: 400 Bad Request
from /home/bpaskinc/myenv/rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:223:in `exception_with_response'

pry(main)> sclient = Kubeclient::Client.new(context.api_endpoint + '/apis/security.openshift.io', 'v1', ssl_options: context.ssl_options, auth_options: context.auth_options)
pry(main)> sclient.create_security_context_constraint(testing_scc)
Kubeclient::HttpError: SecurityContextConstraint in version "v1" cannot be handled as a SecurityContextConstraints: no kind "SecurityContextConstraint" is registered for version "security.openshift.io/v1"
from /home/bpaskinc/kubeclient/lib/kubeclient/common.rb:125:in `rescue in handle_exception'
Caused by RestClient::BadRequest: 400 Bad Request
from /home/bpaskinc/myenv/rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rest-client-2.0.2/lib/restclient/abstract_response.rb:223:in `exception_with_response'

Fixing this (with tests) in #366.

@cben cben added the bug label Nov 23, 2018
@cben cben self-assigned this Nov 23, 2018
@cben
Copy link
Collaborator Author

cben commented Nov 23, 2018

ref: #261 is where SecurityContextConstraints was previously partially fixed.

cben added a commit to cben/kubeclient that referenced this issue Nov 23, 2018
ManageIQ#367

Also fixes ManageIQ#307 - get_security_context_constraints.kind,
  get_endpoints.kind are now plural as in kubernetes.
Also fixes ManageIQ#367 - create_security_context_constraint now works.
cben added a commit to cben/kubeclient that referenced this issue Nov 23, 2018
cben added a commit to cben/kubeclient that referenced this issue Nov 26, 2018
ManageIQ#367

Also fixes ManageIQ#307 - get_security_context_constraints.kind,
  get_endpoints.kind are now plural as in kubernetes.
Also fixes ManageIQ#367 - create_security_context_constraint now works.
cben added a commit to cben/kubeclient that referenced this issue Nov 26, 2018
@cben cben closed this as completed in #366 Nov 26, 2018
@cben cben mentioned this issue Nov 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant