Skip to content

Commit

Permalink
feat(auth): deploy openshift auth proxy (#799)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Apr 26, 2024
1 parent 9593e8a commit a26ff9c
Show file tree
Hide file tree
Showing 21 changed files with 700 additions and 53 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ CORE_NAMESPACE ?= $(DEFAULT_NAMESPACE)
CORE_NAME ?= cryostat
CORE_VERSION ?= 3.0.0-snapshot
export CORE_IMG ?= $(CORE_NAMESPACE)/$(CORE_NAME):$(CORE_VERSION)
OAUTH2_PROXY_NAMESPACE ?= quay.io/oauth2-proxy
OAUTH2_PROXY_NAME ?= oauth2-proxy
OAUTH2_PROXY_VERSION ?= latest
export OAUTH2_PROXY_IMG ?= $(OAUTH2_PROXY_NAMESPACE)/$(OAUTH2_PROXY_NAME):$(OAUTH2_PROXY_VERSION)
OPENSHIFT_OAUTH_PROXY_NAMESPACE ?= quay.io/openshift
OPENSHIFT_OAUTH_PROXY_NAME ?= origin-oauth-proxy
OPENSHIFT_OAUTH_PROXY_VERSION ?= latest
export OPENSHIFT_OAUTH_PROXY_IMG ?= $(OPENSHIFT_OAUTH_PROXY_NAMESPACE)/$(OPENSHIFT_OAUTH_PROXY_NAME):$(OPENSHIFT_OAUTH_PROXY_VERSION)
DATASOURCE_NAMESPACE ?= $(DEFAULT_NAMESPACE)
DATASOURCE_NAME ?= jfr-datasource
DATASOURCE_VERSION ?= latest
Expand Down
8 changes: 8 additions & 0 deletions api/v1beta2/cryostat_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ type ResourceMetadata struct {
}

type ResourceConfigList struct {
// Resource requirements for the auth proxy.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:resourceRequirements"}
AuthProxyResources corev1.ResourceRequirements `json:"authProxyResources,omitempty"`
// Resource requirements for the Cryostat application. If specifying a memory limit, at least 768MiB is recommended.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:resourceRequirements"}
Expand Down Expand Up @@ -500,6 +504,10 @@ type SecurityOptions struct {
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`
// Security Context to apply to the auth proxy container.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
AuthProxySecurityContext *corev1.SecurityContext `json:"authProxySecurityContext,omitempty"`
// Security Context to apply to the Cryostat application container.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
Expand Down
6 changes: 6 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rules:
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
- selfsubjectaccessreviews
verbs:
- create
Expand Down
18 changes: 17 additions & 1 deletion bundle/manifests/cryostat-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ metadata:
capabilities: Seamless Upgrades
categories: Monitoring, Developer Tools
containerImage: quay.io/cryostat/cryostat-operator:3.0.0-dev
createdAt: "2024-04-25T15:33:04Z"
createdAt: "2024-04-26T21:39:27Z"
description: JVM monitoring and profiling tool
operatorframework.io/initialization-resource: |-
{
Expand Down Expand Up @@ -701,6 +701,11 @@ spec:
- description: Resource requirements for the Cryostat deployment.
displayName: Resources
path: resources
- description: Resource requirements for the auth proxy.
displayName: Auth Proxy Resources
path: resources.authProxyResources
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
- description: Resource requirements for the Cryostat application. If specifying
a memory limit, at least 768MiB is recommended.
displayName: Core Resources
Expand Down Expand Up @@ -754,6 +759,9 @@ spec:
path: securityOptions
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- description: Security Context to apply to the auth proxy container.
displayName: Auth Proxy Security Context
path: securityOptions.authProxySecurityContext
- description: Security Context to apply to the Cryostat application container.
displayName: Core Security Context
path: securityOptions.coreSecurityContext
Expand Down Expand Up @@ -1096,6 +1104,10 @@ spec:
command:
- /manager
env:
- name: RELATED_IMAGE_OAUTH2_PROXY
value: quay.io/oauth2-proxy/oauth2-proxy:latest
- name: RELATED_IMAGE_OPENSHIFT_OAUTH_PROXY
value: quay.io/openshift/origin-oauth-proxy:latest
- name: RELATED_IMAGE_CORE
value: quay.io/cryostat/cryostat:3.0.0-snapshot
- name: RELATED_IMAGE_DATASOURCE
Expand Down Expand Up @@ -1266,6 +1278,10 @@ spec:
provider:
name: The Cryostat Community
relatedImages:
- image: quay.io/oauth2-proxy/oauth2-proxy:latest
name: oauth2-proxy
- image: quay.io/openshift/origin-oauth-proxy:latest
name: openshift-oauth-proxy
- image: quay.io/cryostat/cryostat:3.0.0-snapshot
name: core
- image: quay.io/cryostat/jfr-datasource:latest
Expand Down
215 changes: 215 additions & 0 deletions bundle/manifests/operator.cryostat.io_cryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7254,6 +7254,55 @@ spec:
resources:
description: Resource requirements for the Cryostat deployment.
properties:
authProxyResources:
description: Resource requirements for the auth proxy.
properties:
claims:
description: "Claims lists the names of resources, defined
in spec.resourceClaims, that are used by this container.
\n This is an alpha field and requires enabling the DynamicResourceAllocation
feature gate. \n This field is immutable. It can only be
set for containers."
items:
description: ResourceClaim references one entry in PodSpec.ResourceClaims.
properties:
name:
description: Name must match the name of one entry in
pod.spec.resourceClaims of the Pod where this field
is used. It makes that resource available inside a
container.
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. Requests cannot exceed
Limits. More info: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/'
type: object
type: object
coreResources:
description: Resource requirements for the Cryostat application.
If specifying a memory limit, at least 768MiB is recommended.
Expand Down Expand Up @@ -8325,6 +8374,172 @@ spec:
description: Options to configure the Security Contexts for the Cryostat
application.
properties:
authProxySecurityContext:
description: Security Context to apply to the auth proxy container.
properties:
allowPrivilegeEscalation:
description: 'AllowPrivilegeEscalation controls whether a
process can gain more privileges than its parent process.
This bool directly controls if the no_new_privs flag will
be set on the container process. AllowPrivilegeEscalation
is true always when the container is: 1) run as Privileged
2) has CAP_SYS_ADMIN Note that this field cannot be set
when spec.os.name is windows.'
type: boolean
capabilities:
description: The capabilities to add/drop when running containers.
Defaults to the default set of capabilities granted by the
container runtime. Note that this field cannot be set when
spec.os.name is windows.
properties:
add:
description: Added capabilities
items:
description: Capability represent POSIX capabilities
type
type: string
type: array
drop:
description: Removed capabilities
items:
description: Capability represent POSIX capabilities
type
type: string
type: array
type: object
privileged:
description: Run container in privileged mode. Processes in
privileged containers are essentially equivalent to root
on the host. Defaults to false. Note that this field cannot
be set when spec.os.name is windows.
type: boolean
procMount:
description: procMount denotes the type of proc mount to use
for the containers. The default is DefaultProcMount which
uses the container runtime defaults for readonly paths and
masked paths. This requires the ProcMountType feature flag
to be enabled. Note that this field cannot be set when spec.os.name
is windows.
type: string
readOnlyRootFilesystem:
description: Whether this container has a read-only root filesystem.
Default is false. Note that this field cannot be set when
spec.os.name is windows.
type: boolean
runAsGroup:
description: The GID to run the entrypoint of the container
process. Uses runtime default if unset. May also be set
in PodSecurityContext. If set in both SecurityContext and
PodSecurityContext, the value specified in SecurityContext
takes precedence. Note that this field cannot be set when
spec.os.name is windows.
format: int64
type: integer
runAsNonRoot:
description: Indicates that the container must run as a non-root
user. If true, the Kubelet will validate the image at runtime
to ensure that it does not run as UID 0 (root) and fail
to start the container if it does. If unset or false, no
such validation will be performed. May also be set in PodSecurityContext. If
set in both SecurityContext and PodSecurityContext, the
value specified in SecurityContext takes precedence.
type: boolean
runAsUser:
description: The UID to run the entrypoint of the container
process. Defaults to user specified in image metadata if
unspecified. May also be set in PodSecurityContext. If
set in both SecurityContext and PodSecurityContext, the
value specified in SecurityContext takes precedence. Note
that this field cannot be set when spec.os.name is windows.
format: int64
type: integer
seLinuxOptions:
description: The SELinux context to be applied to the container.
If unspecified, the container runtime will allocate a random
SELinux context for each container. May also be set in
PodSecurityContext. If set in both SecurityContext and
PodSecurityContext, the value specified in SecurityContext
takes precedence. Note that this field cannot be set when
spec.os.name is windows.
properties:
level:
description: Level is SELinux level label that applies
to the container.
type: string
role:
description: Role is a SELinux role label that applies
to the container.
type: string
type:
description: Type is a SELinux type label that applies
to the container.
type: string
user:
description: User is a SELinux user label that applies
to the container.
type: string
type: object
seccompProfile:
description: The seccomp options to use by this container.
If seccomp options are provided at both the pod & container
level, the container options override the pod options. Note
that this field cannot be set when spec.os.name is windows.
properties:
localhostProfile:
description: localhostProfile indicates a profile defined
in a file on the node should be used. The profile must
be preconfigured on the node to work. Must be a descending
path, relative to the kubelet's configured seccomp profile
location. Must be set if type is "Localhost". Must NOT
be set for any other type.
type: string
type:
description: "type indicates which kind of seccomp profile
will be applied. Valid options are: \n Localhost - a
profile defined in a file on the node should be used.
RuntimeDefault - the container runtime default profile
should be used. Unconfined - no profile should be applied."
type: string
required:
- type
type: object
windowsOptions:
description: The Windows specific settings applied to all
containers. If unspecified, the options from the PodSecurityContext
will be used. If set in both SecurityContext and PodSecurityContext,
the value specified in SecurityContext takes precedence.
Note that this field cannot be set when spec.os.name is
linux.
properties:
gmsaCredentialSpec:
description: GMSACredentialSpec is where the GMSA admission
webhook (https://github.com/kubernetes-sigs/windows-gmsa)
inlines the contents of the GMSA credential spec named
by the GMSACredentialSpecName field.
type: string
gmsaCredentialSpecName:
description: GMSACredentialSpecName is the name of the
GMSA credential spec to use.
type: string
hostProcess:
description: HostProcess determines if a container should
be run as a 'Host Process' container. All of a Pod's
containers must have the same effective HostProcess
value (it is not allowed to have a mix of HostProcess
containers and non-HostProcess containers). In addition,
if HostProcess is true then HostNetwork must also be
set to true.
type: boolean
runAsUserName:
description: The UserName in Windows to run the entrypoint
of the container process. Defaults to the user specified
in image metadata if unspecified. May also be set in
PodSecurityContext. If set in both SecurityContext and
PodSecurityContext, the value specified in SecurityContext
takes precedence.
type: string
type: object
type: object
coreSecurityContext:
description: Security Context to apply to the Cryostat application
container.
Expand Down
Loading

0 comments on commit a26ff9c

Please sign in to comment.