Skip to content

Commit

Permalink
release workspaces v0.1.0-alpha7 to staging (#4644)
Browse files Browse the repository at this point in the history
This release of workspaces implements support for two labels on
workspaces.konflux-ci.dev resources.

- `internal.workspaces.konflux-ci.dev/is-owner` indicates whether the
  requesting user is or is not an owner of the workspace.  Contains the
  values `true` or `false`.
- `internal.workspaces.konflux-ci.dev/has-direct-access` indicates
  whether the requesting user has been given access directly or not.
  With Kubesaw as a backend, this means that there is at least one
  SpaceBinding granting a user access to the Space.  Contains the values
  `true` or `false`.

This also fixes an issue where the data field of the
`workspaces-metrics-reader` secret was assigned ownership to ArgoCD,
which was causing workspaces to read as out-of-sync.

Full release notes can be found [here](https://github.com/konflux-workspaces/workspaces/releases/tag/v0.1.0-alpha7).

Signed-off-by: Andy Sadler <ansadler@redhat.com>
  • Loading branch information
sadlerap authored Oct 2, 2024
1 parent da59e1c commit f051d84
Show file tree
Hide file tree
Showing 43 changed files with 1,424 additions and 5 deletions.
5 changes: 5 additions & 0 deletions components/workspaces/staging/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- operator/config/default
- server/config/default
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: internalworkspaces.workspaces.konflux-ci.dev
spec:
group: workspaces.konflux-ci.dev
names:
kind: InternalWorkspace
listKind: InternalWorkspaceList
plural: internalworkspaces
singular: internalworkspace
scope: Namespaced
versions:
- additionalPrinterColumns:
- jsonPath: .spec.visibility
name: Visibility
type: string
name: v1alpha1
schema:
openAPIV3Schema:
description: InternalWorkspace is the Schema for the workspaces API
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: InternalWorkspaceSpec defines the desired state of Workspace
properties:
displayName:
type: string
owner:
description: UserInfo contains information about a user identity
properties:
jwtInfo:
description: JwtInfo contains information extracted from the user
JWT Token
properties:
email:
type: string
sub:
type: string
userId:
type: string
required:
- email
- sub
- userId
type: object
required:
- jwtInfo
type: object
visibility:
enum:
- community
- private
type: string
required:
- displayName
- owner
- visibility
type: object
status:
description: InternalWorkspaceStatus defines the observed state of Workspace
properties:
conditions:
items:
description: "Condition contains details for one aspect of the current
state of this API Resource.\n---\nThis struct is intended for
direct use as an array at the field path .status.conditions. For
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
observations of a foo's current state.\n\t // Known .status.conditions.type
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
\ // other fields\n\t}"
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: |-
type of condition in CamelCase or in foo.example.com/CamelCase.
---
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
useful (see .node.status.conditions), the ability to deconflict is important.
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
owner:
description: Owner contains information on the owner
properties:
username:
type: string
type: object
space:
description: Space contains information about the underlying Space
properties:
isHome:
type: boolean
name:
type: string
required:
- isHome
- name
type: object
type: object
type: object
served: true
storage: true
subresources:
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- bases/workspaces.konflux-ci.dev_internalworkspaces.yaml
#+kubebuilder:scaffold:crdkustomizeresource

patches: []
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
# patches here are for enabling the conversion webhook for each CRD
#- patches/webhook_in_workspaces.yaml
#+kubebuilder:scaffold:crdkustomizewebhookpatch

# [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix.
# patches here are for enabling the CA injection for each CRD
#- patches/cainjection_in_workspaces.yaml
#+kubebuilder:scaffold:crdkustomizecainjectionpatch

# the following config is for teaching kustomize how to do kustomization for CRDs.
configurations:
- kustomizeconfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is for teaching kustomize how to substitute name and namespace reference in CRD
nameReference:
- kind: Service
version: v1
fieldSpecs:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/name

namespace:
- kind: CustomResourceDefinition
version: v1
group: apiextensions.k8s.io
path: spec/conversion/webhook/clientConfig/service/namespace
create: false

varReference:
- path: metadata/annotations
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# The following patch adds a directive for certmanager to inject CA into the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME)
name: workspaces.workspaces.io
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# The following patch enables a conversion webhook for the CRD
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: workspaces.workspaces.io
spec:
conversion:
strategy: Webhook
webhook:
clientConfig:
service:
namespace: system
name: webhook-service
path: /convert
conversionReviewVersions:
- v1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: workspaces-system
namePrefix: workspaces-
resources:
- ../crd
- ../rbac
- ../manager
- ../metrics
patches:
- path: manager_auth_proxy_patch.yaml
replacements:
- source:
fieldPath: metadata.name
kind: Secret
name: metrics-reader
targets:
- fieldPaths:
- spec.endpoints.*.authorization.credentials.name
select:
group: monitoring.coreos.com
kind: ServiceMonitor
name: metrics-proxy
- source:
fieldPath: metadata.name
kind: ServiceAccount
name: metrics-reader
targets:
- fieldPaths:
- metadata.annotations.[kubernetes.io/service-account.name]
select:
kind: Secret
name: metrics-reader
options:
create: true

# We need to make the secrets containing the service account tokens before the
# service monitor can start checking for metrics. To ensure this, let's make
# the service account and its secrets before anything else.
sortOptions:
order: legacy
legacySortOptions:
orderFirst:
- Namespace
- ServiceAccount
- Secret
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
namespace: system
spec:
template:
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
# - arm64
# - ppc64le
# - s390x
- key: kubernetes.io/os
operator: In
values:
- linux
containers:
- name: manager
args:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=0.0.0.0:8080"
- "--leader-elect"
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- manager.yaml
images:
- name: controller
newName: quay.io/konflux-workspaces/workspaces-operator
newTag: v0.1.0-alpha7
configMapGenerator:
- behavior: replace
literals:
- kubesaw.namespace=toolchain-host-operator
name: operator-config
Loading

0 comments on commit f051d84

Please sign in to comment.