0

I have a problem with my java pod application:

I put a service account in the deployment.yaml, my code is:

@RestController
public class HelloSecretController{
    @Value("${sm://myjavasecret}")
    String myJavaSecret;
    @Autowired
    private Quickstart quick;
    @Autowired
    private GoogleCredentialsConfig config;
    @GetMapping
    public String hello(){
        String resultado ="";
        try{
             resultado = myJavaSecret + " World";
        }
        catch(com.google.api.gax.rpc.PermissionDeniedException deniedException){
            System.out.println("Houve um erro ao tentar pegar o SECRET MANAGER  {}"+ deniedException.getMessage());
            throw deniedException;
        }
        catch(Exception exception){
            System.out.println("Houve um erro ao tentar pegar o SECRET MANAGER  {}"+ exception.getMessage());
         }
        return resultado;
    }
}

also put the reference in the properties. But insede of the gke in GCP I'm getting this error:

Injection of autowired dependencies failed; nested exception is com.google.api.gax.rpc.PermissionDeniedException: io.grpc.StatusRuntimeException: PERMISSION_DENIED: Permission 'secretmanager.versions.access' denied for resource

Can somebody please help?

I tryed declare a externalSecret, set this with a clusterStorage and set the same namespace at my deployment pod. I expected just print a simple hello word.

Fran Luz
  • 1
  • 2

0 Answers0