This is a prerelease version.

View latest

User Code Namespaces

User Code Namespaces provide a container for Java classpath resources, such as user code and accompanying artifacts like property files. This provides namespace isolation to ensure that access to resources in different namespaces can be managed through configuration. From Hazelcast Platform Operator, you can deploy your application code from external buckets using UserCodeNamespace CRs.

See User Code Namespaces for more detailed information about the configuration and behavior of User Code Namespaces in Hazelcast.

Enabling User Code Namespaces

To enable User Code Namespaces you must configure the userCodeNamespaces section in the Hazelcast custom resource.

Example of Hazelcast with User Code Namespaces enabled
apiVersion: hazelcast.com/v1alpha1
kind: Hazelcast
metadata:
  name: hazelcast
spec:
  clusterSize: 3
  repository: 'docker.io/hazelcast/hazelcast-enterprise'
  licenseKeySecretName: hazelcast-license-key
  userCodeNamespaces: {}

Creating a User Code Namespace

To create a User Code Namespace, you must create a new UserCodeNamespace CR. The name of the CR is used as the name of the created User Code Namespace. The JAR files stored in the configured bucket are uploaded to the Hazelcast cluster under the newly created namespace.

  • AWS

  • GCP

  • Azure

User Code Namespaces in AWS S3:

apiVersion: hazelcast.com/v1alpha1
kind: UserCodeNamespace
metadata:
  name: ucn-sample
spec:
  hazelcastResourceName: hazelcast
  bucketConfig:
    secretName: s3-bucket-secret (1)
    bucketURI: s3://map-store-bucket/path/to/jars (2)
For further information about accessing resources on different cloud providers, see Authorization Methods to Access Cloud Provider Resources.

User Code Namespaces in GCP:

apiVersion: hazelcast.com/v1alpha1
kind: UserCodeNamespace
metadata:
  name: ucn-sample
spec:
  hazelcastResourceName: hazelcast
  bucketConfig:
    secretName: cloud-storage-bucket-secret (1)
    bucketURI: gs://map-store-bucket/path/to/jars (2)
For further information about accessing resources on different cloud providers, see Authorization Methods to Access Cloud Provider Resources.

User Code Namespaces in Azure Blob:

apiVersion: hazelcast.com/v1alpha1
kind: UserCodeNamespace
metadata:
  name: ucn-sample
spec:
  hazelcastResourceName: hazelcast
  bucketConfig:
    secretName: azure-blob-bucket-secret (1)
    bucketURI: azblob://map-store-bucket/path/to/jars (2)
For further information about accessing resources on different cloud providers, see Authorization Methods to Access Cloud Provider Resources.
1 The bucket URI in which to store backup data
2 Name of the secret with credentials for accessing the Bucket URI.

To allow your data structures to resolve your user code, you must reference the required namespace in the data structure configuration. You can configure the same namespace for multiple data structures.

Example of Map with User Code Namespace
apiVersion: hazelcast.com/v1alpha1
kind: Map
metadata:
  name: my-map
spec:
  hazelcastResourceName: hazelcast
  userCodeNamespace: ucn-sample